Chameleon

Chameleon Svn Source Tree

Root/branches/cparm/i386/libsaio/ppm.h

  • Property svn:executable set to *
1/*
2Copyright (c) 2010, Intel Corporation
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7
8 * Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its contributors
14 may be used to endorse or promote products derived from this software
15 without specific prior written permission.
16
17THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
28
29#ifndef ppm_h
30#define ppm_h
31
32#include "datatype.h"
33
34#define PROFILE_ALL
35//#define PROFILE_NEHALEM_EP_DP
36//#define PROFILE_WESTMERE_EP_UP_DP
37//#define PROFILE_NEHALEM_EX_MP
38//#define PROFILE_WESTMERE_EX_MP
39//#define PROFILE_SANDYBRIDGE_UP
40
41#if defined(PROFILE_ALL) || defined(PROFILE_WESTMERE_EX_MP)
42
43#define MAX_CPU_SOCKETS 8 // max count of cpu packages (any range of APIC IDs is ok)
44#define MAX_LOGICAL_CPU 256 // max count of cpu found in MADT
45#define MAX_CORES 32 // Based on full range of Core APID ID values (max of 5 bits for core APIC ID mask)
46
47#elif defined(PROFILE_NEHALEM_EX_MP)
48
49#define MAX_CPU_SOCKETS 8 // max count of cpu packages (any range of APIC IDs is ok)
50#define MAX_LOGICAL_CPU 128 // max count of cpu found in MADT
51#define MAX_CORES 16 // Based on full range of Core APID ID values (max of 4 bits for core APIC ID mask)
52
53#elif defined(PROFILE_WESTMERE_EP_UP_DP)
54
55#define MAX_CPU_SOCKETS 2 // max count of cpu packages (any range of APIC IDs is ok)
56#define MAX_LOGICAL_CPU 64 // max count of cpu found in MADT
57#define MAX_CORES 16 // Based on full range of Core APID ID values (max of 4 bits for core APIC ID mask)
58
59#elif defined(PROFILE_NEHALEM_EP_UP_DP)
60
61#define MAX_CPU_SOCKETS 2 // max count of cpu packages (any range of APIC IDs is ok)
62#define MAX_LOGICAL_CPU 32 // max count of cpu found in MADT
63#define MAX_CORES 8 // Based on full range of Core APID ID values (max of 3 bits for core APIC ID mask)
64
65#elif defined(PROFILE_SANDY_BRIDGE_UP)
66
67#define MAX_CPU_SOCKETS 1 // max count of cpu packages (any range of APIC IDs is ok)
68#define MAX_LOGICAL_CPU 8 // max count of cpu found in MADT
69#define MAX_CORES 4
70
71#endif
72
73#define MAX_PSTATES 16
74#define MAX_CSTATES 4
75#define MAX_TSTATES 15
76
77//Define ACPI_CSD to force building ACPI _CSD
78//#define BUILD_ACPI_CSD
79
80#ifndef DWORD_REGS_TYPEDEF
81#define DWORD_REGS_TYPEDEF
82typedef struct dword_regs {
83 U32 _eax;
84 U32 _ebx;
85 U32 _ecx;
86 U32 _edx;
87} DWORD_REGS;
88#endif
89
90typedef struct acpi_tables {
91 // Define the Storage Locations for all the ACPI Table Pointers.
92 ACPI_TABLE_DSDT *DsdtPointer; // Differentiated System Description Table (RSDP->RSDT->FACP->DSDT)
93 ACPI_TABLE_DSDT *DsdtPointer64; // Differentiated System Description Table (RSDP->XSDT->FACP->XDSDT)
94 ACPI_TABLE_FADT *FacpPointer; // Fixed ACPI Description Table (RSDP->RSDT->FACP)
95 ACPI_TABLE_FACS *FacsPointer; // Firmware ACPI Control Structure (RSDP->RSDT->FACP->FACS)
96 ACPI_TABLE_FACS *FacsPointer64; // Firmware ACPI Control Structure (RSDP->XSDT->FACP->XFACS)
97 ACPI_TABLE_RSDP *RsdPointer; // Root System Description Pointer Structure (RSDP)
98 ACPI_TABLE_RSDT *RsdtPointer; // Root System Description Table (RSDP->RSDT)
99 ACPI_TABLE_MADT *MadtPointer; // Multiple APIC Description Table (RSDP->RSDT->APIC)
100 ACPI_TABLE_SSDT *SsdtPointer; // Secondary System Description Table (RSDP->RSDT->SSDT)
101 ACPI_TABLE_XSDT *XsdtPointer; // Extended Root System Description Table (RSDP->XSDT)
102 ACPI_TABLE_FADT *FacpPointer64; // Fixed ACPI Description Table (RSDP->XSDT->FACP)
103 U8 RsdRevision; // Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+
104} ACPI_TABLES;
105
106typedef struct pstate {
107 U32 frequency;
108 U32 power;
109 U32 ratio;
110} PSTATE;
111
112typedef struct pkg_pstates {
113 U32 num_pstates;
114 PSTATE pstate[MAX_PSTATES];
115} PKG_PSTATES;
116
117typedef struct tstate {
118 U32 freqpercent;
119 U32 power;
120 U32 latency;
121 U32 control;
122 U32 status;
123} TSTATE;
124
125typedef struct pkg_tstates {
126 U32 num_tstates;
127 TSTATE tstate[MAX_TSTATES];
128} PKG_TSTATES;
129
130typedef enum cstate_encoding {
131 IO_REDIRECTION = 0,
132 NATIVE_MWAIT = 1,
133} CSTATE_ENCODING;
134
135typedef enum cpu_cstate {
136 CPU_C1 = 1,
137 CPU_C3_ACPI_C2 = 3,
138 CPU_C3_ACPI_C3 = 4,
139 CPU_C6 = 6,
140 CPU_C7 = 7,
141} CPU_CSTATE;
142
143typedef struct cstate {
144 U8 type;
145 U16 latency;
146 U32 power;
147} CSTATE;
148
149typedef struct pkg_cstates {
150 U32 num_cstates;
151 CSTATE cstate[MAX_CSTATES];
152 ACPI_GENERIC_ADDRESS gas[MAX_CSTATES];
153} PKG_CSTATES;
154
155typedef struct cpu_details {
156 U32 present;
157 U32 x2apic_id;
158 U32 socket_id;
159 U32 intra_package_mask_width;
160 U32 intra_package_mask;
161 U32 smt_mask_width;
162 U32 smt_select_mask;
163 U32 core_select_mask;
164 DWORD_REGS cpuid1;
165 DWORD_REGS cpuid5;
166 DWORD_REGS cpuid6;
167 DWORD_REGS cpuidB_0;
168 DWORD_REGS cpuidB_1;
169 U32 eist_cpuid_feature_flag;
170 U32 turbo_cpuid_feature_flag;
171 U32 turbo_misc_enables_feature_flag;
172 U32 invariant_apic_timer_flag;
173 U32 tdc_limit;
174 U32 tdp_limit;
175 U32 turbo_available;
176 U32 max_ratio_as_mfg;
177 U32 max_ratio_as_cfg;
178 U32 min_ratio;
179 U32 tdc_tdp_limits_for_turbo_flag;
180 U32 ratio_limits_for_turbo_flag;
181 U32 xe_available;
182 U32 logical_processor_count_from_madt;
183 U32 core_logical_processor_count_from_madt[MAX_CORES];
184
185 PKG_PSTATES pkg_pstates;
186
187 PKG_CSTATES pkg_mwait_cstates;
188 PKG_CSTATES pkg_io_cstates;
189
190 PKG_TSTATES pkg_tstates;
191
192 U32 package_cstate_limit;
193 U32 core_c1_supported;
194 U32 core_c3_supported;
195 U32 core_c6_supported;
196 U32 core_c7_supported;
197 U32 mwait_supported;
198 U32 acpi_support_cpuid_feature_flag;
199 U32 energy_perf_bias_supported;
200
201 U64 package_power_limit;
202 U64 package_power_sku_unit;
203} CPU_DETAILS;
204
205typedef struct socket_info {
206 U32 signature;
207 U32 socket_count;
208 CPU_DETAILS cpu[MAX_CPU_SOCKETS];
209} SOCKET_INFO;
210
211typedef struct lapic_info {
212 U32 processorId;
213 U32 apicId;
214 U32 pkg_index;
215 U32 core_apic_id;
216 U32 core_index;
217 PROCESSOR_NUMBER_TO_NAMESEG *namepath;
218 U32 madt_type;
219 U32 uid;
220} LAPIC_INFO;
221
222typedef struct proc_info {
223 U32 processorId;
224 U32 apicId;
225} PROC_INFO;
226
227typedef struct madt_info {
228 U32 lapic_count;
229 LAPIC_INFO lapic[MAX_LOGICAL_CPU];
230} MADT_INFO;
231
232typedef struct rsdt_info {
233 U32 proc_count;
234 PROC_INFO processor[MAX_LOGICAL_CPU];
235} RSDT_INFO;
236
237typedef struct smp_exit_state {
238 U32 signature;
239
240 // Number of Failure or Informative codes included in the buffer
241 U32 error_code_count;
242
243 // Buffer of Failure or Informative codes
244 U32 error_codes[10];
245} SMP_EXIT_STATE;
246
247typedef enum smp_exit_code {
248 // Generic successful
249 SMP_EXIT_CODE_OK = 1,
250
251 // Generic failure
252 EXIT_CODE_FAILED = 2,
253
254 // First logical processor for this socket unable to find available structure
255 EXIT_CODE_FAILED_SOCKET_PROXY_SAVE = 3,
256} SMP_EXIT_CODE;
257
258typedef struct ppm_host {
259 U32 signature;
260
261 U32 pstates_enabled;
262 U32 pstate_coordination;
263 U32 turbo_enabled;
264 U32 cstates_enabled;
265 U32 tstates_enabled;
266 U32 performance_per_watt;
267
268 ACPI_TABLES acpi_tables;
269
270
271 RSDT_INFO rsdt_info;
272 MADT_INFO madt_info;
273 SOCKET_INFO skt_info;
274
275 PPM_SETUP_OPTIONS *options;
276
277 SMP_EXIT_STATE smp_exit_state;
278
279 U32 detected_cpu_family;
280} PPM_HOST;
281
282#endif // ppm_h
283

Archive Download this file

Revision: 1119