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