UncachedMemoryAllocationLib.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. /** @file
  2. Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
  3. This program and the accompanying materials
  4. are licensed and made available under the terms and conditions of the BSD License
  5. which accompanies this distribution. The full text of the license may be found at
  6. http://opensource.org/licenses/bsd-license.php
  7. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  9. **/
  10. #ifndef __UNCACHED_MEMORY_ALLOCATION_LIB_H__
  11. #define __UNCACHED_MEMORY_ALLOCATION_LIB_H__
  12. /**
  13. Converts a cached or uncached address to a physical address suitable for use in SoC registers.
  14. @param VirtualAddress The pointer to convert.
  15. @return The physical address of the supplied virtual pointer.
  16. **/
  17. EFI_PHYSICAL_ADDRESS
  18. ConvertToPhysicalAddress (
  19. IN VOID *VirtualAddress
  20. );
  21. /**
  22. Converts a cached or uncached address to a cached address.
  23. @param Address The pointer to convert.
  24. @return The address of the cached memory location corresponding to the input address.
  25. **/
  26. VOID *
  27. ConvertToCachedAddress (
  28. IN VOID *Address
  29. );
  30. /**
  31. Converts a cached or uncached address to an uncached address.
  32. @param Address The pointer to convert.
  33. @return The address of the uncached memory location corresponding to the input address.
  34. **/
  35. VOID *
  36. ConvertToUncachedAddress (
  37. IN VOID *Address
  38. );
  39. /**
  40. Allocates one or more 4KB pages of type EfiBootServicesData.
  41. Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the
  42. allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
  43. is returned. If there is not enough memory remaining to satisfy the request, then NULL is
  44. returned.
  45. @param Pages The number of 4 KB pages to allocate.
  46. @return A pointer to the allocated buffer or NULL if allocation fails.
  47. **/
  48. VOID *
  49. EFIAPI
  50. UncachedAllocatePages (
  51. IN UINTN Pages
  52. );
  53. /**
  54. Allocates one or more 4KB pages of type EfiRuntimeServicesData.
  55. Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the
  56. allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
  57. is returned. If there is not enough memory remaining to satisfy the request, then NULL is
  58. returned.
  59. @param Pages The number of 4 KB pages to allocate.
  60. @return A pointer to the allocated buffer or NULL if allocation fails.
  61. **/
  62. VOID *
  63. EFIAPI
  64. UncachedAllocateRuntimePages (
  65. IN UINTN Pages
  66. );
  67. /**
  68. Allocates one or more 4KB pages of type EfiReservedMemoryType.
  69. Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a pointer to the
  70. allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
  71. is returned. If there is not enough memory remaining to satisfy the request, then NULL is
  72. returned.
  73. @param Pages The number of 4 KB pages to allocate.
  74. @return A pointer to the allocated buffer or NULL if allocation fails.
  75. **/
  76. VOID *
  77. EFIAPI
  78. UncachedAllocateReservedPages (
  79. IN UINTN Pages
  80. );
  81. /**
  82. Frees one or more 4KB pages that were previously allocated with one of the page allocation
  83. functions in the Memory Allocation Library.
  84. Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
  85. must have been allocated on a previous call to the page allocation services of the Memory
  86. Allocation Library.
  87. If Buffer was not allocated with a page allocation function in the Memory Allocation Library,
  88. then ASSERT().
  89. If Pages is zero, then ASSERT().
  90. @param Buffer Pointer to the buffer of pages to free.
  91. @param Pages The number of 4 KB pages to free.
  92. **/
  93. VOID
  94. EFIAPI
  95. UncachedFreePages (
  96. IN VOID *Buffer,
  97. IN UINTN Pages
  98. );
  99. /**
  100. Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.
  101. Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an
  102. alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
  103. returned. If there is not enough memory at the specified alignment remaining to satisfy the
  104. request, then NULL is returned.
  105. If Alignment is not a power of two and Alignment is not zero, then ASSERT().
  106. @param Pages The number of 4 KB pages to allocate.
  107. @param Alignment The requested alignment of the allocation. Must be a power of two.
  108. If Alignment is zero, then byte alignment is used.
  109. @return A pointer to the allocated buffer or NULL if allocation fails.
  110. **/
  111. VOID *
  112. EFIAPI
  113. UncachedAllocateAlignedPages (
  114. IN UINTN Pages,
  115. IN UINTN Alignment
  116. );
  117. /**
  118. Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment.
  119. Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an
  120. alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
  121. returned. If there is not enough memory at the specified alignment remaining to satisfy the
  122. request, then NULL is returned.
  123. If Alignment is not a power of two and Alignment is not zero, then ASSERT().
  124. @param Pages The number of 4 KB pages to allocate.
  125. @param Alignment The requested alignment of the allocation. Must be a power of two.
  126. If Alignment is zero, then byte alignment is used.
  127. @return A pointer to the allocated buffer or NULL if allocation fails.
  128. **/
  129. VOID *
  130. EFIAPI
  131. UncachedAllocateAlignedRuntimePages (
  132. IN UINTN Pages,
  133. IN UINTN Alignment
  134. );
  135. /**
  136. Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.
  137. Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType with an
  138. alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
  139. returned. If there is not enough memory at the specified alignment remaining to satisfy the
  140. request, then NULL is returned.
  141. If Alignment is not a power of two and Alignment is not zero, then ASSERT().
  142. @param Pages The number of 4 KB pages to allocate.
  143. @param Alignment The requested alignment of the allocation. Must be a power of two.
  144. If Alignment is zero, then byte alignment is used.
  145. @return A pointer to the allocated buffer or NULL if allocation fails.
  146. **/
  147. VOID *
  148. EFIAPI
  149. UncachedAllocateAlignedReservedPages (
  150. IN UINTN Pages,
  151. IN UINTN Alignment
  152. );
  153. /**
  154. Frees one or more 4KB pages that were previously allocated with one of the aligned page
  155. allocation functions in the Memory Allocation Library.
  156. Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
  157. must have been allocated on a previous call to the aligned page allocation services of the Memory
  158. Allocation Library.
  159. If Buffer was not allocated with an aligned page allocation function in the Memory Allocation
  160. Library, then ASSERT().
  161. If Pages is zero, then ASSERT().
  162. @param Buffer Pointer to the buffer of pages to free.
  163. @param Pages The number of 4 KB pages to free.
  164. **/
  165. VOID
  166. EFIAPI
  167. UncachedFreeAlignedPages (
  168. IN VOID *Buffer,
  169. IN UINTN Pages
  170. );
  171. /**
  172. Allocates a buffer of type EfiBootServicesData.
  173. Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a
  174. pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
  175. returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
  176. @param AllocationSize The number of bytes to allocate.
  177. @return A pointer to the allocated buffer or NULL if allocation fails.
  178. **/
  179. VOID *
  180. EFIAPI
  181. UncachedAllocatePool (
  182. IN UINTN AllocationSize
  183. );
  184. /**
  185. Allocates a buffer of type EfiRuntimeServicesData.
  186. Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns
  187. a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
  188. returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
  189. @param AllocationSize The number of bytes to allocate.
  190. @return A pointer to the allocated buffer or NULL if allocation fails.
  191. **/
  192. VOID *
  193. EFIAPI
  194. UncachedAllocateRuntimePool (
  195. IN UINTN AllocationSize
  196. );
  197. /**
  198. Allocates a buffer of type EfieservedMemoryType.
  199. Allocates the number bytes specified by AllocationSize of type EfieservedMemoryType and returns
  200. a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
  201. returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
  202. @param AllocationSize The number of bytes to allocate.
  203. @return A pointer to the allocated buffer or NULL if allocation fails.
  204. **/
  205. VOID *
  206. EFIAPI
  207. UncachedAllocateReservedPool (
  208. IN UINTN AllocationSize
  209. );
  210. /**
  211. Allocates and zeros a buffer of type EfiBootServicesData.
  212. Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the
  213. buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
  214. valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
  215. request, then NULL is returned.
  216. @param AllocationSize The number of bytes to allocate and zero.
  217. @return A pointer to the allocated buffer or NULL if allocation fails.
  218. **/
  219. VOID *
  220. EFIAPI
  221. UncachedAllocateZeroPool (
  222. IN UINTN AllocationSize
  223. );
  224. /**
  225. Allocates and zeros a buffer of type EfiRuntimeServicesData.
  226. Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the
  227. buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
  228. valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
  229. request, then NULL is returned.
  230. @param AllocationSize The number of bytes to allocate and zero.
  231. @return A pointer to the allocated buffer or NULL if allocation fails.
  232. **/
  233. VOID *
  234. EFIAPI
  235. UncachedAllocateRuntimeZeroPool (
  236. IN UINTN AllocationSize
  237. );
  238. /**
  239. Allocates and zeros a buffer of type EfiReservedMemoryType.
  240. Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the
  241. buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
  242. valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
  243. request, then NULL is returned.
  244. @param AllocationSize The number of bytes to allocate and zero.
  245. @return A pointer to the allocated buffer or NULL if allocation fails.
  246. **/
  247. VOID *
  248. EFIAPI
  249. UncachedAllocateReservedZeroPool (
  250. IN UINTN AllocationSize
  251. );
  252. /**
  253. Copies a buffer to an allocated buffer of type EfiBootServicesData.
  254. Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, copies
  255. AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
  256. allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
  257. is not enough memory remaining to satisfy the request, then NULL is returned.
  258. If Buffer is NULL, then ASSERT().
  259. If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
  260. @param AllocationSize The number of bytes to allocate and zero.
  261. @param Buffer The buffer to copy to the allocated buffer.
  262. @return A pointer to the allocated buffer or NULL if allocation fails.
  263. **/
  264. VOID *
  265. EFIAPI
  266. UncachedAllocateCopyPool (
  267. IN UINTN AllocationSize,
  268. IN CONST VOID *Buffer
  269. );
  270. /**
  271. Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.
  272. Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, copies
  273. AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
  274. allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
  275. is not enough memory remaining to satisfy the request, then NULL is returned.
  276. If Buffer is NULL, then ASSERT().
  277. If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
  278. @param AllocationSize The number of bytes to allocate and zero.
  279. @param Buffer The buffer to copy to the allocated buffer.
  280. @return A pointer to the allocated buffer or NULL if allocation fails.
  281. **/
  282. VOID *
  283. EFIAPI
  284. UncachedAllocateRuntimeCopyPool (
  285. IN UINTN AllocationSize,
  286. IN CONST VOID *Buffer
  287. );
  288. /**
  289. Copies a buffer to an allocated buffer of type EfiReservedMemoryType.
  290. Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, copies
  291. AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
  292. allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
  293. is not enough memory remaining to satisfy the request, then NULL is returned.
  294. If Buffer is NULL, then ASSERT().
  295. If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
  296. @param AllocationSize The number of bytes to allocate and zero.
  297. @param Buffer The buffer to copy to the allocated buffer.
  298. @return A pointer to the allocated buffer or NULL if allocation fails.
  299. **/
  300. VOID *
  301. EFIAPI
  302. UncachedAllocateReservedCopyPool (
  303. IN UINTN AllocationSize,
  304. IN CONST VOID *Buffer
  305. );
  306. /**
  307. Frees a buffer that was previously allocated with one of the pool allocation functions in the
  308. Memory Allocation Library.
  309. Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
  310. pool allocation services of the Memory Allocation Library.
  311. If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
  312. then ASSERT().
  313. @param Buffer Pointer to the buffer to free.
  314. **/
  315. VOID
  316. EFIAPI
  317. UncachedFreePool (
  318. IN VOID *Buffer
  319. );
  320. /**
  321. Allocates a buffer of type EfiBootServicesData at a specified alignment.
  322. Allocates the number bytes specified by AllocationSize of type EfiBootServicesData with an
  323. alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
  324. then a valid buffer of 0 size is returned. If there is not enough memory at the specified
  325. alignment remaining to satisfy the request, then NULL is returned.
  326. If Alignment is not a power of two and Alignment is not zero, then ASSERT().
  327. @param AllocationSize The number of bytes to allocate.
  328. @param Alignment The requested alignment of the allocation. Must be a power of two.
  329. If Alignment is zero, then byte alignment is used.
  330. @return A pointer to the allocated buffer or NULL if allocation fails.
  331. **/
  332. VOID *
  333. EFIAPI
  334. UncachedAllocateAlignedPool (
  335. IN UINTN AllocationSize,
  336. IN UINTN Alignment
  337. );
  338. /**
  339. Allocates a buffer of type EfiRuntimeServicesData at a specified alignment.
  340. Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData with an
  341. alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
  342. then a valid buffer of 0 size is returned. If there is not enough memory at the specified
  343. alignment remaining to satisfy the request, then NULL is returned.
  344. If Alignment is not a power of two and Alignment is not zero, then ASSERT().
  345. @param AllocationSize The number of bytes to allocate.
  346. @param Alignment The requested alignment of the allocation. Must be a power of two.
  347. If Alignment is zero, then byte alignment is used.
  348. @return A pointer to the allocated buffer or NULL if allocation fails.
  349. **/
  350. VOID *
  351. EFIAPI
  352. UncachedAllocateAlignedRuntimePool (
  353. IN UINTN AllocationSize,
  354. IN UINTN Alignment
  355. );
  356. /**
  357. Allocates a buffer of type EfieservedMemoryType at a specified alignment.
  358. Allocates the number bytes specified by AllocationSize of type EfieservedMemoryType with an
  359. alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
  360. then a valid buffer of 0 size is returned. If there is not enough memory at the specified
  361. alignment remaining to satisfy the request, then NULL is returned.
  362. If Alignment is not a power of two and Alignment is not zero, then ASSERT().
  363. @param AllocationSize The number of bytes to allocate.
  364. @param Alignment The requested alignment of the allocation. Must be a power of two.
  365. If Alignment is zero, then byte alignment is used.
  366. @return A pointer to the allocated buffer or NULL if allocation fails.
  367. **/
  368. VOID *
  369. EFIAPI
  370. UncachedAllocateAlignedReservedPool (
  371. IN UINTN AllocationSize,
  372. IN UINTN Alignment
  373. );
  374. /**
  375. Allocates and zeros a buffer of type EfiBootServicesData at a specified alignment.
  376. Allocates the number bytes specified by AllocationSize of type EfiBootServicesData with an
  377. alignment specified by Alignment, clears the buffer with zeros, and returns a pointer to the
  378. allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
  379. is not enough memory at the specified alignment remaining to satisfy the request, then NULL is
  380. returned.
  381. If Alignment is not a power of two and Alignment is not zero, then ASSERT().
  382. @param AllocationSize The number of bytes to allocate.
  383. @param Alignment The requested alignment of the allocation. Must be a power of two.
  384. If Alignment is zero, then byte alignment is used.
  385. @return A pointer to the allocated buffer or NULL if allocation fails.
  386. **/
  387. VOID *
  388. EFIAPI
  389. UncachedAllocateAlignedZeroPool (
  390. IN UINTN AllocationSize,
  391. IN UINTN Alignment
  392. );
  393. /**
  394. Allocates and zeros a buffer of type EfiRuntimeServicesData at a specified alignment.
  395. Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData with an
  396. alignment specified by Alignment, clears the buffer with zeros, and returns a pointer to the
  397. allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
  398. is not enough memory at the specified alignment remaining to satisfy the request, then NULL is
  399. returned.
  400. If Alignment is not a power of two and Alignment is not zero, then ASSERT().
  401. @param AllocationSize The number of bytes to allocate.
  402. @param Alignment The requested alignment of the allocation. Must be a power of two.
  403. If Alignment is zero, then byte alignment is used.
  404. @return A pointer to the allocated buffer or NULL if allocation fails.
  405. **/
  406. VOID *
  407. EFIAPI
  408. UncachedAllocateAlignedRuntimeZeroPool (
  409. IN UINTN AllocationSize,
  410. IN UINTN Alignment
  411. );
  412. /**
  413. Allocates and zeros a buffer of type EfieservedMemoryType at a specified alignment.
  414. Allocates the number bytes specified by AllocationSize of type EfieservedMemoryType with an
  415. alignment specified by Alignment, clears the buffer with zeros, and returns a pointer to the
  416. allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
  417. is not enough memory at the specified alignment remaining to satisfy the request, then NULL is
  418. returned.
  419. If Alignment is not a power of two and Alignment is not zero, then ASSERT().
  420. @param AllocationSize The number of bytes to allocate.
  421. @param Alignment The requested alignment of the allocation. Must be a power of two.
  422. If Alignment is zero, then byte alignment is used.
  423. @return A pointer to the allocated buffer or NULL if allocation fails.
  424. **/
  425. VOID *
  426. EFIAPI
  427. UncachedAllocateAlignedReservedZeroPool (
  428. IN UINTN AllocationSize,
  429. IN UINTN Alignment
  430. );
  431. /**
  432. Copies a buffer to an allocated buffer of type EfiBootServicesData at a specified alignment.
  433. Allocates the number bytes specified by AllocationSize of type EfiBootServicesData type with an
  434. alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
  435. then a valid buffer of 0 size is returned. If there is not enough memory at the specified
  436. alignment remaining to satisfy the request, then NULL is returned.
  437. If Alignment is not a power of two and Alignment is not zero, then ASSERT().
  438. @param AllocationSize The number of bytes to allocate.
  439. @param Buffer The buffer to copy to the allocated buffer.
  440. @param Alignment The requested alignment of the allocation. Must be a power of two.
  441. If Alignment is zero, then byte alignment is used.
  442. @return A pointer to the allocated buffer or NULL if allocation fails.
  443. **/
  444. VOID *
  445. EFIAPI
  446. UncachedAllocateAlignedCopyPool (
  447. IN UINTN AllocationSize,
  448. IN CONST VOID *Buffer,
  449. IN UINTN Alignment
  450. );
  451. /**
  452. Copies a buffer to an allocated buffer of type EfiRuntimeServicesData at a specified alignment.
  453. Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData type with an
  454. alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
  455. then a valid buffer of 0 size is returned. If there is not enough memory at the specified
  456. alignment remaining to satisfy the request, then NULL is returned.
  457. If Alignment is not a power of two and Alignment is not zero, then ASSERT().
  458. @param AllocationSize The number of bytes to allocate.
  459. @param Buffer The buffer to copy to the allocated buffer.
  460. @param Alignment The requested alignment of the allocation. Must be a power of two.
  461. If Alignment is zero, then byte alignment is used.
  462. @return A pointer to the allocated buffer or NULL if allocation fails.
  463. **/
  464. VOID *
  465. EFIAPI
  466. UncachedAllocateAlignedRuntimeCopyPool (
  467. IN UINTN AllocationSize,
  468. IN CONST VOID *Buffer,
  469. IN UINTN Alignment
  470. );
  471. /**
  472. Copies a buffer to an allocated buffer of type EfiReservedMemoryType at a specified alignment.
  473. Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType type with an
  474. alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
  475. then a valid buffer of 0 size is returned. If there is not enough memory at the specified
  476. alignment remaining to satisfy the request, then NULL is returned.
  477. If Alignment is not a power of two and Alignment is not zero, then ASSERT().
  478. @param AllocationSize The number of bytes to allocate.
  479. @param Buffer The buffer to copy to the allocated buffer.
  480. @param Alignment The requested alignment of the allocation. Must be a power of two.
  481. If Alignment is zero, then byte alignment is used.
  482. @return A pointer to the allocated buffer or NULL if allocation fails.
  483. **/
  484. VOID *
  485. EFIAPI
  486. UncachedAllocateAlignedReservedCopyPool (
  487. IN UINTN AllocationSize,
  488. IN CONST VOID *Buffer,
  489. IN UINTN Alignment
  490. );
  491. /**
  492. Frees a buffer that was previously allocated with one of the aligned pool allocation functions
  493. in the Memory Allocation Library.
  494. Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
  495. aligned pool allocation services of the Memory Allocation Library.
  496. If Buffer was not allocated with an aligned pool allocation function in the Memory Allocation
  497. Library, then ASSERT().
  498. @param Buffer Pointer to the buffer to free.
  499. **/
  500. VOID
  501. EFIAPI
  502. UncachedFreeAlignedPool (
  503. IN VOID *Buffer
  504. );
  505. VOID
  506. EFIAPI
  507. UncachedSafeFreePool (
  508. IN VOID *Buffer
  509. );
  510. #endif // __UNCACHED_MEMORY_ALLOCATION_LIB_H__