Source-Changes-HG archive

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

[src/trunk]: src/sys Move acpicpu(4) from "acpinodebus" to "cpufeaturebus".



details:   https://anonhg.NetBSD.org/src/rev/514f8546d8dd
branches:  trunk
changeset: 762761:514f8546d8dd
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sun Feb 27 17:10:33 2011 +0000

description:
Move acpicpu(4) from "acpinodebus" to "cpufeaturebus".

diffstat:

 sys/arch/amd64/conf/GENERIC        |    6 +-
 sys/arch/i386/conf/ALL             |    6 +-
 sys/arch/i386/conf/GENERIC         |    6 +-
 sys/arch/x86/conf/files.x86        |   11 +-
 sys/dev/acpi/acpi.c                |    9 +-
 sys/dev/acpi/acpi_cpu.c            |  212 +++++++++++++++++++++---------------
 sys/dev/acpi/acpi_cpu_pstate.c     |    5 +-
 sys/dev/acpi/files.acpi            |   10 +-
 sys/modules/acpicpu/acpicpu.ioconf |    8 +-
 9 files changed, 154 insertions(+), 119 deletions(-)

diffs (truncated from 658 to 300 lines):

diff -r f2983ee1e96b -r 514f8546d8dd sys/arch/amd64/conf/GENERIC
--- a/sys/arch/amd64/conf/GENERIC       Sun Feb 27 15:16:31 2011 +0000
+++ b/sys/arch/amd64/conf/GENERIC       Sun Feb 27 17:10:33 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.314 2011/02/24 10:56:00 jruoho Exp $
+# $NetBSD: GENERIC,v 1.315 2011/02/27 17:10:33 jruoho Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.314 $"
+#ident                 "GENERIC-$Revision: 1.315 $"
 
 maxusers       64              # estimated number of users
 
@@ -79,6 +79,7 @@
 options        SYSCTL_INCLUDE_DESCR    # Include sysctl descriptions in kernel
 
 # CPU features
+#acpicpu*      at cpu?         # ACPI CPU (including frequency scaling)
 coretemp*      at cpu?         # Intel on-die thermal sensor
 est0           at cpu0         # Intel Enhanced SpeedStep (non-ACPI)
 powernow0      at cpu0         # AMD PowerNow! and Cool'n'Quiet (non-ACPI)
@@ -279,7 +280,6 @@
 acpiacad*      at acpi?                # ACPI AC Adapter
 acpibat*       at acpi?                # ACPI Battery
 acpibut*       at acpi?                # ACPI Button
-#acpicpu*      at acpi?                # ACPI CPU
 acpidalb*      at acpi?                # Direct Application Launch Button
 acpiec*        at acpi?                # ACPI Embedded Controller (late)
 acpiecdt*      at acpi?                # ACPI Embedded Controller (early)
diff -r f2983ee1e96b -r 514f8546d8dd sys/arch/i386/conf/ALL
--- a/sys/arch/i386/conf/ALL    Sun Feb 27 15:16:31 2011 +0000
+++ b/sys/arch/i386/conf/ALL    Sun Feb 27 17:10:33 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.298 2011/02/26 18:07:30 ahoka Exp $
+# $NetBSD: ALL,v 1.299 2011/02/27 17:10:33 jruoho Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "ALL-$Revision: 1.298 $"
+#ident                 "ALL-$Revision: 1.299 $"
 
 maxusers       64              # estimated number of users
 
@@ -30,6 +30,7 @@
 options        PAE             # PAE mode (36 bits physical addressing)
 
 # CPU features
+acpicpu*       at cpu?         # ACPI CPU (including frequency scaling)
 coretemp*      at cpu?         # Intel on-die thermal sensor
 est0           at cpu0         # Intel Enhanced SpeedStep (non-ACPI)
 padlock0       at cpu0         # VIA PadLock
@@ -356,7 +357,6 @@
 acpiacad*      at acpi?                # ACPI AC Adapter
 acpibat*       at acpi?                # ACPI Battery
 acpibut*       at acpi?                # ACPI Button
-acpicpu*       at acpi?                # ACPI CPU
 acpidalb*      at acpi?                # ACPI Direct Application Launch Button
 acpiec*        at acpi?                # ACPI Embedded Controller (late)
 acpiecdt*      at acpi?                # ACPI Embedded Controller (early)
diff -r f2983ee1e96b -r 514f8546d8dd sys/arch/i386/conf/GENERIC
--- a/sys/arch/i386/conf/GENERIC        Sun Feb 27 15:16:31 2011 +0000
+++ b/sys/arch/i386/conf/GENERIC        Sun Feb 27 17:10:33 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1023 2011/02/24 13:58:39 jruoho Exp $
+# $NetBSD: GENERIC,v 1.1024 2011/02/27 17:10:34 jruoho Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.1023 $"
+#ident                 "GENERIC-$Revision: 1.1024 $"
 
 maxusers       64              # estimated number of users
 
@@ -38,6 +38,7 @@
 #options       PAE             # PAE mode (36 bits physical addressing)
 
 # CPU features
+#acpicpu*      at cpu?         # ACPI CPU (including frequency scaling)
 coretemp*      at cpu?         # Intel on-die thermal sensor
 est0           at cpu0         # Intel Enhanced SpeedStep (non-ACPI)
 #padlock0      at cpu0         # VIA PadLock
@@ -348,7 +349,6 @@
 acpiacad*      at acpi?                # ACPI AC Adapter
 acpibat*       at acpi?                # ACPI Battery
 acpibut*       at acpi?                # ACPI Button
-#acpicpu*      at acpi?                # ACPI CPU
 acpidalb*      at acpi?                # ACPI Direct Application Launch Button
 acpiec*        at acpi?                # ACPI Embedded Controller (late)
 acpiecdt*      at acpi?                # ACPI Embedded Controller (early)
diff -r f2983ee1e96b -r 514f8546d8dd sys/arch/x86/conf/files.x86
--- a/sys/arch/x86/conf/files.x86       Sun Feb 27 15:16:31 2011 +0000
+++ b/sys/arch/x86/conf/files.x86       Sun Feb 27 17:10:33 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.x86,v 1.62 2011/02/24 13:58:39 jruoho Exp $
+#      $NetBSD: files.x86,v 1.63 2011/02/27 17:10:33 jruoho Exp $
 
 # options for MP configuration through the MP spec
 defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI
@@ -31,6 +31,14 @@
 attach cpu at cpubus
 file   arch/x86/x86/cpu.c              cpu
 
+device acpicpu
+attach acpicpu at cpufeaturebus
+file   dev/acpi/acpi_cpu.c             acpi & acpicpu
+file   dev/acpi/acpi_cpu_cstate.c      acpi & acpicpu
+file   dev/acpi/acpi_cpu_pstate.c      acpi & acpicpu
+file   dev/acpi/acpi_cpu_tstate.c      acpi & acpicpu
+file   arch/x86/acpi/acpi_cpu_md.c     acpi & acpicpu
+
 device coretemp: sysmon_envsys
 attach coretemp at cpufeaturebus
 file   arch/x86/x86/coretemp.c         coretemp
@@ -96,7 +104,6 @@
 file   arch/x86/x86/acpi_machdep.c     acpi
 
 file   arch/x86/acpi/acpi_wakeup.c     acpi
-file   arch/x86/acpi/acpi_cpu_md.c     acpi & acpicpu
 
 file   arch/x86/isa/isa_machdep.c      isa
 
diff -r f2983ee1e96b -r 514f8546d8dd sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c       Sun Feb 27 15:16:31 2011 +0000
+++ b/sys/dev/acpi/acpi.c       Sun Feb 27 17:10:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi.c,v 1.239 2011/02/20 16:24:54 jruoho Exp $        */
+/*     $NetBSD: acpi.c,v 1.240 2011/02/27 17:10:33 jruoho Exp $        */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.239 2011/02/20 16:24:54 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.240 2011/02/27 17:10:33 jruoho Exp $");
 
 #include "opt_acpi.h"
 #include "opt_pcifixup.h"
@@ -134,7 +134,6 @@
  * Machine-dependent code may wish to skip other steps (such as attaching
  * subsystems that ACPI supercedes) when ACPI is active.
  */
-uint32_t       acpi_cpus = 0;
 int            acpi_active = 0;
 int            acpi_suspended = 0;
 int            acpi_force_load = 0;
@@ -161,6 +160,7 @@
  */
 static const char * const acpi_ignored_ids[] = {
 #if defined(i386) || defined(x86_64)
+       "ACPI0007",     /* ACPI CPUs do not attach to acpi(4) */
        "PNP0000",      /* AT interrupt controller is handled internally */
        "PNP0200",      /* AT DMA controller is handled internally */
        "PNP0A??",      /* PCI Busses are handled internally */
@@ -804,7 +804,6 @@
 static void
 acpi_rescan_nodes(struct acpi_softc *sc)
 {
-       const uint32_t ncpus = acpi_md_ncpus();
        struct acpi_attach_args aa;
        struct acpi_devnode *ad;
        ACPI_DEVICE_INFO *di;
@@ -841,7 +840,7 @@
                if (di->Type == ACPI_TYPE_POWER)
                        continue;
 
-               if (di->Type == ACPI_TYPE_PROCESSOR && acpi_cpus >= ncpus)
+               if (di->Type == ACPI_TYPE_PROCESSOR)
                        continue;
 
                if (acpi_match_hid(di, acpi_early_ids) != 0)
diff -r f2983ee1e96b -r 514f8546d8dd sys/dev/acpi/acpi_cpu.c
--- a/sys/dev/acpi/acpi_cpu.c   Sun Feb 27 15:16:31 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu.c   Sun Feb 27 17:10:33 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.29 2011/02/25 19:55:06 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.30 2011/02/27 17:10:33 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.29 2011/02/25 19:55:06 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.30 2011/02/27 17:10:33 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -35,7 +35,6 @@
 #include <sys/kmem.h>
 #include <sys/module.h>
 #include <sys/mutex.h>
-#include <sys/once.h>
 #include <sys/sysctl.h>
 
 #include <dev/acpi/acpireg.h>
@@ -43,6 +42,7 @@
 #include <dev/acpi/acpi_cpu.h>
 
 #include <machine/acpi_machdep.h>
+#include <machine/cpuvar.h>
 
 #define _COMPONENT       ACPI_BUS_COMPONENT
 ACPI_MODULE_NAME         ("acpi_cpu")
@@ -52,14 +52,14 @@
 static int               acpicpu_detach(device_t, int);
 static int               acpicpu_once_attach(void);
 static int               acpicpu_once_detach(void);
-static void              acpicpu_prestart(device_t);
 static void              acpicpu_start(device_t);
-static void              acpicpu_debug_print(struct acpicpu_softc *);
+static void              acpicpu_debug_print(device_t);
 static const char       *acpicpu_debug_print_dep(uint32_t);
 static void              acpicpu_sysctl(device_t);
 
-static int               acpicpu_object(ACPI_HANDLE, struct acpicpu_object *);
-static struct cpu_info  *acpicpu_ci(uint32_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_pdc(struct acpicpu_softc *, uint32_t);
 static ACPI_STATUS       acpicpu_cap_osc(struct acpicpu_softc *,
@@ -68,7 +68,7 @@
 static bool              acpicpu_suspend(device_t, const pmf_qual_t *);
 static bool              acpicpu_resume(device_t, const pmf_qual_t *);
 
-extern uint32_t                  acpi_cpus;
+static uint32_t                  acpicpu_count = 0;
 struct acpicpu_softc   **acpicpu_sc = NULL;
 static struct sysctllog         *acpicpu_log = NULL;
 static bool              acpicpu_dynamic = true;
@@ -85,89 +85,90 @@
 static int
 acpicpu_match(device_t parent, cfdata_t match, void *aux)
 {
-       struct acpi_attach_args *aa = aux;
-       struct acpicpu_object ao;
-       int rv;
+       struct cpufeature_attach_args *cfaa = aux;
 
-       if (aa->aa_node->ad_type != ACPI_TYPE_PROCESSOR)
+       if (acpi_softc == NULL)
                return 0;
 
-       if (acpi_match_hid(aa->aa_node->ad_devinfo, acpicpu_hid) != 0)
-               return 1;
-
-       rv = acpicpu_object(aa->aa_node->ad_handle, &ao);
-
-       if (rv != 0 || acpicpu_ci(ao.ao_procid) == NULL)
+       if (strcmp(cfaa->name, "frequency") != 0)
                return 0;
 
-       return 1;
+       return acpicpu_find(cfaa->ci, NULL);
 }
 
 static void
 acpicpu_attach(device_t parent, device_t self, void *aux)
 {
        struct acpicpu_softc *sc = device_private(self);
-       struct acpi_attach_args *aa = aux;
-       static ONCE_DECL(once_attach);
+       struct cpufeature_attach_args *cfaa = aux;
+       struct cpu_info *ci = cfaa->ci;
        cpuid_t id;
        int rv;
 
-       rv = acpicpu_object(aa->aa_node->ad_handle, &sc->sc_object);
-
-       if (rv != 0)
-               return;
-
-       rv = RUN_ONCE(&once_attach, acpicpu_once_attach);
-
-       if (rv != 0)
-               return;
-
+       sc->sc_ci = ci;
        sc->sc_dev = self;
        sc->sc_cold = true;
-       sc->sc_node = aa->aa_node;
+       sc->sc_node = NULL;
 



Home | Main Index | Thread Index | Old Index