2 Header file for SMM S3 Handler Driver.
4 Copyright (c) 2013-2015 Intel Corporation.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #ifndef _ACPI_SMM_DRIVER_H
12 #define _ACPI_SMM_DRIVER_H
17 // Driver Consumed Protocol Prototypes
19 #include <Protocol/SmmSxDispatch2.h>
20 #include <Protocol/SmmSwDispatch2.h>
21 #include <Protocol/FirmwareVolume.h>
22 #include <Protocol/GlobalNvsArea.h>
23 #include <Protocol/PciRootBridgeIo.h>
24 #include <Library/UefiDriverEntryPoint.h>
25 #include <Protocol/Spi.h>
26 #include <Library/IoLib.h>
27 #include <Library/PciLib.h>
28 #include <Library/PcdLib.h>
29 #include <Library/LockBoxLib.h>
30 #include <Library/DebugLib.h>
31 #include <Library/BaseMemoryLib.h>
32 #include <Library/UefiBootServicesTableLib.h>
33 #include <Library/BaseLib.h>
34 #include <Library/UefiRuntimeServicesTableLib.h>
35 #include <Library/S3IoLib.h>
36 #include <Library/S3BootScriptLib.h>
37 #include <Guid/Acpi.h>
38 #include <Guid/GlobalVariable.h>
39 #include <Library/SmmServicesTableLib.h>
40 #include <Guid/SmramMemoryReserve.h>
41 #include <Library/ReportStatusCodeLib.h>
42 #include <Library/HobLib.h>
43 #include <QNCAccess.h>
44 #include <Library/QNCAccessLib.h>
45 #include <Library/IntelQNCLib.h>
46 #include <Library/PlatformHelperLib.h>
47 #include <Library/PlatformPcieHelperLib.h>
49 #include <IndustryStandard/Pci22.h>
51 #define EFI_ACPI_ACPI_ENABLE 0xA0
52 #define EFI_ACPI_ACPI_DISABLE 0xA1
54 #define R_IOPORT_CMOS_STANDARD_INDEX 0x70
55 #define R_IOPORT_CMOS_STANDARD_DATA 0x71
56 #define RTC_ADDRESS_REGISTER_C 12
57 #define RTC_ADDRESS_REGISTER_D 13
59 #define PCI_DEVICE(Bus, Dev, Func) \
62 #define PCI_REG_MASK(Byte0, Byte1, Byte2, Byte3, Byte4, Byte5, Byte6, Byte7) \
63 Byte0, Byte1, Byte2, Byte3, Byte4, Byte5, Byte6, Byte7
65 #define PCI_DEVICE_END 0xFF
68 // Related data structures definition
70 typedef struct _EFI_ACPI_SMM_DEV
{
73 // Parent dispatch driver returned sleep handle
75 EFI_HANDLE S3SleepEntryHandle
;
77 EFI_HANDLE S4SleepEntryHandle
;
79 EFI_HANDLE S1SleepEntryHandle
;
81 EFI_HANDLE S5SoftOffEntryHandle
;
83 EFI_HANDLE EnableAcpiHandle
;
85 EFI_HANDLE DisableAcpiHandle
;
87 EFI_HANDLE PpCallbackHandle
;
89 EFI_HANDLE MorCallbackHandle
;
92 // QNC Power Management I/O register base
97 // QNC General Purpose Event0 register base
101 UINT32 BootScriptSaved
;
109 InitPlatformAcpiSmm (
110 IN EFI_HANDLE ImageHandle
,
111 IN EFI_SYSTEM_TABLE
*SystemTable
,
112 IN OUT VOID
*CommBuffer
,
113 IN OUT UINTN
*CommBufferSize
117 SxSleepEntryCallBack (
118 IN EFI_HANDLE DispatchHandle
,
119 IN CONST VOID
*DispatchContext
,
121 IN OUT VOID
*CommBuffer
,
122 IN OUT UINTN
*CommBufferSize
126 DisableAcpiCallback (
127 IN EFI_HANDLE DispatchHandle
,
128 IN CONST VOID
*DispatchContext
,
129 IN OUT VOID
*CommBuffer
,
130 IN OUT UINTN
*CommBufferSize
135 IN EFI_HANDLE DispatchHandle
,
136 IN CONST VOID
*DispatchContext
,
137 IN OUT VOID
*CommBuffer
,
138 IN OUT UINTN
*CommBufferSize
142 RegisterToDispatchDriver (
148 IN EFI_SMM_SYSTEM_TABLE2
*Smst
152 SaveRuntimeScriptTable (
153 IN EFI_SMM_SYSTEM_TABLE2
*Smst
157 RestoreQncS3SwCallback (
158 IN EFI_HANDLE DispatchHandle
,
159 IN CONST VOID
*DispatchContext
,
160 IN OUT VOID
*CommBuffer
,
161 IN OUT UINTN
*CommBufferSize
164 extern EFI_GUID gQncS3CodeInLockBoxGuid
;
165 extern EFI_GUID gQncS3ContextInLockBoxGuid
;