Move the sysctl function pointers used by acpicpu(4) to x86/cpu.c. Rename these so that the same pointers may be used in other parts.diff -r1.5 -r1.6 src/sys/arch/x86/acpi/acpi_cpu_md.c
(jruoho)
--- src/sys/arch/x86/acpi/acpi_cpu_md.c 2010/08/08 16:58:41 1.5
+++ src/sys/arch/x86/acpi/acpi_cpu_md.c 2010/08/09 04:18:48 1.6
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: acpi_cpu_md.c,v 1.5 2010/08/08 16:58:41 jruoho Exp $ */ | 1 | /* $NetBSD: acpi_cpu_md.c,v 1.6 2010/08/09 04:18:48 jruoho Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi> | 4 | * Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * | 10 | * | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -17,27 +17,27 @@ | @@ -17,27 +17,27 @@ | |||
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
27 | * SUCH DAMAGE. | 27 | * SUCH DAMAGE. | |
28 | */ | 28 | */ | |
29 | #include <sys/cdefs.h> | 29 | #include <sys/cdefs.h> | |
30 | __KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.5 2010/08/08 16:58:41 jruoho Exp $"); | 30 | __KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.6 2010/08/09 04:18:48 jruoho Exp $"); | |
31 | 31 | |||
32 | #include <sys/param.h> | 32 | #include <sys/param.h> | |
33 | #include <sys/bus.h> | 33 | #include <sys/bus.h> | |
34 | #include <sys/kcore.h> | 34 | #include <sys/kcore.h> | |
35 | #include <sys/sysctl.h> | 35 | #include <sys/sysctl.h> | |
36 | #include <sys/xcall.h> | 36 | #include <sys/xcall.h> | |
37 | 37 | |||
38 | #include <x86/cpu.h> | 38 | #include <x86/cpu.h> | |
39 | #include <x86/cpufunc.h> | 39 | #include <x86/cpufunc.h> | |
40 | #include <x86/cputypes.h> | 40 | #include <x86/cputypes.h> | |
41 | #include <x86/cpuvar.h> | 41 | #include <x86/cpuvar.h> | |
42 | #include <x86/cpu_msr.h> | 42 | #include <x86/cpu_msr.h> | |
43 | #include <x86/machdep.h> | 43 | #include <x86/machdep.h> | |
@@ -206,56 +206,40 @@ acpicpu_md_idle_enter(int method, int st | @@ -206,56 +206,40 @@ acpicpu_md_idle_enter(int method, int st | |||
206 | x86_enable_intr(); | 206 | x86_enable_intr(); | |
207 | return; | 207 | return; | |
208 | } | 208 | } | |
209 | 209 | |||
210 | x86_stihlt(); | 210 | x86_stihlt(); | |
211 | break; | 211 | break; | |
212 | } | 212 | } | |
213 | } | 213 | } | |
214 | 214 | |||
215 | int | 215 | int | |
216 | acpicpu_md_pstate_start(void) | 216 | acpicpu_md_pstate_start(void) | |
217 | { | 217 | { | |
218 | 218 | |||
219 | switch (cpu_vendor) { | 219 | cpu_freq_sysctl_get = acpicpu_md_pstate_sysctl_get; | |
220 | 220 | cpu_freq_sysctl_set = acpicpu_md_pstate_sysctl_set; | ||
221 | case CPUVENDOR_INTEL: | 221 | cpu_freq_sysctl_all = acpicpu_md_pstate_sysctl_all; | |
222 | est_sysctl_get = acpicpu_md_pstate_sysctl_get; | |||
223 | est_sysctl_set = acpicpu_md_pstate_sysctl_set; | |||
224 | est_sysctl_all = acpicpu_md_pstate_sysctl_all; | |||
225 | break; | |||
226 | ||||
227 | default: | |||
228 | return ENODEV; | |||
229 | } | |||
230 | 222 | |||
231 | return 0; | 223 | return 0; | |
232 | } | 224 | } | |
233 | 225 | |||
234 | int | 226 | int | |
235 | acpicpu_md_pstate_stop(void) | 227 | acpicpu_md_pstate_stop(void) | |
236 | { | 228 | { | |
237 | 229 | |||
238 | switch (cpu_vendor) { | 230 | cpu_freq_sysctl_get = NULL; | |
239 | 231 | cpu_freq_sysctl_set = NULL; | ||
240 | case CPUVENDOR_INTEL: | 232 | cpu_freq_sysctl_all = NULL; | |
241 | est_sysctl_get = NULL; | |||
242 | est_sysctl_set = NULL; | |||
243 | est_sysctl_all = NULL; | |||
244 | break; | |||
245 | ||||
246 | default: | |||
247 | return ENODEV; | |||
248 | } | |||
249 | 233 | |||
250 | return 0; | 234 | return 0; | |
251 | } | 235 | } | |
252 | 236 | |||
253 | static int | 237 | static int | |
254 | acpicpu_md_pstate_sysctl_get(SYSCTLFN_ARGS) | 238 | acpicpu_md_pstate_sysctl_get(SYSCTLFN_ARGS) | |
255 | { | 239 | { | |
256 | struct cpu_info *ci = curcpu(); | 240 | struct cpu_info *ci = curcpu(); | |
257 | struct acpicpu_softc *sc; | 241 | struct acpicpu_softc *sc; | |
258 | struct sysctlnode node; | 242 | struct sysctlnode node; | |
259 | uint32_t freq; | 243 | uint32_t freq; | |
260 | int err; | 244 | int err; | |
261 | 245 |
--- src/sys/arch/x86/include/cpuvar.h 2010/08/08 16:58:42 1.35
+++ src/sys/arch/x86/include/cpuvar.h 2010/08/09 04:18:48 1.36
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: cpuvar.h,v 1.35 2010/08/08 16:58:42 jruoho Exp $ */ | 1 | /* $NetBSD: cpuvar.h,v 1.36 2010/08/09 04:18:48 jruoho Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by RedBack Networks Inc. | 8 | * by RedBack Networks Inc. | |
9 | * | 9 | * | |
10 | * Author: Bill Sommerfeld | 10 | * Author: Bill Sommerfeld | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
@@ -132,28 +132,28 @@ void coretemp_register(struct cpu_info * | @@ -132,28 +132,28 @@ void coretemp_register(struct cpu_info * | |||
132 | 132 | |||
133 | #ifdef INTEL_ONDEMAND_CLOCKMOD | 133 | #ifdef INTEL_ONDEMAND_CLOCKMOD | |
134 | void clockmod_init(void); | 134 | void clockmod_init(void); | |
135 | #endif | 135 | #endif | |
136 | 136 | |||
137 | #ifdef ENHANCED_SPEEDSTEP | 137 | #ifdef ENHANCED_SPEEDSTEP | |
138 | void est_init(int); | 138 | void est_init(int); | |
139 | int via_get_bus_clock(struct cpu_info *); | 139 | int via_get_bus_clock(struct cpu_info *); | |
140 | int viac7_get_bus_clock(struct cpu_info *); | 140 | int viac7_get_bus_clock(struct cpu_info *); | |
141 | int p3_get_bus_clock(struct cpu_info *); | 141 | int p3_get_bus_clock(struct cpu_info *); | |
142 | int p4_get_bus_clock(struct cpu_info *); | 142 | int p4_get_bus_clock(struct cpu_info *); | |
143 | #endif | 143 | #endif | |
144 | 144 | |||
145 | extern int (*est_sysctl_get)(SYSCTLFN_PROTO); | 145 | extern int (*cpu_freq_sysctl_get)(SYSCTLFN_PROTO); | |
146 | extern int (*est_sysctl_set)(SYSCTLFN_PROTO); | 146 | extern int (*cpu_freq_sysctl_set)(SYSCTLFN_PROTO); | |
147 | extern int (*est_sysctl_all)(SYSCTLFN_PROTO); | 147 | extern int (*cpu_freq_sysctl_all)(SYSCTLFN_PROTO); | |
148 | 148 | |||
149 | void cpu_get_tsc_freq(struct cpu_info *); | 149 | void cpu_get_tsc_freq(struct cpu_info *); | |
150 | void pat_init(struct cpu_info *); | 150 | void pat_init(struct cpu_info *); | |
151 | 151 | |||
152 | extern int cpu_vendor; | 152 | extern int cpu_vendor; | |
153 | extern bool x86_mp_online; | 153 | extern bool x86_mp_online; | |
154 | 154 | |||
155 | extern uint32_t cpu_feature[5]; | 155 | extern uint32_t cpu_feature[5]; | |
156 | 156 | |||
157 | #endif /* _KERNEL */ | 157 | #endif /* _KERNEL */ | |
158 | 158 | |||
159 | #endif /* !_X86_CPUVAR_H_ */ | 159 | #endif /* !_X86_CPUVAR_H_ */ |
--- src/sys/arch/x86/x86/cpu.c 2010/08/04 10:02:12 1.74
+++ src/sys/arch/x86/x86/cpu.c 2010/08/09 04:18:48 1.75
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: cpu.c,v 1.74 2010/08/04 10:02:12 jruoho Exp $ */ | 1 | /* $NetBSD: cpu.c,v 1.75 2010/08/09 04:18:48 jruoho Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2000, 2006, 2007, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2000, 2006, 2007, 2008 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Bill Sommerfeld of RedBack Networks Inc, and by Andrew Doran. | 8 | * by Bill Sommerfeld of RedBack Networks Inc, and by Andrew Doran. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -52,27 +52,27 @@ | @@ -52,27 +52,27 @@ | |||
52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
54 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE | 54 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE | |
55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
56 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 56 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
57 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 57 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
59 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 59 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
60 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 60 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
61 | * SUCH DAMAGE. | 61 | * SUCH DAMAGE. | |
62 | */ | 62 | */ | |
63 | 63 | |||
64 | #include <sys/cdefs.h> | 64 | #include <sys/cdefs.h> | |
65 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.74 2010/08/04 10:02:12 jruoho Exp $"); | 65 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.75 2010/08/09 04:18:48 jruoho Exp $"); | |
66 | 66 | |||
67 | #include "opt_ddb.h" | 67 | #include "opt_ddb.h" | |
68 | #include "opt_mpbios.h" /* for MPDEBUG */ | 68 | #include "opt_mpbios.h" /* for MPDEBUG */ | |
69 | #include "opt_mtrr.h" | 69 | #include "opt_mtrr.h" | |
70 | 70 | |||
71 | #include "lapic.h" | 71 | #include "lapic.h" | |
72 | #include "ioapic.h" | 72 | #include "ioapic.h" | |
73 | 73 | |||
74 | #ifdef i386 | 74 | #ifdef i386 | |
75 | #include "npx.h" | 75 | #include "npx.h" | |
76 | #endif | 76 | #endif | |
77 | 77 | |||
78 | #include <sys/param.h> | 78 | #include <sys/param.h> | |
@@ -175,26 +175,30 @@ uint32_t cpu_feature[5]; /* X86 CPUID fe | @@ -175,26 +175,30 @@ uint32_t cpu_feature[5]; /* X86 CPUID fe | |||
175 | * [1] basic features %ecx | 175 | * [1] basic features %ecx | |
176 | * [2] extended features %edx | 176 | * [2] extended features %edx | |
177 | * [3] extended features %ecx | 177 | * [3] extended features %ecx | |
178 | * [4] VIA padlock features | 178 | * [4] VIA padlock features | |
179 | */ | 179 | */ | |
180 | 180 | |||
181 | extern char x86_64_doubleflt_stack[]; | 181 | extern char x86_64_doubleflt_stack[]; | |
182 | 182 | |||
183 | bool x86_mp_online; | 183 | bool x86_mp_online; | |
184 | paddr_t mp_trampoline_paddr = MP_TRAMPOLINE; | 184 | paddr_t mp_trampoline_paddr = MP_TRAMPOLINE; | |
185 | static vaddr_t cmos_data_mapping; | 185 | static vaddr_t cmos_data_mapping; | |
186 | struct cpu_info *cpu_starting; | 186 | struct cpu_info *cpu_starting; | |
187 | 187 | |||
188 | int (*cpu_freq_sysctl_get)(SYSCTLFN_PROTO) = NULL; | |||
189 | int (*cpu_freq_sysctl_set)(SYSCTLFN_PROTO) = NULL; | |||
190 | int (*cpu_freq_sysctl_all)(SYSCTLFN_PROTO) = NULL; | |||
191 | ||||
188 | void cpu_hatch(void *); | 192 | void cpu_hatch(void *); | |
189 | static void cpu_boot_secondary(struct cpu_info *ci); | 193 | static void cpu_boot_secondary(struct cpu_info *ci); | |
190 | static void cpu_start_secondary(struct cpu_info *ci); | 194 | static void cpu_start_secondary(struct cpu_info *ci); | |
191 | static void cpu_copy_trampoline(void); | 195 | static void cpu_copy_trampoline(void); | |
192 | 196 | |||
193 | /* | 197 | /* | |
194 | * Runs once per boot once multiprocessor goo has been detected and | 198 | * Runs once per boot once multiprocessor goo has been detected and | |
195 | * the local APIC on the boot processor has been mapped. | 199 | * the local APIC on the boot processor has been mapped. | |
196 | * | 200 | * | |
197 | * Called from lapic_boot_init() (from mpbios_scan()). | 201 | * Called from lapic_boot_init() (from mpbios_scan()). | |
198 | */ | 202 | */ | |
199 | void | 203 | void | |
200 | cpu_init_first(void) | 204 | cpu_init_first(void) |
--- src/sys/arch/x86/x86/est.c 2010/08/08 16:58:42 1.16
+++ src/sys/arch/x86/x86/est.c 2010/08/09 04:18:49 1.17
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: est.c,v 1.16 2010/08/08 16:58:42 jruoho Exp $ */ | 1 | /* $NetBSD: est.c,v 1.17 2010/08/09 04:18:49 jruoho Exp $ */ | |
2 | /* | 2 | /* | |
3 | * Copyright (c) 2003 Michael Eriksson. | 3 | * Copyright (c) 2003 Michael Eriksson. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * 3. The name of the author may not be used to endorse or promote products | 14 | * 3. The name of the author may not be used to endorse or promote products | |
@@ -71,27 +71,27 @@ | @@ -71,27 +71,27 @@ | |||
71 | * Table 3-4, 3-5, 3-6, Voltage and Current Specifications. | 71 | * Table 3-4, 3-5, 3-6, Voltage and Current Specifications. | |
72 | * http://www.intel.com/design/mobile/datashts/302189.htm | 72 | * http://www.intel.com/design/mobile/datashts/302189.htm | |
73 | * | 73 | * | |
74 | * - Linux cpufreq patches, speedstep-centrino.c. | 74 | * - Linux cpufreq patches, speedstep-centrino.c. | |
75 | * Encoding of MSR_PERF_CTL and MSR_PERF_STATUS. | 75 | * Encoding of MSR_PERF_CTL and MSR_PERF_STATUS. | |
76 | * http://www.codemonkey.org.uk/projects/cpufreq/cpufreq-2.4.22-pre6-1.gz | 76 | * http://www.codemonkey.org.uk/projects/cpufreq/cpufreq-2.4.22-pre6-1.gz | |
77 | * | 77 | * | |
78 | * ACPI objects: _PCT is MSR location, _PSS is freq/voltage, _PPC is caps. | 78 | * ACPI objects: _PCT is MSR location, _PSS is freq/voltage, _PPC is caps. | |
79 | */ | 79 | */ | |
80 | 80 | |||
81 | /* #define EST_DEBUG */ | 81 | /* #define EST_DEBUG */ | |
82 | 82 | |||
83 | #include <sys/cdefs.h> | 83 | #include <sys/cdefs.h> | |
84 | __KERNEL_RCSID(0, "$NetBSD: est.c,v 1.16 2010/08/08 16:58:42 jruoho Exp $"); | 84 | __KERNEL_RCSID(0, "$NetBSD: est.c,v 1.17 2010/08/09 04:18:49 jruoho Exp $"); | |
85 | 85 | |||
86 | #include <sys/param.h> | 86 | #include <sys/param.h> | |
87 | #include <sys/systm.h> | 87 | #include <sys/systm.h> | |
88 | #include <sys/device.h> | 88 | #include <sys/device.h> | |
89 | #include <sys/malloc.h> | 89 | #include <sys/malloc.h> | |
90 | #include <sys/sysctl.h> | 90 | #include <sys/sysctl.h> | |
91 | #include <sys/once.h> | 91 | #include <sys/once.h> | |
92 | #include <sys/xcall.h> | 92 | #include <sys/xcall.h> | |
93 | 93 | |||
94 | #include <x86/cpuvar.h> | 94 | #include <x86/cpuvar.h> | |
95 | #include <x86/cputypes.h> | 95 | #include <x86/cputypes.h> | |
96 | #include <x86/cpu_msr.h> | 96 | #include <x86/cpu_msr.h> | |
97 | 97 | |||
@@ -1002,58 +1002,54 @@ static char *freq_names; | @@ -1002,58 +1002,54 @@ static char *freq_names; | |||
1002 | static struct fqlist fake_fqlist; | 1002 | static struct fqlist fake_fqlist; | |
1003 | static int est_node_target, est_node_current; | 1003 | static int est_node_target, est_node_current; | |
1004 | static const char est_desc[] = "Enhanced SpeedStep"; | 1004 | static const char est_desc[] = "Enhanced SpeedStep"; | |
1005 | static int lvendor, bus_clock; | 1005 | static int lvendor, bus_clock; | |
1006 | 1006 | |||
1007 | static int est_init_once(void); | 1007 | static int est_init_once(void); | |
1008 | static void est_init_main(int); | 1008 | static void est_init_main(int); | |
1009 | 1009 | |||
1010 | static int est_sysctl_helper(SYSCTLFN_PROTO); | 1010 | static int est_sysctl_helper(SYSCTLFN_PROTO); | |
1011 | static int est_sysctl_helper_get(SYSCTLFN_PROTO); | 1011 | static int est_sysctl_helper_get(SYSCTLFN_PROTO); | |
1012 | static int est_sysctl_helper_set(SYSCTLFN_PROTO); | 1012 | static int est_sysctl_helper_set(SYSCTLFN_PROTO); | |
1013 | static int est_sysctl_helper_all(SYSCTLFN_PROTO); | 1013 | static int est_sysctl_helper_all(SYSCTLFN_PROTO); | |
1014 | 1014 | |||
1015 | int (*est_sysctl_get)(SYSCTLFN_PROTO) = NULL; | |||
1016 | int (*est_sysctl_set)(SYSCTLFN_PROTO) = NULL; | |||
1017 | int (*est_sysctl_all)(SYSCTLFN_PROTO) = NULL; | |||
1018 | ||||
1019 | static int | 1015 | static int | |
1020 | est_sysctl_helper_get(SYSCTLFN_ARGS) | 1016 | est_sysctl_helper_get(SYSCTLFN_ARGS) | |
1021 | { | 1017 | { | |
1022 | 1018 | |||
1023 | if (est_sysctl_get != NULL) | 1019 | if (cpu_freq_sysctl_get != NULL) | |
1024 | return (*est_sysctl_get)(SYSCTLFN_CALL(rnode)); | 1020 | return (*cpu_freq_sysctl_get)(SYSCTLFN_CALL(rnode)); | |
1025 | 1021 | |||
1026 | return est_sysctl_helper(SYSCTLFN_CALL(rnode)); | 1022 | return est_sysctl_helper(SYSCTLFN_CALL(rnode)); | |
1027 | } | 1023 | } | |
1028 | 1024 | |||
1029 | static int | 1025 | static int | |
1030 | est_sysctl_helper_set(SYSCTLFN_ARGS) | 1026 | est_sysctl_helper_set(SYSCTLFN_ARGS) | |
1031 | { | 1027 | { | |
1032 | 1028 | |||
1033 | if (est_sysctl_set != NULL) | 1029 | if (cpu_freq_sysctl_set != NULL) | |
1034 | return (*est_sysctl_set)(SYSCTLFN_CALL(rnode)); | 1030 | return (*cpu_freq_sysctl_set)(SYSCTLFN_CALL(rnode)); | |
1035 | 1031 | |||
1036 | return est_sysctl_helper(SYSCTLFN_CALL(rnode)); | 1032 | return est_sysctl_helper(SYSCTLFN_CALL(rnode)); | |
1037 | } | 1033 | } | |
1038 | 1034 | |||
1039 | static int | 1035 | static int | |
1040 | est_sysctl_helper_all(SYSCTLFN_ARGS) | 1036 | est_sysctl_helper_all(SYSCTLFN_ARGS) | |
1041 | { | 1037 | { | |
1042 | struct sysctlnode node; | 1038 | struct sysctlnode node; | |
1043 | int err; | 1039 | int err; | |
1044 | 1040 | |||
1045 | if (est_sysctl_all != NULL) | 1041 | if (cpu_freq_sysctl_all != NULL) | |
1046 | return (*est_sysctl_all)(SYSCTLFN_CALL(rnode)); | 1042 | return (*cpu_freq_sysctl_all)(SYSCTLFN_CALL(rnode)); | |
1047 | 1043 | |||
1048 | if (freq_names == NULL) | 1044 | if (freq_names == NULL) | |
1049 | return ENXIO; | 1045 | return ENXIO; | |
1050 | 1046 | |||
1051 | node = *rnode; | 1047 | node = *rnode; | |
1052 | node.sysctl_data = freq_names; | 1048 | node.sysctl_data = freq_names; | |
1053 | 1049 | |||
1054 | err = sysctl_lookup(SYSCTLFN_CALL(&node)); | 1050 | err = sysctl_lookup(SYSCTLFN_CALL(&node)); | |
1055 | 1051 | |||
1056 | if (err != 0 || newp == NULL) | 1052 | if (err != 0 || newp == NULL) | |
1057 | return err; | 1053 | return err; | |
1058 | 1054 | |||
1059 | return 0; | 1055 | return 0; |