3 Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
22 #include <IndustryStandard/Acpi50.h>
30 #define EFI_ACPI_LOW_POWER_IDLE_TABLE_REVISION 0x1
33 // Ensure proper structure formats
37 typedef union _EFI_ACPI_LPI_STATE_FLAGS {
40 UINT32 CounterUnavailable :1;
44 } EFI_ACPI_LPI_STATE_FLAGS, *PEFI_ACPI_LPI_STATE_FLAGS;
46 // Only Mwait LPI here:
48 typedef struct _EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR {
49 UINT32 Type; // offset: 0
50 UINT32 Length; // offset: 4
51 UINT16 UniqueId; // offset: 8
52 UINT8 Reserved[2]; // offset: 9
53 EFI_ACPI_LPI_STATE_FLAGS Flags; // offset: 12
54 EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE EntryTrigger; // offset: 16
55 UINT32 Residency; // offset: 28
56 UINT32 Latency; // offset: 32
57 EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE ResidencyCounter; // offset: 36
58 UINT64 ResidencyCounterFrequency; //offset: 48
59 } EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR;
63 // Defines for LPIT table, some are VLV specific
68 #define EFI_ACPI_LOW_POWER_IDLE_TABLE_SIGNATURE 0x5449504c
70 #define EFI_ACPI_OEM_LPIT_REVISION 0x00000000
72 #define EFI_ACPI_LOW_POWER_IDLE_MWAIT_TYPE 0x0
73 #define EFI_ACPI_LOW_POWER_IDLE_DEFAULT_FLAG 0x0
74 #define EFI_ACPI_LOW_POWER_IDLE_RES_FREQ_8K 0x8000 // 32768
77 // LPI state count (4 on VLV: S0ir, S0i1, S0i2, S0i3)
80 #define EFI_ACPI_VLV_LPI_STATE_COUNT 0x4
83 // LPI TRIGGER (HW C7 on VLV),
86 #define EFI_ACPI_VLV_LPI_TRIGGER {0x7F,0x1,0x2,0x0,0x64}
89 // LPI residency counter (MMIO)
91 #define EFI_ACPI_VLV_LPI_RES_COUNTER0 {0x0,32,0x0,0x03,0xFED03080}
92 #define EFI_ACPI_VLV_LPI_RES_COUNTER1 {0x0,32,0x0,0x03,0xFED03084}
93 #define EFI_ACPI_VLV_LPI_RES_COUNTER2 {0x0,32,0x0,0x03,0xFED03088}
94 #define EFI_ACPI_VLV_LPI_RES_COUNTER3 {0x0,32,0x0,0x03,0xFED0308C}
97 // LPI break-even residency in us - all match S0i3 residency
98 // Residency estimate: Latency x 3
100 #define EFI_ACPI_VLV_LPI_MIN_RES0 15000
101 #define EFI_ACPI_VLV_LPI_MIN_RES1 15000
102 #define EFI_ACPI_VLV_LPI_MIN_RES2 15000
103 #define EFI_ACPI_VLV_LPI_MIN_RES3 15000
106 // LPI latency in us - all match S0i3 latency
108 #define EFI_ACPI_VLV_LPI_LATENCY0 5000
109 #define EFI_ACPI_VLV_LPI_LATENCY1 5000
110 #define EFI_ACPI_VLV_LPI_LATENCY2 5000
111 #define EFI_ACPI_VLV_LPI_LATENCY3 5000
117 #define EFI_ACPI_VLV_LPI_UNIQUE_ID0 0
118 #define EFI_ACPI_VLV_LPI_UNIQUE_ID1 1
119 #define EFI_ACPI_VLV_LPI_UNIQUE_ID2 2
120 #define EFI_ACPI_VLV_LPI_UNIQUE_ID3 3
123 // LPI ACPI table header
127 typedef struct _EFI_ACPI_LOW_POWER_IDLE_TABLE {
128 EFI_ACPI_DESCRIPTION_HEADER Header;
129 EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR LpiStates[EFI_ACPI_VLV_LPI_STATE_COUNT];
130 } EFI_ACPI_LOW_POWER_IDLE_TABLE;
134 EFI_ACPI_LOW_POWER_IDLE_TABLE Lpit = {
141 EFI_ACPI_LOW_POWER_IDLE_TABLE_SIGNATURE,
142 sizeof (EFI_ACPI_LOW_POWER_IDLE_TABLE),
143 EFI_ACPI_LOW_POWER_IDLE_TABLE_REVISION ,
146 // Checksum will be updated at runtime
151 // It is expected that these values will be updated at runtime
153 ' ', ' ', ' ', ' ', ' ', ' ',
156 EFI_ACPI_OEM_LPIT_REVISION,
167 EFI_ACPI_LOW_POWER_IDLE_MWAIT_TYPE,
168 sizeof(EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR),
169 EFI_ACPI_VLV_LPI_UNIQUE_ID0,
171 {EFI_ACPI_LOW_POWER_IDLE_DEFAULT_FLAG}, // Flags
172 EFI_ACPI_VLV_LPI_TRIGGER, //EntryTrigger
173 EFI_ACPI_VLV_LPI_MIN_RES0, //Residency
174 EFI_ACPI_VLV_LPI_LATENCY0, //Latency
175 EFI_ACPI_VLV_LPI_RES_COUNTER0, //ResidencyCounter
176 EFI_ACPI_LOW_POWER_IDLE_RES_FREQ_8K //Residency counter frequency
179 EFI_ACPI_LOW_POWER_IDLE_MWAIT_TYPE,
180 sizeof(EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR),
181 EFI_ACPI_VLV_LPI_UNIQUE_ID1,
183 {EFI_ACPI_LOW_POWER_IDLE_DEFAULT_FLAG}, // Flags
184 EFI_ACPI_VLV_LPI_TRIGGER, //EntryTrigger
185 EFI_ACPI_VLV_LPI_MIN_RES1, //Residency
186 EFI_ACPI_VLV_LPI_LATENCY1, //Latency
187 EFI_ACPI_VLV_LPI_RES_COUNTER1, //ResidencyCounter
188 EFI_ACPI_LOW_POWER_IDLE_RES_FREQ_8K //Residency counter frequency
191 EFI_ACPI_LOW_POWER_IDLE_MWAIT_TYPE,
192 sizeof(EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR),
193 EFI_ACPI_VLV_LPI_UNIQUE_ID2,
195 {EFI_ACPI_LOW_POWER_IDLE_DEFAULT_FLAG}, // Flags
196 EFI_ACPI_VLV_LPI_TRIGGER, //EntryTrigger
197 EFI_ACPI_VLV_LPI_MIN_RES2, //Residency
198 EFI_ACPI_VLV_LPI_LATENCY2, //Latency
199 EFI_ACPI_VLV_LPI_RES_COUNTER2, //ResidencyCounter
200 EFI_ACPI_LOW_POWER_IDLE_RES_FREQ_8K //Residency counter frequency
203 EFI_ACPI_LOW_POWER_IDLE_MWAIT_TYPE,
204 sizeof(EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR),
205 EFI_ACPI_VLV_LPI_UNIQUE_ID3,
207 {EFI_ACPI_LOW_POWER_IDLE_DEFAULT_FLAG}, // Flags
208 EFI_ACPI_VLV_LPI_TRIGGER, //EntryTrigger
209 EFI_ACPI_VLV_LPI_MIN_RES3, //Residency
210 EFI_ACPI_VLV_LPI_LATENCY3, //Latency
211 EFI_ACPI_VLV_LPI_RES_COUNTER3, //ResidencyCounter
212 EFI_ACPI_LOW_POWER_IDLE_RES_FREQ_8K //Residency counter frequency
225 // Reference the table being generated to prevent the optimizer from
226 // removing the data structure from the executable