]>
Commit | Line | Data |
---|---|---|
4c5acce7 FT |
1 | /** @file\r |
2 | Provides the services required to access a block I/O 2 device during PEI recovery\r | |
3 | boot mode.\r | |
4 | \r | |
5 | Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r | |
6 | This program and the accompanying materials are licensed and made available under\r | |
7 | the terms and conditions of the BSD License that accompanies this distribution.\r | |
8 | The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php.\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | @par Revision Reference:\r | |
15 | This PPI is defined in UEFI Platform Initialization Specification 1.4 Volume 1:\r | |
16 | Pre-EFI Initalization Core Interface.\r | |
17 | \r | |
18 | **/\r | |
19 | \r | |
20 | #ifndef _PEI_BLOCK_IO2_H_\r | |
21 | #define _PEI_BLOCK_IO2_H_\r | |
22 | \r | |
23 | #include <Ppi/BlockIo.h>\r | |
24 | #include <Protocol/DevicePath.h>\r | |
25 | \r | |
26 | ///\r | |
27 | /// Global ID for EFI_PEI_RECOVERY_BLOCK_IO2_PPI\r | |
28 | ///\r | |
29 | #define EFI_PEI_RECOVERY_BLOCK_IO2_PPI_GUID \\r | |
30 | { \\r | |
31 | 0x26cc0fad, 0xbeb3, 0x478a, { 0x91, 0xb2, 0xc, 0x18, 0x8f, 0x72, 0x61, 0x98 } \\r | |
32 | }\r | |
33 | \r | |
34 | ///\r | |
35 | /// The forward declaration for EFI_PEI_RECOVERY_BLOCK_IO_PPI.\r | |
36 | ///\r | |
37 | typedef struct _EFI_PEI_RECOVERY_BLOCK_IO2_PPI EFI_PEI_RECOVERY_BLOCK_IO2_PPI;\r | |
38 | \r | |
39 | #define EFI_PEI_RECOVERY_BLOCK_IO2_PPI_REVISION 0x00010000\r | |
40 | \r | |
41 | typedef struct {\r | |
42 | ///\r | |
43 | /// A type of interface that the device being referenced by DeviceIndex is\r | |
44 | /// attached to. This field re-uses Messaging Device Path Node sub-type values\r | |
45 | /// as defined by Section 9.3.5 Messaging Device Path of UEFI Specification.\r | |
46 | /// When more than one sub-type is associated with the interface, sub-type with\r | |
47 | /// the smallest number must be used.\r | |
48 | ///\r | |
49 | UINT8 InterfaceType;\r | |
50 | ///\r | |
51 | /// A flag that indicates if media is removable.\r | |
52 | ///\r | |
53 | BOOLEAN RemovableMedia;\r | |
54 | ///\r | |
55 | /// A flag that indicates if media is present. This flag is always set for\r | |
56 | /// non-removable media devices.\r | |
57 | ///\r | |
58 | BOOLEAN MediaPresent;\r | |
59 | ///\r | |
60 | /// A flag that indicates if media is read-only.\r | |
61 | ///\r | |
62 | BOOLEAN ReadOnly;\r | |
63 | ///\r | |
64 | /// The size of a logical block in bytes.\r | |
65 | ///\r | |
66 | UINT32 BlockSize;\r | |
67 | ///\r | |
68 | /// The last logical block that the device supports.\r | |
69 | ///\r | |
70 | EFI_PEI_LBA LastBlock;\r | |
71 | } EFI_PEI_BLOCK_IO2_MEDIA;\r | |
72 | \r | |
73 | /**\r | |
74 | Gets the count of block I/O devices that one specific block driver detects.\r | |
75 | \r | |
76 | This function is used for getting the count of block I/O devices that one\r | |
77 | specific block driver detects. To the PEI ATAPI driver, it returns the number\r | |
78 | of all the detected ATAPI devices it detects during the enumeration process.\r | |
79 | To the PEI legacy floppy driver, it returns the number of all the legacy\r | |
80 | devices it finds during its enumeration process. If no device is detected,\r | |
81 | then the function will return zero.\r | |
82 | \r | |
83 | @param[in] PeiServices General-purpose services that are available\r | |
84 | to every PEIM.\r | |
85 | @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI\r | |
86 | instance.\r | |
87 | @param[out] NumberBlockDevices The number of block I/O devices discovered.\r | |
88 | \r | |
89 | @retval EFI_SUCCESS The operation performed successfully.\r | |
90 | \r | |
91 | **/\r | |
92 | typedef\r | |
93 | EFI_STATUS\r | |
94 | (EFIAPI *EFI_PEI_GET_NUMBER_BLOCK_DEVICES2)(\r | |
95 | IN EFI_PEI_SERVICES **PeiServices,\r | |
96 | IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,\r | |
97 | OUT UINTN *NumberBlockDevices\r | |
98 | );\r | |
99 | \r | |
100 | /**\r | |
101 | Gets a block device's media information.\r | |
102 | \r | |
103 | This function will provide the caller with the specified block device's media\r | |
104 | information. If the media changes, calling this function will update the media\r | |
105 | information accordingly.\r | |
106 | \r | |
107 | @param[in] PeiServices General-purpose services that are available to every\r | |
108 | PEIM\r | |
109 | @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.\r | |
110 | @param[in] DeviceIndex Specifies the block device to which the function wants\r | |
111 | to talk. Because the driver that implements Block I/O\r | |
112 | PPIs will manage multiple block devices, the PPIs that\r | |
113 | want to talk to a single device must specify the\r | |
114 | device index that was assigned during the enumeration\r | |
115 | process. This index is a number from one to\r | |
116 | NumberBlockDevices.\r | |
117 | @param[out] MediaInfo The media information of the specified block media.\r | |
118 | The caller is responsible for the ownership of this\r | |
119 | data structure.\r | |
120 | \r | |
121 | @par Note:\r | |
122 | The MediaInfo structure describes an enumeration of possible block device\r | |
123 | types. This enumeration exists because no device paths are actually passed\r | |
124 | across interfaces that describe the type or class of hardware that is publishing\r | |
125 | the block I/O interface. This enumeration will allow for policy decisions\r | |
126 | in the Recovery PEIM, such as "Try to recover from legacy floppy first,\r | |
127 | LS-120 second, CD-ROM third." If there are multiple partitions abstracted\r | |
128 | by a given device type, they should be reported in ascending order; this\r | |
129 | order also applies to nested partitions, such as legacy MBR, where the\r | |
130 | outermost partitions would have precedence in the reporting order. The\r | |
131 | same logic applies to systems such as IDE that have precedence relationships\r | |
132 | like "Master/Slave" or "Primary/Secondary". The master device should be\r | |
133 | reported first, the slave second.\r | |
134 | \r | |
135 | @retval EFI_SUCCESS Media information about the specified block device\r | |
136 | was obtained successfully.\r | |
137 | @retval EFI_DEVICE_ERROR Cannot get the media information due to a hardware\r | |
138 | error.\r | |
139 | \r | |
140 | **/\r | |
141 | typedef\r | |
142 | EFI_STATUS\r | |
143 | (EFIAPI *EFI_PEI_GET_DEVICE_MEDIA_INFORMATION2)(\r | |
144 | IN EFI_PEI_SERVICES **PeiServices,\r | |
145 | IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,\r | |
146 | IN UINTN DeviceIndex,\r | |
147 | OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo\r | |
148 | );\r | |
149 | \r | |
150 | /**\r | |
151 | Reads the requested number of blocks from the specified block device.\r | |
152 | \r | |
153 | The function reads the requested number of blocks from the device. All the\r | |
154 | blocks are read, or an error is returned. If there is no media in the device,\r | |
155 | the function returns EFI_NO_MEDIA.\r | |
156 | \r | |
157 | @param[in] PeiServices General-purpose services that are available to\r | |
158 | every PEIM.\r | |
159 | @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.\r | |
160 | @param[in] DeviceIndex Specifies the block device to which the function wants\r | |
161 | to talk. Because the driver that implements Block I/O\r | |
162 | PPIs will manage multiple block devices, PPIs that\r | |
163 | want to talk to a single device must specify the device\r | |
164 | index that was assigned during the enumeration process.\r | |
165 | This index is a number from one to NumberBlockDevices.\r | |
166 | @param[in] StartLBA The starting logical block address (LBA) to read from\r | |
167 | on the device\r | |
168 | @param[in] BufferSize The size of the Buffer in bytes. This number must be\r | |
169 | a multiple of the intrinsic block size of the device.\r | |
170 | @param[out] Buffer A pointer to the destination buffer for the data.\r | |
171 | The caller is responsible for the ownership of the\r | |
172 | buffer.\r | |
173 | \r | |
174 | @retval EFI_SUCCESS The data was read correctly from the device.\r | |
175 | @retval EFI_DEVICE_ERROR The device reported an error while attempting\r | |
176 | to perform the read operation.\r | |
177 | @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not\r | |
178 | valid, or the buffer is not properly aligned.\r | |
179 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
180 | @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of\r | |
181 | the intrinsic block size of the device.\r | |
182 | \r | |
183 | **/\r | |
184 | typedef\r | |
185 | EFI_STATUS\r | |
186 | (EFIAPI *EFI_PEI_READ_BLOCKS2)(\r | |
187 | IN EFI_PEI_SERVICES **PeiServices,\r | |
188 | IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,\r | |
189 | IN UINTN DeviceIndex,\r | |
190 | IN EFI_PEI_LBA StartLBA,\r | |
191 | IN UINTN BufferSize,\r | |
192 | OUT VOID *Buffer\r | |
193 | );\r | |
194 | \r | |
195 | ///\r | |
196 | /// EFI_PEI_RECOVERY_BLOCK_IO_PPI provides the services that are required\r | |
197 | /// to access a block I/O device during PEI recovery boot mode.\r | |
198 | ///\r | |
199 | struct _EFI_PEI_RECOVERY_BLOCK_IO2_PPI {\r | |
200 | ///\r | |
201 | /// The revision to which the interface adheres.\r | |
202 | /// All future revisions must be backwards compatible.\r | |
203 | ///\r | |
204 | UINT64 Revision;\r | |
205 | ///\r | |
206 | /// Gets the number of block I/O devices that the specific block driver manages.\r | |
207 | ///\r | |
208 | EFI_PEI_GET_NUMBER_BLOCK_DEVICES2 GetNumberOfBlockDevices;\r | |
209 | \r | |
210 | ///\r | |
211 | /// Gets the specified media information.\r | |
212 | ///\r | |
213 | EFI_PEI_GET_DEVICE_MEDIA_INFORMATION2 GetBlockDeviceMediaInfo;\r | |
214 | \r | |
215 | ///\r | |
216 | /// Reads the requested number of blocks from the specified block device.\r | |
217 | ///\r | |
218 | EFI_PEI_READ_BLOCKS2 ReadBlocks;\r | |
219 | };\r | |
220 | \r | |
221 | extern EFI_GUID gEfiPeiVirtualBlockIo2PpiGuid;\r | |
222 | \r | |
223 | #endif\r |