]>
Commit | Line | Data |
---|---|---|
48555339 FT |
1 | /** @file\r |
2 | \r | |
77af8668 | 3 | Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r |
9d510e61 | 4 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
48555339 FT |
5 | \r |
6 | **/\r | |
7 | \r | |
8 | #ifndef _SD_BLOCK_IO_PEI_H_\r | |
9 | #define _SD_BLOCK_IO_PEI_H_\r | |
10 | \r | |
11 | #include <PiPei.h>\r | |
12 | \r | |
13 | #include <Ppi/SdMmcHostController.h>\r | |
14 | #include <Ppi/BlockIo.h>\r | |
15 | #include <Ppi/BlockIo2.h>\r | |
77af8668 HW |
16 | #include <Ppi/IoMmu.h>\r |
17 | #include <Ppi/EndOfPeiPhase.h>\r | |
48555339 FT |
18 | \r |
19 | #include <Library/DebugLib.h>\r | |
20 | #include <Library/BaseLib.h>\r | |
21 | #include <Library/BaseMemoryLib.h>\r | |
22 | #include <Library/MemoryAllocationLib.h>\r | |
23 | #include <Library/IoLib.h>\r | |
24 | #include <Library/TimerLib.h>\r | |
25 | #include <Library/PeiServicesLib.h>\r | |
26 | \r | |
27 | #include <IndustryStandard/Sd.h>\r | |
28 | \r | |
29 | typedef struct _SD_PEIM_HC_PRIVATE_DATA SD_PEIM_HC_PRIVATE_DATA;\r | |
30 | typedef struct _SD_PEIM_HC_SLOT SD_PEIM_HC_SLOT;\r | |
31 | typedef struct _SD_TRB SD_TRB;\r | |
32 | \r | |
33 | #include "SdHci.h"\r | |
34 | #include "SdHcMem.h"\r | |
35 | \r | |
36 | #define SD_PEIM_SIG SIGNATURE_32 ('S', 'D', 'C', 'P')\r | |
37 | #define SD_PEIM_SLOT_SIG SIGNATURE_32 ('S', 'D', 'C', 'S')\r | |
38 | \r | |
39 | #define SD_PEIM_MAX_SLOTS 6\r | |
40 | \r | |
41 | struct _SD_PEIM_HC_SLOT {\r | |
42 | UINT32 Signature;\r | |
43 | EFI_PEI_BLOCK_IO2_MEDIA Media;\r | |
44 | \r | |
45 | UINTN SdHcBase;\r | |
46 | SD_HC_SLOT_CAP Capability;\r | |
47 | SD_CSD Csd;\r | |
48 | BOOLEAN SectorAddressing;\r | |
49 | SD_PEIM_HC_PRIVATE_DATA *Private;\r | |
50 | };\r | |
51 | \r | |
52 | struct _SD_PEIM_HC_PRIVATE_DATA {\r | |
53 | UINT32 Signature;\r | |
54 | SD_PEIM_MEM_POOL *Pool;\r | |
55 | EFI_PEI_RECOVERY_BLOCK_IO_PPI BlkIoPpi;\r | |
56 | EFI_PEI_RECOVERY_BLOCK_IO2_PPI BlkIo2Ppi;\r | |
57 | EFI_PEI_PPI_DESCRIPTOR BlkIoPpiList;\r | |
58 | EFI_PEI_PPI_DESCRIPTOR BlkIo2PpiList;\r | |
77af8668 HW |
59 | \r |
60 | //\r | |
61 | // EndOfPei callback is used to do the cleanups before exit of PEI phase.\r | |
62 | //\r | |
63 | EFI_PEI_NOTIFY_DESCRIPTOR EndOfPeiNotifyList;\r | |
64 | \r | |
48555339 FT |
65 | SD_PEIM_HC_SLOT Slot[SD_PEIM_MAX_SLOTS];\r |
66 | UINT8 SlotNum;\r | |
67 | UINT8 TotalBlkIoDevices;\r | |
68 | };\r | |
69 | \r | |
70 | #define SD_TIMEOUT MultU64x32((UINT64)(3), 1000000)\r | |
71 | #define GET_SD_PEIM_HC_PRIVATE_DATA_FROM_THIS(a) CR (a, SD_PEIM_HC_PRIVATE_DATA, BlkIoPpi, SD_PEIM_SIG)\r | |
72 | #define GET_SD_PEIM_HC_PRIVATE_DATA_FROM_THIS2(a) CR (a, SD_PEIM_HC_PRIVATE_DATA, BlkIo2Ppi, SD_PEIM_SIG)\r | |
77af8668 | 73 | #define GET_SD_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY(a) CR (a, SD_PEIM_HC_PRIVATE_DATA, EndOfPeiNotifyList, SD_PEIM_SIG)\r |
48555339 FT |
74 | \r |
75 | struct _SD_TRB {\r | |
76 | SD_PEIM_HC_SLOT *Slot;\r | |
77 | UINT16 BlockSize;\r | |
78 | \r | |
79 | SD_COMMAND_PACKET *Packet;\r | |
80 | VOID *Data;\r | |
81 | UINT32 DataLen;\r | |
82 | BOOLEAN Read;\r | |
77af8668 HW |
83 | EFI_PHYSICAL_ADDRESS DataPhy;\r |
84 | VOID *DataMap;\r | |
48555339 FT |
85 | SD_HC_TRANSFER_MODE Mode;\r |
86 | \r | |
87 | UINT64 Timeout;\r | |
88 | \r | |
89 | SD_HC_ADMA_DESC_LINE *AdmaDesc;\r | |
90 | UINTN AdmaDescSize;\r | |
91 | };\r | |
92 | \r | |
93 | /**\r | |
94 | Gets the count of block I/O devices that one specific block driver detects.\r | |
95 | \r | |
96 | This function is used for getting the count of block I/O devices that one\r | |
97 | specific block driver detects. To the PEI ATAPI driver, it returns the number\r | |
98 | of all the detected ATAPI devices it detects during the enumeration process.\r | |
99 | To the PEI legacy floppy driver, it returns the number of all the legacy\r | |
100 | devices it finds during its enumeration process. If no device is detected,\r | |
101 | then the function will return zero.\r | |
102 | \r | |
103 | @param[in] PeiServices General-purpose services that are available\r | |
104 | to every PEIM.\r | |
105 | @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI\r | |
106 | instance.\r | |
107 | @param[out] NumberBlockDevices The number of block I/O devices discovered.\r | |
108 | \r | |
109 | @retval EFI_SUCCESS The operation performed successfully.\r | |
110 | \r | |
111 | **/\r | |
112 | EFI_STATUS\r | |
113 | EFIAPI\r | |
114 | SdBlockIoPeimGetDeviceNo (\r | |
115 | IN EFI_PEI_SERVICES **PeiServices,\r | |
116 | IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,\r | |
117 | OUT UINTN *NumberBlockDevices\r | |
118 | );\r | |
119 | \r | |
120 | /**\r | |
121 | Gets a block device's media information.\r | |
122 | \r | |
123 | This function will provide the caller with the specified block device's media\r | |
124 | information. If the media changes, calling this function will update the media\r | |
125 | information accordingly.\r | |
126 | \r | |
127 | @param[in] PeiServices General-purpose services that are available to every\r | |
128 | PEIM\r | |
129 | @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.\r | |
130 | @param[in] DeviceIndex Specifies the block device to which the function wants\r | |
131 | to talk. Because the driver that implements Block I/O\r | |
132 | PPIs will manage multiple block devices, the PPIs that\r | |
133 | want to talk to a single device must specify the\r | |
134 | device index that was assigned during the enumeration\r | |
135 | process. This index is a number from one to\r | |
136 | NumberBlockDevices.\r | |
137 | @param[out] MediaInfo The media information of the specified block media.\r | |
138 | The caller is responsible for the ownership of this\r | |
139 | data structure.\r | |
140 | \r | |
141 | @par Note:\r | |
142 | The MediaInfo structure describes an enumeration of possible block device\r | |
143 | types. This enumeration exists because no device paths are actually passed\r | |
144 | across interfaces that describe the type or class of hardware that is publishing\r | |
145 | the block I/O interface. This enumeration will allow for policy decisions\r | |
146 | in the Recovery PEIM, such as "Try to recover from legacy floppy first,\r | |
147 | LS-120 second, CD-ROM third." If there are multiple partitions abstracted\r | |
148 | by a given device type, they should be reported in ascending order; this\r | |
149 | order also applies to nested partitions, such as legacy MBR, where the\r | |
150 | outermost partitions would have precedence in the reporting order. The\r | |
151 | same logic applies to systems such as IDE that have precedence relationships\r | |
152 | like "Master/Slave" or "Primary/Secondary". The master device should be\r | |
153 | reported first, the slave second.\r | |
154 | \r | |
155 | @retval EFI_SUCCESS Media information about the specified block device\r | |
156 | was obtained successfully.\r | |
157 | @retval EFI_DEVICE_ERROR Cannot get the media information due to a hardware\r | |
158 | error.\r | |
159 | \r | |
160 | **/\r | |
161 | EFI_STATUS\r | |
162 | EFIAPI\r | |
163 | SdBlockIoPeimGetMediaInfo (\r | |
164 | IN EFI_PEI_SERVICES **PeiServices,\r | |
165 | IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,\r | |
166 | IN UINTN DeviceIndex,\r | |
167 | OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo\r | |
168 | );\r | |
169 | \r | |
170 | /**\r | |
171 | Reads the requested number of blocks from the specified block device.\r | |
172 | \r | |
173 | The function reads the requested number of blocks from the device. All the\r | |
174 | blocks are read, or an error is returned. If there is no media in the device,\r | |
175 | the function returns EFI_NO_MEDIA.\r | |
176 | \r | |
177 | @param[in] PeiServices General-purpose services that are available to\r | |
178 | every PEIM.\r | |
179 | @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.\r | |
180 | @param[in] DeviceIndex Specifies the block device to which the function wants\r | |
181 | to talk. Because the driver that implements Block I/O\r | |
182 | PPIs will manage multiple block devices, PPIs that\r | |
183 | want to talk to a single device must specify the device\r | |
184 | index that was assigned during the enumeration process.\r | |
185 | This index is a number from one to NumberBlockDevices.\r | |
186 | @param[in] StartLBA The starting logical block address (LBA) to read from\r | |
187 | on the device\r | |
188 | @param[in] BufferSize The size of the Buffer in bytes. This number must be\r | |
189 | a multiple of the intrinsic block size of the device.\r | |
190 | @param[out] Buffer A pointer to the destination buffer for the data.\r | |
191 | The caller is responsible for the ownership of the\r | |
192 | buffer.\r | |
193 | \r | |
194 | @retval EFI_SUCCESS The data was read correctly from the device.\r | |
195 | @retval EFI_DEVICE_ERROR The device reported an error while attempting\r | |
196 | to perform the read operation.\r | |
197 | @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not\r | |
198 | valid, or the buffer is not properly aligned.\r | |
199 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
200 | @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of\r | |
201 | the intrinsic block size of the device.\r | |
202 | \r | |
203 | **/\r | |
204 | EFI_STATUS\r | |
205 | EFIAPI\r | |
206 | SdBlockIoPeimReadBlocks (\r | |
207 | IN EFI_PEI_SERVICES **PeiServices,\r | |
208 | IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,\r | |
209 | IN UINTN DeviceIndex,\r | |
210 | IN EFI_PEI_LBA StartLBA,\r | |
211 | IN UINTN BufferSize,\r | |
212 | OUT VOID *Buffer\r | |
213 | );\r | |
214 | \r | |
215 | /**\r | |
216 | Gets the count of block I/O devices that one specific block driver detects.\r | |
217 | \r | |
218 | This function is used for getting the count of block I/O devices that one\r | |
219 | specific block driver detects. To the PEI ATAPI driver, it returns the number\r | |
220 | of all the detected ATAPI devices it detects during the enumeration process.\r | |
221 | To the PEI legacy floppy driver, it returns the number of all the legacy\r | |
222 | devices it finds during its enumeration process. If no device is detected,\r | |
223 | then the function will return zero.\r | |
224 | \r | |
225 | @param[in] PeiServices General-purpose services that are available\r | |
226 | to every PEIM.\r | |
227 | @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI\r | |
228 | instance.\r | |
229 | @param[out] NumberBlockDevices The number of block I/O devices discovered.\r | |
230 | \r | |
231 | @retval EFI_SUCCESS The operation performed successfully.\r | |
232 | \r | |
233 | **/\r | |
234 | EFI_STATUS\r | |
235 | EFIAPI\r | |
236 | SdBlockIoPeimGetDeviceNo2 (\r | |
237 | IN EFI_PEI_SERVICES **PeiServices,\r | |
238 | IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,\r | |
239 | OUT UINTN *NumberBlockDevices\r | |
240 | );\r | |
241 | \r | |
242 | /**\r | |
243 | Gets a block device's media information.\r | |
244 | \r | |
245 | This function will provide the caller with the specified block device's media\r | |
246 | information. If the media changes, calling this function will update the media\r | |
247 | information accordingly.\r | |
248 | \r | |
249 | @param[in] PeiServices General-purpose services that are available to every\r | |
250 | PEIM\r | |
251 | @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.\r | |
252 | @param[in] DeviceIndex Specifies the block device to which the function wants\r | |
253 | to talk. Because the driver that implements Block I/O\r | |
254 | PPIs will manage multiple block devices, the PPIs that\r | |
255 | want to talk to a single device must specify the\r | |
256 | device index that was assigned during the enumeration\r | |
257 | process. This index is a number from one to\r | |
258 | NumberBlockDevices.\r | |
259 | @param[out] MediaInfo The media information of the specified block media.\r | |
260 | The caller is responsible for the ownership of this\r | |
261 | data structure.\r | |
262 | \r | |
263 | @par Note:\r | |
264 | The MediaInfo structure describes an enumeration of possible block device\r | |
265 | types. This enumeration exists because no device paths are actually passed\r | |
266 | across interfaces that describe the type or class of hardware that is publishing\r | |
267 | the block I/O interface. This enumeration will allow for policy decisions\r | |
268 | in the Recovery PEIM, such as "Try to recover from legacy floppy first,\r | |
269 | LS-120 second, CD-ROM third." If there are multiple partitions abstracted\r | |
270 | by a given device type, they should be reported in ascending order; this\r | |
271 | order also applies to nested partitions, such as legacy MBR, where the\r | |
272 | outermost partitions would have precedence in the reporting order. The\r | |
273 | same logic applies to systems such as IDE that have precedence relationships\r | |
274 | like "Master/Slave" or "Primary/Secondary". The master device should be\r | |
275 | reported first, the slave second.\r | |
276 | \r | |
277 | @retval EFI_SUCCESS Media information about the specified block device\r | |
278 | was obtained successfully.\r | |
279 | @retval EFI_DEVICE_ERROR Cannot get the media information due to a hardware\r | |
280 | error.\r | |
281 | \r | |
282 | **/\r | |
283 | EFI_STATUS\r | |
284 | EFIAPI\r | |
285 | SdBlockIoPeimGetMediaInfo2 (\r | |
286 | IN EFI_PEI_SERVICES **PeiServices,\r | |
287 | IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,\r | |
288 | IN UINTN DeviceIndex,\r | |
289 | OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo\r | |
290 | );\r | |
291 | \r | |
292 | /**\r | |
293 | Reads the requested number of blocks from the specified block device.\r | |
294 | \r | |
295 | The function reads the requested number of blocks from the device. All the\r | |
296 | blocks are read, or an error is returned. If there is no media in the device,\r | |
297 | the function returns EFI_NO_MEDIA.\r | |
298 | \r | |
299 | @param[in] PeiServices General-purpose services that are available to\r | |
300 | every PEIM.\r | |
301 | @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.\r | |
302 | @param[in] DeviceIndex Specifies the block device to which the function wants\r | |
303 | to talk. Because the driver that implements Block I/O\r | |
304 | PPIs will manage multiple block devices, PPIs that\r | |
305 | want to talk to a single device must specify the device\r | |
306 | index that was assigned during the enumeration process.\r | |
307 | This index is a number from one to NumberBlockDevices.\r | |
308 | @param[in] StartLBA The starting logical block address (LBA) to read from\r | |
309 | on the device\r | |
310 | @param[in] BufferSize The size of the Buffer in bytes. This number must be\r | |
311 | a multiple of the intrinsic block size of the device.\r | |
312 | @param[out] Buffer A pointer to the destination buffer for the data.\r | |
313 | The caller is responsible for the ownership of the\r | |
314 | buffer.\r | |
315 | \r | |
316 | @retval EFI_SUCCESS The data was read correctly from the device.\r | |
317 | @retval EFI_DEVICE_ERROR The device reported an error while attempting\r | |
318 | to perform the read operation.\r | |
319 | @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not\r | |
320 | valid, or the buffer is not properly aligned.\r | |
321 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
322 | @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of\r | |
323 | the intrinsic block size of the device.\r | |
324 | \r | |
325 | **/\r | |
326 | EFI_STATUS\r | |
327 | EFIAPI\r | |
328 | SdBlockIoPeimReadBlocks2 (\r | |
329 | IN EFI_PEI_SERVICES **PeiServices,\r | |
330 | IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,\r | |
331 | IN UINTN DeviceIndex,\r | |
332 | IN EFI_PEI_LBA StartLBA,\r | |
333 | IN UINTN BufferSize,\r | |
334 | OUT VOID *Buffer\r | |
335 | );\r | |
336 | \r | |
337 | /**\r | |
338 | Initialize the memory management pool for the host controller.\r | |
339 | \r | |
340 | @param Private The Sd Peim driver private data.\r | |
341 | \r | |
342 | @retval EFI_SUCCESS The memory pool is initialized.\r | |
343 | @retval Others Fail to init the memory pool.\r | |
344 | \r | |
345 | **/\r | |
346 | EFI_STATUS\r | |
347 | SdPeimInitMemPool (\r | |
348 | IN SD_PEIM_HC_PRIVATE_DATA *Private\r | |
349 | );\r | |
350 | \r | |
77af8668 HW |
351 | /**\r |
352 | Release the memory management pool.\r | |
353 | \r | |
354 | @param Pool The memory pool to free.\r | |
355 | \r | |
356 | @retval EFI_DEVICE_ERROR Fail to free the memory pool.\r | |
357 | @retval EFI_SUCCESS The memory pool is freed.\r | |
358 | \r | |
359 | **/\r | |
360 | EFI_STATUS\r | |
361 | SdPeimFreeMemPool (\r | |
362 | IN SD_PEIM_MEM_POOL *Pool\r | |
363 | );\r | |
364 | \r | |
48555339 FT |
365 | /**\r |
366 | Allocate some memory from the host controller's memory pool\r | |
367 | which can be used to communicate with host controller.\r | |
368 | \r | |
369 | @param Pool The host controller's memory pool.\r | |
370 | @param Size Size of the memory to allocate.\r | |
371 | \r | |
372 | @return The allocated memory or NULL.\r | |
373 | \r | |
374 | **/\r | |
375 | VOID *\r | |
376 | SdPeimAllocateMem (\r | |
377 | IN SD_PEIM_MEM_POOL *Pool,\r | |
378 | IN UINTN Size\r | |
379 | );\r | |
380 | \r | |
381 | /**\r | |
382 | Free the allocated memory back to the memory pool.\r | |
383 | \r | |
384 | @param Pool The memory pool of the host controller.\r | |
385 | @param Mem The memory to free.\r | |
386 | @param Size The size of the memory to free.\r | |
387 | \r | |
388 | **/\r | |
389 | VOID\r | |
390 | SdPeimFreeMem (\r | |
391 | IN SD_PEIM_MEM_POOL *Pool,\r | |
392 | IN VOID *Mem,\r | |
393 | IN UINTN Size\r | |
394 | );\r | |
395 | \r | |
77af8668 HW |
396 | /**\r |
397 | Initialize IOMMU.\r | |
398 | **/\r | |
399 | VOID\r | |
400 | IoMmuInit (\r | |
401 | VOID\r | |
402 | );\r | |
403 | \r | |
404 | /**\r | |
405 | Provides the controller-specific addresses required to access system memory from a\r | |
406 | DMA bus master.\r | |
407 | \r | |
408 | @param Operation Indicates if the bus master is going to read or write to system memory.\r | |
409 | @param HostAddress The system memory address to map to the PCI controller.\r | |
410 | @param NumberOfBytes On input the number of bytes to map. On output the number of bytes\r | |
411 | that were mapped.\r | |
412 | @param DeviceAddress The resulting map address for the bus master PCI controller to use to\r | |
413 | access the hosts HostAddress.\r | |
414 | @param Mapping A resulting value to pass to Unmap().\r | |
415 | \r | |
416 | @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.\r | |
417 | @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.\r | |
418 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
419 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
420 | @retval EFI_DEVICE_ERROR The system hardware could not map the requested address.\r | |
421 | \r | |
422 | **/\r | |
423 | EFI_STATUS\r | |
424 | IoMmuMap (\r | |
425 | IN EDKII_IOMMU_OPERATION Operation,\r | |
426 | IN VOID *HostAddress,\r | |
427 | IN OUT UINTN *NumberOfBytes,\r | |
428 | OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r | |
429 | OUT VOID **Mapping\r | |
430 | );\r | |
431 | \r | |
432 | /**\r | |
433 | Completes the Map() operation and releases any corresponding resources.\r | |
434 | \r | |
435 | @param Mapping The mapping value returned from Map().\r | |
436 | \r | |
437 | @retval EFI_SUCCESS The range was unmapped.\r | |
438 | @retval EFI_INVALID_PARAMETER Mapping is not a value that was returned by Map().\r | |
439 | @retval EFI_DEVICE_ERROR The data was not committed to the target system memory.\r | |
440 | **/\r | |
441 | EFI_STATUS\r | |
442 | IoMmuUnmap (\r | |
443 | IN VOID *Mapping\r | |
444 | );\r | |
445 | \r | |
446 | /**\r | |
447 | Allocates pages that are suitable for an OperationBusMasterCommonBuffer or\r | |
448 | OperationBusMasterCommonBuffer64 mapping.\r | |
449 | \r | |
450 | @param Pages The number of pages to allocate.\r | |
451 | @param HostAddress A pointer to store the base system memory address of the\r | |
452 | allocated range.\r | |
453 | @param DeviceAddress The resulting map address for the bus master PCI controller to use to\r | |
454 | access the hosts HostAddress.\r | |
455 | @param Mapping A resulting value to pass to Unmap().\r | |
456 | \r | |
457 | @retval EFI_SUCCESS The requested memory pages were allocated.\r | |
458 | @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are\r | |
459 | MEMORY_WRITE_COMBINE and MEMORY_CACHED.\r | |
460 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
461 | @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.\r | |
462 | \r | |
463 | **/\r | |
464 | EFI_STATUS\r | |
465 | IoMmuAllocateBuffer (\r | |
466 | IN UINTN Pages,\r | |
467 | OUT VOID **HostAddress,\r | |
468 | OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r | |
469 | OUT VOID **Mapping\r | |
470 | );\r | |
471 | \r | |
472 | /**\r | |
473 | Frees memory that was allocated with AllocateBuffer().\r | |
474 | \r | |
475 | @param Pages The number of pages to free.\r | |
476 | @param HostAddress The base system memory address of the allocated range.\r | |
477 | @param Mapping The mapping value returned from Map().\r | |
478 | \r | |
479 | @retval EFI_SUCCESS The requested memory pages were freed.\r | |
480 | @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages\r | |
481 | was not allocated with AllocateBuffer().\r | |
482 | \r | |
483 | **/\r | |
484 | EFI_STATUS\r | |
485 | IoMmuFreeBuffer (\r | |
486 | IN UINTN Pages,\r | |
487 | IN VOID *HostAddress,\r | |
488 | IN VOID *Mapping\r | |
489 | );\r | |
490 | \r | |
491 | /**\r | |
492 | One notified function to cleanup the allocated DMA buffers at the end of PEI.\r | |
493 | \r | |
494 | @param[in] PeiServices Pointer to PEI Services Table.\r | |
495 | @param[in] NotifyDescriptor Pointer to the descriptor for the Notification\r | |
496 | event that caused this function to execute.\r | |
497 | @param[in] Ppi Pointer to the PPI data associated with this function.\r | |
498 | \r | |
499 | @retval EFI_SUCCESS The function completes successfully\r | |
500 | \r | |
501 | **/\r | |
502 | EFI_STATUS\r | |
503 | EFIAPI\r | |
504 | SdBlockIoPeimEndOfPei (\r | |
505 | IN EFI_PEI_SERVICES **PeiServices,\r | |
506 | IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r | |
507 | IN VOID *Ppi\r | |
508 | );\r | |
509 | \r | |
48555339 | 510 | #endif\r |