1/*++
2
3  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
4
5
6  This program and the accompanying materials are licensed and made available under
7
8  the terms and conditions of the BSD License that accompanies this distribution.
9
10  The full text of the license may be found at
11
12  http://opensource.org/licenses/bsd-license.php.
13
14
15
16  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17
18  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19
20
21
22
23
24Module Name:
25
26  AcpiPlatform.h
27
28Abstract:
29
30  This is an implementation of the ACPI platform driver.  Requirements for
31  this driver are defined in the Tiano ACPI External Product Specification,
32  revision 0.3.6.
33
34
35--*/
36
37#ifndef _ACPI_PLATFORM_H_
38#define _ACPI_PLATFORM_H_
39
40//
41// Statements that include other header files.
42//
43#include <FrameworkDxe.h>
44#include <PiDxe.h>
45#include <Base.h>
46#include <Library/UefiLib.h>
47#include <Library/BaseLib.h>
48#include <Library/UefiBootServicesTableLib.h>
49#include <Library/UefiRuntimeServicesTableLib.h>
50#include <Library/DebugLib.h>
51#include <Protocol/FirmwareVolume.h>
52#include <Library/PcdLib.h>
53#include <IndustryStandard/HighPrecisionEventTimerTable.h>
54#include <IndustryStandard/Acpi.h>
55#include <Protocol/AcpiSystemDescriptionTable.h>
56#include <Protocol/MpService.h>
57#include <Protocol/CpuIo.h>
58#include <IndustryStandard/Acpi30.h>
59#include <IndustryStandard/Acpi20.h>
60#include <Library/HobLib.h>
61#include <AlertStandardFormatTable.h>
62#include <Guid/SetupVariable.h>
63#include <Protocol/GlobalNvsArea.h>
64#include <Library/BaseMemoryLib.h>
65#include <Library/MemoryAllocationLib.h>
66#include <PchRegs.h>
67#include <Library/PchPlatformLib.h>
68//
69// Global variables.
70//
71EFI_GLOBAL_NVS_AREA_PROTOCOL  mGlobalNvsArea;
72
73//
74// ACPI table information used to initialize tables.
75#define EFI_ACPI_OEM_REVISION     0x00000003
76#define EFI_ACPI_CREATOR_ID       SIGNATURE_32 ('V', 'L', 'V', '2')
77#define EFI_ACPI_CREATOR_REVISION 0x0100000D
78
79#define WPCN381U_CONFIG_INDEX     0x2E
80#define WPCN381U_CONFIG_DATA      0x2F
81#define WPCN381U_CHIP_ID          0xF4
82#define WDCP376_CHIP_ID           0xF1
83
84#define MOBILE_PLATFORM 1
85#define DESKTOP_PLATFORM 2
86
87//
88// Define macros to build data structure signatures from characters.
89//
90#ifndef EFI_SIGNATURE_16
91#define EFI_SIGNATURE_16(A, B)        ((A) | (B << 8))
92#endif
93#ifndef EFI_SIGNATURE_32
94#define EFI_SIGNATURE_32(A, B, C, D)  (EFI_SIGNATURE_16 (A, B) | (EFI_SIGNATURE_16 (C, D) << 16))
95#endif
96#ifndef EFI_SIGNATURE_64
97#define EFI_SIGNATURE_64(A, B, C, D, E, F, G, H) \
98    (EFI_SIGNATURE_32 (A, B, C, D) | ((UINT64) (EFI_SIGNATURE_32 (E, F, G, H)) << 32))
99#endif
100
101
102#define GV3_SSDT_OEM_TABLE_IDBASE 0x4000
103
104//
105// Private Driver Data.
106//
107//
108// Define Union of IO APIC & Local APIC structure.
109//
110typedef union {
111  EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE AcpiLocalApic;
112  EFI_ACPI_2_0_IO_APIC_STRUCTURE              AcpiIoApic;
113  struct {
114    UINT8 Type;
115    UINT8 Length;
116  } AcpiApicCommon;
117} ACPI_APIC_STRUCTURE_PTR;
118
119//
120// Protocol private structure definition.
121//
122
123/**
124  Entry point of the ACPI platform driver.
125
126  @param[in]  ImageHandle        EFI_HANDLE: A handle for the image that is initializing this driver.
127  @param[in]  SystemTable        EFI_SYSTEM_TABLE: A pointer to the EFI system table.
128
129  @retval  EFI_SUCCESS           Driver initialized successfully.
130  @retval  EFI_LOAD_ERROR        Failed to Initialize or has been loaded.
131  @retval  EFI_OUT_OF_RESOURCES  Could not allocate needed resources.
132
133**/
134EFI_STATUS
135InstallAcpiPlatform (
136  IN EFI_HANDLE           ImageHandle,
137  IN EFI_SYSTEM_TABLE     *SystemTable
138  );
139
140/**
141  Get Acpi Table Version.
142
143  @param[in]  ImageHandle          EFI_HANDLE: A handle for the image that is initializing this driver.
144  @param[in]  SystemTable          EFI_SYSTEM_TABLE: A pointer to the EFI system table.
145
146  @retval  EFI_SUCCESS:            Driver initialized successfully.
147  @retval  EFI_LOAD_ERROR:         Failed to Initialize or has been loaded.
148  @retval  EFI_OUT_OF_RESOURCES:   Could not allocate needed resources.
149
150--*/
151EFI_ACPI_TABLE_VERSION
152GetAcpiTableVersion (
153  VOID
154  );
155
156/**
157  The funtion returns Oem specific information of Acpi Platform.
158
159  @param[in]  OemId          OemId returned.
160  @param[in]  OemTableId     OemTableId returned.
161  @param[in]  OemRevision    OemRevision returned.
162
163  @retval  EFI_STATUS        Status of function execution.
164
165**/
166EFI_STATUS
167AcpiPlatformGetOemFields (
168  OUT UINT8   *OemId,
169  OUT UINT64  *OemTableId,
170  OUT UINT32  *OemRevision
171  );
172
173/**
174  The function returns Acpi table version.
175
176  @param[in]
177
178  @retval  EFI_ACPI_TABLE_VERSION   Acpi table version encoded as a UINT32.
179
180**/
181EFI_ACPI_TABLE_VERSION
182AcpiPlatformGetAcpiSetting (
183  VOID
184  );
185
186/**
187  Entry point for Acpi platform driver.
188
189  @param[in]  ImageHandle        A handle for the image that is initializing this driver.
190  @param[in]  SystemTable        A pointer to the EFI system table.
191
192  @retval  EFI_SUCCESS           Driver initialized successfully.
193  @retval  EFI_LOAD_ERROR        Failed to Initialize or has been loaded.
194  @retval  EFI_OUT_OF_RESOURCES  Could not allocate needed resources.
195
196**/
197EFI_STATUS
198EFIAPI
199AcpiPlatformEntryPoint (
200  IN EFI_HANDLE         ImageHandle,
201  IN EFI_SYSTEM_TABLE   *SystemTable
202  );
203
204UINT8
205ReadCmosBank1Byte (
206  IN  UINT8                           Index
207  );
208
209VOID
210WriteCmosBank1Byte (
211  IN  UINT8                           Index,
212  IN  UINT8                           Data
213  );
214
215VOID
216SelectNFCDevice (
217  IN VOID
218  );
219
220VOID
221SettingI2CTouchAddress (
222  IN VOID
223  );
224
225extern
226EFI_STATUS
227EFIAPI
228IsctDxeEntryPoint (
229  IN EFI_HANDLE       ImageHandle,
230  IN EFI_SYSTEM_TABLE *SystemTable
231  );
232
233#endif
234