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