Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi Store a pointer to cpu_info rather than cpu_inf...



details:   https://anonhg.NetBSD.org/src/rev/440d20192d6b
branches:  trunk
changeset: 762658:440d20192d6b
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Fri Feb 25 06:18:02 2011 +0000

description:
Store a pointer to cpu_info rather than cpu_info::ci_acpiid alone.

diffstat:

 sys/dev/acpi/acpi_cpu.c |  30 +++++++++++++++++-------------
 sys/dev/acpi/acpi_cpu.h |   4 ++--
 2 files changed, 19 insertions(+), 15 deletions(-)

diffs (124 lines):

diff -r 19fc1d91aab9 -r 440d20192d6b sys/dev/acpi/acpi_cpu.c
--- a/sys/dev/acpi/acpi_cpu.c   Fri Feb 25 05:07:43 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu.c   Fri Feb 25 06:18:02 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.26 2011/02/16 08:35:51 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.27 2011/02/25 06:18:02 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 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.26 2011/02/16 08:35:51 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.27 2011/02/25 06:18:02 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -57,7 +57,7 @@
 static void              acpicpu_sysctl(device_t);
 
 static int               acpicpu_object(ACPI_HANDLE, struct acpicpu_object *);
-static cpuid_t           acpicpu_id(uint32_t);
+static struct cpu_info  *acpicpu_ci(uint32_t);
 static uint32_t                  acpicpu_cap(struct acpicpu_softc *);
 static ACPI_STATUS       acpicpu_cap_pdc(struct acpicpu_softc *, uint32_t);
 static ACPI_STATUS       acpicpu_cap_osc(struct acpicpu_softc *,
@@ -95,7 +95,7 @@
 
        rv = acpicpu_object(aa->aa_node->ad_handle, &ao);
 
-       if (rv != 0 || acpicpu_id(ao.ao_procid) == 0xFFFFFF)
+       if (rv != 0 || acpicpu_ci(ao.ao_procid) == NULL)
                return 0;
 
        return 1;
@@ -107,6 +107,7 @@
        struct acpicpu_softc *sc = device_private(self);
        struct acpi_attach_args *aa = aux;
        static ONCE_DECL(once_attach);
+       cpuid_t id;
        int rv;
 
        rv = acpicpu_object(aa->aa_node->ad_handle, &sc->sc_object);
@@ -122,14 +123,17 @@
        sc->sc_dev = self;
        sc->sc_cold = true;
        sc->sc_node = aa->aa_node;
-       sc->sc_cpuid = acpicpu_id(sc->sc_object.ao_procid);
+
+       sc->sc_ci = acpicpu_ci(sc->sc_object.ao_procid);
 
-       if (sc->sc_cpuid == 0xFFFFFF) {
-               aprint_error(": invalid CPU ID\n");
+       if (sc->sc_ci == NULL) {
+               aprint_error(": invalid CPU\n");
                return;
        }
 
-       if (acpicpu_sc[sc->sc_cpuid] != NULL) {
+       id = sc->sc_ci->ci_acpiid;
+
+       if (acpicpu_sc[id] != NULL) {
                aprint_error(": already attached\n");
                return;
        }
@@ -138,7 +142,7 @@
        aprint_normal(": ACPI CPU\n");
 
        acpi_cpus++;
-       acpicpu_sc[sc->sc_cpuid] = sc;
+       acpicpu_sc[id] = sc;
 
        sc->sc_cap = acpicpu_cap(sc);
        sc->sc_flags |= acpicpu_md_quirks();
@@ -356,8 +360,8 @@
        return ACPI_FAILURE(rv) ? 1 : 0;
 }
 
-static cpuid_t
-acpicpu_id(uint32_t id)
+static struct cpu_info *
+acpicpu_ci(uint32_t id)
 {
        CPU_INFO_ITERATOR cii;
        struct cpu_info *ci;
@@ -365,10 +369,10 @@
        for (CPU_INFO_FOREACH(cii, ci)) {
 
                if (id == ci->ci_acpiid)
-                       return id;
+                       return ci;
        }
 
-       return 0xFFFFFF;
+       return NULL;
 }
 
 static uint32_t
diff -r 19fc1d91aab9 -r 440d20192d6b sys/dev/acpi/acpi_cpu.h
--- a/sys/dev/acpi/acpi_cpu.h   Fri Feb 25 05:07:43 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu.h   Fri Feb 25 06:18:02 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.h,v 1.28 2011/01/13 03:40:51 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.h,v 1.29 2011/02/25 06:18:02 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -178,6 +178,7 @@
 
 struct acpicpu_softc {
        device_t                 sc_dev;
+       struct cpu_info         *sc_ci;
        struct acpi_devnode     *sc_node;
        struct acpicpu_object    sc_object;
 
@@ -203,7 +204,6 @@
        kmutex_t                 sc_mtx;
        uint32_t                 sc_cap;
        uint32_t                 sc_flags;
-       cpuid_t                  sc_cpuid;
        bool                     sc_cold;
 };
 



Home | Main Index | Thread Index | Old Index