3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Partition driver that produces logical BlockIo devices from a physical
19 BlockIo device. The logical BlockIo devices are based on the format
20 of the raw block devices media. Currently "El Torito CD-ROM", Legacy
21 MBR, and GPT partition schemes are supported.
27 #ifndef __PARTITION_H__
28 #define __PARTITION_H__
30 #include <IndustryStandard/Mbr.h>
31 #include <IndustryStandard/ElTorito.h>
32 #include <IndustryStandard/EfiGpt.h>
35 // Partition private data
37 #define PARTITION_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('P', 'a', 'r', 't')
42 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
43 EFI_BLOCK_IO_PROTOCOL BlockIo
;
44 EFI_BLOCK_IO_MEDIA Media
;
46 EFI_DISK_IO_PROTOCOL
*DiskIo
;
47 EFI_BLOCK_IO_PROTOCOL
*ParentBlockIo
;
54 } PARTITION_PRIVATE_DATA
;
56 #define PARTITION_DEVICE_FROM_BLOCK_IO_THIS(a) CR (a, PARTITION_PRIVATE_DATA, BlockIo, PARTITION_PRIVATE_DATA_SIGNATURE)
61 extern EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding
;
62 extern EFI_COMPONENT_NAME_PROTOCOL gPartitionComponentName
;
65 // Extract INT32 from char array
67 #define UNPACK_INT32(a) (INT32)( (((UINT8 *) a)[0] << 0) | \
68 (((UINT8 *) a)[1] << 8) | \
69 (((UINT8 *) a)[2] << 16) | \
70 (((UINT8 *) a)[3] << 24) )
73 // Extract UINT32 from char array
75 #define UNPACK_UINT32(a) (UINT32)( (((UINT8 *) a)[0] << 0) | \
76 (((UINT8 *) a)[1] << 8) | \
77 (((UINT8 *) a)[2] << 16) | \
78 (((UINT8 *) a)[3] << 24) )
81 // Function Prototypes
85 PartitionDriverBindingSupported (
86 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
87 IN EFI_HANDLE ControllerHandle
,
88 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
93 PartitionDriverBindingStart (
94 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
95 IN EFI_HANDLE ControllerHandle
,
96 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
101 PartitionDriverBindingStop (
102 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
103 IN EFI_HANDLE ControllerHandle
,
104 IN UINTN NumberOfChildren
,
105 IN EFI_HANDLE
*ChildHandleBuffer
109 // EFI Component Name Functions
113 PartitionComponentNameGetDriverName (
114 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
116 OUT CHAR16
**DriverName
121 PartitionComponentNameGetControllerName (
122 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
123 IN EFI_HANDLE ControllerHandle
,
124 IN EFI_HANDLE ChildHandle OPTIONAL
,
126 OUT CHAR16
**ControllerName
130 PartitionInstallChildHandle (
131 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
132 IN EFI_HANDLE ParentHandle
,
133 IN EFI_DISK_IO_PROTOCOL
*ParentDiskIo
,
134 IN EFI_BLOCK_IO_PROTOCOL
*ParentBlockIo
,
135 IN EFI_DEVICE_PATH_PROTOCOL
*ParentDevicePath
,
136 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePathNode
,
140 IN BOOLEAN InstallEspGuid
145 PartitionInstallGptChildHandles (
146 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
147 IN EFI_HANDLE Handle
,
148 IN EFI_DISK_IO_PROTOCOL
*DiskIo
,
149 IN EFI_BLOCK_IO_PROTOCOL
*BlockIo
,
150 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
155 PartitionInstallElToritoChildHandles (
156 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
157 IN EFI_HANDLE Handle
,
158 IN EFI_DISK_IO_PROTOCOL
*DiskIo
,
159 IN EFI_BLOCK_IO_PROTOCOL
*BlockIo
,
160 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
165 PartitionInstallMbrChildHandles (
166 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
167 IN EFI_HANDLE Handle
,
168 IN EFI_DISK_IO_PROTOCOL
*DiskIo
,
169 IN EFI_BLOCK_IO_PROTOCOL
*BlockIo
,
170 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
176 (*PARTITION_DETECT_ROUTINE
) (
177 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
178 IN EFI_HANDLE Handle
,
179 IN EFI_DISK_IO_PROTOCOL
*DiskIo
,
180 IN EFI_BLOCK_IO_PROTOCOL
*BlockIo
,
181 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath