Source-Changes-HG archive

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

[src/trunk]: src/sys Move the function that counts the CPUs from acpicpu(4) t...



details:   https://anonhg.NetBSD.org/src/rev/ca416c711131
branches:  trunk
changeset: 760791:ca416c711131
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Thu Jan 13 03:40:50 2011 +0000

description:
Move the function that counts the CPUs from acpicpu(4) to the MD layer.

diffstat:

 sys/arch/ia64/acpi/acpi_machdep.c    |  11 +++++++++--
 sys/arch/ia64/include/acpi_machdep.h |  19 ++++++++++---------
 sys/arch/x86/acpi/acpi_cpu_md.c      |  16 +++++-----------
 sys/arch/x86/include/acpi_machdep.h  |   3 ++-
 sys/arch/x86/x86/acpi_machdep.c      |  13 +++++++++++--
 sys/dev/acpi/acpi_cpu.h              |   3 +--
 sys/dev/acpi/acpi_cpu_cstate.c       |   6 +++---
 7 files changed, 41 insertions(+), 30 deletions(-)

diffs (240 lines):

diff -r 2ba8f249d1c0 -r ca416c711131 sys/arch/ia64/acpi/acpi_machdep.c
--- a/sys/arch/ia64/acpi/acpi_machdep.c Thu Jan 13 03:20:14 2011 +0000
+++ b/sys/arch/ia64/acpi/acpi_machdep.c Thu Jan 13 03:40:50 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_machdep.c,v 1.2 2010/07/24 09:35:36 jruoho Exp $  */
+/*     $NetBSD: acpi_machdep.c,v 1.3 2011/01/13 03:40:50 jruoho Exp $  */
 /*
  * Copyright (c) 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -28,7 +28,7 @@
  * Machine-dependent routines for ACPICA.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.2 2010/07/24 09:35:36 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.3 2011/01/13 03:40:50 jruoho Exp $");
 
 #include <sys/param.h>
 
@@ -185,6 +185,13 @@
        disable_intr();
 }
 
+uint32_t
+acpi_md_ncpus(void)
+{
+
+       return 0;               /* XXX. */
+}
+
 void
 acpi_md_callback(void)
 {
diff -r 2ba8f249d1c0 -r ca416c711131 sys/arch/ia64/include/acpi_machdep.h
--- a/sys/arch/ia64/include/acpi_machdep.h      Thu Jan 13 03:20:14 2011 +0000
+++ b/sys/arch/ia64/include/acpi_machdep.h      Thu Jan 13 03:40:50 2011 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: acpi_machdep.h,v 1.2 2009/07/20 04:41:37 kiyohara Exp $        */
+/*     $NetBSD: acpi_machdep.h,v 1.3 2011/01/13 03:40:50 jruoho Exp $  */
 
 ACPI_STATUS acpi_md_OsInitialize(void);
 ACPI_STATUS acpi_md_OsTerminate(void);
-ACPI_PHYSICAL_ADDRESS acpi_md_OsGetRootPointer(void); 
+ACPI_PHYSICAL_ADDRESS acpi_md_OsGetRootPointer(void);
 
 #define acpi_md_OsIn8(x)       inb((x))
 #define acpi_md_OsIn16(x)      inw((x))
@@ -13,7 +13,7 @@
 #define acpi_md_OsOut32(x, v)  outl((x), (v))
 
 ACPI_STATUS acpi_md_OsInstallInterruptHandler(UINT32, ACPI_OSD_HANDLER,
-                                             void *, void **); 
+                                             void *, void **);
 void acpi_md_OsRemoveInterruptHandler(void *);
 
 ACPI_STATUS acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS, UINT32, void **);
@@ -21,10 +21,11 @@
 ACPI_STATUS acpi_md_OsGetPhysicalAddress(void *LogicalAddress,
                                         ACPI_PHYSICAL_ADDRESS *PhysicalAddress);
 
-BOOLEAN acpi_md_OsReadable(void *, UINT32);
-BOOLEAN acpi_md_OsWritable(void *, UINT32);
-void acpi_md_OsEnableInterrupt(void); 
-void acpi_md_OsDisableInterrupt(void);
+BOOLEAN                acpi_md_OsReadable(void *, UINT32);
+BOOLEAN                acpi_md_OsWritable(void *, UINT32);
+void           acpi_md_OsEnableInterrupt(void);
+void           acpi_md_OsDisableInterrupt(void);
 
-int acpi_md_sleep(int);
-void acpi_md_callback(void);
+int            acpi_md_sleep(int);
+uint32_t       acpi_md_ncpus(void);
+void           acpi_md_callback(void);
diff -r 2ba8f249d1c0 -r ca416c711131 sys/arch/x86/acpi/acpi_cpu_md.c
--- a/sys/arch/x86/acpi/acpi_cpu_md.c   Thu Jan 13 03:20:14 2011 +0000
+++ b/sys/arch/x86/acpi/acpi_cpu_md.c   Thu Jan 13 03:40:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.37 2010/12/30 17:06:17 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.38 2011/01/13 03:40:50 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_md.c,v 1.37 2010/12/30 17:06:17 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.38 2011/01/13 03:40:50 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -48,6 +48,8 @@
 #include <dev/pci/pcivar.h>
 #include <dev/pci/pcidevs.h>
 
+#include <machine/acpi_machdep.h>
+
 /*
  * AMD C1E.
  */
@@ -110,7 +112,6 @@
 static int      acpicpu_md_pstate_sysctl_set(SYSCTLFN_PROTO);
 static int      acpicpu_md_pstate_sysctl_all(SYSCTLFN_PROTO);
 
-extern uint32_t cpus_running;
 extern struct acpicpu_softc **acpicpu_sc;
 static bool acpicpu_pstate_status = false;
 static struct sysctllog *acpicpu_log = NULL;
@@ -157,7 +158,7 @@
        uint32_t family, val = 0;
        uint32_t regs[4];
 
-       if (acpicpu_md_cpus_running() == 1)
+       if (acpi_md_ncpus() == 1)
                val |= ACPICPU_FLAG_C_BM;
 
        if ((ci->ci_feat_val[1] & CPUID2_MONITOR) != 0)
@@ -312,13 +313,6 @@
                wrmsr(MSR_CMPHALT, val & ~c1e);
 }
 
-uint32_t
-acpicpu_md_cpus_running(void)
-{
-
-       return popcount32(cpus_running);
-}
-
 int
 acpicpu_md_idle_start(struct acpicpu_softc *sc)
 {
diff -r 2ba8f249d1c0 -r ca416c711131 sys/arch/x86/include/acpi_machdep.h
--- a/sys/arch/x86/include/acpi_machdep.h       Thu Jan 13 03:20:14 2011 +0000
+++ b/sys/arch/x86/include/acpi_machdep.h       Thu Jan 13 03:40:50 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_machdep.h,v 1.7 2010/07/24 21:53:54 jruoho Exp $  */
+/*     $NetBSD: acpi_machdep.h,v 1.8 2011/01/13 03:40:50 jruoho Exp $  */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -73,6 +73,7 @@
 
 int            acpi_md_sleep(int);
 void           acpi_md_sleep_init(void);
+uint32_t       acpi_md_ncpus(void);
 void           acpi_md_callback(void);
 
 #endif /* !_X86_ACPI_MACHDEP_H_ */
diff -r 2ba8f249d1c0 -r ca416c711131 sys/arch/x86/x86/acpi_machdep.c
--- a/sys/arch/x86/x86/acpi_machdep.c   Thu Jan 13 03:20:14 2011 +0000
+++ b/sys/arch/x86/x86/acpi_machdep.c   Thu Jan 13 03:40:50 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_machdep.c,v 1.27 2010/04/28 19:17:04 dyoung Exp $ */
+/*     $NetBSD: acpi_machdep.c,v 1.28 2011/01/13 03:40:50 jruoho Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.27 2010/04/28 19:17:04 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.28 2011/01/13 03:40:50 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -72,6 +72,8 @@
 #include "opt_mpbios.h"
 #include "opt_acpi.h"
 
+extern uint32_t cpus_running;
+
 ACPI_STATUS
 acpi_md_OsInitialize(void)
 {
@@ -95,6 +97,7 @@
        ACPI_STATUS Status;
 
        Status = AcpiFindRootPointer(&PhysicalAddress);
+
        if (ACPI_FAILURE(Status))
                PhysicalAddress = 0;
 
@@ -282,6 +285,12 @@
        x86_enable_intr();
 }
 
+uint32_t
+acpi_md_ncpus(void)
+{
+       return popcount32(cpus_running);
+}
+
 void
 acpi_md_callback(void)
 {
diff -r 2ba8f249d1c0 -r ca416c711131 sys/dev/acpi/acpi_cpu.h
--- a/sys/dev/acpi/acpi_cpu.h   Thu Jan 13 03:20:14 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu.h   Thu Jan 13 03:40:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.h,v 1.27 2010/12/30 12:05:02 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.h,v 1.28 2011/01/13 03:40:51 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -236,7 +236,6 @@
 uint32_t       acpicpu_md_cap(void);
 uint32_t       acpicpu_md_quirks(void);
 void           acpicpu_md_quirks_c1e(void);
-uint32_t       acpicpu_md_cpus_running(void);
 int            acpicpu_md_idle_start(struct acpicpu_softc *);
 int            acpicpu_md_idle_stop(void);
 void           acpicpu_md_idle_enter(int, int);
diff -r 2ba8f249d1c0 -r ca416c711131 sys/dev/acpi/acpi_cpu_cstate.c
--- a/sys/dev/acpi/acpi_cpu_cstate.c    Thu Jan 13 03:20:14 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu_cstate.c    Thu Jan 13 03:40:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_cstate.c,v 1.35 2011/01/04 05:48:48 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_cstate.c,v 1.36 2011/01/13 03:40:51 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_cstate.c,v 1.35 2011/01/04 05:48:48 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.36 2011/01/13 03:40:51 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -541,7 +541,7 @@
        if (sc->sc_object.ao_pblkaddr == 0)
                return;
 
-       if (acpicpu_md_cpus_running() > 1) {
+       if (acpi_md_ncpus() > 1) {
 
                if ((AcpiGbl_FADT.Flags & ACPI_FADT_C2_MP_SUPPORTED) == 0)
                        return;



Home | Main Index | Thread Index | Old Index