]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocationServices.h
7d7e190c5149c76f65b78521397215e4a188d18f
[mirror_edk2.git] / MdeModulePkg / Library / PiSmmCoreMemoryAllocationLib / PiSmmCoreMemoryAllocationServices.h
1 /** @file
2 Contains function prototypes for Memory Services in the SMM Core.
3
4 This header file borrows the PiSmmCore Memory Allocation services as the primitive
5 for memory allocation.
6
7 Copyright (c) 2008 - 2010, Intel Corporation<BR>
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 _PI_SMM_CORE_MEMORY_ALLOCATION_SERVICES_H_
19 #define _PI_SMM_CORE_MEMORY_ALLOCATION_SERVICES_H_
20
21 /**
22 Allocates pages from the memory map.
23
24 @param Type The type of allocation to perform
25 @param MemoryType The type of memory to turn the allocated pages
26 into
27 @param NumberOfPages The number of pages to allocate
28 @param Memory A pointer to receive the base allocated memory
29 address
30
31 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in spec.
32 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
33 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
34 @retval EFI_SUCCESS Pages successfully allocated.
35
36 **/
37 EFI_STATUS
38 EFIAPI
39 SmmAllocatePages (
40 IN EFI_ALLOCATE_TYPE Type,
41 IN EFI_MEMORY_TYPE MemoryType,
42 IN UINTN NumberOfPages,
43 OUT EFI_PHYSICAL_ADDRESS *Memory
44 );
45
46 /**
47 Frees previous allocated pages.
48
49 @param Memory Base address of memory being freed
50 @param NumberOfPages The number of pages to free
51
52 @retval EFI_NOT_FOUND Could not find the entry that covers the range
53 @retval EFI_INVALID_PARAMETER Address not aligned
54 @return EFI_SUCCESS Pages successfully freed.
55
56 **/
57 EFI_STATUS
58 EFIAPI
59 SmmFreePages (
60 IN EFI_PHYSICAL_ADDRESS Memory,
61 IN UINTN NumberOfPages
62 );
63
64 /**
65 Allocate pool of a particular type.
66
67 @param PoolType Type of pool to allocate
68 @param Size The amount of pool to allocate
69 @param Buffer The address to return a pointer to the allocated
70 pool
71
72 @retval EFI_INVALID_PARAMETER PoolType not valid
73 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
74 @retval EFI_SUCCESS Pool successfully allocated.
75
76 **/
77 EFI_STATUS
78 EFIAPI
79 SmmAllocatePool (
80 IN EFI_MEMORY_TYPE PoolType,
81 IN UINTN Size,
82 OUT VOID **Buffer
83 );
84
85 /**
86 Frees pool.
87
88 @param Buffer The allocated pool entry to free
89
90 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
91 @retval EFI_SUCCESS Pool successfully freed.
92
93 **/
94 EFI_STATUS
95 EFIAPI
96 SmmFreePool (
97 IN VOID *Buffer
98 );
99
100 #endif