Commit | Line | Data |
---|---|---|
e42e9404 | 1 | /** @file\r |
2 | The internal header file that declared a data structure that is shared\r | |
3 | between the SMM IPL and the SMM Core.\r | |
4 | \r | |
84edd20b | 5 | Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r |
e42e9404 | 6 | This program and the accompanying materials are licensed and made available \r |
7 | under the terms and conditions of the BSD License which accompanies this \r | |
8 | distribution. The full text of the license may be found at \r | |
9 | http://opensource.org/licenses/bsd-license.php \r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef _PI_SMM_CORE_PRIVATE_DATA_H_\r | |
17 | #define _PI_SMM_CORE_PRIVATE_DATA_H_\r | |
18 | \r | |
5657b268 | 19 | ///\r |
20 | /// Define values for the communications buffer used when gEfiEventDxeDispatchGuid is\r | |
21 | /// event signaled. This event is signaled by the DXE Core each time the DXE Core \r | |
22 | /// dispatcher has completed its work. When this event is signaled, the SMM Core\r | |
23 | /// if notified, so the SMM Core can dispatch SMM drivers. If COMM_BUFFER_SMM_DISPATCH_ERROR\r | |
24 | /// is returned in the communication buffer, then an error occurred dispatching SMM\r | |
25 | /// Drivers. If COMM_BUFFER_SMM_DISPATCH_SUCCESS is returned, then the SMM Core \r | |
26 | /// dispatched all the drivers it could. If COMM_BUFFER_SMM_DISPATCH_RESTART is \r | |
27 | /// returned, then the SMM Core just dispatched the SMM Driver that registered\r | |
28 | /// the SMM Entry Point enabling the use of SMM Mode. In this case, the SMM Core\r | |
29 | /// should be notified again to dispatch more SMM Drivers using SMM Mode.\r | |
30 | ///\r | |
31 | #define COMM_BUFFER_SMM_DISPATCH_ERROR 0x00\r | |
32 | #define COMM_BUFFER_SMM_DISPATCH_SUCCESS 0x01\r | |
33 | #define COMM_BUFFER_SMM_DISPATCH_RESTART 0x02\r | |
34 | \r | |
e42e9404 | 35 | ///\r |
36 | /// Signature for the private structure shared between the SMM IPL and the SMM Core\r | |
37 | ///\r | |
38 | #define SMM_CORE_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('s', 'm', 'm', 'c')\r | |
39 | \r | |
40 | ///\r | |
41 | /// Private structure that is used to share information between the SMM IPL and \r | |
42 | /// the SMM Core. This structure is allocated from memory of type EfiRuntimeServicesData.\r | |
43 | /// Since runtime memory types are converted to available memory when a legacy boot \r | |
c16f9cc3 | 44 | /// is performed, the SMM Core must not access any fields of this structure if a legacy \r |
e42e9404 | 45 | /// boot is performed. As a result, the SMM IPL must create an event notification \r |
46 | /// for the Legacy Boot event and notify the SMM Core that a legacy boot is being \r | |
47 | /// performed. The SMM Core can then use this information to filter accesses to \r | |
48 | /// thos structure.\r | |
49 | ///\r | |
50 | typedef struct {\r | |
51 | UINTN Signature;\r | |
52 | \r | |
53 | ///\r | |
54 | /// The ImageHandle passed into the entry point of the SMM IPL. This ImageHandle\r | |
55 | /// is used by the SMM Core to fill in the ParentImageHandle field of the Loaded\r | |
56 | /// Image Protocol for each SMM Driver that is dispatched by the SMM Core.\r | |
57 | ///\r | |
58 | EFI_HANDLE SmmIplImageHandle;\r | |
59 | \r | |
60 | ///\r | |
61 | /// The number of SMRAM ranges passed from the SMM IPL to the SMM Core. The SMM\r | |
62 | /// Core uses these ranges of SMRAM to initialize the SMM Core memory manager.\r | |
63 | ///\r | |
64 | UINTN SmramRangeCount;\r | |
65 | \r | |
66 | ///\r | |
67 | /// A table of SMRAM ranges passed from the SMM IPL to the SMM Core. The SMM\r | |
68 | /// Core uses these ranges of SMRAM to initialize the SMM Core memory manager.\r | |
69 | ///\r | |
70 | EFI_SMRAM_DESCRIPTOR *SmramRanges;\r | |
71 | \r | |
72 | ///\r | |
73 | /// The SMM Foundation Entry Point. The SMM Core fills in this field when the \r | |
74 | /// SMM Core is initialized. The SMM IPL is responsbile for registering this entry \r | |
75 | /// point with the SMM Configuration Protocol. The SMM Configuration Protocol may \r | |
76 | /// not be available at the time the SMM IPL and SMM Core are started, so the SMM IPL\r | |
77 | /// sets up a protocol notification on the SMM Configuration Protocol and registers \r | |
78 | /// the SMM Foundation Entry Point as soon as the SMM Configuration Protocol is \r | |
79 | /// available.\r | |
80 | ///\r | |
81 | EFI_SMM_ENTRY_POINT SmmEntryPoint;\r | |
82 | \r | |
83 | ///\r | |
84 | /// Boolean flag set to TRUE while an SMI is being processed by the SMM Core.\r | |
85 | /// \r | |
86 | BOOLEAN SmmEntryPointRegistered;\r | |
87 | \r | |
88 | ///\r | |
89 | /// Boolean flag set to TRUE while an SMI is being processed by the SMM Core.\r | |
90 | /// \r | |
91 | BOOLEAN InSmm;\r | |
92 | \r | |
93 | ///\r | |
94 | /// This field is set by the SMM Core then the SMM Core is initialized. This field is\r | |
95 | /// used by the SMM Base 2 Protocol and SMM Communication Protocol implementations in\r | |
96 | /// the SMM IPL. \r | |
97 | ///\r | |
98 | EFI_SMM_SYSTEM_TABLE2 *Smst;\r | |
99 | \r | |
100 | ///\r | |
101 | /// This field is used by the SMM Communicatioon Protocol to pass a buffer into \r | |
102 | /// a software SMI handler and for the software SMI handler to pass a buffer back to\r | |
103 | /// the caller of the SMM Communication Protocol. \r | |
104 | ///\r | |
105 | VOID *CommunicationBuffer;\r | |
106 | \r | |
107 | ///\r | |
108 | /// This field is used by the SMM Communicatioon Protocol to pass the size of a buffer,\r | |
109 | /// in bytes, into a software SMI handler and for the software SMI handler to pass the \r | |
110 | /// size, in bytes, of a buffer back to the caller of the SMM Communication Protocol.\r | |
111 | ///\r | |
ab780ebf | 112 | UINTN BufferSize;\r |
e42e9404 | 113 | \r |
114 | ///\r | |
115 | /// This field is used by the SMM Communication Protocol to pass the return status from\r | |
116 | /// a software SMI handler back to the caller of the SMM Communication Protocol.\r | |
117 | ///\r | |
118 | EFI_STATUS ReturnStatus;\r | |
84edd20b SZ |
119 | \r |
120 | EFI_PHYSICAL_ADDRESS PiSmmCoreImageBase;\r | |
121 | UINT64 PiSmmCoreImageSize;\r | |
122 | EFI_PHYSICAL_ADDRESS PiSmmCoreEntryPoint;\r | |
123 | \r | |
124 | UINTN FullSmramRangeCount;\r | |
125 | EFI_SMRAM_DESCRIPTOR *FullSmramRanges;\r | |
e42e9404 | 126 | } SMM_CORE_PRIVATE_DATA;\r |
127 | \r | |
84edd20b SZ |
128 | //\r |
129 | // Page management\r | |
130 | //\r | |
131 | \r | |
132 | typedef struct {\r | |
133 | LIST_ENTRY Link;\r | |
134 | UINTN NumberOfPages;\r | |
135 | } FREE_PAGE_LIST;\r | |
136 | \r | |
137 | extern LIST_ENTRY mSmmMemoryMap;\r | |
138 | \r | |
139 | //\r | |
140 | // Pool management\r | |
141 | //\r | |
142 | \r | |
143 | //\r | |
144 | // MIN_POOL_SHIFT must not be less than 5\r | |
145 | //\r | |
146 | #define MIN_POOL_SHIFT 6\r | |
147 | #define MIN_POOL_SIZE (1 << MIN_POOL_SHIFT)\r | |
148 | \r | |
149 | //\r | |
150 | // MAX_POOL_SHIFT must not be less than EFI_PAGE_SHIFT - 1\r | |
151 | //\r | |
152 | #define MAX_POOL_SHIFT (EFI_PAGE_SHIFT - 1)\r | |
153 | #define MAX_POOL_SIZE (1 << MAX_POOL_SHIFT)\r | |
154 | \r | |
155 | //\r | |
156 | // MAX_POOL_INDEX are calculated by maximum and minimum pool sizes\r | |
157 | //\r | |
158 | #define MAX_POOL_INDEX (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)\r | |
159 | \r | |
160 | typedef struct {\r | |
161 | UINTN Size;\r | |
162 | BOOLEAN Available;\r | |
163 | } POOL_HEADER;\r | |
164 | \r | |
165 | typedef struct {\r | |
166 | POOL_HEADER Header;\r | |
167 | LIST_ENTRY Link;\r | |
168 | } FREE_POOL_HEADER;\r | |
169 | \r | |
170 | extern LIST_ENTRY mSmmPoolLists[MAX_POOL_INDEX];\r | |
171 | \r | |
e42e9404 | 172 | #endif\r |