Deleted Added
full compact
acpi_cpu.c (133616) acpi_cpu.c (136366)
1/*-
2 * Copyright (c) 2003 Nate Lawson (SDG)
3 * Copyright (c) 2001 Michael Smith
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003 Nate Lawson (SDG)
3 * Copyright (c) 2001 Michael Smith
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_cpu.c 133616 2004-08-13 06:21:47Z njl $");
29__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_cpu.c 136366 2004-10-11 05:39:15Z njl $");
30
31#include "opt_acpi.h"
32#include <sys/param.h>
33#include <sys/bus.h>
34#include <sys/kernel.h>
35#include <sys/malloc.h>
36#include <sys/module.h>
37#include <sys/pcpu.h>
38#include <sys/power.h>
39#include <sys/proc.h>
40#include <sys/sbuf.h>
41#include <sys/smp.h>
42
43#include <dev/pci/pcivar.h>
44#include <machine/atomic.h>
45#include <machine/bus.h>
30
31#include "opt_acpi.h"
32#include <sys/param.h>
33#include <sys/bus.h>
34#include <sys/kernel.h>
35#include <sys/malloc.h>
36#include <sys/module.h>
37#include <sys/pcpu.h>
38#include <sys/power.h>
39#include <sys/proc.h>
40#include <sys/sbuf.h>
41#include <sys/smp.h>
42
43#include <dev/pci/pcivar.h>
44#include <machine/atomic.h>
45#include <machine/bus.h>
46#ifdef __ia64__
47#include <machine/pal.h>
48#endif
49#include <sys/rman.h>
50
51#include "acpi.h"
52#include <dev/acpica/acpivar.h>
53
54/*
55 * Support for ACPI Processor devices, including ACPI 2.0 throttling
56 * and C[1-3] sleep states.

--- 93 unchanged lines hidden (view full) ---

150static int acpi_cpu_throttle_probe(struct acpi_cpu_softc *sc);
151static int acpi_cpu_cx_probe(struct acpi_cpu_softc *sc);
152static int acpi_cpu_cx_cst(struct acpi_cpu_softc *sc);
153static void acpi_cpu_startup(void *arg);
154static void acpi_cpu_startup_throttling(void);
155static void acpi_cpu_startup_cx(void);
156static void acpi_cpu_throttle_set(uint32_t speed);
157static void acpi_cpu_idle(void);
46#include <sys/rman.h>
47
48#include "acpi.h"
49#include <dev/acpica/acpivar.h>
50
51/*
52 * Support for ACPI Processor devices, including ACPI 2.0 throttling
53 * and C[1-3] sleep states.

--- 93 unchanged lines hidden (view full) ---

147static int acpi_cpu_throttle_probe(struct acpi_cpu_softc *sc);
148static int acpi_cpu_cx_probe(struct acpi_cpu_softc *sc);
149static int acpi_cpu_cx_cst(struct acpi_cpu_softc *sc);
150static void acpi_cpu_startup(void *arg);
151static void acpi_cpu_startup_throttling(void);
152static void acpi_cpu_startup_cx(void);
153static void acpi_cpu_throttle_set(uint32_t speed);
154static void acpi_cpu_idle(void);
158static void acpi_cpu_c1(void);
159static void acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context);
160static int acpi_cpu_quirks(struct acpi_cpu_softc *sc);
161static int acpi_cpu_throttle_sysctl(SYSCTL_HANDLER_ARGS);
162static int acpi_cpu_usage_sysctl(SYSCTL_HANDLER_ARGS);
163static int acpi_cpu_cx_lowest_sysctl(SYSCTL_HANDLER_ARGS);
164
165static device_method_t acpi_cpu_methods[] = {
166 /* Device interface */

--- 746 unchanged lines hidden (view full) ---

913 }
914
915 /* Find the actual time asleep in microseconds, minus overhead. */
916 end_time = acpi_TimerDelta(end_time, start_time);
917 sc->cpu_prev_sleep = PM_USEC(end_time) - cx_next->trans_lat;
918 ACPI_ENABLE_IRQS();
919}
920
155static void acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context);
156static int acpi_cpu_quirks(struct acpi_cpu_softc *sc);
157static int acpi_cpu_throttle_sysctl(SYSCTL_HANDLER_ARGS);
158static int acpi_cpu_usage_sysctl(SYSCTL_HANDLER_ARGS);
159static int acpi_cpu_cx_lowest_sysctl(SYSCTL_HANDLER_ARGS);
160
161static device_method_t acpi_cpu_methods[] = {
162 /* Device interface */

--- 746 unchanged lines hidden (view full) ---

909 }
910
911 /* Find the actual time asleep in microseconds, minus overhead. */
912 end_time = acpi_TimerDelta(end_time, start_time);
913 sc->cpu_prev_sleep = PM_USEC(end_time) - cx_next->trans_lat;
914 ACPI_ENABLE_IRQS();
915}
916
921/* Put the CPU in C1 in a machine-dependant way. */
922static void
923acpi_cpu_c1()
924{
925#ifdef __ia64__
926 ia64_call_pal_static(PAL_HALT_LIGHT, 0, 0, 0);
927#else
928 __asm __volatile("sti; hlt");
929#endif
930}
931
932/*
933 * Re-evaluate the _PSS and _CST objects when we are notified that they
934 * have changed.
935 *
936 * XXX Re-evaluation disabled until locking is done.
937 */
938static void
939acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context)

--- 165 unchanged lines hidden ---
917/*
918 * Re-evaluate the _PSS and _CST objects when we are notified that they
919 * have changed.
920 *
921 * XXX Re-evaluation disabled until locking is done.
922 */
923static void
924acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context)

--- 165 unchanged lines hidden ---