Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 If an ioapic doesn't really exist, don't ad...



details:   https://anonhg.NetBSD.org/src/rev/4795f6943be8
branches:  trunk
changeset: 763849:4795f6943be8
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Tue Apr 05 13:43:33 2011 +0000

description:
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

diffstat:

 sys/arch/x86/x86/ioapic.c |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (51 lines):

diff -r 684fc0a3bf20 -r 4795f6943be8 sys/arch/x86/x86/ioapic.c
--- a/sys/arch/x86/x86/ioapic.c Tue Apr 05 13:17:04 2011 +0000
+++ b/sys/arch/x86/x86/ioapic.c Tue Apr 05 13:43:33 2011 +0000
@@ -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");
 



Home | Main Index | Thread Index | Old Index