From 4880e8363876ff5994168406cddb4251ea4d2278 Mon Sep 17 00:00:00 2001 From: fvdl Date: Thu, 13 Jan 2005 23:40:01 +0000 Subject: [PATCH] If there are no ioapics, don't bother to put things in ioapic mode. However, always do this otherwise, regardless of the revision. Remove incorrect comment. --- sys/arch/x86/pci/aapic.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/sys/arch/x86/pci/aapic.c b/sys/arch/x86/pci/aapic.c index 8e874c21d89d..e429aa760878 100644 --- a/sys/arch/x86/pci/aapic.c +++ b/sys/arch/x86/pci/aapic.c @@ -1,7 +1,7 @@ -/* $NetBSD: aapic.c,v 1.2 2004/04/23 21:13:06 itojun Exp $ */ +/* $NetBSD: aapic.c,v 1.3 2005/01/13 23:40:01 fvdl Exp $ */ #include -__KERNEL_RCSID(0, "$NetBSD: aapic.c,v 1.2 2004/04/23 21:13:06 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aapic.c,v 1.3 2005/01/13 23:40:01 fvdl Exp $"); #include #include @@ -14,6 +14,12 @@ __KERNEL_RCSID(0, "$NetBSD: aapic.c,v 1.2 2004/04/23 21:13:06 itojun Exp $"); #include +#include "ioapic.h" + +#if NIOAPIC > 0 +extern int nioapics; +#endif + static int aapic_match __P((struct device *, struct cfdata *, void *)); static void aapic_attach __P((struct device *, struct device *, void *)); @@ -54,21 +60,21 @@ aapic_attach(parent, self, aux) rev = PCI_REVISION(pa->pa_class); printf(": %s (rev. 0x%02x)\n", devinfo, rev); +#if NIOAPIC > 0 + if (nioapics == 0) + return; +#else + return; +#endif + reg = pci_conf_read(pa->pa_pc, pa->pa_tag, AMD8131_IOAPIC_CTL); - if ((reg & AMD8131_IOAEN) == 0) { - reg |= AMD8131_IOAEN; - pci_conf_write(pa->pa_pc, pa->pa_tag, AMD8131_IOAPIC_CTL, reg); - } + reg |= AMD8131_IOAEN; + pci_conf_write(pa->pa_pc, pa->pa_tag, AMD8131_IOAPIC_CTL, reg); - /* - * Work around erratum #22 for A0 and B0 revisions. - */ - if (rev == 0x01 || rev == 0x11) { - pci_decompose_tag(pa->pa_pc, pa->pa_tag, &bus, &dev, &func); - func = 0; - tag = pci_make_tag(pa->pa_pc, bus, dev, func); - reg = pci_conf_read(pa->pa_pc, tag, AMD8131_PCIX_MISC); - reg &= ~0x00000001; - pci_conf_write(pa->pa_pc, tag, AMD8131_PCIX_MISC, reg); - } + pci_decompose_tag(pa->pa_pc, pa->pa_tag, &bus, &dev, &func); + func = 0; + tag = pci_make_tag(pa->pa_pc, bus, dev, func); + reg = pci_conf_read(pa->pa_pc, tag, AMD8131_PCIX_MISC); + reg &= ~AMD8131_NIOAMODE; + pci_conf_write(pa->pa_pc, tag, AMD8131_PCIX_MISC, reg); }