1/** @file
2This is an implementation of the ACPI platform driver.  Requirements for
3this driver are defined in the Tiano ACPI External Product Specification,
4revision 0.3.6.
5
6Copyright (c) 2013-2015 Intel Corporation.
7
8This program and the accompanying materials
9are licensed and made available under the terms and conditions of the BSD License
10which accompanies this distribution.  The full text of the license may be found at
11http://opensource.org/licenses/bsd-license.php
12
13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16
17**/
18
19#ifndef _ACPI_PLATFORM_H_
20#define _ACPI_PLATFORM_H_
21
22//
23// Statements that include other header files
24//
25
26#include <PiDxe.h>
27#include <IntelQNCDxe.h>
28#include <Platform.h>
29#include <PlatformBoards.h>
30#include <Ioh.h>
31#include <QNCCommonDefinitions.h>
32
33#include <Protocol/GlobalNvsArea.h>
34#include <Protocol/MpService.h>
35#include <Protocol/AcpiSystemDescriptionTable.h>
36#include <Protocol/FirmwareVolume2.h>
37
38#include <Library/UefiDriverEntryPoint.h>
39#include <Library/UefiBootServicesTableLib.h>
40#include <Library/UefiRuntimeServicesTableLib.h>
41#include <Library/DebugLib.h>
42#include <Library/BaseMemoryLib.h>
43#include <Library/IoLib.h>
44#include <Library/PcdLib.h>
45#include <Library/UefiLib.h>
46#include <Library/DxeServicesLib.h>
47#include <Library/DevicePathLib.h>
48#include <Library/MemoryAllocationLib.h>
49#include <Library/QNCAccessLib.h>
50#include <Library/PlatformHelperLib.h>
51
52#include <IndustryStandard/Acpi.h>
53#include <IndustryStandard/HighPrecisionEventTimerTable.h>
54#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
55
56#include "Madt.h"
57#include "AcpiPciUpdate.h"
58
59#pragma pack(1)
60typedef struct {
61  UINT8   StartByte;
62  UINT32  NameStr;
63  UINT8   OpCode;
64  UINT16  Size;                // Hardcode to 16bit width because the table we use is fixed size
65  UINT8   NumEntries;
66} EFI_ACPI_NAME_COMMAND;
67
68typedef struct {
69  UINT8   PackageOp;
70  UINT8   PkgLeadByte;
71  UINT8   NumEntries;
72  UINT8   DwordPrefix0;
73  UINT32  CoreFreq;
74  UINT8   DwordPrefix1;
75  UINT32  Power;
76  UINT8   DwordPrefix2;
77  UINT32  TransLatency;
78  UINT8   DwordPrefix3;
79  UINT32  BMLatency;
80  UINT8   DwordPrefix4;
81  UINT32  Control;
82  UINT8   DwordPrefix5;
83  UINT32  Status;
84} EFI_PSS_PACKAGE;
85#pragma pack()
86
87
88#define AML_NAME_OP               0x08
89#define AML_METHOD_OP             0x14
90#define AML_OPREGION_OP           0x80
91#define AML_PACKAGE_OP            0x12    // Package operator.
92
93//
94// ACPI table information used to initialize tables.
95//
96#define EFI_ACPI_OEM_ID           "INTEL "
97#define EFI_ACPI_OEM_TABLE_ID     0x2020204F4E414954ULL  // "TIANO   "
98#define EFI_ACPI_OEM_REVISION     0x00000002
99#define EFI_ACPI_CREATOR_ID       0x5446534D          // "MSFT"
100#define EFI_ACPI_CREATOR_REVISION 0x01000013
101
102#define ACPI_COMPATIBLE_1_0       0
103#define ACPI_COMPATIBLE_2_0       1
104#define ACPI_COMPATIBLE_3_0       2
105
106
107
108
109//
110// Private Driver Data
111//
112
113//
114// Define Union of IO APIC & Local APIC structure;
115//
116
117typedef union {
118  EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE     AcpiLocalApic;
119  EFI_ACPI_2_0_IO_APIC_STRUCTURE                  AcpiIoApic;
120  struct {
121    UINT8                                         Type;
122    UINT8                                         Length;
123  } AcpiApicCommon;
124} ACPI_APIC_STRUCTURE_PTR;
125
126#endif
127