add ia32 and x64 direcotry for EdkFvbServiceLib
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / Partition / Dxe / Partition.h
CommitLineData
b9575d60 1/** @file\r
79840ee1 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
b9575d60
A
7 Copyright (c) 2006 - 2007, Intel Corporation \r
8 All rights reserved. This program and the accompanying materials \r
9 are licensed and made available under the terms and conditions of the BSD License \r
10 which accompanies this distribution. The full text of the license may be found at \r
11 http://opensource.org/licenses/bsd-license.php \r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
15\r
16**/\r
17\r
42bc7f77
A
18#ifndef _PARTITION_H \r
19#define _PARTITION_H \r
b9575d60
A
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
79840ee1 36\r
79840ee1 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
68extern EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding;\r
69extern EFI_COMPONENT_NAME_PROTOCOL gPartitionComponentName;\r
70\r
71//\r
72// Extract INT32 from char array\r
73//\r
74#define UNPACK_INT32(a) (INT32)( (((UINT8 *) a)[0] << 0) | \\r
75 (((UINT8 *) a)[1] << 8) | \\r
76 (((UINT8 *) a)[2] << 16) | \\r
77 (((UINT8 *) a)[3] << 24) )\r
78\r
79//\r
80// Extract UINT32 from char array\r
81//\r
82#define UNPACK_UINT32(a) (UINT32)( (((UINT8 *) a)[0] << 0) | \\r
83 (((UINT8 *) a)[1] << 8) | \\r
84 (((UINT8 *) a)[2] << 16) | \\r
85 (((UINT8 *) a)[3] << 24) )\r
86\r
87//\r
88// Function Prototypes\r
89//\r
90EFI_STATUS\r
91EFIAPI\r
92PartitionDriverBindingSupported (\r
93 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
94 IN EFI_HANDLE ControllerHandle,\r
95 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
96 );\r
97\r
98EFI_STATUS\r
99EFIAPI\r
100PartitionDriverBindingStart (\r
101 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
102 IN EFI_HANDLE ControllerHandle,\r
103 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
104 );\r
105\r
106EFI_STATUS\r
107EFIAPI\r
108PartitionDriverBindingStop (\r
109 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
110 IN EFI_HANDLE ControllerHandle,\r
111 IN UINTN NumberOfChildren,\r
112 IN EFI_HANDLE *ChildHandleBuffer\r
113 );\r
114\r
115//\r
116// EFI Component Name Functions\r
117//\r
118EFI_STATUS\r
119EFIAPI\r
120PartitionComponentNameGetDriverName (\r
121 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
122 IN CHAR8 *Language,\r
123 OUT CHAR16 **DriverName\r
124 );\r
125\r
126EFI_STATUS\r
127EFIAPI\r
128PartitionComponentNameGetControllerName (\r
129 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
130 IN EFI_HANDLE ControllerHandle,\r
131 IN EFI_HANDLE ChildHandle OPTIONAL,\r
132 IN CHAR8 *Language,\r
133 OUT CHAR16 **ControllerName\r
134 );\r
135\r
136EFI_STATUS\r
137PartitionInstallChildHandle (\r
138 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
139 IN EFI_HANDLE ParentHandle,\r
140 IN EFI_DISK_IO_PROTOCOL *ParentDiskIo,\r
141 IN EFI_BLOCK_IO_PROTOCOL *ParentBlockIo,\r
142 IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,\r
143 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,\r
144 IN UINT64 Start,\r
145 IN UINT64 End,\r
146 IN UINT32 BlockSize,\r
147 IN BOOLEAN InstallEspGuid\r
148 )\r
149;\r
150\r
151EFI_STATUS\r
152PartitionInstallGptChildHandles (\r
153 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
154 IN EFI_HANDLE Handle,\r
155 IN EFI_DISK_IO_PROTOCOL *DiskIo,\r
156 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
157 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
158 )\r
159;\r
160\r
161EFI_STATUS\r
162PartitionInstallElToritoChildHandles (\r
163 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
164 IN EFI_HANDLE Handle,\r
165 IN EFI_DISK_IO_PROTOCOL *DiskIo,\r
166 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
167 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
168 )\r
169;\r
170\r
171EFI_STATUS\r
172PartitionInstallMbrChildHandles (\r
173 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
174 IN EFI_HANDLE Handle,\r
175 IN EFI_DISK_IO_PROTOCOL *DiskIo,\r
176 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
177 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
178 )\r
179;\r
180\r
181typedef\r
182EFI_STATUS\r
183(*PARTITION_DETECT_ROUTINE) (\r
184 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
185 IN EFI_HANDLE Handle,\r
186 IN EFI_DISK_IO_PROTOCOL *DiskIo,\r
187 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
188 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
189 );\r
190\r
42bc7f77 191#endif\r