]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Disk/Partition/Dxe/Partition.h
pdated code per coding standard. Changed comments, converted all \ to / and removed...
[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
19 #include <Uefi.h>
20 #include <Protocol/BlockIo.h>
21 #include <Guid/Gpt.h>
22 #include <Protocol/ComponentName.h>
23 #include <Protocol/DevicePath.h>
24 #include <Protocol/DriverBinding.h>
25 #include <Protocol/DiskIo.h>
26 #include <Library/DebugLib.h>
27 #include <Library/UefiDriverEntryPoint.h>
28 #include <Library/BaseLib.h>
29 #include <Library/UefiLib.h>
30 #include <Library/BaseMemoryLib.h>
31 #include <Library/MemoryAllocationLib.h>
32 #include <Library/UefiBootServicesTableLib.h>
33 #include <Library/DevicePathLib.h>
34
35 //
36 // Driver Binding Externs
37 //
38 extern EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding;
39 extern EFI_COMPONENT_NAME_PROTOCOL gPartitionComponentName;
40
41 #include <IndustryStandard/Mbr.h>
42 #include <IndustryStandard/ElTorito.h>
43
44
45 //
46 // Partition private data
47 //
48 #define PARTITION_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('P', 'a', 'r', 't')
49 typedef struct {
50 UINT64 Signature;
51
52 EFI_HANDLE Handle;
53 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
54 EFI_BLOCK_IO_PROTOCOL BlockIo;
55 EFI_BLOCK_IO_MEDIA Media;
56
57 EFI_DISK_IO_PROTOCOL *DiskIo;
58 EFI_BLOCK_IO_PROTOCOL *ParentBlockIo;
59 UINT64 Start;
60 UINT64 End;
61 UINT32 BlockSize;
62
63 EFI_GUID *EspGuid;
64
65 } PARTITION_PRIVATE_DATA;
66
67 #define PARTITION_DEVICE_FROM_BLOCK_IO_THIS(a) CR (a, PARTITION_PRIVATE_DATA, BlockIo, PARTITION_PRIVATE_DATA_SIGNATURE)
68
69 //
70 // Global Variables
71 //
72 extern EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding;
73 extern EFI_COMPONENT_NAME_PROTOCOL gPartitionComponentName;
74
75 //
76 // Extract INT32 from char array
77 //
78 #define UNPACK_INT32(a) (INT32)( (((UINT8 *) a)[0] << 0) | \
79 (((UINT8 *) a)[1] << 8) | \
80 (((UINT8 *) a)[2] << 16) | \
81 (((UINT8 *) a)[3] << 24) )
82
83 //
84 // Extract UINT32 from char array
85 //
86 #define UNPACK_UINT32(a) (UINT32)( (((UINT8 *) a)[0] << 0) | \
87 (((UINT8 *) a)[1] << 8) | \
88 (((UINT8 *) a)[2] << 16) | \
89 (((UINT8 *) a)[3] << 24) )
90
91 //
92 // Function Prototypes
93 //
94 EFI_STATUS
95 EFIAPI
96 PartitionDriverBindingSupported (
97 IN EFI_DRIVER_BINDING_PROTOCOL *This,
98 IN EFI_HANDLE ControllerHandle,
99 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
100 );
101
102 EFI_STATUS
103 EFIAPI
104 PartitionDriverBindingStart (
105 IN EFI_DRIVER_BINDING_PROTOCOL *This,
106 IN EFI_HANDLE ControllerHandle,
107 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
108 );
109
110 EFI_STATUS
111 EFIAPI
112 PartitionDriverBindingStop (
113 IN EFI_DRIVER_BINDING_PROTOCOL *This,
114 IN EFI_HANDLE ControllerHandle,
115 IN UINTN NumberOfChildren,
116 IN EFI_HANDLE *ChildHandleBuffer
117 );
118
119 //
120 // EFI Component Name Functions
121 //
122 EFI_STATUS
123 EFIAPI
124 PartitionComponentNameGetDriverName (
125 IN EFI_COMPONENT_NAME_PROTOCOL *This,
126 IN CHAR8 *Language,
127 OUT CHAR16 **DriverName
128 );
129
130 EFI_STATUS
131 EFIAPI
132 PartitionComponentNameGetControllerName (
133 IN EFI_COMPONENT_NAME_PROTOCOL *This,
134 IN EFI_HANDLE ControllerHandle,
135 IN EFI_HANDLE ChildHandle OPTIONAL,
136 IN CHAR8 *Language,
137 OUT CHAR16 **ControllerName
138 );
139
140 EFI_STATUS
141 PartitionInstallChildHandle (
142 IN EFI_DRIVER_BINDING_PROTOCOL *This,
143 IN EFI_HANDLE ParentHandle,
144 IN EFI_DISK_IO_PROTOCOL *ParentDiskIo,
145 IN EFI_BLOCK_IO_PROTOCOL *ParentBlockIo,
146 IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
147 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
148 IN UINT64 Start,
149 IN UINT64 End,
150 IN UINT32 BlockSize,
151 IN BOOLEAN InstallEspGuid
152 )
153 ;
154
155 EFI_STATUS
156 PartitionInstallGptChildHandles (
157 IN EFI_DRIVER_BINDING_PROTOCOL *This,
158 IN EFI_HANDLE Handle,
159 IN EFI_DISK_IO_PROTOCOL *DiskIo,
160 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
161 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
162 )
163 ;
164
165 EFI_STATUS
166 PartitionInstallElToritoChildHandles (
167 IN EFI_DRIVER_BINDING_PROTOCOL *This,
168 IN EFI_HANDLE Handle,
169 IN EFI_DISK_IO_PROTOCOL *DiskIo,
170 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
171 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
172 )
173 ;
174
175 EFI_STATUS
176 PartitionInstallMbrChildHandles (
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
182 )
183 ;
184
185 typedef
186 EFI_STATUS
187 (*PARTITION_DETECT_ROUTINE) (
188 IN EFI_DRIVER_BINDING_PROTOCOL *This,
189 IN EFI_HANDLE Handle,
190 IN EFI_DISK_IO_PROTOCOL *DiskIo,
191 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
192 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
193 );
194