Module Name:    src
Committed By:   pgoyette
Date:           Tue Apr  5 13:43:33 UTC 2011

Modified Files:
        src/sys/arch/x86/x86: ioapic.c

Log Message:
If an ioapic doesn't really exist, don't add it to internal tables.
This is what other xxxBSDs seem to do in similar circumstances.

Addresses my PR kern/43568

OK jruoho@ in private Email


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/x86/x86/ioapic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/ioapic.c
diff -u src/sys/arch/x86/x86/ioapic.c:1.44 src/sys/arch/x86/x86/ioapic.c:1.45
--- src/sys/arch/x86/x86/ioapic.c:1.44	Tue Aug 18 16:41:03 2009
+++ src/sys/arch/x86/x86/ioapic.c	Tue Apr  5 13:43:33 2011
@@ -1,4 +1,4 @@
-/* 	$NetBSD: ioapic.c,v 1.44 2009/08/18 16:41:03 jmcneill Exp $	*/
+/* 	$NetBSD: ioapic.c,v 1.45 2011/04/05 13:43:33 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2009 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.44 2009/08/18 16:41:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.45 2011/04/05 13:43:33 pgoyette Exp $");
 
 #include "opt_ddb.h"
 
@@ -279,8 +279,6 @@
 		return;
 	}
 
-	ioapic_add(sc);
-
 	aprint_verbose(": pa 0x%jx", (uintmax_t)aaa->apic_address);
 #ifndef _IOAPIC_CUSTOM_RW
 	{
@@ -308,7 +306,14 @@
 
 	apic_id = (ioapic_read(sc,IOAPIC_ID)&IOAPIC_ID_MASK)>>IOAPIC_ID_SHIFT;
 	ver_sz = ioapic_read(sc, IOAPIC_VER);
-	
+
+	if (ver_sz == 0xffffffff) {
+		aprint_error(": failed to read version/size\n");
+		goto out;
+	}
+
+	ioapic_add(sc);
+
 	sc->sc_apic_vers = (ver_sz & IOAPIC_VER_MASK) >> IOAPIC_VER_SHIFT;
 	sc->sc_apic_sz = (ver_sz & IOAPIC_MAX_MASK) >> IOAPIC_MAX_SHIFT;
 	sc->sc_apic_sz++;
@@ -385,6 +390,7 @@
 		}
 	}
 
+ out:
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, "couldn't establish power handler\n");
 

Reply via email to