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 Module Name:
24 
25   AcpiPlatformHooks.h
26 
27 Abstract:
28 
29   This is an implementation of the ACPI platform driver.  Requirements for
30   this driver are defined in the Tiano ACPI External Product Specification,
31   revision 0.3.6.
32 
33 --*/
34 
35 #ifndef _ACPI_PLATFORM_HOOKS_H_
36 #define _ACPI_PLATFORM_HOOKS_H_
37 
38 //
39 // Statements that include other header files
40 //
41 
42 #include <IndustryStandard/Acpi.h>
43 #include "Platform.h"
44 #include <Protocol/EnhancedSpeedstep.h>
45 
46 #define AML_NAME_OP           0x08
47 #define AML_METHOD_OP         0x14
48 #define AML_OPREGION_OP       0x80
49 #define AML_PACKAGE_OP        0x12  // Package operator.
50 #define AML_NAME_PREFIX_SIZE  0x06
51 #define AML_NAME_DWORD_SIZE   0x0C
52 
53 #pragma pack(1)
54 
55 typedef struct {
56   UINT8   AcpiProcessorId;
57   UINT8   ApicId;
58   UINT16  Flags;
59 } EFI_CPU_ID_MAP;
60 
61 typedef struct {
62   UINT8   StartByte;
63   UINT32  NameStr;
64   UINT8   Size;
65   UINT32  Value;
66 } EFI_ACPI_NAMEPACK_DWORD;
67 
68 typedef struct {
69   UINT8   StartByte;
70   UINT32  NameStr;
71   UINT8   OpCode;
72   UINT16  Size;                     // Hardcode to 16bit width because the table we use is fixed size
73   UINT8   NumEntries;
74 } EFI_ACPI_NAME_COMMAND;
75 
76 typedef struct {
77   UINT8   PackageOp;
78   UINT8   PkgLeadByte;
79   UINT8   NumEntries;
80   UINT8   DwordPrefix0;
81   UINT32  CoreFreq;
82   UINT8   DwordPrefix1;
83   UINT32  Power;
84   UINT8   DwordPrefix2;
85   UINT32  TransLatency;
86   UINT8   DwordPrefix3;
87   UINT32  BMLatency;
88   UINT8   DwordPrefix4;
89   UINT32  Control;
90   UINT8   DwordPrefix5;
91   UINT32  Status;
92 } EFI_PSS_PACKAGE;
93 
94 typedef struct {
95   UINT8 PackageOp;
96   UINT8 PkgLeadByte;
97   UINT8 NumEntries;
98   UINT8 BytePrefix0;
99   UINT8 Entries;
100   UINT8 BytePrefix1;
101   UINT8 Revision;
102   UINT8 BytePrefix2;
103   UINT8 Domain;
104   UINT8 BytePrefix3;
105   UINT8 Coordinate;
106   UINT8 BytePrefix4;
107   UINT8 ProcNumber;
108 } EFI_PSD_PACKAGE;
109 
110 #pragma pack()
111 
112 #define ACPI_NAME_COMMAND_FROM_NAME_STR(a)  BASE_CR (a, EFI_ACPI_NAME_COMMAND, NameStr)
113 #define ACPI_NAME_COMMAND_FROM_NAMEPACK_STR(a)  BASE_CR (a, EFI_ACPI_NAMEPACK_DWORD, NameStr)
114 
115 EFI_STATUS
116 PlatformHookInit (
117   VOID
118   );
119 
120 
121 EFI_STATUS
122 PatchDsdtTable (
123   IN OUT   EFI_ACPI_DESCRIPTION_HEADER  *TableHeader
124   );
125 
126 EFI_STATUS
127 PatchGv3SsdtTable (
128   IN OUT  EFI_ACPI_DESCRIPTION_HEADER *Table
129   );
130 
131 EFI_STATUS
132 PatchErstTable (
133   IN OUT  EFI_ACPI_DESCRIPTION_HEADER *Table
134   );
135 
136 EFI_STATUS
137 AppendCpuMapTableEntry (
138   IN EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE   *AcpiLocalApic
139   );
140 
141 #endif
142