From 453d5d4dc14dadf42c46c17276521a4fef590241 Mon Sep 17 00:00:00 2001 From: ad Date: Mon, 12 May 2008 14:19:33 +0000 Subject: [PATCH] - Complain if unable to reset the lapic ID. - Minor clean up. --- sys/arch/x86/x86/cpu.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sys/arch/x86/x86/cpu.c b/sys/arch/x86/x86/cpu.c index 68e8e73ca394..063cab1bf1af 100644 --- a/sys/arch/x86/x86/cpu.c +++ b/sys/arch/x86/x86/cpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.46 2008/05/12 11:58:10 ad Exp $ */ +/* $NetBSD: cpu.c,v 1.47 2008/05/12 14:19:33 ad Exp $ */ /*- * Copyright (c) 2000, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.46 2008/05/12 11:58:10 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.47 2008/05/12 14:19:33 ad Exp $"); #include "opt_ddb.h" #include "opt_mpbios.h" /* for MPDEBUG */ @@ -303,14 +303,16 @@ cpu_attach(device_t parent, device_t self, void *aux) if (cpunum != lapic_cpu_number()) { uint32_t reg; aprint_verbose("\n"); - aprint_verbose("%s: running CPU is at apic %d" - " instead of at expected %d", - device_xname(sc->sc_dev), lapic_cpu_number(), + aprint_verbose_dev(self, "running CPU at apic %d" + " instead of at expected %d", lapic_cpu_number(), cpunum); reg = i82489_readreg(LAPIC_ID); i82489_writereg(LAPIC_ID, (reg & ~LAPIC_ID_MASK) | (cpunum << LAPIC_ID_SHIFT)); } + if (cpunum != lapic_cpu_number()) { + aprint_error_dev(self, "unable to reset apic id\n"); + } } ci->ci_self = ci; @@ -326,7 +328,7 @@ cpu_attach(device_t parent, device_t self, void *aux) error = mi_cpu_attach(ci); if (error != 0) { aprint_normal("\n"); - aprint_error_dev(sc->sc_dev, + aprint_error_dev(self, "mi_cpu_attach failed with %d\n", error); return; } @@ -399,7 +401,7 @@ cpu_attach(device_t parent, device_t self, void *aux) } cpu_vm_init(ci); - cpus_attached |= ci->ci_cpumask; + atomic_or_32(&cpus_attached, ci->ci_cpumask); if (!pmf_device_register(self, cpu_suspend, cpu_resume)) aprint_error_dev(self, "couldn't establish power handler\n"); @@ -407,7 +409,7 @@ cpu_attach(device_t parent, device_t self, void *aux) if (mp_verbose) { struct lwp *l = ci->ci_data.cpu_idlelwp; - aprint_verbose_dev(sc->sc_dev, + aprint_verbose_dev(self, "idle lwp at %p, idle sp at %p\n", l, #ifdef i386