]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h
Add ASM16 tool configuration for MYTOOLS tag.
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / PartitionDxe / Partition.h
CommitLineData
adbcbf8f 1/** @file\r
2 Partition driver that produces logical BlockIo devices from a physical \r
3 BlockIo device. The logical BlockIo devices are based on the format\r
4 of the raw block devices media. Currently "El Torito CD-ROM", Legacy \r
5 MBR, and GPT partition schemes are supported.\r
6\r
f42be642 7Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
8All rights reserved. This program and the accompanying materials\r
9are licensed and made available under the terms and conditions of the BSD License\r
10which accompanies this distribution. The full text of the license may be found at\r
11http://opensource.org/licenses/bsd-license.php\r
12\r
13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
adbcbf8f 15\r
16**/\r
17\r
18#ifndef _PARTITION_H \r
19#define _PARTITION_H \r
20\r
21#include <Uefi.h>\r
22#include <Protocol/BlockIo.h>\r
23#include <Guid/Gpt.h>\r
24#include <Protocol/ComponentName.h>\r
25#include <Protocol/DevicePath.h>\r
26#include <Protocol/DriverBinding.h>\r
27#include <Protocol/DiskIo.h>\r
28#include <Library/DebugLib.h>\r
29#include <Library/UefiDriverEntryPoint.h>\r
30#include <Library/BaseLib.h>\r
31#include <Library/UefiLib.h>\r
32#include <Library/BaseMemoryLib.h>\r
33#include <Library/MemoryAllocationLib.h>\r
34#include <Library/UefiBootServicesTableLib.h>\r
35#include <Library/DevicePathLib.h>\r
36\r
37#include <IndustryStandard/Mbr.h>\r
38#include <IndustryStandard/ElTorito.h>\r
39\r
40\r
41//\r
42// Partition private data\r
43//\r
44#define PARTITION_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('P', 'a', 'r', 't')\r
45typedef struct {\r
46 UINT64 Signature;\r
47\r
48 EFI_HANDLE Handle;\r
49 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
50 EFI_BLOCK_IO_PROTOCOL BlockIo;\r
51 EFI_BLOCK_IO_MEDIA Media;\r
52\r
53 EFI_DISK_IO_PROTOCOL *DiskIo;\r
54 EFI_BLOCK_IO_PROTOCOL *ParentBlockIo;\r
55 UINT64 Start;\r
56 UINT64 End;\r
57 UINT32 BlockSize;\r
58\r
59 EFI_GUID *EspGuid;\r
60\r
61} PARTITION_PRIVATE_DATA;\r
62\r
63#define PARTITION_DEVICE_FROM_BLOCK_IO_THIS(a) CR (a, PARTITION_PRIVATE_DATA, BlockIo, PARTITION_PRIVATE_DATA_SIGNATURE)\r
64\r
65//\r
66// Global Variables\r
67//\r
d38a0f44 68extern EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding;\r
69extern EFI_COMPONENT_NAME_PROTOCOL gPartitionComponentName;\r
70extern EFI_COMPONENT_NAME2_PROTOCOL gPartitionComponentName2;\r
adbcbf8f 71\r
72//\r
73// Extract INT32 from char array\r
74//\r
75#define UNPACK_INT32(a) (INT32)( (((UINT8 *) a)[0] << 0) | \\r
76 (((UINT8 *) a)[1] << 8) | \\r
77 (((UINT8 *) a)[2] << 16) | \\r
78 (((UINT8 *) a)[3] << 24) )\r
79\r
80//\r
81// Extract UINT32 from char array\r
82//\r
83#define UNPACK_UINT32(a) (UINT32)( (((UINT8 *) a)[0] << 0) | \\r
84 (((UINT8 *) a)[1] << 8) | \\r
85 (((UINT8 *) a)[2] << 16) | \\r
86 (((UINT8 *) a)[3] << 24) )\r
87\r
88//\r
89// Function Prototypes\r
90//\r
91EFI_STATUS\r
92EFIAPI\r
93PartitionDriverBindingSupported (\r
94 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
95 IN EFI_HANDLE ControllerHandle,\r
96 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
97 );\r
98\r
99EFI_STATUS\r
100EFIAPI\r
101PartitionDriverBindingStart (\r
102 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
103 IN EFI_HANDLE ControllerHandle,\r
104 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
105 );\r
106\r
107EFI_STATUS\r
108EFIAPI\r
109PartitionDriverBindingStop (\r
110 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
111 IN EFI_HANDLE ControllerHandle,\r
112 IN UINTN NumberOfChildren,\r
113 IN EFI_HANDLE *ChildHandleBuffer\r
114 );\r
115\r
116//\r
117// EFI Component Name Functions\r
118//\r
d38a0f44 119/**\r
120 Retrieves a Unicode string that is the user readable name of the driver.\r
121\r
122 This function retrieves the user readable name of a driver in the form of a\r
123 Unicode string. If the driver specified by This has a user readable name in\r
124 the language specified by Language, then a pointer to the driver name is\r
125 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
126 by This does not support the language specified by Language,\r
127 then EFI_UNSUPPORTED is returned.\r
128\r
129 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
130 EFI_COMPONENT_NAME_PROTOCOL instance.\r
131\r
132 @param Language[in] A pointer to a Null-terminated ASCII string\r
133 array indicating the language. This is the\r
134 language of the driver name that the caller is\r
135 requesting, and it must match one of the\r
136 languages specified in SupportedLanguages. The\r
137 number of languages supported by a driver is up\r
138 to the driver writer. Language is specified\r
139 in RFC 3066 or ISO 639-2 language code format.\r
140\r
141 @param DriverName[out] A pointer to the Unicode string to return.\r
142 This Unicode string is the name of the\r
143 driver specified by This in the language\r
144 specified by Language.\r
145\r
146 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
147 This and the language specified by Language was\r
148 returned in DriverName.\r
149\r
150 @retval EFI_INVALID_PARAMETER Language is NULL.\r
151\r
152 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
153\r
154 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
155 the language specified by Language.\r
156\r
157**/\r
adbcbf8f 158EFI_STATUS\r
159EFIAPI\r
160PartitionComponentNameGetDriverName (\r
161 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
162 IN CHAR8 *Language,\r
163 OUT CHAR16 **DriverName\r
164 );\r
165\r
d38a0f44 166\r
167/**\r
168 Retrieves a Unicode string that is the user readable name of the controller\r
169 that is being managed by a driver.\r
170\r
171 This function retrieves the user readable name of the controller specified by\r
172 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
173 driver specified by This has a user readable name in the language specified by\r
174 Language, then a pointer to the controller name is returned in ControllerName,\r
175 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
176 managing the controller specified by ControllerHandle and ChildHandle,\r
177 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
178 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
179\r
180 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
181 EFI_COMPONENT_NAME_PROTOCOL instance.\r
182\r
183 @param ControllerHandle[in] The handle of a controller that the driver\r
184 specified by This is managing. This handle\r
185 specifies the controller whose name is to be\r
186 returned.\r
187\r
188 @param ChildHandle[in] The handle of the child controller to retrieve\r
189 the name of. This is an optional parameter that\r
190 may be NULL. It will be NULL for device\r
191 drivers. It will also be NULL for a bus drivers\r
192 that wish to retrieve the name of the bus\r
193 controller. It will not be NULL for a bus\r
194 driver that wishes to retrieve the name of a\r
195 child controller.\r
196\r
197 @param Language[in] A pointer to a Null-terminated ASCII string\r
198 array indicating the language. This is the\r
199 language of the driver name that the caller is\r
200 requesting, and it must match one of the\r
201 languages specified in SupportedLanguages. The\r
202 number of languages supported by a driver is up\r
203 to the driver writer. Language is specified in\r
204 RFC 3066 or ISO 639-2 language code format.\r
205\r
206 @param ControllerName[out] A pointer to the Unicode string to return.\r
207 This Unicode string is the name of the\r
208 controller specified by ControllerHandle and\r
209 ChildHandle in the language specified by\r
210 Language from the point of view of the driver\r
211 specified by This.\r
212\r
213 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
214 the language specified by Language for the\r
215 driver specified by This was returned in\r
216 DriverName.\r
217\r
218 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
219\r
220 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
221 EFI_HANDLE.\r
222\r
223 @retval EFI_INVALID_PARAMETER Language is NULL.\r
224\r
225 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
226\r
227 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
228 managing the controller specified by\r
229 ControllerHandle and ChildHandle.\r
230\r
231 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
232 the language specified by Language.\r
233\r
234**/\r
adbcbf8f 235EFI_STATUS\r
236EFIAPI\r
237PartitionComponentNameGetControllerName (\r
238 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
239 IN EFI_HANDLE ControllerHandle,\r
240 IN EFI_HANDLE ChildHandle OPTIONAL,\r
241 IN CHAR8 *Language,\r
242 OUT CHAR16 **ControllerName\r
243 );\r
244\r
d38a0f44 245\r
adbcbf8f 246EFI_STATUS\r
247PartitionInstallChildHandle (\r
248 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
249 IN EFI_HANDLE ParentHandle,\r
250 IN EFI_DISK_IO_PROTOCOL *ParentDiskIo,\r
251 IN EFI_BLOCK_IO_PROTOCOL *ParentBlockIo,\r
252 IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,\r
253 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,\r
254 IN UINT64 Start,\r
255 IN UINT64 End,\r
256 IN UINT32 BlockSize,\r
257 IN BOOLEAN InstallEspGuid\r
258 )\r
259;\r
260\r
261EFI_STATUS\r
262PartitionInstallGptChildHandles (\r
263 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
264 IN EFI_HANDLE Handle,\r
265 IN EFI_DISK_IO_PROTOCOL *DiskIo,\r
266 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
267 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
268 )\r
269;\r
270\r
271EFI_STATUS\r
272PartitionInstallElToritoChildHandles (\r
273 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
274 IN EFI_HANDLE Handle,\r
275 IN EFI_DISK_IO_PROTOCOL *DiskIo,\r
276 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
277 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
278 )\r
279;\r
280\r
281EFI_STATUS\r
282PartitionInstallMbrChildHandles (\r
283 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
284 IN EFI_HANDLE Handle,\r
285 IN EFI_DISK_IO_PROTOCOL *DiskIo,\r
286 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
287 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
288 )\r
289;\r
290\r
291typedef\r
292EFI_STATUS\r
293(*PARTITION_DETECT_ROUTINE) (\r
294 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
295 IN EFI_HANDLE Handle,\r
296 IN EFI_DISK_IO_PROTOCOL *DiskIo,\r
297 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
298 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
299 );\r
300\r
301#endif\r