]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / UefiCpuPkg / Library / SmmCpuFeaturesLib / SmmStm.h
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 Get STM state.
51
52 @return STM state
53
54 **/
55 EFI_SM_MONITOR_STATE
56 EFIAPI
57 GetMonitorState (
58 VOID
59 );
60
61 /**
62
63 Load STM image to MSEG.
64
65 @param StmImage STM image
66 @param StmImageSize STM image size
67
68 @retval EFI_SUCCESS Load STM to MSEG successfully
69 @retval EFI_BUFFER_TOO_SMALL MSEG is smaller than minimal requirement of STM image
70
71 **/
72 EFI_STATUS
73 EFIAPI
74 LoadMonitor (
75 IN EFI_PHYSICAL_ADDRESS StmImage,
76 IN UINTN StmImageSize
77 );
78
79 /**
80
81 Add resources in list to database. Allocate new memory areas as needed.
82
83 @param ResourceList A pointer to resource list to be added
84 @param NumEntries Optional number of entries.
85 If 0, list must be terminated by END_OF_RESOURCES.
86
87 @retval EFI_SUCCESS If resources are added
88 @retval EFI_INVALID_PARAMETER If nested procedure detected resource failer
89 @retval EFI_OUT_OF_RESOURCES If nested procedure returned it and we cannot allocate more areas.
90
91 **/
92 EFI_STATUS
93 EFIAPI
94 AddPiResource (
95 IN STM_RSC *ResourceList,
96 IN UINT32 NumEntries OPTIONAL
97 );
98
99 /**
100
101 Delete resources in list to database.
102
103 @param ResourceList A pointer to resource list to be deleted
104 NULL means delete all resources.
105 @param NumEntries Optional number of entries.
106 If 0, list must be terminated by END_OF_RESOURCES.
107
108 @retval EFI_SUCCESS If resources are deleted
109 @retval EFI_INVALID_PARAMETER If nested procedure detected resource failer
110
111 **/
112 EFI_STATUS
113 EFIAPI
114 DeletePiResource (
115 IN STM_RSC *ResourceList,
116 IN UINT32 NumEntries OPTIONAL
117 );
118
119 /**
120
121 Get BIOS resources.
122
123 @param ResourceList A pointer to resource list to be filled
124 @param ResourceSize On input it means size of resource list input.
125 On output it means size of resource list filled,
126 or the size of resource list to be filled if size of too small.
127
128 @retval EFI_SUCCESS If resources are returned.
129 @retval EFI_BUFFER_TOO_SMALL If resource list buffer is too small to hold the whole resources.
130
131 **/
132 EFI_STATUS
133 EFIAPI
134 GetPiResource (
135 OUT STM_RSC *ResourceList,
136 IN OUT UINT32 *ResourceSize
137 );
138
139 /**
140 This function initialize STM configuration table.
141 **/
142 VOID
143 StmSmmConfigurationTableInit (
144 VOID
145 );
146
147 /**
148 This function notify STM resource change.
149
150 @param StmResource BIOS STM resource
151
152 **/
153 VOID
154 NotifyStmResourceChange (
155 IN VOID *StmResource
156 );
157
158 /**
159 This function return BIOS STM resource.
160
161 @return BIOS STM resource
162
163 **/
164 VOID *
165 GetStmResource (
166 VOID
167 );
168
169 /**
170 This function fixes up the address of the global variable or function
171 referred in SmiEntry assembly files to be the absolute address.
172 **/
173 VOID
174 EFIAPI
175 SmmCpuFeaturesLibStmSmiEntryFixupAddress (
176 );
177
178 #endif