]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Disk/Partition/Dxe/Partition.h
add ia32 and x64 direcotry for EdkFvbServiceLib
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / Partition / Dxe / Partition.h
1 /** @file
2 Partition driver that produces logical BlockIo devices from a physical
3 BlockIo device. The logical BlockIo devices are based on the format
4 of the raw block devices media. Currently "El Torito CD-ROM", Legacy
5 MBR, and GPT partition schemes are supported.
6
7 Copyright (c) 2006 - 2007, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18 #ifndef _PARTITION_H
19 #define _PARTITION_H
20
21 #include <Uefi.h>
22 #include <Protocol/BlockIo.h>
23 #include <Guid/Gpt.h>
24 #include <Protocol/ComponentName.h>
25 #include <Protocol/DevicePath.h>
26 #include <Protocol/DriverBinding.h>
27 #include <Protocol/DiskIo.h>
28 #include <Library/DebugLib.h>
29 #include <Library/UefiDriverEntryPoint.h>
30 #include <Library/BaseLib.h>
31 #include <Library/UefiLib.h>
32 #include <Library/BaseMemoryLib.h>
33 #include <Library/MemoryAllocationLib.h>
34 #include <Library/UefiBootServicesTableLib.h>
35 #include <Library/DevicePathLib.h>
36
37 #include <IndustryStandard/Mbr.h>
38 #include <IndustryStandard/ElTorito.h>
39
40
41 //
42 // Partition private data
43 //
44 #define PARTITION_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('P', 'a', 'r', 't')
45 typedef struct {
46 UINT64 Signature;
47
48 EFI_HANDLE Handle;
49 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
50 EFI_BLOCK_IO_PROTOCOL BlockIo;
51 EFI_BLOCK_IO_MEDIA Media;
52
53 EFI_DISK_IO_PROTOCOL *DiskIo;
54 EFI_BLOCK_IO_PROTOCOL *ParentBlockIo;
55 UINT64 Start;
56 UINT64 End;
57 UINT32 BlockSize;
58
59 EFI_GUID *EspGuid;
60
61 } PARTITION_PRIVATE_DATA;
62
63 #define PARTITION_DEVICE_FROM_BLOCK_IO_THIS(a) CR (a, PARTITION_PRIVATE_DATA, BlockIo, PARTITION_PRIVATE_DATA_SIGNATURE)
64
65 //
66 // Global Variables
67 //
68 extern EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding;
69 extern EFI_COMPONENT_NAME_PROTOCOL gPartitionComponentName;
70
71 //
72 // Extract INT32 from char array
73 //
74 #define UNPACK_INT32(a) (INT32)( (((UINT8 *) a)[0] << 0) | \
75 (((UINT8 *) a)[1] << 8) | \
76 (((UINT8 *) a)[2] << 16) | \
77 (((UINT8 *) a)[3] << 24) )
78
79 //
80 // Extract UINT32 from char array
81 //
82 #define UNPACK_UINT32(a) (UINT32)( (((UINT8 *) a)[0] << 0) | \
83 (((UINT8 *) a)[1] << 8) | \
84 (((UINT8 *) a)[2] << 16) | \
85 (((UINT8 *) a)[3] << 24) )
86
87 //
88 // Function Prototypes
89 //
90 EFI_STATUS
91 EFIAPI
92 PartitionDriverBindingSupported (
93 IN EFI_DRIVER_BINDING_PROTOCOL *This,
94 IN EFI_HANDLE ControllerHandle,
95 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
96 );
97
98 EFI_STATUS
99 EFIAPI
100 PartitionDriverBindingStart (
101 IN EFI_DRIVER_BINDING_PROTOCOL *This,
102 IN EFI_HANDLE ControllerHandle,
103 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
104 );
105
106 EFI_STATUS
107 EFIAPI
108 PartitionDriverBindingStop (
109 IN EFI_DRIVER_BINDING_PROTOCOL *This,
110 IN EFI_HANDLE ControllerHandle,
111 IN UINTN NumberOfChildren,
112 IN EFI_HANDLE *ChildHandleBuffer
113 );
114
115 //
116 // EFI Component Name Functions
117 //
118 EFI_STATUS
119 EFIAPI
120 PartitionComponentNameGetDriverName (
121 IN EFI_COMPONENT_NAME_PROTOCOL *This,
122 IN CHAR8 *Language,
123 OUT CHAR16 **DriverName
124 );
125
126 EFI_STATUS
127 EFIAPI
128 PartitionComponentNameGetControllerName (
129 IN EFI_COMPONENT_NAME_PROTOCOL *This,
130 IN EFI_HANDLE ControllerHandle,
131 IN EFI_HANDLE ChildHandle OPTIONAL,
132 IN CHAR8 *Language,
133 OUT CHAR16 **ControllerName
134 );
135
136 EFI_STATUS
137 PartitionInstallChildHandle (
138 IN EFI_DRIVER_BINDING_PROTOCOL *This,
139 IN EFI_HANDLE ParentHandle,
140 IN EFI_DISK_IO_PROTOCOL *ParentDiskIo,
141 IN EFI_BLOCK_IO_PROTOCOL *ParentBlockIo,
142 IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
143 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
144 IN UINT64 Start,
145 IN UINT64 End,
146 IN UINT32 BlockSize,
147 IN BOOLEAN InstallEspGuid
148 )
149 ;
150
151 EFI_STATUS
152 PartitionInstallGptChildHandles (
153 IN EFI_DRIVER_BINDING_PROTOCOL *This,
154 IN EFI_HANDLE Handle,
155 IN EFI_DISK_IO_PROTOCOL *DiskIo,
156 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
157 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
158 )
159 ;
160
161 EFI_STATUS
162 PartitionInstallElToritoChildHandles (
163 IN EFI_DRIVER_BINDING_PROTOCOL *This,
164 IN EFI_HANDLE Handle,
165 IN EFI_DISK_IO_PROTOCOL *DiskIo,
166 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
167 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
168 )
169 ;
170
171 EFI_STATUS
172 PartitionInstallMbrChildHandles (
173 IN EFI_DRIVER_BINDING_PROTOCOL *This,
174 IN EFI_HANDLE Handle,
175 IN EFI_DISK_IO_PROTOCOL *DiskIo,
176 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
177 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
178 )
179 ;
180
181 typedef
182 EFI_STATUS
183 (*PARTITION_DETECT_ROUTINE) (
184 IN EFI_DRIVER_BINDING_PROTOCOL *This,
185 IN EFI_HANDLE Handle,
186 IN EFI_DISK_IO_PROTOCOL *DiskIo,
187 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
188 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
189 );
190
191 #endif