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