Mercurial > illumos > illumos-gate
annotate usr/src/uts/i86pc/os/cpupm/cpu_acpi.c @ 14169:ae5fcf7b2a38
4048 cpu_acpi is too verbose about disabled SpeedStep/PowerNow! support
Reviewed by: Albert Lee <trisk@nexenta.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Dan McDonald <danmcd@nexenta.com>
author | Yuri Pankov <yuri.pankov@nexenta.com> |
---|---|
date | Thu, 29 Aug 2013 02:06:39 +0400 |
parents | 01b2fa2ff254 |
children |
rev | line source |
---|---|
4667 | 1 /* |
2 * CDDL HEADER START | |
3 * | |
4 * The contents of this file are subject to the terms of the | |
5 * Common Development and Distribution License (the "License"). | |
6 * You may not use this file except in compliance with the License. | |
7 * | |
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | |
9 * or http://www.opensolaris.org/os/licensing. | |
10 * See the License for the specific language governing permissions | |
11 * and limitations under the License. | |
12 * | |
13 * When distributing Covered Code, include this CDDL HEADER in each | |
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. | |
15 * If applicable, add the following below this CDDL HEADER, with the | |
16 * fields enclosed by brackets "[]" replaced with your own identifying | |
17 * information: Portions Copyright [yyyy] [name of copyright owner] | |
18 * | |
19 * CDDL HEADER END | |
20 */ | |
21 /* | |
12511
01b2fa2ff254
6949969 cpu_acpi_cache_cst writes past the end of allocated memory, corrupting the kernel heap
jiang.liu@intel.com
parents:
12004
diff
changeset
|
22 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. |
4667 | 23 */ |
24 | |
25 #include <sys/cpu_acpi.h> | |
8983
981f8c40440c
6807891 system does not consider C3 when ACPI _CST object did not contain a C2 state
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
26 #include <sys/cpu_idle.h> |
9004
0f2f9c0e4285
6756843 Clean up messages related to P and T states
Anup Pemmaiah <Napanda.Pemmaiah@Sun.COM>
parents:
8983
diff
changeset
|
27 #include <sys/dtrace.h> |
0f2f9c0e4285
6756843 Clean up messages related to P and T states
Anup Pemmaiah <Napanda.Pemmaiah@Sun.COM>
parents:
8983
diff
changeset
|
28 #include <sys/sdt.h> |
4667 | 29 |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
30 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
31 * List of the processor ACPI object types that are being used. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
32 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
33 typedef enum cpu_acpi_obj { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
34 PDC_OBJ = 0, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
35 PCT_OBJ, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
36 PSS_OBJ, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
37 PSD_OBJ, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
38 PPC_OBJ, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
39 PTC_OBJ, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
40 TSS_OBJ, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
41 TSD_OBJ, |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
42 TPC_OBJ, |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
43 CST_OBJ, |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
44 CSD_OBJ, |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
45 } cpu_acpi_obj_t; |
4667 | 46 |
47 /* | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
48 * Container to store object name. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
49 * Other attributes can be added in the future as necessary. |
4667 | 50 */ |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
51 typedef struct cpu_acpi_obj_attr { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
52 char *name; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
53 } cpu_acpi_obj_attr_t; |
4667 | 54 |
55 /* | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
56 * List of object attributes. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
57 * NOTE: Please keep the ordering of the list as same as cpu_acpi_obj_t. |
4667 | 58 */ |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
59 static cpu_acpi_obj_attr_t cpu_acpi_obj_attrs[] = { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
60 {"_PDC"}, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
61 {"_PCT"}, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
62 {"_PSS"}, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
63 {"_PSD"}, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
64 {"_PPC"}, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
65 {"_PTC"}, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
66 {"_TSS"}, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
67 {"_TSD"}, |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
68 {"_TPC"}, |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
69 {"_CST"}, |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
70 {"_CSD"} |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
71 }; |
4667 | 72 |
73 /* | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
74 * Cache the ACPI CPU control data objects. |
4667 | 75 */ |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
76 static int |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
77 cpu_acpi_cache_ctrl_regs(cpu_acpi_handle_t handle, cpu_acpi_obj_t objtype, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
78 cpu_acpi_ctrl_regs_t *regs) |
4667 | 79 { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
80 ACPI_STATUS astatus; |
4667 | 81 ACPI_BUFFER abuf; |
82 ACPI_OBJECT *obj; | |
83 AML_RESOURCE_GENERIC_REGISTER *greg; | |
84 int ret = -1; | |
85 int i; | |
86 | |
87 /* | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
88 * Fetch the control registers (if present) for the CPU node. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
89 * Since they are optional, non-existence is not a failure |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
90 * (we just consider it a fixed hardware case). |
4667 | 91 */ |
92 abuf.Length = ACPI_ALLOCATE_BUFFER; | |
93 abuf.Pointer = NULL; | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
94 astatus = AcpiEvaluateObjectTyped(handle->cs_handle, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
95 cpu_acpi_obj_attrs[objtype].name, NULL, &abuf, ACPI_TYPE_PACKAGE); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
96 if (ACPI_FAILURE(astatus)) { |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
97 if (astatus == AE_NOT_FOUND) { |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
98 DTRACE_PROBE3(cpu_acpi__eval__err, int, handle->cs_id, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
99 int, objtype, int, astatus); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
100 regs[0].cr_addrspace_id = ACPI_ADR_SPACE_FIXED_HARDWARE; |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
101 regs[1].cr_addrspace_id = ACPI_ADR_SPACE_FIXED_HARDWARE; |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
102 return (1); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
103 } |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
104 cmn_err(CE_NOTE, "!cpu_acpi: error %d evaluating %s package " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
105 "for CPU %d.", astatus, cpu_acpi_obj_attrs[objtype].name, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
106 handle->cs_id); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
107 goto out; |
4667 | 108 } |
109 | |
110 obj = abuf.Pointer; | |
111 if (obj->Package.Count != 2) { | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
112 cmn_err(CE_NOTE, "!cpu_acpi: %s package bad count %d for " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
113 "CPU %d.", cpu_acpi_obj_attrs[objtype].name, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
114 obj->Package.Count, handle->cs_id); |
4667 | 115 goto out; |
116 } | |
117 | |
118 /* | |
119 * Does the package look coherent? | |
120 */ | |
121 for (i = 0; i < obj->Package.Count; i++) { | |
122 if (obj->Package.Elements[i].Type != ACPI_TYPE_BUFFER) { | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
123 cmn_err(CE_NOTE, "!cpu_acpi: Unexpected data in " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
124 "%s package for CPU %d.", |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
125 cpu_acpi_obj_attrs[objtype].name, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
126 handle->cs_id); |
4667 | 127 goto out; |
128 } | |
129 | |
130 greg = (AML_RESOURCE_GENERIC_REGISTER *) | |
131 obj->Package.Elements[i].Buffer.Pointer; | |
132 if (greg->DescriptorType != | |
133 ACPI_RESOURCE_NAME_GENERIC_REGISTER) { | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
134 cmn_err(CE_NOTE, "!cpu_acpi: %s package has format " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
135 "error for CPU %d.", |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
136 cpu_acpi_obj_attrs[objtype].name, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
137 handle->cs_id); |
4667 | 138 goto out; |
139 } | |
140 if (greg->ResourceLength != | |
141 ACPI_AML_SIZE_LARGE(AML_RESOURCE_GENERIC_REGISTER)) { | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
142 cmn_err(CE_NOTE, "!cpu_acpi: %s package not right " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
143 "size for CPU %d.", |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
144 cpu_acpi_obj_attrs[objtype].name, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
145 handle->cs_id); |
4667 | 146 goto out; |
147 } | |
148 if (greg->AddressSpaceId != ACPI_ADR_SPACE_FIXED_HARDWARE && | |
149 greg->AddressSpaceId != ACPI_ADR_SPACE_SYSTEM_IO) { | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
150 cmn_err(CE_NOTE, "!cpu_apci: %s contains unsupported " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
151 "address space type %x for CPU %d.", |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
152 cpu_acpi_obj_attrs[objtype].name, |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
153 greg->AddressSpaceId, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
154 handle->cs_id); |
4667 | 155 goto out; |
156 } | |
157 } | |
158 | |
159 /* | |
160 * Looks good! | |
161 */ | |
162 for (i = 0; i < obj->Package.Count; i++) { | |
163 greg = (AML_RESOURCE_GENERIC_REGISTER *) | |
164 obj->Package.Elements[i].Buffer.Pointer; | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
165 regs[i].cr_addrspace_id = greg->AddressSpaceId; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
166 regs[i].cr_width = greg->BitWidth; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
167 regs[i].cr_offset = greg->BitOffset; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
168 regs[i].cr_asize = greg->AccessSize; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
169 regs[i].cr_address = greg->Address; |
4667 | 170 } |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
171 ret = 0; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
172 out: |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
173 if (abuf.Pointer != NULL) |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
174 AcpiOsFree(abuf.Pointer); |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
175 return (ret); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
176 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
177 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
178 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
179 * Cache the ACPI _PCT data. The _PCT data defines the interface to use |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
180 * when making power level transitions (i.e., system IO ports, fixed |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
181 * hardware port, etc). |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
182 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
183 static int |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
184 cpu_acpi_cache_pct(cpu_acpi_handle_t handle) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
185 { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
186 cpu_acpi_pct_t *pct; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
187 int ret; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
188 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
189 CPU_ACPI_OBJ_IS_NOT_CACHED(handle, CPU_ACPI_PCT_CACHED); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
190 pct = &CPU_ACPI_PCT(handle)[0]; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
191 if ((ret = cpu_acpi_cache_ctrl_regs(handle, PCT_OBJ, pct)) == 0) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
192 CPU_ACPI_OBJ_IS_CACHED(handle, CPU_ACPI_PCT_CACHED); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
193 return (ret); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
194 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
195 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
196 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
197 * Cache the ACPI _PTC data. The _PTC data defines the interface to use |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
198 * when making T-state transitions (i.e., system IO ports, fixed |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
199 * hardware port, etc). |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
200 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
201 static int |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
202 cpu_acpi_cache_ptc(cpu_acpi_handle_t handle) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
203 { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
204 cpu_acpi_ptc_t *ptc; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
205 int ret; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
206 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
207 CPU_ACPI_OBJ_IS_NOT_CACHED(handle, CPU_ACPI_PTC_CACHED); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
208 ptc = &CPU_ACPI_PTC(handle)[0]; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
209 if ((ret = cpu_acpi_cache_ctrl_regs(handle, PTC_OBJ, ptc)) == 0) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
210 CPU_ACPI_OBJ_IS_CACHED(handle, CPU_ACPI_PTC_CACHED); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
211 return (ret); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
212 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
213 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
214 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
215 * Cache the ACPI CPU state dependency data objects. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
216 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
217 static int |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
218 cpu_acpi_cache_state_dependencies(cpu_acpi_handle_t handle, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
219 cpu_acpi_obj_t objtype, cpu_acpi_state_dependency_t *sd) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
220 { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
221 ACPI_STATUS astatus; |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
222 ACPI_BUFFER abuf; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
223 ACPI_OBJECT *pkg, *elements; |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
224 int number; |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
225 int ret = -1; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
226 |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
227 if (objtype == CSD_OBJ) { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
228 number = 6; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
229 } else { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
230 number = 5; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
231 } |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
232 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
233 * Fetch the dependencies (if present) for the CPU node. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
234 * Since they are optional, non-existence is not a failure |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
235 * (it's up to the caller to determine how to handle non-existence). |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
236 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
237 abuf.Length = ACPI_ALLOCATE_BUFFER; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
238 abuf.Pointer = NULL; |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
239 astatus = AcpiEvaluateObjectTyped(handle->cs_handle, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
240 cpu_acpi_obj_attrs[objtype].name, NULL, &abuf, ACPI_TYPE_PACKAGE); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
241 if (ACPI_FAILURE(astatus)) { |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
242 if (astatus == AE_NOT_FOUND) { |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
243 DTRACE_PROBE3(cpu_acpi__eval__err, int, handle->cs_id, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
244 int, objtype, int, astatus); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
245 return (1); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
246 } |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
247 cmn_err(CE_NOTE, "!cpu_acpi: error %d evaluating %s package " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
248 "for CPU %d.", astatus, cpu_acpi_obj_attrs[objtype].name, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
249 handle->cs_id); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
250 goto out; |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
251 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
252 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
253 pkg = abuf.Pointer; |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
254 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
255 if (((objtype != CSD_OBJ) && (pkg->Package.Count != 1)) || |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
256 ((objtype == CSD_OBJ) && (pkg->Package.Count != 1) && |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
257 (pkg->Package.Count != 2))) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
258 cmn_err(CE_NOTE, "!cpu_acpi: %s unsupported package count %d " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
259 "for CPU %d.", cpu_acpi_obj_attrs[objtype].name, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
260 pkg->Package.Count, handle->cs_id); |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
261 goto out; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
262 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
263 |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
264 /* |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
265 * For C-state domain, we assume C2 and C3 have the same |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
266 * domain information |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
267 */ |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
268 if (pkg->Package.Elements[0].Type != ACPI_TYPE_PACKAGE || |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
269 pkg->Package.Elements[0].Package.Count != number) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
270 cmn_err(CE_NOTE, "!cpu_acpi: Unexpected data in %s package " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
271 "for CPU %d.", cpu_acpi_obj_attrs[objtype].name, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
272 handle->cs_id); |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
273 goto out; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
274 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
275 elements = pkg->Package.Elements[0].Package.Elements; |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
276 if (elements[0].Integer.Value != number || |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
277 elements[1].Integer.Value != 0) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
278 cmn_err(CE_NOTE, "!cpu_acpi: Unexpected %s revision for " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
279 "CPU %d.", cpu_acpi_obj_attrs[objtype].name, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
280 handle->cs_id); |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
281 goto out; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
282 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
283 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
284 sd->sd_entries = elements[0].Integer.Value; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
285 sd->sd_revision = elements[1].Integer.Value; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
286 sd->sd_domain = elements[2].Integer.Value; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
287 sd->sd_type = elements[3].Integer.Value; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
288 sd->sd_num = elements[4].Integer.Value; |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
289 if (objtype == CSD_OBJ) { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
290 sd->sd_index = elements[5].Integer.Value; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
291 } |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
292 |
4667 | 293 ret = 0; |
294 out: | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
295 if (abuf.Pointer != NULL) |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
296 AcpiOsFree(abuf.Pointer); |
4667 | 297 return (ret); |
298 } | |
299 | |
300 /* | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
301 * Cache the ACPI _PSD data. The _PSD data defines P-state CPU dependencies |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
302 * (think CPU domains). |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
303 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
304 static int |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
305 cpu_acpi_cache_psd(cpu_acpi_handle_t handle) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
306 { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
307 cpu_acpi_psd_t *psd; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
308 int ret; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
309 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
310 CPU_ACPI_OBJ_IS_NOT_CACHED(handle, CPU_ACPI_PSD_CACHED); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
311 psd = &CPU_ACPI_PSD(handle); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
312 ret = cpu_acpi_cache_state_dependencies(handle, PSD_OBJ, psd); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
313 if (ret == 0) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
314 CPU_ACPI_OBJ_IS_CACHED(handle, CPU_ACPI_PSD_CACHED); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
315 return (ret); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
316 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
317 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
318 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
319 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
320 * Cache the ACPI _TSD data. The _TSD data defines T-state CPU dependencies |
4667 | 321 * (think CPU domains). |
322 */ | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
323 static int |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
324 cpu_acpi_cache_tsd(cpu_acpi_handle_t handle) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
325 { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
326 cpu_acpi_tsd_t *tsd; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
327 int ret; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
328 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
329 CPU_ACPI_OBJ_IS_NOT_CACHED(handle, CPU_ACPI_TSD_CACHED); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
330 tsd = &CPU_ACPI_TSD(handle); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
331 ret = cpu_acpi_cache_state_dependencies(handle, TSD_OBJ, tsd); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
332 if (ret == 0) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
333 CPU_ACPI_OBJ_IS_CACHED(handle, CPU_ACPI_TSD_CACHED); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
334 return (ret); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
335 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
336 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
337 |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
338 /* |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
339 * Cache the ACPI _CSD data. The _CSD data defines C-state CPU dependencies |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
340 * (think CPU domains). |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
341 */ |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
342 static int |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
343 cpu_acpi_cache_csd(cpu_acpi_handle_t handle) |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
344 { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
345 cpu_acpi_csd_t *csd; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
346 int ret; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
347 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
348 CPU_ACPI_OBJ_IS_NOT_CACHED(handle, CPU_ACPI_CSD_CACHED); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
349 csd = &CPU_ACPI_CSD(handle); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
350 ret = cpu_acpi_cache_state_dependencies(handle, CSD_OBJ, csd); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
351 if (ret == 0) |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
352 CPU_ACPI_OBJ_IS_CACHED(handle, CPU_ACPI_CSD_CACHED); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
353 return (ret); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
354 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
355 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
356 |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
357 static void |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
358 cpu_acpi_cache_pstate(cpu_acpi_handle_t handle, ACPI_OBJECT *obj, int cnt) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
359 { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
360 cpu_acpi_pstate_t *pstate; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
361 ACPI_OBJECT *q, *l; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
362 int i, j; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
363 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
364 CPU_ACPI_PSTATES_COUNT(handle) = cnt; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
365 CPU_ACPI_PSTATES(handle) = kmem_zalloc(CPU_ACPI_PSTATES_SIZE(cnt), |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
366 KM_SLEEP); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
367 pstate = (cpu_acpi_pstate_t *)CPU_ACPI_PSTATES(handle); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
368 for (i = 0, l = NULL; i < obj->Package.Count && cnt > 0; i++, l = q) { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
369 uint32_t *up; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
370 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
371 q = obj->Package.Elements[i].Package.Elements; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
372 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
373 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
374 * Skip duplicate entries. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
375 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
376 if (l != NULL && l[0].Integer.Value == q[0].Integer.Value) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
377 continue; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
378 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
379 up = (uint32_t *)pstate; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
380 for (j = 0; j < CPU_ACPI_PSS_CNT; j++) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
381 up[j] = q[j].Integer.Value; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
382 pstate++; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
383 cnt--; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
384 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
385 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
386 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
387 static void |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
388 cpu_acpi_cache_tstate(cpu_acpi_handle_t handle, ACPI_OBJECT *obj, int cnt) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
389 { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
390 cpu_acpi_tstate_t *tstate; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
391 ACPI_OBJECT *q, *l; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
392 int i, j; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
393 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
394 CPU_ACPI_TSTATES_COUNT(handle) = cnt; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
395 CPU_ACPI_TSTATES(handle) = kmem_zalloc(CPU_ACPI_TSTATES_SIZE(cnt), |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
396 KM_SLEEP); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
397 tstate = (cpu_acpi_tstate_t *)CPU_ACPI_TSTATES(handle); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
398 for (i = 0, l = NULL; i < obj->Package.Count && cnt > 0; i++, l = q) { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
399 uint32_t *up; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
400 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
401 q = obj->Package.Elements[i].Package.Elements; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
402 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
403 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
404 * Skip duplicate entries. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
405 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
406 if (l != NULL && l[0].Integer.Value == q[0].Integer.Value) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
407 continue; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
408 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
409 up = (uint32_t *)tstate; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
410 for (j = 0; j < CPU_ACPI_TSS_CNT; j++) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
411 up[j] = q[j].Integer.Value; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
412 tstate++; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
413 cnt--; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
414 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
415 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
416 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
417 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
418 * Cache the _PSS or _TSS data. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
419 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
420 static int |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
421 cpu_acpi_cache_supported_states(cpu_acpi_handle_t handle, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
422 cpu_acpi_obj_t objtype, int fcnt) |
4667 | 423 { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
424 ACPI_STATUS astatus; |
4667 | 425 ACPI_BUFFER abuf; |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
426 ACPI_OBJECT *obj, *q, *l; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
427 boolean_t eot = B_FALSE; |
4667 | 428 int ret = -1; |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
429 int cnt; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
430 int i, j; |
4667 | 431 |
432 /* | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
433 * Fetch the state data (if present) for the CPU node. |
4667 | 434 */ |
435 abuf.Length = ACPI_ALLOCATE_BUFFER; | |
436 abuf.Pointer = NULL; | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
437 astatus = AcpiEvaluateObjectTyped(handle->cs_handle, |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
438 cpu_acpi_obj_attrs[objtype].name, NULL, &abuf, |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
439 ACPI_TYPE_PACKAGE); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
440 if (ACPI_FAILURE(astatus)) { |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
441 if (astatus == AE_NOT_FOUND) { |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
442 DTRACE_PROBE3(cpu_acpi__eval__err, int, handle->cs_id, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
443 int, objtype, int, astatus); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
444 return (1); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
445 } |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
446 cmn_err(CE_NOTE, "!cpu_acpi: error %d evaluating %s package " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
447 "for CPU %d.", astatus, cpu_acpi_obj_attrs[objtype].name, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
448 handle->cs_id); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
449 goto out; |
4667 | 450 } |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
451 obj = abuf.Pointer; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
452 if (obj->Package.Count < 2) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
453 cmn_err(CE_NOTE, "!cpu_acpi: %s package bad count %d for " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
454 "CPU %d.", cpu_acpi_obj_attrs[objtype].name, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
455 obj->Package.Count, handle->cs_id); |
4667 | 456 goto out; |
457 } | |
458 | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
459 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
460 * Does the package look coherent? |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
461 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
462 cnt = 0; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
463 for (i = 0, l = NULL; i < obj->Package.Count; i++, l = q) { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
464 if (obj->Package.Elements[i].Type != ACPI_TYPE_PACKAGE || |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
465 obj->Package.Elements[i].Package.Count != fcnt) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
466 cmn_err(CE_NOTE, "!cpu_acpi: Unexpected data in " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
467 "%s package for CPU %d.", |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
468 cpu_acpi_obj_attrs[objtype].name, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
469 handle->cs_id); |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
470 goto out; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
471 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
472 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
473 q = obj->Package.Elements[i].Package.Elements; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
474 for (j = 0; j < fcnt; j++) { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
475 if (q[j].Type != ACPI_TYPE_INTEGER) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
476 cmn_err(CE_NOTE, "!cpu_acpi: %s element " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
477 "invalid (type) for CPU %d.", |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
478 cpu_acpi_obj_attrs[objtype].name, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
479 handle->cs_id); |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
480 goto out; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
481 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
482 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
483 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
484 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
485 * Ignore duplicate entries. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
486 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
487 if (l != NULL && l[0].Integer.Value == q[0].Integer.Value) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
488 continue; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
489 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
490 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
491 * Some supported state tables are larger than required |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
492 * and unused elements are filled with patterns |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
493 * of 0xff. Simply check here for frequency = 0xffff |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
494 * and stop counting if found. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
495 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
496 if (q[0].Integer.Value == 0xffff) { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
497 eot = B_TRUE; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
498 continue; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
499 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
500 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
501 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
502 * We should never find a valid entry after we've hit |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
503 * an the end-of-table entry. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
504 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
505 if (eot) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
506 cmn_err(CE_NOTE, "!cpu_acpi: Unexpected data in %s " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
507 "package after eot for CPU %d.", |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
508 cpu_acpi_obj_attrs[objtype].name, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
509 handle->cs_id); |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
510 goto out; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
511 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
512 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
513 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
514 * states must be defined in order from highest to lowest. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
515 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
516 if (l != NULL && l[0].Integer.Value < q[0].Integer.Value) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
517 cmn_err(CE_NOTE, "!cpu_acpi: %s package state " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
518 "definitions out of order for CPU %d.", |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
519 cpu_acpi_obj_attrs[objtype].name, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
520 handle->cs_id); |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
521 goto out; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
522 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
523 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
524 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
525 * This entry passes. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
526 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
527 cnt++; |
4667 | 528 } |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
529 if (cnt == 0) |
4667 | 530 goto out; |
531 | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
532 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
533 * Yes, fill in the structure. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
534 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
535 ASSERT(objtype == PSS_OBJ || objtype == TSS_OBJ); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
536 (objtype == PSS_OBJ) ? cpu_acpi_cache_pstate(handle, obj, cnt) : |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
537 cpu_acpi_cache_tstate(handle, obj, cnt); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
538 |
4667 | 539 ret = 0; |
540 out: | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
541 if (abuf.Pointer != NULL) |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
542 AcpiOsFree(abuf.Pointer); |
4667 | 543 return (ret); |
544 } | |
545 | |
546 /* | |
547 * Cache the _PSS data. The _PSS data defines the different power levels | |
548 * supported by the CPU and the attributes associated with each power level | |
549 * (i.e., frequency, voltage, etc.). The power levels are number from | |
550 * highest to lowest. That is, the highest power level is _PSS entry 0 | |
551 * and the lowest power level is the last _PSS entry. | |
552 */ | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
553 static int |
4667 | 554 cpu_acpi_cache_pstates(cpu_acpi_handle_t handle) |
555 { | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
556 int ret; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
557 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
558 CPU_ACPI_OBJ_IS_NOT_CACHED(handle, CPU_ACPI_PSS_CACHED); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
559 ret = cpu_acpi_cache_supported_states(handle, PSS_OBJ, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
560 CPU_ACPI_PSS_CNT); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
561 if (ret == 0) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
562 CPU_ACPI_OBJ_IS_CACHED(handle, CPU_ACPI_PSS_CACHED); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
563 return (ret); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
564 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
565 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
566 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
567 * Cache the _TSS data. The _TSS data defines the different freq throttle |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
568 * levels supported by the CPU and the attributes associated with each |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
569 * throttle level (i.e., frequency throttle percentage, voltage, etc.). |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
570 * The throttle levels are number from highest to lowest. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
571 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
572 static int |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
573 cpu_acpi_cache_tstates(cpu_acpi_handle_t handle) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
574 { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
575 int ret; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
576 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
577 CPU_ACPI_OBJ_IS_NOT_CACHED(handle, CPU_ACPI_TSS_CACHED); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
578 ret = cpu_acpi_cache_supported_states(handle, TSS_OBJ, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
579 CPU_ACPI_TSS_CNT); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
580 if (ret == 0) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
581 CPU_ACPI_OBJ_IS_CACHED(handle, CPU_ACPI_TSS_CACHED); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
582 return (ret); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
583 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
584 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
585 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
586 * Cache the ACPI CPU present capabilities data objects. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
587 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
588 static int |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
589 cpu_acpi_cache_present_capabilities(cpu_acpi_handle_t handle, |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
590 cpu_acpi_obj_t objtype, cpu_acpi_present_capabilities_t *pc) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
591 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
592 { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
593 ACPI_STATUS astatus; |
4667 | 594 ACPI_BUFFER abuf; |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
595 ACPI_OBJECT *obj; |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
596 int ret = -1; |
4667 | 597 |
598 /* | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
599 * Fetch the present capabilites object (if present) for the CPU node. |
4667 | 600 */ |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
601 abuf.Length = ACPI_ALLOCATE_BUFFER; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
602 abuf.Pointer = NULL; |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
603 astatus = AcpiEvaluateObject(handle->cs_handle, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
604 cpu_acpi_obj_attrs[objtype].name, NULL, &abuf); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
605 if (ACPI_FAILURE(astatus) && astatus != AE_NOT_FOUND) { |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
606 cmn_err(CE_NOTE, "!cpu_acpi: error %d evaluating %s " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
607 "package for CPU %d.", astatus, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
608 cpu_acpi_obj_attrs[objtype].name, handle->cs_id); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
609 goto out; |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
610 } |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
611 if (astatus == AE_NOT_FOUND || abuf.Length == 0) { |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
612 *pc = 0; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
613 return (1); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
614 } |
4667 | 615 |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
616 obj = (ACPI_OBJECT *)abuf.Pointer; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
617 *pc = obj->Integer.Value; |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
618 |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
619 ret = 0; |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
620 out: |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
621 if (abuf.Pointer != NULL) |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
622 AcpiOsFree(abuf.Pointer); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
623 return (ret); |
4667 | 624 } |
625 | |
626 /* | |
627 * Cache the _PPC data. The _PPC simply contains an integer value which | |
628 * represents the highest power level that a CPU should transition to. | |
629 * That is, it's an index into the array of _PSS entries and will be | |
630 * greater than or equal to zero. | |
631 */ | |
632 void | |
633 cpu_acpi_cache_ppc(cpu_acpi_handle_t handle) | |
634 { | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
635 cpu_acpi_ppc_t *ppc; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
636 int ret; |
4667 | 637 |
638 CPU_ACPI_OBJ_IS_NOT_CACHED(handle, CPU_ACPI_PPC_CACHED); | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
639 ppc = &CPU_ACPI_PPC(handle); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
640 ret = cpu_acpi_cache_present_capabilities(handle, PPC_OBJ, ppc); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
641 if (ret == 0) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
642 CPU_ACPI_OBJ_IS_CACHED(handle, CPU_ACPI_PPC_CACHED); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
643 } |
4667 | 644 |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
645 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
646 * Cache the _TPC data. The _TPC simply contains an integer value which |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
647 * represents the throttle level that a CPU should transition to. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
648 * That is, it's an index into the array of _TSS entries and will be |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
649 * greater than or equal to zero. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
650 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
651 void |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
652 cpu_acpi_cache_tpc(cpu_acpi_handle_t handle) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
653 { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
654 cpu_acpi_tpc_t *tpc; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
655 int ret; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
656 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
657 CPU_ACPI_OBJ_IS_NOT_CACHED(handle, CPU_ACPI_TPC_CACHED); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
658 tpc = &CPU_ACPI_TPC(handle); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
659 ret = cpu_acpi_cache_present_capabilities(handle, TPC_OBJ, tpc); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
660 if (ret == 0) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
661 CPU_ACPI_OBJ_IS_CACHED(handle, CPU_ACPI_TPC_CACHED); |
4667 | 662 } |
663 | |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
664 int |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
665 cpu_acpi_verify_cstate(cpu_acpi_cstate_t *cstate) |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
666 { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
667 uint32_t addrspaceid = cstate->cs_addrspace_id; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
668 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
669 if ((addrspaceid != ACPI_ADR_SPACE_FIXED_HARDWARE) && |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
670 (addrspaceid != ACPI_ADR_SPACE_SYSTEM_IO)) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
671 cmn_err(CE_NOTE, "!cpu_acpi: _CST unsupported address space id" |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
672 ":C%d, type: %d\n", cstate->cs_type, addrspaceid); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
673 return (1); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
674 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
675 return (0); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
676 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
677 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
678 int |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
679 cpu_acpi_cache_cst(cpu_acpi_handle_t handle) |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
680 { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
681 ACPI_STATUS astatus; |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
682 ACPI_BUFFER abuf; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
683 ACPI_OBJECT *obj; |
12511
01b2fa2ff254
6949969 cpu_acpi_cache_cst writes past the end of allocated memory, corrupting the kernel heap
jiang.liu@intel.com
parents:
12004
diff
changeset
|
684 ACPI_INTEGER cnt, old_cnt; |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
685 cpu_acpi_cstate_t *cstate, *p; |
9148
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
686 size_t alloc_size; |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
687 int i, count; |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
688 int ret = 1; |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
689 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
690 CPU_ACPI_OBJ_IS_NOT_CACHED(handle, CPU_ACPI_CST_CACHED); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
691 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
692 abuf.Length = ACPI_ALLOCATE_BUFFER; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
693 abuf.Pointer = NULL; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
694 |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
695 /* |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
696 * Fetch the C-state data (if present) for the CPU node. |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
697 */ |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
698 astatus = AcpiEvaluateObjectTyped(handle->cs_handle, "_CST", |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
699 NULL, &abuf, ACPI_TYPE_PACKAGE); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
700 if (ACPI_FAILURE(astatus)) { |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
701 if (astatus == AE_NOT_FOUND) { |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
702 DTRACE_PROBE3(cpu_acpi__eval__err, int, handle->cs_id, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
703 int, CST_OBJ, int, astatus); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
704 return (1); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
705 } |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
706 cmn_err(CE_NOTE, "!cpu_acpi: error %d evaluating _CST package " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
707 "for CPU %d.", astatus, handle->cs_id); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
708 goto out; |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
709 |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
710 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
711 obj = (ACPI_OBJECT *)abuf.Pointer; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
712 if (obj->Package.Count < 2) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
713 cmn_err(CE_NOTE, "!cpu_acpi: _CST unsupported package " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
714 "count %d for CPU %d.", obj->Package.Count, handle->cs_id); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
715 goto out; |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
716 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
717 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
718 /* |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
719 * Does the package look coherent? |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
720 */ |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
721 cnt = obj->Package.Elements[0].Integer.Value; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
722 if (cnt < 1 || cnt != obj->Package.Count - 1) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
723 cmn_err(CE_NOTE, "!cpu_acpi: _CST invalid element " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
724 "count %d != Package count %d for CPU %d", |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
725 (int)cnt, (int)obj->Package.Count - 1, handle->cs_id); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
726 goto out; |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
727 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
728 |
12511
01b2fa2ff254
6949969 cpu_acpi_cache_cst writes past the end of allocated memory, corrupting the kernel heap
jiang.liu@intel.com
parents:
12004
diff
changeset
|
729 /* |
01b2fa2ff254
6949969 cpu_acpi_cache_cst writes past the end of allocated memory, corrupting the kernel heap
jiang.liu@intel.com
parents:
12004
diff
changeset
|
730 * Reuse the old buffer if the number of C states is the same. |
01b2fa2ff254
6949969 cpu_acpi_cache_cst writes past the end of allocated memory, corrupting the kernel heap
jiang.liu@intel.com
parents:
12004
diff
changeset
|
731 */ |
01b2fa2ff254
6949969 cpu_acpi_cache_cst writes past the end of allocated memory, corrupting the kernel heap
jiang.liu@intel.com
parents:
12004
diff
changeset
|
732 if (CPU_ACPI_CSTATES(handle) && |
01b2fa2ff254
6949969 cpu_acpi_cache_cst writes past the end of allocated memory, corrupting the kernel heap
jiang.liu@intel.com
parents:
12004
diff
changeset
|
733 (old_cnt = CPU_ACPI_CSTATES_COUNT(handle)) != cnt) { |
01b2fa2ff254
6949969 cpu_acpi_cache_cst writes past the end of allocated memory, corrupting the kernel heap
jiang.liu@intel.com
parents:
12004
diff
changeset
|
734 kmem_free(CPU_ACPI_CSTATES(handle), |
01b2fa2ff254
6949969 cpu_acpi_cache_cst writes past the end of allocated memory, corrupting the kernel heap
jiang.liu@intel.com
parents:
12004
diff
changeset
|
735 CPU_ACPI_CSTATES_SIZE(old_cnt)); |
01b2fa2ff254
6949969 cpu_acpi_cache_cst writes past the end of allocated memory, corrupting the kernel heap
jiang.liu@intel.com
parents:
12004
diff
changeset
|
736 CPU_ACPI_CSTATES(handle) = NULL; |
01b2fa2ff254
6949969 cpu_acpi_cache_cst writes past the end of allocated memory, corrupting the kernel heap
jiang.liu@intel.com
parents:
12004
diff
changeset
|
737 } |
01b2fa2ff254
6949969 cpu_acpi_cache_cst writes past the end of allocated memory, corrupting the kernel heap
jiang.liu@intel.com
parents:
12004
diff
changeset
|
738 |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
739 CPU_ACPI_CSTATES_COUNT(handle) = (uint32_t)cnt; |
9148
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
740 alloc_size = CPU_ACPI_CSTATES_SIZE(cnt); |
12004
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
10488
diff
changeset
|
741 if (CPU_ACPI_CSTATES(handle) == NULL) |
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
10488
diff
changeset
|
742 CPU_ACPI_CSTATES(handle) = kmem_zalloc(alloc_size, KM_SLEEP); |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
743 cstate = (cpu_acpi_cstate_t *)CPU_ACPI_CSTATES(handle); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
744 p = cstate; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
745 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
746 for (i = 1, count = 1; i <= cnt; i++) { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
747 ACPI_OBJECT *pkg; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
748 AML_RESOURCE_GENERIC_REGISTER *reg; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
749 ACPI_OBJECT *element; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
750 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
751 pkg = &(obj->Package.Elements[i]); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
752 reg = (AML_RESOURCE_GENERIC_REGISTER *) |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
753 pkg->Package.Elements[0].Buffer.Pointer; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
754 cstate->cs_addrspace_id = reg->AddressSpaceId; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
755 cstate->cs_address = reg->Address; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
756 element = &(pkg->Package.Elements[1]); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
757 cstate->cs_type = element->Integer.Value; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
758 element = &(pkg->Package.Elements[2]); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
759 cstate->cs_latency = element->Integer.Value; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
760 element = &(pkg->Package.Elements[3]); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
761 cstate->cs_power = element->Integer.Value; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
762 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
763 if (cpu_acpi_verify_cstate(cstate)) { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
764 /* |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
765 * ignore this entry if it's not valid |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
766 */ |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
767 continue; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
768 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
769 if (cstate == p) { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
770 cstate++; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
771 } else if (p->cs_type == cstate->cs_type) { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
772 /* |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
773 * if there are duplicate entries, we keep the |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
774 * last one. This fixes: |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
775 * 1) some buggy BIOS have total duplicate entries. |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
776 * 2) ACPI Spec allows the same cstate entry with |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
777 * different power and latency, we use the one |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
778 * with more power saving. |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
779 */ |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
780 (void) memcpy(p, cstate, sizeof (cpu_acpi_cstate_t)); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
781 } else { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
782 /* |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
783 * we got a valid entry, cache it to the |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
784 * cstate structure |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
785 */ |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
786 p = cstate++; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
787 count++; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
788 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
789 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
790 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
791 if (count < 2) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
792 cmn_err(CE_NOTE, "!cpu_acpi: _CST invalid count %d < 2 for " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
793 "CPU %d", count, handle->cs_id); |
9148
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
794 kmem_free(CPU_ACPI_CSTATES(handle), alloc_size); |
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
795 CPU_ACPI_CSTATES(handle) = NULL; |
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
796 CPU_ACPI_CSTATES_COUNT(handle) = (uint32_t)0; |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
797 goto out; |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
798 } |
8983
981f8c40440c
6807891 system does not consider C3 when ACPI _CST object did not contain a C2 state
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
799 cstate = (cpu_acpi_cstate_t *)CPU_ACPI_CSTATES(handle); |
981f8c40440c
6807891 system does not consider C3 when ACPI _CST object did not contain a C2 state
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
800 if (cstate[0].cs_type != CPU_ACPI_C1) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
801 cmn_err(CE_NOTE, "!cpu_acpi: _CST first element type not " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
802 "C1: %d for CPU %d", (int)cstate->cs_type, handle->cs_id); |
9148
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
803 kmem_free(CPU_ACPI_CSTATES(handle), alloc_size); |
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
804 CPU_ACPI_CSTATES(handle) = NULL; |
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
805 CPU_ACPI_CSTATES_COUNT(handle) = (uint32_t)0; |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
806 goto out; |
8983
981f8c40440c
6807891 system does not consider C3 when ACPI _CST object did not contain a C2 state
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
807 } |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
808 |
9148
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
809 if (count != cnt) { |
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
810 void *orig = CPU_ACPI_CSTATES(handle); |
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
811 |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
812 CPU_ACPI_CSTATES_COUNT(handle) = (uint32_t)count; |
9148
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
813 CPU_ACPI_CSTATES(handle) = kmem_zalloc( |
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
814 CPU_ACPI_CSTATES_SIZE(count), KM_SLEEP); |
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
815 (void) memcpy(CPU_ACPI_CSTATES(handle), orig, |
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
816 CPU_ACPI_CSTATES_SIZE(count)); |
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
817 kmem_free(orig, alloc_size); |
cbc850545d32
6819156 cpu_acpi_free_cstate_data can free the wrong size
Bill Holler <Bill.Holler@Sun.COM>
parents:
9147
diff
changeset
|
818 } |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
819 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
820 CPU_ACPI_OBJ_IS_CACHED(handle, CPU_ACPI_CST_CACHED); |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
821 |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
822 ret = 0; |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
823 |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
824 out: |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
825 if (abuf.Pointer != NULL) |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
826 AcpiOsFree(abuf.Pointer); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
827 return (ret); |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
828 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
829 |
4667 | 830 /* |
831 * Cache the _PCT, _PSS, _PSD and _PPC data. | |
832 */ | |
833 int | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
834 cpu_acpi_cache_pstate_data(cpu_acpi_handle_t handle) |
4667 | 835 { |
836 if (cpu_acpi_cache_pct(handle) < 0) { | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
837 DTRACE_PROBE2(cpu_acpi__cache__err, int, handle->cs_id, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
838 int, PCT_OBJ); |
4667 | 839 return (-1); |
840 } | |
841 | |
842 if (cpu_acpi_cache_pstates(handle) != 0) { | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
843 DTRACE_PROBE2(cpu_acpi__cache__err, int, handle->cs_id, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
844 int, PSS_OBJ); |
4667 | 845 return (-1); |
846 } | |
847 | |
848 if (cpu_acpi_cache_psd(handle) < 0) { | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
849 DTRACE_PROBE2(cpu_acpi__cache__err, int, handle->cs_id, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
850 int, PSD_OBJ); |
4667 | 851 return (-1); |
852 } | |
853 | |
854 cpu_acpi_cache_ppc(handle); | |
855 | |
856 return (0); | |
857 } | |
858 | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
859 void |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
860 cpu_acpi_free_pstate_data(cpu_acpi_handle_t handle) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
861 { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
862 if (handle != NULL) { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
863 if (CPU_ACPI_PSTATES(handle)) { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
864 kmem_free(CPU_ACPI_PSTATES(handle), |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
865 CPU_ACPI_PSTATES_SIZE( |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
866 CPU_ACPI_PSTATES_COUNT(handle))); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
867 CPU_ACPI_PSTATES(handle) = NULL; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
868 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
869 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
870 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
871 |
4667 | 872 /* |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
873 * Cache the _PTC, _TSS, _TSD and _TPC data. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
874 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
875 int |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
876 cpu_acpi_cache_tstate_data(cpu_acpi_handle_t handle) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
877 { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
878 int ret; |
9004
0f2f9c0e4285
6756843 Clean up messages related to P and T states
Anup Pemmaiah <Napanda.Pemmaiah@Sun.COM>
parents:
8983
diff
changeset
|
879 |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
880 if (cpu_acpi_cache_ptc(handle) < 0) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
881 DTRACE_PROBE2(cpu_acpi__cache__err, int, handle->cs_id, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
882 int, PTC_OBJ); |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
883 return (-1); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
884 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
885 |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
886 if ((ret = cpu_acpi_cache_tstates(handle)) != 0) { |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
887 DTRACE_PROBE2(cpu_acpi__cache__err, int, handle->cs_id, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
888 int, TSS_OBJ); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
889 return (ret); |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
890 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
891 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
892 if (cpu_acpi_cache_tsd(handle) < 0) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
893 DTRACE_PROBE2(cpu_acpi__cache__err, int, handle->cs_id, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
894 int, TSD_OBJ); |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
895 return (-1); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
896 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
897 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
898 cpu_acpi_cache_tpc(handle); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
899 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
900 return (0); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
901 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
902 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
903 void |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
904 cpu_acpi_free_tstate_data(cpu_acpi_handle_t handle) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
905 { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
906 if (handle != NULL) { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
907 if (CPU_ACPI_TSTATES(handle)) { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
908 kmem_free(CPU_ACPI_TSTATES(handle), |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
909 CPU_ACPI_TSTATES_SIZE( |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
910 CPU_ACPI_TSTATES_COUNT(handle))); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
911 CPU_ACPI_TSTATES(handle) = NULL; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
912 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
913 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
914 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
915 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
916 /* |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
917 * Cache the _CST data. |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
918 */ |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
919 int |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
920 cpu_acpi_cache_cstate_data(cpu_acpi_handle_t handle) |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
921 { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
922 int ret; |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
923 |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
924 if ((ret = cpu_acpi_cache_cst(handle)) != 0) { |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
925 DTRACE_PROBE2(cpu_acpi__cache__err, int, handle->cs_id, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
926 int, CST_OBJ); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
927 return (ret); |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
928 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
929 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
930 if (cpu_acpi_cache_csd(handle) < 0) { |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
931 DTRACE_PROBE2(cpu_acpi__cache__err, int, handle->cs_id, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
932 int, CSD_OBJ); |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
933 return (-1); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
934 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
935 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
936 return (0); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
937 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
938 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
939 void |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
940 cpu_acpi_free_cstate_data(cpu_acpi_handle_t handle) |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
941 { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
942 if (handle != NULL) { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
943 if (CPU_ACPI_CSTATES(handle)) { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
944 kmem_free(CPU_ACPI_CSTATES(handle), |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
945 CPU_ACPI_CSTATES_SIZE( |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
946 CPU_ACPI_CSTATES_COUNT(handle))); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
947 CPU_ACPI_CSTATES(handle) = NULL; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
948 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
949 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
950 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
951 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
952 /* |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
953 * Register a handler for processor change notifications. |
4667 | 954 */ |
955 void | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
956 cpu_acpi_install_notify_handler(cpu_acpi_handle_t handle, |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
957 ACPI_NOTIFY_HANDLER handler, void *ctx) |
4667 | 958 { |
959 if (ACPI_FAILURE(AcpiInstallNotifyHandler(handle->cs_handle, | |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
960 ACPI_DEVICE_NOTIFY, handler, ctx))) |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
961 cmn_err(CE_NOTE, "!cpu_acpi: Unable to register " |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
962 "notify handler for CPU %d.", handle->cs_id); |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
963 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
964 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
965 /* |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
966 * Remove a handler for processor change notifications. |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
967 */ |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
968 void |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
969 cpu_acpi_remove_notify_handler(cpu_acpi_handle_t handle, |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
970 ACPI_NOTIFY_HANDLER handler) |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
971 { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
972 if (ACPI_FAILURE(AcpiRemoveNotifyHandler(handle->cs_handle, |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
973 ACPI_DEVICE_NOTIFY, handler))) |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
974 cmn_err(CE_NOTE, "!cpu_acpi: Unable to remove " |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
975 "notify handler for CPU %d.", handle->cs_id); |
4667 | 976 } |
977 | |
978 /* | |
979 * Write _PDC. | |
980 */ | |
981 int | |
982 cpu_acpi_write_pdc(cpu_acpi_handle_t handle, uint32_t revision, uint32_t count, | |
983 uint32_t *capabilities) | |
984 { | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
985 ACPI_STATUS astatus; |
4667 | 986 ACPI_OBJECT obj; |
987 ACPI_OBJECT_LIST list = { 1, &obj}; | |
988 uint32_t *buffer; | |
989 uint32_t *bufptr; | |
990 uint32_t bufsize; | |
991 int i; | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
992 int ret = 0; |
4667 | 993 |
994 bufsize = (count + 2) * sizeof (uint32_t); | |
995 buffer = kmem_zalloc(bufsize, KM_SLEEP); | |
996 buffer[0] = revision; | |
997 buffer[1] = count; | |
998 bufptr = &buffer[2]; | |
999 for (i = 0; i < count; i++) | |
1000 *bufptr++ = *capabilities++; | |
1001 | |
1002 obj.Type = ACPI_TYPE_BUFFER; | |
1003 obj.Buffer.Length = bufsize; | |
1004 obj.Buffer.Pointer = (void *)buffer; | |
1005 | |
1006 /* | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
1007 * Fetch the ??? (if present) for the CPU node. |
4667 | 1008 */ |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
1009 astatus = AcpiEvaluateObject(handle->cs_handle, "_PDC", &list, NULL); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
1010 if (ACPI_FAILURE(astatus)) { |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
1011 if (astatus == AE_NOT_FOUND) { |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
1012 DTRACE_PROBE3(cpu_acpi__eval__err, int, handle->cs_id, |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
1013 int, PDC_OBJ, int, astatus); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
1014 ret = 1; |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
1015 } else { |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
1016 cmn_err(CE_NOTE, "!cpu_acpi: error %d evaluating _PDC " |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
1017 "package for CPU %d.", astatus, handle->cs_id); |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
1018 ret = -1; |
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
1019 } |
4667 | 1020 } |
1021 | |
1022 kmem_free(buffer, bufsize); | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
1023 return (ret); |
4667 | 1024 } |
1025 | |
1026 /* | |
1027 * Write to system IO port. | |
1028 */ | |
1029 int | |
1030 cpu_acpi_write_port(ACPI_IO_ADDRESS address, uint32_t value, uint32_t width) | |
1031 { | |
1032 if (ACPI_FAILURE(AcpiOsWritePort(address, value, width))) { | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
1033 cmn_err(CE_NOTE, "!cpu_acpi: error writing system IO port " |
4872
d29c11d096f3
6589662 Error messages from cpu_acpi on install boot w/snv_70
mh27603
parents:
4667
diff
changeset
|
1034 "%lx.", (long)address); |
4667 | 1035 return (-1); |
1036 } | |
1037 return (0); | |
1038 } | |
1039 | |
1040 /* | |
1041 * Read from a system IO port. | |
1042 */ | |
1043 int | |
1044 cpu_acpi_read_port(ACPI_IO_ADDRESS address, uint32_t *value, uint32_t width) | |
1045 { | |
1046 if (ACPI_FAILURE(AcpiOsReadPort(address, value, width))) { | |
10075
254480e5218d
6856778 cpu_acpi: error messages could be more user friendly.
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
9980
diff
changeset
|
1047 cmn_err(CE_NOTE, "!cpu_acpi: error reading system IO port " |
4872
d29c11d096f3
6589662 Error messages from cpu_acpi on install boot w/snv_70
mh27603
parents:
4667
diff
changeset
|
1048 "%lx.", (long)address); |
4667 | 1049 return (-1); |
1050 } | |
1051 return (0); | |
1052 } | |
1053 | |
1054 /* | |
1055 * Return supported frequencies. | |
1056 */ | |
1057 uint_t | |
1058 cpu_acpi_get_speeds(cpu_acpi_handle_t handle, int **speeds) | |
1059 { | |
1060 cpu_acpi_pstate_t *pstate; | |
1061 int *hspeeds; | |
1062 uint_t nspeeds; | |
1063 int i; | |
1064 | |
1065 nspeeds = CPU_ACPI_PSTATES_COUNT(handle); | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1066 pstate = (cpu_acpi_pstate_t *)CPU_ACPI_PSTATES(handle); |
4667 | 1067 hspeeds = kmem_zalloc(nspeeds * sizeof (int), KM_SLEEP); |
1068 for (i = 0; i < nspeeds; i++) { | |
1069 hspeeds[i] = CPU_ACPI_FREQ(pstate); | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1070 pstate++; |
4667 | 1071 } |
1072 *speeds = hspeeds; | |
1073 return (nspeeds); | |
1074 } | |
1075 | |
1076 /* | |
1077 * Free resources allocated by cpu_acpi_get_speeds(). | |
1078 */ | |
1079 void | |
1080 cpu_acpi_free_speeds(int *speeds, uint_t nspeeds) | |
1081 { | |
1082 kmem_free(speeds, nspeeds * sizeof (int)); | |
1083 } | |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1084 |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1085 uint_t |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1086 cpu_acpi_get_max_cstates(cpu_acpi_handle_t handle) |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1087 { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1088 if (CPU_ACPI_CSTATES(handle)) |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1089 return (CPU_ACPI_CSTATES_COUNT(handle)); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1090 else |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1091 return (1); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1092 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1093 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1094 void |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1095 cpu_acpi_set_register(uint32_t bitreg, uint32_t value) |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1096 { |
10488
296c315b92df
6878359 CPU power management driver needs to support detach
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
10447
diff
changeset
|
1097 (void) AcpiWriteBitRegister(bitreg, value); |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1098 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1099 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1100 void |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1101 cpu_acpi_get_register(uint32_t bitreg, uint32_t *value) |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1102 { |
10488
296c315b92df
6878359 CPU power management driver needs to support detach
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
10447
diff
changeset
|
1103 (void) AcpiReadBitRegister(bitreg, value); |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1104 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1105 |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1106 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1107 * Map the dip to an ACPI handle for the device. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1108 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1109 cpu_acpi_handle_t |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1110 cpu_acpi_init(cpu_t *cp) |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1111 { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1112 cpu_acpi_handle_t handle; |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1113 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1114 handle = kmem_zalloc(sizeof (cpu_acpi_state_t), KM_SLEEP); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1115 |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1116 if (ACPI_FAILURE(acpica_get_handle_cpu(cp->cpu_id, |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1117 &handle->cs_handle))) { |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1118 kmem_free(handle, sizeof (cpu_acpi_state_t)); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1119 return (NULL); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1120 } |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
7851
diff
changeset
|
1121 handle->cs_id = cp->cpu_id; |
7319
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1122 return (handle); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1123 } |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1124 |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1125 /* |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1126 * Free any resources. |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1127 */ |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1128 void |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1129 cpu_acpi_fini(cpu_acpi_handle_t handle) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1130 { |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1131 if (handle) |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1132 kmem_free(handle, sizeof (cpu_acpi_state_t)); |
d281dd2d2049
6715149 T-State support for intel based processors
Mark Haywood <Mark.Haywood@Sun.COM>
parents:
6968
diff
changeset
|
1133 } |