Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi If the thermal zone has a _PSL method, print a ...
details: https://anonhg.NetBSD.org/src/rev/949ab877b32a
branches: trunk
changeset: 761016:949ab877b32a
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Jan 18 21:15:54 2011 +0000
description:
If the thermal zone has a _PSL method, print a list of processors
associated with the zone at attach time.
acpitz0 at acpi0 (THM0)
acpitz0: levels: critical 127.0 C, passive cooling
acpitz1 at acpi0 (THM1): cpu0 cpu1
acpitz1: levels: critical 100.0 C, passive 95.5 C, passive cooling
diffstat:
sys/dev/acpi/acpi_tz.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 67 insertions(+), 5 deletions(-)
diffs (112 lines):
diff -r 635915ae52fe -r 949ab877b32a sys/dev/acpi/acpi_tz.c
--- a/sys/dev/acpi/acpi_tz.c Tue Jan 18 21:07:51 2011 +0000
+++ b/sys/dev/acpi/acpi_tz.c Tue Jan 18 21:15:54 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_tz.c,v 1.77 2011/01/09 14:58:10 jruoho Exp $ */
+/* $NetBSD: acpi_tz.c,v 1.78 2011/01/18 21:15:54 jmcneill Exp $ */
/*
* Copyright (c) 2003 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.77 2011/01/09 14:58:10 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.78 2011/01/18 21:15:54 jmcneill Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -133,6 +133,8 @@
#ifdef notyet
static ACPI_STATUS acpitz_set_fanspeed(device_t, uint32_t);
#endif
+static void acpitz_print_processor_list(device_t);
+static struct cpu_info *acpitz_find_processor(uint32_t);
CFATTACH_DECL_NEW(acpitz, sizeof(struct acpitz_softc),
acpitz_match, acpitz_attach, acpitz_detach, NULL);
@@ -162,14 +164,15 @@
ACPI_INTEGER val;
ACPI_STATUS rv;
- aprint_naive("\n");
- aprint_normal(": ACPI Thermal Zone\n");
-
sc->sc_first = true;
sc->sc_have_fan = false;
sc->sc_node = aa->aa_node;
sc->sc_zone.tzp = ATZ_TZP_RATE;
+ aprint_naive("\n");
+ acpitz_print_processor_list(self);
+ aprint_normal("\n");
+
/*
* The _TZP (ACPI 4.0, p. 430) defines the recommended
* polling interval (in tenths of seconds). A value zero
@@ -701,6 +704,65 @@
#endif
static void
+acpitz_print_processor_list(device_t dv)
+{
+ struct acpitz_softc *sc = device_private(dv);
+ ACPI_HANDLE handle = sc->sc_node->ad_handle;
+ ACPI_HANDLE prhandle;
+ ACPI_BUFFER buf, prbuf;
+ ACPI_OBJECT *obj, *pref, *pr;
+ ACPI_STATUS rv;
+ struct cpu_info *ci;
+ unsigned int i, cnt;
+
+ rv = acpi_eval_struct(handle, "_PSL", &buf);
+ if (ACPI_FAILURE(rv) || buf.Pointer == NULL)
+ return;
+ obj = buf.Pointer;
+ if (obj->Type != ACPI_TYPE_PACKAGE || obj->Package.Count == 0)
+ goto done;
+
+ for (i = 0, cnt = 0; i < obj->Package.Count; i++) {
+ pref = &obj->Package.Elements[i];
+ rv = acpi_eval_reference_handle(pref, &prhandle);
+ if (ACPI_FAILURE(rv))
+ continue;
+ rv = acpi_eval_struct(prhandle, NULL, &prbuf);
+ if (ACPI_FAILURE(rv) || prbuf.Pointer == NULL)
+ continue;
+ pr = prbuf.Pointer;
+ if (pr->Type != ACPI_TYPE_PROCESSOR)
+ goto next;
+
+ ci = acpitz_find_processor(pr->Processor.ProcId);
+ if (ci) {
+ if (cnt == 0)
+ aprint_normal(":");
+ aprint_normal(" %s", device_xname(ci->ci_dev));
+ ++cnt;
+ }
+next:
+ ACPI_FREE(prbuf.Pointer);
+ }
+
+done:
+ ACPI_FREE(buf.Pointer);
+}
+
+static struct cpu_info *
+acpitz_find_processor(uint32_t id)
+{
+ CPU_INFO_ITERATOR cii;
+ struct cpu_info *ci;
+
+ for (CPU_INFO_FOREACH(cii, ci))
+ if (ci->ci_acpiid == id)
+ return ci;
+
+ return NULL;
+}
+
+static void
acpitz_tick(void *opaque)
{
device_t dv = opaque;
Home |
Main Index |
Thread Index |
Old Index