TianoCore EDK2 master
Loading...
Searching...
No Matches
Partition.h
Go to the documentation of this file.
1
13#ifndef _PARTITION_H_
14#define _PARTITION_H_
15
16#include <Uefi.h>
17#include <Protocol/BlockIo.h>
18#include <Protocol/BlockIo2.h>
19#include <Guid/Gpt.h>
21#include <Protocol/DevicePath.h>
23#include <Protocol/DiskIo.h>
24#include <Protocol/DiskIo2.h>
26#include <Library/DebugLib.h>
28#include <Library/BaseLib.h>
29#include <Library/UefiLib.h>
34
38
39//
40// Partition private data
41//
42#define PARTITION_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'a', 'r', 't')
43typedef struct {
44 UINT64 Signature;
45
46 EFI_HANDLE Handle;
47 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
51 EFI_BLOCK_IO_MEDIA Media2;// For BlockIO2
52 EFI_PARTITION_INFO_PROTOCOL PartitionInfo;
53
55 EFI_DISK_IO2_PROTOCOL *DiskIo2;
56 EFI_BLOCK_IO_PROTOCOL *ParentBlockIo;
57 EFI_BLOCK_IO2_PROTOCOL *ParentBlockIo2;
58 UINT64 Start;
59 UINT64 End;
60 UINT32 BlockSize;
61 BOOLEAN InStop;
62
63 EFI_GUID TypeGuid;
65
66typedef struct {
67 EFI_DISK_IO2_TOKEN DiskIo2Token;
68 EFI_BLOCK_IO2_TOKEN *BlockIo2Token;
70
71#define PARTITION_DEVICE_FROM_BLOCK_IO_THIS(a) CR (a, PARTITION_PRIVATE_DATA, BlockIo, PARTITION_PRIVATE_DATA_SIGNATURE)
72#define PARTITION_DEVICE_FROM_BLOCK_IO2_THIS(a) CR (a, PARTITION_PRIVATE_DATA, BlockIo2, PARTITION_PRIVATE_DATA_SIGNATURE)
73
74//
75// Global Variables
76//
77extern EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding;
78extern EFI_COMPONENT_NAME_PROTOCOL gPartitionComponentName;
79extern EFI_COMPONENT_NAME2_PROTOCOL gPartitionComponentName2;
80
81//
82// Extract INT32 from char array
83//
84#define UNPACK_INT32(a) (INT32)( (((UINT8 *) a)[0] << 0) | \
85 (((UINT8 *) a)[1] << 8) | \
86 (((UINT8 *) a)[2] << 16) | \
87 (((UINT8 *) a)[3] << 24) )
88
89//
90// Extract UINT32 from char array
91//
92#define UNPACK_UINT32(a) (UINT32)( (((UINT8 *) a)[0] << 0) | \
93 (((UINT8 *) a)[1] << 8) | \
94 (((UINT8 *) a)[2] << 16) | \
95 (((UINT8 *) a)[3] << 24) )
96
97//
98// GPT Partition Entry Status
99//
100typedef struct {
101 BOOLEAN OutOfRange;
102 BOOLEAN Overlap;
103 BOOLEAN OsSpecific;
105
106//
107// Function Prototypes
108//
109
125EFIAPI
128 IN EFI_HANDLE ControllerHandle,
129 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
130 );
131
148EFIAPI
151 IN EFI_HANDLE ControllerHandle,
152 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
153 );
154
170EFIAPI
173 IN EFI_HANDLE ControllerHandle,
174 IN UINTN NumberOfChildren,
175 IN EFI_HANDLE *ChildHandleBuffer
176 );
177
178//
179// EFI Component Name Functions
180//
181
222EFIAPI
225 IN CHAR8 *Language,
226 OUT CHAR16 **DriverName
227 );
228
298EFIAPI
301 IN EFI_HANDLE ControllerHandle,
302 IN EFI_HANDLE ChildHandle OPTIONAL,
303 IN CHAR8 *Language,
304 OUT CHAR16 **ControllerName
305 );
306
332 IN EFI_HANDLE ParentHandle,
333 IN EFI_DISK_IO_PROTOCOL *ParentDiskIo,
334 IN EFI_DISK_IO2_PROTOCOL *ParentDiskIo2,
335 IN EFI_BLOCK_IO_PROTOCOL *ParentBlockIo,
336 IN EFI_BLOCK_IO2_PROTOCOL *ParentBlockIo2,
337 IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
338 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
339 IN EFI_PARTITION_INFO_PROTOCOL *PartitionInfo,
340 IN EFI_LBA Start,
341 IN EFI_LBA End,
342 IN UINT32 BlockSize,
343 IN EFI_GUID *TypeGuid
344 );
345
355BOOLEAN
357 IN EFI_HANDLE ControllerHandle
358 );
359
380 IN EFI_HANDLE Handle,
381 IN EFI_DISK_IO_PROTOCOL *DiskIo,
382 IN EFI_DISK_IO2_PROTOCOL *DiskIo2,
383 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
384 IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2,
385 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
386 );
387
408 IN EFI_HANDLE Handle,
409 IN EFI_DISK_IO_PROTOCOL *DiskIo,
410 IN EFI_DISK_IO2_PROTOCOL *DiskIo2,
411 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
412 IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2,
413 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
414 );
415
435 IN EFI_HANDLE Handle,
436 IN EFI_DISK_IO_PROTOCOL *DiskIo,
437 IN EFI_DISK_IO2_PROTOCOL *DiskIo2,
438 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
439 IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2,
440 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
441 );
442
463 IN EFI_HANDLE Handle,
464 IN EFI_DISK_IO_PROTOCOL *DiskIo,
465 IN EFI_DISK_IO2_PROTOCOL *DiskIo2,
466 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
467 IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2,
468 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
469 );
470
471typedef
473(*PARTITION_DETECT_ROUTINE) (
475 IN EFI_HANDLE Handle,
476 IN EFI_DISK_IO_PROTOCOL *DiskIo,
477 IN EFI_DISK_IO2_PROTOCOL *DiskIo2,
478 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
479 IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2,
480 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
481 );
482
483#endif
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_STATUS EFIAPI PartitionDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
Definition: Partition.c:399
EFI_STATUS EFIAPI PartitionComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
Definition: ComponentName.c:85
EFI_STATUS EFIAPI PartitionDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: Partition.c:70
BOOLEAN HasChildren(IN EFI_HANDLE ControllerHandle)
Definition: Partition.c:1355
EFI_STATUS PartitionInstallChildHandle(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ParentHandle, IN EFI_DISK_IO_PROTOCOL *ParentDiskIo, IN EFI_DISK_IO2_PROTOCOL *ParentDiskIo2, IN EFI_BLOCK_IO_PROTOCOL *ParentBlockIo, IN EFI_BLOCK_IO2_PROTOCOL *ParentBlockIo2, IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath, IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN EFI_PARTITION_INFO_PROTOCOL *PartitionInfo, IN EFI_LBA Start, IN EFI_LBA End, IN UINT32 BlockSize, IN EFI_GUID *TypeGuid)
Definition: Partition.c:1134
EFI_STATUS EFIAPI PartitionDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: Partition.c:194
EFI_STATUS PartitionInstallMbrChildHandles(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Handle, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN EFI_DISK_IO2_PROTOCOL *DiskIo2, IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
Definition: Mbr.c:118
EFI_STATUS PartitionInstallUdfChildHandles(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Handle, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN EFI_DISK_IO2_PROTOCOL *DiskIo2, IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
Definition: Udf.c:738
EFI_STATUS PartitionInstallGptChildHandles(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Handle, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN EFI_DISK_IO2_PROTOCOL *DiskIo2, IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
Definition: Gpt.c:186
EFI_STATUS EFIAPI PartitionComponentNameGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, OUT CHAR16 **ControllerName)
EFI_STATUS PartitionInstallElToritoChildHandles(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Handle, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN EFI_DISK_IO2_PROTOCOL *DiskIo2, IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
Definition: ElTorito.c:30
UINT64 EFI_LBA
Definition: UefiBaseType.h:45
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
Definition: Base.h:213