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