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_info() from acpi_uti...
details: https://anonhg.NetBSD.org/src/rev/1597d89249ef
branches: trunk
changeset: 766305:1597d89249ef
user: jruoho <jruoho%NetBSD.org@localhost>
date: Mon Jun 20 15:33:49 2011 +0000
description:
Use the new acpi_match_cpu_info() from acpi_util.c.
diffstat:
sys/dev/acpi/acpi_cpu.c | 70 +++++++-----------------------------------------
1 files changed, 11 insertions(+), 59 deletions(-)
diffs (132 lines):
diff -r 6a941a18588b -r 1597d89249ef sys/dev/acpi/acpi_cpu.c
--- a/sys/dev/acpi/acpi_cpu.c Mon Jun 20 15:31:52 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu.c Mon Jun 20 15:33:49 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.41 2011/06/12 10:11:52 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.42 2011/06/20 15:33:49 jruoho Exp $ */
/*-
* Copyright (c) 2010, 2011 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.41 2011/06/12 10:11:52 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.42 2011/06/20 15:33:49 jruoho Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -57,8 +57,6 @@
static void acpicpu_sysctl(device_t);
static ACPI_STATUS acpicpu_object(ACPI_HANDLE, struct acpicpu_object *);
-static int acpicpu_find(struct cpu_info *,
- struct acpi_devnode **);
static uint32_t acpicpu_cap(struct acpicpu_softc *);
static ACPI_STATUS acpicpu_cap_osc(struct acpicpu_softc *,
uint32_t, uint32_t *);
@@ -85,11 +83,6 @@
{ "Supermicro", "PDSMi-LN4", "0123456789" },
};
-static const char * const acpicpu_hid[] = {
- "ACPI0007",
- NULL
-};
-
CFATTACH_DECL_NEW(acpicpu, sizeof(struct acpicpu_softc),
acpicpu_match, acpicpu_attach, acpicpu_detach, NULL);
@@ -123,7 +116,10 @@
if (ci == NULL)
return 0;
- return acpicpu_find(ci, NULL);
+ if (acpi_match_cpu_info(ci) == NULL)
+ return 0;
+
+ return 10;
}
static void
@@ -131,6 +127,7 @@
{
struct acpicpu_softc *sc = device_private(self);
struct cpu_info *ci;
+ ACPI_HANDLE hdl;
cpuid_t id;
int rv;
@@ -142,15 +139,16 @@
sc->sc_ci = ci;
sc->sc_dev = self;
sc->sc_cold = true;
- sc->sc_node = NULL;
- rv = acpicpu_find(ci, &sc->sc_node);
+ hdl = acpi_match_cpu_info(ci);
- if (rv == 0) {
+ if (hdl == NULL) {
aprint_normal(": failed to match processor\n");
return;
}
+ sc->sc_node = acpi_get_node(hdl);
+
if (acpicpu_once_attach() != 0) {
aprint_normal(": failed to initialize\n");
return;
@@ -404,52 +402,6 @@
return rv;
}
-static int
-acpicpu_find(struct cpu_info *ci, struct acpi_devnode **ptr)
-{
- struct acpi_softc *sc = acpi_softc;
- struct acpicpu_object ao;
- struct acpi_devnode *ad;
- ACPI_INTEGER val;
- ACPI_STATUS rv;
-
- if (sc == NULL || acpi_active == 0)
- return 0;
-
- /*
- * CPUs are declared in the ACPI namespace
- * either as a Processor() or as a Device().
- * In both cases the MADT entries are used
- * for the match (see ACPI 4.0, section 8.4).
- */
- SIMPLEQ_FOREACH(ad, &sc->ad_head, ad_list) {
-
- if (ad->ad_type == ACPI_TYPE_PROCESSOR) {
-
- rv = acpicpu_object(ad->ad_handle, &ao);
-
- if (ACPI_SUCCESS(rv) && ci->ci_acpiid == ao.ao_procid)
- goto out;
- }
-
- if (acpi_match_hid(ad->ad_devinfo, acpicpu_hid) != 0) {
-
- rv = acpi_eval_integer(ad->ad_handle, "_UID", &val);
-
- if (ACPI_SUCCESS(rv) && ci->ci_acpiid == val)
- goto out;
- }
- }
-
- return 0;
-
-out:
- if (ptr != NULL)
- *ptr = ad;
-
- return 10;
-}
-
static uint32_t
acpicpu_cap(struct acpicpu_softc *sc)
{
Home |
Main Index |
Thread Index |
Old Index