Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Use the new acpi_match_cpu_handle() from acpi_u...
details: https://anonhg.NetBSD.org/src/rev/440730be6dda
branches: trunk
changeset: 766306:440730be6dda
user: jruoho <jruoho%NetBSD.org@localhost>
date: Mon Jun 20 15:36:49 2011 +0000
description:
Use the new acpi_match_cpu_handle() from acpi_util.c.
diffstat:
sys/dev/acpi/acpi_tz.c | 52 ++++++++++++++++++-------------------------------
1 files changed, 19 insertions(+), 33 deletions(-)
diffs (104 lines):
diff -r 1597d89249ef -r 440730be6dda sys/dev/acpi/acpi_tz.c
--- a/sys/dev/acpi/acpi_tz.c Mon Jun 20 15:33:49 2011 +0000
+++ b/sys/dev/acpi/acpi_tz.c Mon Jun 20 15:36:49 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_tz.c,v 1.80 2011/06/06 17:49:41 pgoyette Exp $ */
+/* $NetBSD: acpi_tz.c,v 1.81 2011/06/20 15:36:49 jruoho 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.80 2011/06/06 17:49:41 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.81 2011/06/20 15:36:49 jruoho Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -134,7 +134,6 @@
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);
@@ -708,60 +707,47 @@
{
struct acpitz_softc *sc = device_private(dv);
ACPI_HANDLE handle = sc->sc_node->ad_handle;
+ ACPI_OBJECT *obj, *pref;
ACPI_HANDLE prhandle;
- ACPI_BUFFER buf, prbuf;
- ACPI_OBJECT *obj, *pref, *pr;
+ ACPI_BUFFER buf;
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++) {
+ for (cnt = i = 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)
+
+ ci = acpi_match_cpu_handle(prhandle);
+
+ if (ci == 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);
+ if (cnt == 0)
+ aprint_normal(":");
+
+ aprint_normal(" %s", device_xname(ci->ci_dev));
+ ++cnt;
}
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)
{
Home |
Main Index |
Thread Index |
Old Index