]> git.proxmox.com Git - mirror_edk2.git/blob - QuarkPlatformPkg/Acpi/DxeSmm/AcpiSmm/AcpiSmmPlatform.h
1a218cd14352e159eba437e6f2a3e372719b4d3c
[mirror_edk2.git] / QuarkPlatformPkg / Acpi / DxeSmm / AcpiSmm / AcpiSmmPlatform.h
1 /** @file
2 Header file for SMM S3 Handler Driver.
3
4 Copyright (c) 2013-2015 Intel Corporation.
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8
9 **/
10
11 #ifndef _ACPI_SMM_DRIVER_H
12 #define _ACPI_SMM_DRIVER_H
13 //
14 // Include files
15 //
16 //
17 // Driver Consumed Protocol Prototypes
18 //
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>
48 #include "Platform.h"
49 #include <IndustryStandard/Pci22.h>
50
51 #define EFI_ACPI_ACPI_ENABLE 0xA0
52 #define EFI_ACPI_ACPI_DISABLE 0xA1
53
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
58
59 #define PCI_DEVICE(Bus, Dev, Func) \
60 Bus, Dev, Func
61
62 #define PCI_REG_MASK(Byte0, Byte1, Byte2, Byte3, Byte4, Byte5, Byte6, Byte7) \
63 Byte0, Byte1, Byte2, Byte3, Byte4, Byte5, Byte6, Byte7
64
65 #define PCI_DEVICE_END 0xFF
66
67 //
68 // Related data structures definition
69 //
70 typedef struct _EFI_ACPI_SMM_DEV {
71
72 //
73 // Parent dispatch driver returned sleep handle
74 //
75 EFI_HANDLE S3SleepEntryHandle;
76
77 EFI_HANDLE S4SleepEntryHandle;
78
79 EFI_HANDLE S1SleepEntryHandle;
80
81 EFI_HANDLE S5SoftOffEntryHandle;
82
83 EFI_HANDLE EnableAcpiHandle;
84
85 EFI_HANDLE DisableAcpiHandle;
86
87 EFI_HANDLE PpCallbackHandle;
88
89 EFI_HANDLE MorCallbackHandle;
90
91 //
92 // QNC Power Management I/O register base
93 //
94 UINT32 QncPmBase;
95
96 //
97 // QNC General Purpose Event0 register base
98 //
99 UINT32 QncGpe0Base;
100
101 UINT32 BootScriptSaved;
102
103 } EFI_ACPI_SMM_DEV;
104
105 //
106 // Prototypes
107 //
108 EFI_STATUS
109 InitPlatformAcpiSmm (
110 IN EFI_HANDLE ImageHandle,
111 IN EFI_SYSTEM_TABLE *SystemTable,
112 IN OUT VOID *CommBuffer,
113 IN OUT UINTN *CommBufferSize
114 );
115
116 EFI_STATUS
117 SxSleepEntryCallBack (
118 IN EFI_HANDLE DispatchHandle,
119 IN CONST VOID *DispatchContext,
120
121 IN OUT VOID *CommBuffer,
122 IN OUT UINTN *CommBufferSize
123 );
124
125 EFI_STATUS
126 DisableAcpiCallback (
127 IN EFI_HANDLE DispatchHandle,
128 IN CONST VOID *DispatchContext,
129 IN OUT VOID *CommBuffer,
130 IN OUT UINTN *CommBufferSize
131 );
132
133 EFI_STATUS
134 EnableAcpiCallback (
135 IN EFI_HANDLE DispatchHandle,
136 IN CONST VOID *DispatchContext,
137 IN OUT VOID *CommBuffer,
138 IN OUT UINTN *CommBufferSize
139 );
140
141 EFI_STATUS
142 RegisterToDispatchDriver (
143 VOID
144 );
145
146 EFI_STATUS
147 GetAllQncPmBase (
148 IN EFI_SMM_SYSTEM_TABLE2 *Smst
149 );
150
151 EFI_STATUS
152 SaveRuntimeScriptTable (
153 IN EFI_SMM_SYSTEM_TABLE2 *Smst
154 );
155
156 EFI_STATUS
157 RestoreQncS3SwCallback (
158 IN EFI_HANDLE DispatchHandle,
159 IN CONST VOID *DispatchContext,
160 IN OUT VOID *CommBuffer,
161 IN OUT UINTN *CommBufferSize
162 );
163
164 extern EFI_GUID gQncS3CodeInLockBoxGuid;
165 extern EFI_GUID gQncS3ContextInLockBoxGuid;
166
167 #endif