2 Header file for SMM S3 Handler Driver.
4 Copyright (c) 2013-2015 Intel Corporation.
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #ifndef _ACPI_SMM_DRIVER_H
18 #define _ACPI_SMM_DRIVER_H
23 // Driver Consumed Protocol Prototypes
25 #include <Protocol/SmmSxDispatch2.h>
26 #include <Protocol/SmmSwDispatch2.h>
27 #include <Protocol/FirmwareVolume.h>
28 #include <Protocol/GlobalNvsArea.h>
29 #include <Protocol/PciRootBridgeIo.h>
30 #include <Library/UefiDriverEntryPoint.h>
31 #include <Protocol/Spi.h>
32 #include <Library/IoLib.h>
33 #include <Library/PciLib.h>
34 #include <Library/PcdLib.h>
35 #include <Library/LockBoxLib.h>
36 #include <Library/DebugLib.h>
37 #include <Library/BaseMemoryLib.h>
38 #include <Library/UefiBootServicesTableLib.h>
39 #include <Library/BaseLib.h>
40 #include <Library/UefiRuntimeServicesTableLib.h>
41 #include <Library/S3IoLib.h>
42 #include <Library/S3BootScriptLib.h>
43 #include <Guid/Acpi.h>
44 #include <Guid/GlobalVariable.h>
45 #include <Library/SmmServicesTableLib.h>
46 #include <Guid/SmramMemoryReserve.h>
47 #include <Library/ReportStatusCodeLib.h>
48 #include <Library/HobLib.h>
49 #include <QNCAccess.h>
50 #include <Library/QNCAccessLib.h>
51 #include <Library/IntelQNCLib.h>
52 #include <Library/PlatformHelperLib.h>
53 #include <Library/PlatformPcieHelperLib.h>
55 #include <IndustryStandard/Pci22.h>
57 #define EFI_ACPI_ACPI_ENABLE 0xA0
58 #define EFI_ACPI_ACPI_DISABLE 0xA1
60 #define R_IOPORT_CMOS_STANDARD_INDEX 0x70
61 #define R_IOPORT_CMOS_STANDARD_DATA 0x71
62 #define RTC_ADDRESS_REGISTER_C 12
63 #define RTC_ADDRESS_REGISTER_D 13
65 #define PCI_DEVICE(Bus, Dev, Func) \
68 #define PCI_REG_MASK(Byte0, Byte1, Byte2, Byte3, Byte4, Byte5, Byte6, Byte7) \
69 Byte0, Byte1, Byte2, Byte3, Byte4, Byte5, Byte6, Byte7
71 #define PCI_DEVICE_END 0xFF
74 // Related data structures definition
76 typedef struct _EFI_ACPI_SMM_DEV
{
79 // Parent dispatch driver returned sleep handle
81 EFI_HANDLE S3SleepEntryHandle
;
83 EFI_HANDLE S4SleepEntryHandle
;
85 EFI_HANDLE S1SleepEntryHandle
;
87 EFI_HANDLE S5SoftOffEntryHandle
;
89 EFI_HANDLE EnableAcpiHandle
;
91 EFI_HANDLE DisableAcpiHandle
;
93 EFI_HANDLE PpCallbackHandle
;
95 EFI_HANDLE MorCallbackHandle
;
98 // QNC Power Management I/O register base
103 // QNC General Purpose Event0 register base
107 UINT32 BootScriptSaved
;
115 InitPlatformAcpiSmm (
116 IN EFI_HANDLE ImageHandle
,
117 IN EFI_SYSTEM_TABLE
*SystemTable
,
118 IN OUT VOID
*CommBuffer
,
119 IN OUT UINTN
*CommBufferSize
123 SxSleepEntryCallBack (
124 IN EFI_HANDLE DispatchHandle
,
125 IN CONST VOID
*DispatchContext
,
127 IN OUT VOID
*CommBuffer
,
128 IN OUT UINTN
*CommBufferSize
132 DisableAcpiCallback (
133 IN EFI_HANDLE DispatchHandle
,
134 IN CONST VOID
*DispatchContext
,
135 IN OUT VOID
*CommBuffer
,
136 IN OUT UINTN
*CommBufferSize
141 IN EFI_HANDLE DispatchHandle
,
142 IN CONST VOID
*DispatchContext
,
143 IN OUT VOID
*CommBuffer
,
144 IN OUT UINTN
*CommBufferSize
148 RegisterToDispatchDriver (
154 IN EFI_SMM_SYSTEM_TABLE2
*Smst
158 SaveRuntimeScriptTable (
159 IN EFI_SMM_SYSTEM_TABLE2
*Smst
163 RestoreQncS3SwCallback (
164 IN EFI_HANDLE DispatchHandle
,
165 IN CONST VOID
*DispatchContext
,
166 IN OUT VOID
*CommBuffer
,
167 IN OUT UINTN
*CommBufferSize
170 extern EFI_GUID gQncS3CodeInLockBoxGuid
;
171 extern EFI_GUID gQncS3ContextInLockBoxGuid
;