]>
Commit | Line | Data |
---|---|---|
09119a00 MK |
1 | /** @file\r |
2 | SMM STM support\r | |
3 | \r | |
1c7a65eb | 4 | Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r |
0acd8697 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
09119a00 MK |
6 | \r |
7 | **/\r | |
8 | \r | |
9 | #ifndef _SMM_STM_H_\r | |
10 | #define _SMM_STM_H_\r | |
11 | \r | |
12 | #include <Protocol/SmMonitorInit.h>\r | |
13 | \r | |
14 | /**\r | |
15 | \r | |
16 | Create 4G page table for STM.\r | |
17 | 2M PAE page table in X64 version.\r | |
18 | \r | |
19 | @param PageTableBase The page table base in MSEG\r | |
20 | \r | |
21 | **/\r | |
22 | VOID\r | |
23 | StmGen4GPageTable (\r | |
053e878b | 24 | IN UINTN PageTableBase\r |
09119a00 MK |
25 | );\r |
26 | \r | |
27 | /**\r | |
28 | This is SMM exception handle.\r | |
29 | Consumed by STM when exception happen.\r | |
30 | \r | |
31 | @param Context STM protection exception stack frame\r | |
32 | \r | |
33 | @return the EBX value for STM reference.\r | |
34 | EBX = 0: resume SMM guest using register state found on exception stack.\r | |
35 | EBX = 1 to 0x0F: EBX contains a BIOS error code which the STM must record in the\r | |
36 | TXT.ERRORCODE register and subsequently reset the system via\r | |
37 | TXT.CMD.SYS_RESET. The value of the TXT.ERRORCODE register is calculated as\r | |
38 | follows: TXT.ERRORCODE = (EBX & 0x0F) | STM_CRASH_BIOS_PANIC\r | |
39 | EBX = 0x10 to 0xFFFFFFFF - reserved, do not use.\r | |
40 | \r | |
41 | **/\r | |
42 | UINT32\r | |
43 | EFIAPI\r | |
44 | SmmStmExceptionHandler (\r | |
053e878b | 45 | IN OUT STM_PROTECTION_EXCEPTION_STACK_FRAME Context\r |
09119a00 MK |
46 | );\r |
47 | \r | |
09119a00 MK |
48 | /**\r |
49 | \r | |
50 | Get STM state.\r | |
51 | \r | |
52 | @return STM state\r | |
53 | \r | |
54 | **/\r | |
55 | EFI_SM_MONITOR_STATE\r | |
56 | EFIAPI\r | |
57 | GetMonitorState (\r | |
58 | VOID\r | |
59 | );\r | |
60 | \r | |
61 | /**\r | |
62 | \r | |
63 | Load STM image to MSEG.\r | |
64 | \r | |
65 | @param StmImage STM image\r | |
66 | @param StmImageSize STM image size\r | |
67 | \r | |
68 | @retval EFI_SUCCESS Load STM to MSEG successfully\r | |
69 | @retval EFI_BUFFER_TOO_SMALL MSEG is smaller than minimal requirement of STM image\r | |
70 | \r | |
71 | **/\r | |
72 | EFI_STATUS\r | |
73 | EFIAPI\r | |
74 | LoadMonitor (\r | |
053e878b MK |
75 | IN EFI_PHYSICAL_ADDRESS StmImage,\r |
76 | IN UINTN StmImageSize\r | |
09119a00 MK |
77 | );\r |
78 | \r | |
79 | /**\r | |
80 | \r | |
81 | Add resources in list to database. Allocate new memory areas as needed.\r | |
82 | \r | |
83 | @param ResourceList A pointer to resource list to be added\r | |
84 | @param NumEntries Optional number of entries.\r | |
85 | If 0, list must be terminated by END_OF_RESOURCES.\r | |
86 | \r | |
87 | @retval EFI_SUCCESS If resources are added\r | |
88 | @retval EFI_INVALID_PARAMETER If nested procedure detected resource failer\r | |
89 | @retval EFI_OUT_OF_RESOURCES If nested procedure returned it and we cannot allocate more areas.\r | |
90 | \r | |
91 | **/\r | |
92 | EFI_STATUS\r | |
93 | EFIAPI\r | |
94 | AddPiResource (\r | |
95 | IN STM_RSC *ResourceList,\r | |
053e878b | 96 | IN UINT32 NumEntries OPTIONAL\r |
09119a00 MK |
97 | );\r |
98 | \r | |
99 | /**\r | |
100 | \r | |
101 | Delete resources in list to database.\r | |
102 | \r | |
103 | @param ResourceList A pointer to resource list to be deleted\r | |
104 | NULL means delete all resources.\r | |
105 | @param NumEntries Optional number of entries.\r | |
106 | If 0, list must be terminated by END_OF_RESOURCES.\r | |
107 | \r | |
108 | @retval EFI_SUCCESS If resources are deleted\r | |
109 | @retval EFI_INVALID_PARAMETER If nested procedure detected resource failer\r | |
110 | \r | |
111 | **/\r | |
112 | EFI_STATUS\r | |
113 | EFIAPI\r | |
114 | DeletePiResource (\r | |
053e878b MK |
115 | IN STM_RSC *ResourceList,\r |
116 | IN UINT32 NumEntries OPTIONAL\r | |
09119a00 MK |
117 | );\r |
118 | \r | |
119 | /**\r | |
120 | \r | |
121 | Get BIOS resources.\r | |
122 | \r | |
123 | @param ResourceList A pointer to resource list to be filled\r | |
124 | @param ResourceSize On input it means size of resource list input.\r | |
125 | On output it means size of resource list filled,\r | |
126 | or the size of resource list to be filled if size of too small.\r | |
127 | \r | |
128 | @retval EFI_SUCCESS If resources are returned.\r | |
129 | @retval EFI_BUFFER_TOO_SMALL If resource list buffer is too small to hold the whole resources.\r | |
130 | \r | |
131 | **/\r | |
132 | EFI_STATUS\r | |
133 | EFIAPI\r | |
134 | GetPiResource (\r | |
053e878b MK |
135 | OUT STM_RSC *ResourceList,\r |
136 | IN OUT UINT32 *ResourceSize\r | |
09119a00 MK |
137 | );\r |
138 | \r | |
139 | /**\r | |
418aded9 | 140 | This function initialize STM configuration table.\r |
09119a00 MK |
141 | **/\r |
142 | VOID\r | |
143 | StmSmmConfigurationTableInit (\r | |
144 | VOID\r | |
145 | );\r | |
146 | \r | |
147 | /**\r | |
148 | This function notify STM resource change.\r | |
149 | \r | |
150 | @param StmResource BIOS STM resource\r | |
151 | \r | |
152 | **/\r | |
153 | VOID\r | |
154 | NotifyStmResourceChange (\r | |
053e878b | 155 | IN VOID *StmResource\r |
09119a00 MK |
156 | );\r |
157 | \r | |
158 | /**\r | |
159 | This function return BIOS STM resource.\r | |
160 | \r | |
161 | @return BIOS STM resource\r | |
162 | \r | |
163 | **/\r | |
164 | VOID *\r | |
165 | GetStmResource (\r | |
166 | VOID\r | |
167 | );\r | |
168 | \r | |
1c7a65eb LG |
169 | /**\r |
170 | This function fixes up the address of the global variable or function\r | |
418aded9 | 171 | referred in SmiEntry assembly files to be the absolute address.\r |
1c7a65eb LG |
172 | **/\r |
173 | VOID\r | |
174 | EFIAPI\r | |
175 | SmmCpuFeaturesLibStmSmiEntryFixupAddress (\r | |
053e878b | 176 | );\r |
1c7a65eb | 177 | \r |
09119a00 | 178 | #endif\r |