Remove a redundant function.diff -r1.7 -r1.8 src/sys/arch/x86/acpi/acpi_cpu_md.c
(jruoho)
--- src/sys/arch/x86/acpi/acpi_cpu_md.c 2010/08/09 04:27:07 1.7
+++ src/sys/arch/x86/acpi/acpi_cpu_md.c 2010/08/09 13:41:39 1.8
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: acpi_cpu_md.c,v 1.7 2010/08/09 04:27:07 jruoho Exp $ */ | 1 | /* $NetBSD: acpi_cpu_md.c,v 1.8 2010/08/09 13:41:39 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.7 2010/08/09 04:27:07 jruoho Exp $"); | 30 | __KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.8 2010/08/09 13:41:39 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> | |
@@ -128,42 +128,32 @@ acpicpu_md_quirks(void) | @@ -128,42 +128,32 @@ acpicpu_md_quirks(void) | |||
128 | } | 128 | } | |
129 | 129 | |||
130 | return val; | 130 | return val; | |
131 | } | 131 | } | |
132 | 132 | |||
133 | uint32_t | 133 | uint32_t | |
134 | acpicpu_md_cpus_running(void) | 134 | acpicpu_md_cpus_running(void) | |
135 | { | 135 | { | |
136 | 136 | |||
137 | return popcount32(cpus_running); | 137 | return popcount32(cpus_running); | |
138 | } | 138 | } | |
139 | 139 | |||
140 | int | 140 | int | |
141 | acpicpu_md_idle_init(void) | 141 | acpicpu_md_idle_start(void) | |
142 | { | 142 | { | |
143 | const size_t size = sizeof(native_idle_text); | 143 | const size_t size = sizeof(native_idle_text); | |
144 | 144 | |||
145 | x86_disable_intr(); | 145 | x86_disable_intr(); | |
146 | x86_cpu_idle_get(&native_idle, native_idle_text, size); | 146 | x86_cpu_idle_get(&native_idle, native_idle_text, size); | |
147 | x86_enable_intr(); | |||
148 | ||||
149 | return 0; | |||
150 | } | |||
151 | ||||
152 | int | |||
153 | acpicpu_md_idle_start(void) | |||
154 | { | |||
155 | ||||
156 | x86_disable_intr(); | |||
157 | x86_cpu_idle_set(acpicpu_cstate_idle, "acpi"); | 147 | x86_cpu_idle_set(acpicpu_cstate_idle, "acpi"); | |
158 | x86_enable_intr(); | 148 | x86_enable_intr(); | |
159 | 149 | |||
160 | return 0; | 150 | return 0; | |
161 | } | 151 | } | |
162 | 152 | |||
163 | int | 153 | int | |
164 | acpicpu_md_idle_stop(void) | 154 | acpicpu_md_idle_stop(void) | |
165 | { | 155 | { | |
166 | uint64_t xc; | 156 | uint64_t xc; | |
167 | 157 | |||
168 | x86_disable_intr(); | 158 | x86_disable_intr(); | |
169 | x86_cpu_idle_set(native_idle, native_idle_text); | 159 | x86_cpu_idle_set(native_idle, native_idle_text); |
--- src/sys/dev/acpi/acpi_cpu.h 2010/08/08 18:47:54 1.10
+++ src/sys/dev/acpi/acpi_cpu.h 2010/08/09 13:41:38 1.11
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: acpi_cpu.h,v 1.10 2010/08/08 18:47:54 jruoho Exp $ */ | 1 | /* $NetBSD: acpi_cpu.h,v 1.11 2010/08/09 13:41:38 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 | |
@@ -181,23 +181,22 @@ void acpicpu_cstate_idle(void); | @@ -181,23 +181,22 @@ void acpicpu_cstate_idle(void); | |||
181 | 181 | |||
182 | void acpicpu_pstate_attach(device_t); | 182 | void acpicpu_pstate_attach(device_t); | |
183 | int acpicpu_pstate_detach(device_t); | 183 | int acpicpu_pstate_detach(device_t); | |
184 | int acpicpu_pstate_start(device_t); | 184 | int acpicpu_pstate_start(device_t); | |
185 | bool acpicpu_pstate_suspend(device_t); | 185 | bool acpicpu_pstate_suspend(device_t); | |
186 | bool acpicpu_pstate_resume(device_t); | 186 | bool acpicpu_pstate_resume(device_t); | |
187 | void acpicpu_pstate_callback(void *); | 187 | void acpicpu_pstate_callback(void *); | |
188 | int acpicpu_pstate_get(struct acpicpu_softc *, uint32_t *); | 188 | int acpicpu_pstate_get(struct acpicpu_softc *, uint32_t *); | |
189 | int acpicpu_pstate_set(struct acpicpu_softc *, uint32_t); | 189 | int acpicpu_pstate_set(struct acpicpu_softc *, uint32_t); | |
190 | 190 | |||
191 | uint32_t acpicpu_md_cap(void); | 191 | uint32_t acpicpu_md_cap(void); | |
192 | uint32_t acpicpu_md_quirks(void); | 192 | uint32_t acpicpu_md_quirks(void); | |
193 | uint32_t acpicpu_md_cpus_running(void); | 193 | uint32_t acpicpu_md_cpus_running(void); | |
194 | int acpicpu_md_idle_init(void); | |||
195 | int acpicpu_md_idle_start(void); | 194 | int acpicpu_md_idle_start(void); | |
196 | int acpicpu_md_idle_stop(void); | 195 | int acpicpu_md_idle_stop(void); | |
197 | void acpicpu_md_idle_enter(int, int); | 196 | void acpicpu_md_idle_enter(int, int); | |
198 | int acpicpu_md_pstate_start(void); | 197 | int acpicpu_md_pstate_start(void); | |
199 | int acpicpu_md_pstate_stop(void); | 198 | int acpicpu_md_pstate_stop(void); | |
200 | int acpicpu_md_pstate_get(struct acpicpu_softc *, uint32_t *); | 199 | int acpicpu_md_pstate_get(struct acpicpu_softc *, uint32_t *); | |
201 | int acpicpu_md_pstate_set(struct acpicpu_pstate *); | 200 | int acpicpu_md_pstate_set(struct acpicpu_pstate *); | |
202 | 201 | |||
203 | #endif /* !_SYS_DEV_ACPI_ACPI_CPU_H */ | 202 | #endif /* !_SYS_DEV_ACPI_ACPI_CPU_H */ |
--- src/sys/dev/acpi/acpi_cpu_cstate.c 2010/08/09 05:00:24 1.17
+++ src/sys/dev/acpi/acpi_cpu_cstate.c 2010/08/09 13:41:38 1.18
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: acpi_cpu_cstate.c,v 1.17 2010/08/09 05:00:24 jruoho Exp $ */ | 1 | /* $NetBSD: acpi_cpu_cstate.c,v 1.18 2010/08/09 13:41:38 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_cstate.c,v 1.17 2010/08/09 05:00:24 jruoho Exp $"); | 30 | __KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.18 2010/08/09 13:41:38 jruoho Exp $"); | |
31 | 31 | |||
32 | #include <sys/param.h> | 32 | #include <sys/param.h> | |
33 | #include <sys/cpu.h> | 33 | #include <sys/cpu.h> | |
34 | #include <sys/device.h> | 34 | #include <sys/device.h> | |
35 | #include <sys/kernel.h> | 35 | #include <sys/kernel.h> | |
36 | #include <sys/once.h> | 36 | #include <sys/once.h> | |
37 | #include <sys/mutex.h> | 37 | #include <sys/mutex.h> | |
38 | #include <sys/timetc.h> | 38 | #include <sys/timetc.h> | |
39 | 39 | |||
40 | #include <dev/pci/pcivar.h> | 40 | #include <dev/pci/pcivar.h> | |
41 | #include <dev/pci/pcidevs.h> | 41 | #include <dev/pci/pcidevs.h> | |
42 | 42 | |||
43 | #include <dev/acpi/acpireg.h> | 43 | #include <dev/acpi/acpireg.h> | |
@@ -155,38 +155,32 @@ acpicpu_cstate_detach(device_t self) | @@ -155,38 +155,32 @@ acpicpu_cstate_detach(device_t self) | |||
155 | if (rv != 0) | 155 | if (rv != 0) | |
156 | return rv; | 156 | return rv; | |
157 | 157 | |||
158 | sc->sc_flags &= ~ACPICPU_FLAG_C; | 158 | sc->sc_flags &= ~ACPICPU_FLAG_C; | |
159 | 159 | |||
160 | return 0; | 160 | return 0; | |
161 | } | 161 | } | |
162 | 162 | |||
163 | int | 163 | int | |
164 | acpicpu_cstate_start(device_t self) | 164 | acpicpu_cstate_start(device_t self) | |
165 | { | 165 | { | |
166 | struct acpicpu_softc *sc = device_private(self); | 166 | struct acpicpu_softc *sc = device_private(self); | |
167 | static ONCE_DECL(once_start); | 167 | static ONCE_DECL(once_start); | |
168 | static ONCE_DECL(once_save); | |||
169 | int rv; | 168 | int rv; | |
170 | 169 | |||
171 | /* | 170 | /* | |
172 | * Save the existing idle-mechanism and claim the idle_loop(9). | 171 | * Save the existing idle-mechanism and claim the idle_loop(9). | |
173 | * This should be called after all ACPI CPUs have been attached. | 172 | * This should be called after all ACPI CPUs have been attached. | |
174 | */ | 173 | */ | |
175 | rv = RUN_ONCE(&once_save, acpicpu_md_idle_init); | |||
176 | ||||
177 | if (rv != 0) | |||
178 | return rv; | |||
179 | ||||
180 | rv = RUN_ONCE(&once_start, acpicpu_md_idle_start); | 174 | rv = RUN_ONCE(&once_start, acpicpu_md_idle_start); | |
181 | 175 | |||
182 | if (rv == 0) | 176 | if (rv == 0) | |
183 | sc->sc_flags |= ACPICPU_FLAG_C; | 177 | sc->sc_flags |= ACPICPU_FLAG_C; | |
184 | 178 | |||
185 | return rv; | 179 | return rv; | |
186 | } | 180 | } | |
187 | 181 | |||
188 | bool | 182 | bool | |
189 | acpicpu_cstate_suspend(device_t self) | 183 | acpicpu_cstate_suspend(device_t self) | |
190 | { | 184 | { | |
191 | 185 | |||
192 | return true; | 186 | return true; |