]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/PlatformSmm/SmmPlatform.h
Upload BSD-licensed Vlv2TbltDevicePkg and Vlv2DeviceRefCodePkg to
[mirror_edk2.git] / Vlv2TbltDevicePkg / PlatformSmm / SmmPlatform.h
1 /*++
2
3 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
4
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 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 Module Name:
15
16 SmmPlatform.h
17
18 Abstract:
19
20 Header file for
21
22 ++*/
23
24 #ifndef _PLATFORM_H
25 #define _PLATFORM_H
26
27 #include <PiSmm.h>
28
29
30
31 #include <Protocol/SmmBase.h>
32 #include <Protocol/FirmwareVolume.h>
33 #include <Protocol/SmmPowerButtonDispatch.h>
34 #include <Protocol/SmmSxDispatch.h>
35 #include <Protocol/SmmSwDispatch.h>
36 #include <Protocol/SmmSwDispatch2.h>
37 #include <Protocol/SmmIchnDispatch.h>
38 #include <Protocol/SmmAccess.h>
39 #include <Protocol/SmmVariable.h>
40 #include <Protocol/PciRootBridgeIo.h>
41 #include <Protocol/LoadedImage.h>
42 #include "Protocol/GlobalNvsArea.h"
43 #include <Guid/AcpiVariableCompatibility.h>
44 #include <Guid/SetupVariable.h>
45 #include <Guid/EfiVpdData.h>
46 #include <Guid/PciLanInfo.h>
47 #include <IndustryStandard/Pci22.h>
48
49 #include "PchAccess.h"
50 #include "PlatformBaseAddresses.h"
51
52 #include <Library/UefiBootServicesTableLib.h>
53 #include <Library/S3BootScriptLib.h>
54 #include <Library/IoLib.h>
55 #include <Library/DebugLib.h>
56 #include <Library/HobLib.h>
57 #include <Library/BaseLib.h>
58 #include <Library/BaseMemoryLib.h>
59 #include <Library/DevicePathLib.h>
60 #include <Library/PcdLib.h>
61 #include <Library/PchPlatformLib.h>
62 #include <Library/StallSmmLib.h>
63
64
65
66 typedef struct {
67 UINT8 Register;
68 UINT8 Function;
69 UINT8 Device;
70 UINT8 Bus;
71 UINT32 ExtendedRegister;
72 } SMM_PCI_IO_ADDRESS;
73
74 typedef struct {
75 CHAR8 BoardAaNumber[7];
76 UINTN BoardFabNumber;
77 } BOARD_AA_NUMBER_DECODE;
78
79 //
80 // BugBug -- Need to get these two values from acpi.h, but right now, they are
81 // declared in platform-specific variants of this file, so no easy
82 // way to pick-up the include file and work across platforms.
83 // Need these definitions to go into a file like common\acpi.h.
84 //
85 #define ACPI_ENABLE 0xA0
86 #define ACPI_DISABLE 0xA1
87
88 #define APM_12_FUNCS 0x50
89 #define SMI_SET_SMMVARIABLE_PROTOCOL 0x51 // this is used in Cpu\Pentium\Smm\Base\SmmBase.c
90
91 #define SMI_CMD_GET_MSEG_STATUS 0x70
92 #define SMI_CMD_UPDATE_MSEG_SIZE 0x71
93 #define SMI_CMD_LOAD_STM 0x72
94 #define SMI_CMD_UNLOAD_STM 0x73
95 #define SMI_CMD_GET_SMRAM_RANGES 0x74
96
97
98 #define PCAT_RTC_ADDRESS_REGISTER 0x74
99 #define PCAT_RTC_DATA_REGISTER 0x75
100
101 #define RTC_ADDRESS_SECOND 0x00
102 #define RTC_ADDRESS_SECOND_ALARM 0x01
103 #define RTC_ADDRESS_MINUTE 0x02
104 #define RTC_ADDRESS_MINUTE_ALARM 0x03
105 #define RTC_ADDRESS_HOUR 0x04
106 #define RTC_ADDRESS_HOUR_ALARM 0x05
107
108 #define RTC_ADDRESS_REGISTER_A 0x0A
109 #define RTC_ADDRESS_REGISTER_B 0x0B
110 #define RTC_ADDRESS_REGISTER_C 0x0C
111 #define RTC_ADDRESS_REGISTER_D 0x0D
112
113 #define B_RTC_ALARM_INT_ENABLE 0x20
114 #define B_RTC_ALARM_INT_STATUS 0x20
115
116 #define B_RTC_DATE_ALARM_MASK 0x3F
117
118 #define PCAT_CMOS_2_ADDRESS_REGISTER 0x72
119 #define PCAT_CMOS_2_DATA_REGISTER 0x73
120
121 #define EC_C_PORT 0x66
122 #define SMC_SMI_DISABLE 0xBC
123 #define SMC_ENABLE_ACPI_MODE 0xAA // Enable ACPI mode
124
125 #define IO_MISC 156
126
127
128 #define MAXIMUM_NUMBER_OF_PSTATES 12
129 #define ICH_SMM_DATA_PORT 0xB3
130
131 #define EFI_IA32_PMG_CST_CONFIG 0x000000E2
132 #define B_EFI_CST_CONTROL_LOCK BIT15
133 #define B_EFI_IO_MWAIT_REDIRECTION_ENABLE BIT10
134 #define EFI_IA32_PMG_IO_CAPTURE_ADDR 0x000000E4
135
136 extern EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *mPciRootBridgeIo;
137
138 //
139 // Callback function prototypes
140 //
141 VOID
142 EFIAPI
143 PowerButtonCallback (
144 IN EFI_HANDLE DispatchHandle,
145 IN EFI_SMM_POWER_BUTTON_DISPATCH_CONTEXT *DispatchContext
146 );
147
148 VOID
149 S5SleepWakeOnLanCallBack (
150 IN EFI_HANDLE DispatchHandle,
151 IN EFI_SMM_SX_DISPATCH_CONTEXT *DispatchContext
152 );
153
154 VOID
155 EFIAPI
156 S5SleepAcLossCallBack (
157 IN EFI_HANDLE DispatchHandle,
158 IN EFI_SMM_SX_DISPATCH_CONTEXT *DispatchContext
159 );
160
161
162 VOID
163 EFIAPI
164 S4S5CallBack (
165 IN EFI_HANDLE DispatchHandle,
166 IN EFI_SMM_SX_DISPATCH_CONTEXT *DispatchContext
167 );
168
169 VOID
170 EFIAPI
171 EnableAcpiCallback (
172 IN EFI_HANDLE DispatchHandle,
173 IN EFI_SMM_SW_DISPATCH_CONTEXT *DispatchContext
174 );
175
176 VOID
177 EFIAPI
178 DisableAcpiCallback (
179 IN EFI_HANDLE DispatchHandle,
180 IN EFI_SMM_SW_DISPATCH_CONTEXT *DispatchContext
181 );
182
183 VOID
184 EFIAPI
185 SmmReadyToBootCallback (
186 IN EFI_HANDLE DispatchHandle,
187 IN EFI_SMM_SW_DISPATCH_CONTEXT *DispatchContext
188 );
189
190 VOID
191 DummyTco1Callback (
192 IN EFI_HANDLE DispatchHandle,
193 IN EFI_SMM_ICHN_DISPATCH_CONTEXT *DispatchContext
194 );
195
196
197 VOID
198 PerrSerrCallback (
199 IN EFI_HANDLE DispatchHandle,
200 IN EFI_SMM_ICHN_DISPATCH_CONTEXT *DispatchContext
201 );
202
203 VOID
204 RiCallback (
205 IN EFI_HANDLE DispatchHandle,
206 IN EFI_SMM_ICHN_DISPATCH_CONTEXT *DispatchContext
207 );
208
209
210 VOID
211 SetAfterG3On (
212 BOOLEAN Enable
213 );
214
215 VOID
216 TurnOffVregUsb (
217 );
218
219 VOID
220 PStateSupportCallback (
221 IN EFI_HANDLE DispatchHandle,
222 IN EFI_SMM_SW_DISPATCH_CONTEXT *DispatchContext
223 );
224
225 VOID
226 PStateTransitionCallback (
227 IN EFI_HANDLE DispatchHandle,
228 IN EFI_SMM_SW_DISPATCH_CONTEXT *DispatchContext
229 );
230
231 EFI_STATUS
232 EFIAPI
233 SxSleepEntryCallBack (
234 IN EFI_HANDLE DispatchHandle,
235 IN EFI_SMM_SX_DISPATCH_CONTEXT *DispatchContext
236 );
237
238 EFI_STATUS
239 SaveRuntimeScriptTable (
240 VOID
241 );
242
243
244 #endif
245