]>
Commit | Line | Data |
---|---|---|
713b7781 | 1 | /** @file\r |
2 | Contains function prototypes for Memory Services in the SMM Core.\r | |
3 | \r | |
4 | This header file borrows the PiSmmCore Memory Allocation services as the primitive\r | |
5 | for memory allocation. \r | |
6 | \r | |
842b1242 | 7 | Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>\r |
cd5ebaa0 | 8 | This program and the accompanying materials \r |
713b7781 | 9 | are licensed and made available under the terms and conditions of the BSD License \r |
10 | which accompanies this distribution. The full text of the license may be found at \r | |
11 | http://opensource.org/licenses/bsd-license.php \r | |
12 | \r | |
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
15 | \r | |
16 | **/\r | |
17 | \r | |
18 | #ifndef _PI_SMM_CORE_MEMORY_ALLOCATION_SERVICES_H_\r | |
19 | #define _PI_SMM_CORE_MEMORY_ALLOCATION_SERVICES_H_\r | |
20 | \r | |
842b1242 JY |
21 | typedef struct {\r |
22 | UINTN Signature;\r | |
23 | ///\r | |
24 | /// The ImageHandle passed into the entry point of the SMM IPL. This ImageHandle\r | |
25 | /// is used by the SMM Core to fill in the ParentImageHandle field of the Loaded\r | |
26 | /// Image Protocol for each SMM Driver that is dispatched by the SMM Core.\r | |
27 | ///\r | |
28 | EFI_HANDLE SmmIplImageHandle;\r | |
29 | ///\r | |
30 | /// The number of SMRAM ranges passed from the SMM IPL to the SMM Core. The SMM\r | |
31 | /// Core uses these ranges of SMRAM to initialize the SMM Core memory manager.\r | |
32 | ///\r | |
33 | UINTN SmramRangeCount;\r | |
34 | ///\r | |
35 | /// A table of SMRAM ranges passed from the SMM IPL to the SMM Core. The SMM\r | |
36 | /// Core uses these ranges of SMRAM to initialize the SMM Core memory manager.\r | |
37 | ///\r | |
38 | EFI_SMRAM_DESCRIPTOR *SmramRanges;\r | |
39 | } SMM_CORE_PRIVATE_DATA;\r | |
40 | \r | |
41 | /**\r | |
42 | Called to initialize the memory service.\r | |
43 | \r | |
44 | @param SmramRangeCount Number of SMRAM Regions\r | |
45 | @param SmramRanges Pointer to SMRAM Descriptors\r | |
46 | \r | |
47 | **/\r | |
48 | VOID\r | |
49 | SmmInitializeMemoryServices (\r | |
50 | IN UINTN SmramRangeCount,\r | |
51 | IN EFI_SMRAM_DESCRIPTOR *SmramRanges\r | |
52 | );\r | |
53 | \r | |
713b7781 | 54 | /**\r |
55 | Allocates pages from the memory map.\r | |
56 | \r | |
57 | @param Type The type of allocation to perform\r | |
58 | @param MemoryType The type of memory to turn the allocated pages\r | |
59 | into\r | |
60 | @param NumberOfPages The number of pages to allocate\r | |
61 | @param Memory A pointer to receive the base allocated memory\r | |
62 | address\r | |
63 | \r | |
64 | @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in spec.\r | |
65 | @retval EFI_NOT_FOUND Could not allocate pages match the requirement.\r | |
66 | @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.\r | |
67 | @retval EFI_SUCCESS Pages successfully allocated.\r | |
68 | \r | |
69 | **/\r | |
70 | EFI_STATUS\r | |
71 | EFIAPI\r | |
72 | SmmAllocatePages (\r | |
73 | IN EFI_ALLOCATE_TYPE Type,\r | |
74 | IN EFI_MEMORY_TYPE MemoryType,\r | |
75 | IN UINTN NumberOfPages,\r | |
76 | OUT EFI_PHYSICAL_ADDRESS *Memory\r | |
77 | );\r | |
78 | \r | |
79 | /**\r | |
80 | Frees previous allocated pages.\r | |
81 | \r | |
82 | @param Memory Base address of memory being freed\r | |
83 | @param NumberOfPages The number of pages to free\r | |
84 | \r | |
85 | @retval EFI_NOT_FOUND Could not find the entry that covers the range\r | |
86 | @retval EFI_INVALID_PARAMETER Address not aligned\r | |
87 | @return EFI_SUCCESS Pages successfully freed.\r | |
88 | \r | |
89 | **/\r | |
90 | EFI_STATUS\r | |
91 | EFIAPI\r | |
92 | SmmFreePages (\r | |
93 | IN EFI_PHYSICAL_ADDRESS Memory,\r | |
94 | IN UINTN NumberOfPages\r | |
95 | );\r | |
96 | \r | |
97 | /**\r | |
98 | Allocate pool of a particular type.\r | |
99 | \r | |
100 | @param PoolType Type of pool to allocate\r | |
101 | @param Size The amount of pool to allocate\r | |
102 | @param Buffer The address to return a pointer to the allocated\r | |
103 | pool\r | |
104 | \r | |
105 | @retval EFI_INVALID_PARAMETER PoolType not valid\r | |
106 | @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.\r | |
107 | @retval EFI_SUCCESS Pool successfully allocated.\r | |
108 | \r | |
109 | **/\r | |
110 | EFI_STATUS\r | |
111 | EFIAPI\r | |
112 | SmmAllocatePool (\r | |
113 | IN EFI_MEMORY_TYPE PoolType,\r | |
114 | IN UINTN Size,\r | |
115 | OUT VOID **Buffer\r | |
116 | );\r | |
117 | \r | |
118 | /**\r | |
119 | Frees pool.\r | |
120 | \r | |
121 | @param Buffer The allocated pool entry to free\r | |
122 | \r | |
123 | @retval EFI_INVALID_PARAMETER Buffer is not a valid value.\r | |
124 | @retval EFI_SUCCESS Pool successfully freed.\r | |
125 | \r | |
126 | **/\r | |
127 | EFI_STATUS\r | |
128 | EFIAPI\r | |
129 | SmmFreePool (\r | |
130 | IN VOID *Buffer\r | |
131 | );\r | |
132 | \r | |
133 | #endif\r |