]> git.proxmox.com Git - mirror_edk2.git/blame - Vlv2DeviceRefCodePkg/AcpiTablesPCAT/Lpit/Lpit.aslc
FatBinPkg: Update EBC/IA32/X64/IPF binaries
[mirror_edk2.git] / Vlv2DeviceRefCodePkg / AcpiTablesPCAT / Lpit / Lpit.aslc
CommitLineData
3cbfba02
DW
1/*++\r
2\r
3Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved\r
4\r
5 This program and the accompanying materials are licensed and made available under\r
6 the terms and conditions of the BSD License that accompanies this distribution.\r
7 The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php.\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13\r
14\r
15--*/\r
16\r
17//\r
18// Include files\r
19//\r
20\r
21#include <PiDxe.h>\r
22#include <IndustryStandard/Acpi50.h>\r
23\r
24\r
25\r
26//\r
27// LPIT Definitions\r
28//\r
29\r
30#define EFI_ACPI_LOW_POWER_IDLE_TABLE_REVISION 0x1\r
31\r
32//\r
33// Ensure proper structure formats\r
34//\r
35#pragma pack(1)\r
36\r
37typedef union _EFI_ACPI_LPI_STATE_FLAGS {\r
38 struct {\r
39 UINT32 Disabled :1;\r
40 UINT32 CounterUnavailable :1;\r
41 UINT32 Reserved :30;\r
42 };\r
43 UINT32 AsUlong;\r
44} EFI_ACPI_LPI_STATE_FLAGS, *PEFI_ACPI_LPI_STATE_FLAGS;\r
45\r
46// Only Mwait LPI here:\r
47\r
48typedef struct _EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR {\r
49 UINT32 Type; // offset: 0\r
50 UINT32 Length; // offset: 4\r
51 UINT16 UniqueId; // offset: 8\r
52 UINT8 Reserved[2]; // offset: 9\r
53 EFI_ACPI_LPI_STATE_FLAGS Flags; // offset: 12\r
54 EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE EntryTrigger; // offset: 16\r
55 UINT32 Residency; // offset: 28\r
56 UINT32 Latency; // offset: 32\r
57 EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE ResidencyCounter; // offset: 36\r
58 UINT64 ResidencyCounterFrequency; //offset: 48\r
59} EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR;\r
60\r
61\r
62//\r
63// Defines for LPIT table, some are VLV specific\r
64//\r
65\r
66\r
67// signature "LPIT"\r
68#define EFI_ACPI_LOW_POWER_IDLE_TABLE_SIGNATURE 0x5449504c\r
69\r
70#define EFI_ACPI_OEM_LPIT_REVISION 0x00000000\r
71\r
72#define EFI_ACPI_LOW_POWER_IDLE_MWAIT_TYPE 0x0\r
73#define EFI_ACPI_LOW_POWER_IDLE_DEFAULT_FLAG 0x0\r
74#define EFI_ACPI_LOW_POWER_IDLE_RES_FREQ_8K 0x8000 // 32768\r
75\r
76//\r
77// LPI state count (4 on VLV: S0ir, S0i1, S0i2, S0i3)\r
78//\r
79\r
80#define EFI_ACPI_VLV_LPI_STATE_COUNT 0x4\r
81\r
82//\r
83// LPI TRIGGER (HW C7 on VLV),\r
84// TOFIX!!!\r
85//\r
86#define EFI_ACPI_VLV_LPI_TRIGGER {0x7F,0x1,0x2,0x0,0x64}\r
87\r
88//\r
89// LPI residency counter (MMIO)\r
90//\r
91#define EFI_ACPI_VLV_LPI_RES_COUNTER0 {0x0,32,0x0,0x03,0xFED03080}\r
92#define EFI_ACPI_VLV_LPI_RES_COUNTER1 {0x0,32,0x0,0x03,0xFED03084}\r
93#define EFI_ACPI_VLV_LPI_RES_COUNTER2 {0x0,32,0x0,0x03,0xFED03088}\r
94#define EFI_ACPI_VLV_LPI_RES_COUNTER3 {0x0,32,0x0,0x03,0xFED0308C}\r
95\r
96//\r
97// LPI break-even residency in us - all match S0i3 residency\r
98// Residency estimate: Latency x 3\r
99//\r
100#define EFI_ACPI_VLV_LPI_MIN_RES0 15000\r
101#define EFI_ACPI_VLV_LPI_MIN_RES1 15000\r
102#define EFI_ACPI_VLV_LPI_MIN_RES2 15000\r
103#define EFI_ACPI_VLV_LPI_MIN_RES3 15000\r
104\r
105//\r
106// LPI latency in us - all match S0i3 latency\r
107//\r
108#define EFI_ACPI_VLV_LPI_LATENCY0 5000\r
109#define EFI_ACPI_VLV_LPI_LATENCY1 5000\r
110#define EFI_ACPI_VLV_LPI_LATENCY2 5000\r
111#define EFI_ACPI_VLV_LPI_LATENCY3 5000\r
112\r
113\r
114//\r
115// LPI ID\r
116//\r
117#define EFI_ACPI_VLV_LPI_UNIQUE_ID0 0\r
118#define EFI_ACPI_VLV_LPI_UNIQUE_ID1 1\r
119#define EFI_ACPI_VLV_LPI_UNIQUE_ID2 2\r
120#define EFI_ACPI_VLV_LPI_UNIQUE_ID3 3\r
121\r
122//\r
123// LPI ACPI table header\r
124//\r
125\r
126\r
127typedef struct _EFI_ACPI_LOW_POWER_IDLE_TABLE {\r
128 EFI_ACPI_DESCRIPTION_HEADER Header;\r
129 EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR LpiStates[EFI_ACPI_VLV_LPI_STATE_COUNT];\r
130} EFI_ACPI_LOW_POWER_IDLE_TABLE;\r
131\r
132#pragma pack()\r
133\r
134EFI_ACPI_LOW_POWER_IDLE_TABLE Lpit = {\r
135\r
136 //\r
137 // Header\r
138 //\r
139\r
140\r
141 EFI_ACPI_LOW_POWER_IDLE_TABLE_SIGNATURE,\r
142 sizeof (EFI_ACPI_LOW_POWER_IDLE_TABLE),\r
143 EFI_ACPI_LOW_POWER_IDLE_TABLE_REVISION ,\r
144\r
145 //\r
146 // Checksum will be updated at runtime\r
147 //\r
148 0x00,\r
149\r
150 //\r
151 // It is expected that these values will be updated at runtime\r
152 //\r
153 ' ', ' ', ' ', ' ', ' ', ' ',\r
154\r
155 0,\r
156 EFI_ACPI_OEM_LPIT_REVISION,\r
157 0,\r
158 0,\r
159\r
160\r
161\r
162 //\r
163 // Descriptor\r
164 //\r
165 {\r
166 {\r
167 EFI_ACPI_LOW_POWER_IDLE_MWAIT_TYPE,\r
168 sizeof(EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR),\r
169 EFI_ACPI_VLV_LPI_UNIQUE_ID0,\r
170 {0,0},\r
171 {EFI_ACPI_LOW_POWER_IDLE_DEFAULT_FLAG}, // Flags\r
172 EFI_ACPI_VLV_LPI_TRIGGER, //EntryTrigger\r
173 EFI_ACPI_VLV_LPI_MIN_RES0, //Residency\r
174 EFI_ACPI_VLV_LPI_LATENCY0, //Latency\r
175 EFI_ACPI_VLV_LPI_RES_COUNTER0, //ResidencyCounter\r
176 EFI_ACPI_LOW_POWER_IDLE_RES_FREQ_8K //Residency counter frequency\r
177 },\r
178 {\r
179 EFI_ACPI_LOW_POWER_IDLE_MWAIT_TYPE,\r
180 sizeof(EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR),\r
181 EFI_ACPI_VLV_LPI_UNIQUE_ID1,\r
182 {0,0},\r
183 {EFI_ACPI_LOW_POWER_IDLE_DEFAULT_FLAG}, // Flags\r
184 EFI_ACPI_VLV_LPI_TRIGGER, //EntryTrigger\r
185 EFI_ACPI_VLV_LPI_MIN_RES1, //Residency\r
186 EFI_ACPI_VLV_LPI_LATENCY1, //Latency\r
187 EFI_ACPI_VLV_LPI_RES_COUNTER1, //ResidencyCounter\r
188 EFI_ACPI_LOW_POWER_IDLE_RES_FREQ_8K //Residency counter frequency\r
189 },\r
190 {\r
191 EFI_ACPI_LOW_POWER_IDLE_MWAIT_TYPE,\r
192 sizeof(EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR),\r
193 EFI_ACPI_VLV_LPI_UNIQUE_ID2,\r
194 {0,0},\r
195 {EFI_ACPI_LOW_POWER_IDLE_DEFAULT_FLAG}, // Flags\r
196 EFI_ACPI_VLV_LPI_TRIGGER, //EntryTrigger\r
197 EFI_ACPI_VLV_LPI_MIN_RES2, //Residency\r
198 EFI_ACPI_VLV_LPI_LATENCY2, //Latency\r
199 EFI_ACPI_VLV_LPI_RES_COUNTER2, //ResidencyCounter\r
200 EFI_ACPI_LOW_POWER_IDLE_RES_FREQ_8K //Residency counter frequency\r
201 },\r
202 {\r
203 EFI_ACPI_LOW_POWER_IDLE_MWAIT_TYPE,\r
204 sizeof(EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR),\r
205 EFI_ACPI_VLV_LPI_UNIQUE_ID3,\r
206 {0,0},\r
207 {EFI_ACPI_LOW_POWER_IDLE_DEFAULT_FLAG}, // Flags\r
208 EFI_ACPI_VLV_LPI_TRIGGER, //EntryTrigger\r
209 EFI_ACPI_VLV_LPI_MIN_RES3, //Residency\r
210 EFI_ACPI_VLV_LPI_LATENCY3, //Latency\r
211 EFI_ACPI_VLV_LPI_RES_COUNTER3, //ResidencyCounter\r
212 EFI_ACPI_LOW_POWER_IDLE_RES_FREQ_8K //Residency counter frequency\r
213 }\r
214 }\r
215\r
216};\r
217\r
218\r
219VOID*\r
220ReferenceAcpiTable (\r
221 VOID\r
222 )\r
223{\r
224 //\r
225 // Reference the table being generated to prevent the optimizer from\r
226 // removing the data structure from the executable\r
227 //\r
228 return (VOID*)&Lpit;\r
229}\r