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