Source-Changes-HG archive

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

[src/trunk]: src/sys Store the MADT-derived CPU ID to <x86/cpu.h>. This is re...



details:   https://anonhg.NetBSD.org/src/rev/324950e90d92
branches:  trunk
changeset: 756812:324950e90d92
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Wed Aug 04 10:02:11 2010 +0000

description:
Store the MADT-derived CPU ID to <x86/cpu.h>. This is required to properly
match the ACPI processor object ID with the ID available in the APIC table.

diffstat:

 sys/arch/x86/include/cpu.h     |  3 ++-
 sys/arch/x86/include/cpuvar.h  |  3 ++-
 sys/arch/x86/x86/cpu.c         |  5 +++--
 sys/arch/x86/x86/mpacpi.c      |  6 ++++--
 sys/arch/x86/x86/mpbios.c      |  5 +++--
 sys/dev/acpi/acpi_cpu.c        |  6 +++---
 sys/dev/acpi/acpi_cpu_cstate.c |  8 ++++----
 7 files changed, 21 insertions(+), 15 deletions(-)

diffs (178 lines):

diff -r 2780e64a47ae -r 324950e90d92 sys/arch/x86/include/cpu.h
--- a/sys/arch/x86/include/cpu.h        Wed Aug 04 09:16:58 2010 +0000
+++ b/sys/arch/x86/include/cpu.h        Wed Aug 04 10:02:11 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.23 2010/07/24 00:45:56 jym Exp $     */
+/*     $NetBSD: cpu.h,v 1.24 2010/08/04 10:02:11 jruoho Exp $  */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -95,6 +95,7 @@
        int     ci_fpused;              /* XEN: FPU was used by curlwp */
        cpuid_t ci_cpuid;               /* our CPU ID */
        int     ci_cpumask;             /* (1 << CPU ID) */
+       uint32_t ci_acpiid;             /* our ACPI/MADT ID */
        uint32_t ci_initapicid;         /* our intitial APIC ID */
        struct cpu_data ci_data;        /* MI per-cpu data */
 
diff -r 2780e64a47ae -r 324950e90d92 sys/arch/x86/include/cpuvar.h
--- a/sys/arch/x86/include/cpuvar.h     Wed Aug 04 09:16:58 2010 +0000
+++ b/sys/arch/x86/include/cpuvar.h     Wed Aug 04 10:02:11 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpuvar.h,v 1.33 2010/07/06 20:50:35 cegger Exp $ */
+/*     $NetBSD: cpuvar.h,v 1.34 2010/08/04 10:02:11 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
@@ -79,6 +79,7 @@
 #define CPU_ROLE_AP    2
 
 struct cpu_attach_args {
+       int cpu_id;
        int cpu_number;
        int cpu_role;
        const struct cpu_functions *cpu_func;
diff -r 2780e64a47ae -r 324950e90d92 sys/arch/x86/x86/cpu.c
--- a/sys/arch/x86/x86/cpu.c    Wed Aug 04 09:16:58 2010 +0000
+++ b/sys/arch/x86/x86/cpu.c    Wed Aug 04 10:02:11 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.73 2010/07/24 00:45:56 jym Exp $     */
+/*     $NetBSD: cpu.c,v 1.74 2010/08/04 10:02:12 jruoho Exp $  */
 
 /*-
  * Copyright (c) 2000, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.73 2010/07/24 00:45:56 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.74 2010/08/04 10:02:12 jruoho Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"                /* for MPDEBUG */
@@ -330,6 +330,7 @@
        ci->ci_self = ci;
        sc->sc_info = ci;
        ci->ci_dev = self;
+       ci->ci_acpiid = caa->cpu_id;
        ci->ci_cpuid = caa->cpu_number;
        ci->ci_func = caa->cpu_func;
 
diff -r 2780e64a47ae -r 324950e90d92 sys/arch/x86/x86/mpacpi.c
--- a/sys/arch/x86/x86/mpacpi.c Wed Aug 04 09:16:58 2010 +0000
+++ b/sys/arch/x86/x86/mpacpi.c Wed Aug 04 10:02:11 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mpacpi.c,v 1.87 2010/04/27 05:34:14 jruoho Exp $       */
+/*     $NetBSD: mpacpi.c,v 1.88 2010/08/04 10:02:12 jruoho Exp $       */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.87 2010/04/27 05:34:14 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.88 2010/08/04 10:02:12 jruoho Exp $");
 
 #include "acpica.h"
 #include "opt_acpi.h"
@@ -383,6 +383,7 @@
                                caa.cpu_role = CPU_ROLE_AP;
                        else
                                caa.cpu_role = CPU_ROLE_BP;
+                       caa.cpu_id = lapic->ProcessorId;
                        caa.cpu_number = lapic->Id;
                        caa.cpu_func = &mp_cpu_funcs;
                        locs[CPUBUSCF_APID] = caa.cpu_number;
@@ -409,6 +410,7 @@
                                caa.cpu_role = CPU_ROLE_AP;
                        else
                                caa.cpu_role = CPU_ROLE_BP;
+                       caa.cpu_id = x2apic->Uid;
                        caa.cpu_number = x2apic->LocalApicId;
                        caa.cpu_func = &mp_cpu_funcs;
                        locs[CPUBUSCF_APID] = caa.cpu_number;
diff -r 2780e64a47ae -r 324950e90d92 sys/arch/x86/x86/mpbios.c
--- a/sys/arch/x86/x86/mpbios.c Wed Aug 04 09:16:58 2010 +0000
+++ b/sys/arch/x86/x86/mpbios.c Wed Aug 04 10:02:11 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mpbios.c,v 1.57 2010/04/18 23:47:51 jym Exp $  */
+/*     $NetBSD: mpbios.c,v 1.58 2010/08/04 10:02:12 jruoho Exp $       */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpbios.c,v 1.57 2010/04/18 23:47:51 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpbios.c,v 1.58 2010/08/04 10:02:12 jruoho Exp $");
 
 #include "acpica.h"
 #include "lapic.h"
@@ -717,6 +717,7 @@
        else
                caa.cpu_role = CPU_ROLE_AP;
 
+       caa.cpu_id = entry->apic_id;
        caa.cpu_number = entry->apic_id;
        caa.cpu_func = &mp_cpu_funcs;
        locs[CPUBUSCF_APID] = caa.cpu_number;
diff -r 2780e64a47ae -r 324950e90d92 sys/dev/acpi/acpi_cpu.c
--- a/sys/dev/acpi/acpi_cpu.c   Wed Aug 04 09:16:58 2010 +0000
+++ b/sys/dev/acpi/acpi_cpu.c   Wed Aug 04 10:02:11 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.10 2010/07/30 06:11:14 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.11 2010/08/04 10:02:12 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.10 2010/07/30 06:11:14 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.11 2010/08/04 10:02:12 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -270,7 +270,7 @@
 
        for (CPU_INFO_FOREACH(cii, ci)) {
 
-               if (id == ci->ci_cpuid)
+               if (id == ci->ci_acpiid)
                        return id;
        }
 
diff -r 2780e64a47ae -r 324950e90d92 sys/dev/acpi/acpi_cpu_cstate.c
--- a/sys/dev/acpi/acpi_cpu_cstate.c    Wed Aug 04 09:16:58 2010 +0000
+++ b/sys/dev/acpi/acpi_cpu_cstate.c    Wed Aug 04 10:02:11 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_cstate.c,v 1.13 2010/07/30 06:11:14 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_cstate.c,v 1.14 2010/08/04 10:02:12 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.13 2010/07/30 06:11:14 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.14 2010/08/04 10:02:12 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -717,10 +717,10 @@
        acpi_md_OsDisableInterrupt();
 
        KASSERT(acpicpu_sc != NULL);
-       KASSERT(ci->ci_cpuid < maxcpus);
+       KASSERT(ci->ci_acpiid < maxcpus);
        KASSERT(ci->ci_ilevel == IPL_NONE);
 
-       sc = acpicpu_sc[ci->ci_cpuid];
+       sc = acpicpu_sc[ci->ci_acpiid];
 
        if (__predict_false(sc == NULL))
                goto halt;



Home | Main Index | Thread Index | Old Index