diff --git a/sys/arch/amd64/conf/files.amd64 b/sys/arch/amd64/conf/files.amd64 index ad15fa13bac4..2bcde0be399d 100644 --- a/sys/arch/amd64/conf/files.amd64 +++ b/sys/arch/amd64/conf/files.amd64 @@ -1,4 +1,4 @@ -# $NetBSD: files.amd64,v 1.5 2003/08/20 21:48:52 fvdl Exp $ +# $NetBSD: files.amd64,v 1.6 2003/09/06 17:44:36 fvdl Exp $ # # new style config file for amd64 architecture # @@ -107,7 +107,6 @@ file arch/amd64/amd64/cpu.c cpu include "dev/pci/files.pci" defparam PCI_CONF_MODE -file arch/amd64/pci/pciide_machdep.c pciide # PCI-Host bridge chipsets device pchb: pcibus diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386 index 1b292fe4c320..f020e202c57b 100644 --- a/sys/arch/i386/conf/files.i386 +++ b/sys/arch/i386/conf/files.i386 @@ -1,4 +1,4 @@ -# $NetBSD: files.i386,v 1.242 2003/07/27 01:19:26 thorpej Exp $ +# $NetBSD: files.i386,v 1.243 2003/09/06 17:44:38 fvdl Exp $ # # new style config file for i386 architecture # @@ -162,7 +162,6 @@ file arch/i386/pci/ali1543.c pcibios & pcibios_intr_fixup file arch/i386/pci/pci_bus_fixup.c pcibios & pcibios_bus_fixup file arch/i386/pci/pci_addr_fixup.c pcibios & pcibios_addr_fixup defparam PCI_CONF_MODE -file arch/i386/pci/pciide_machdep.c pciide file arch/i386/pci/pcic_pci_machdep.c pcic_pci # PCI-Host bridge chipsets diff --git a/sys/arch/i386/pci/pciide_machdep.c b/sys/arch/i386/pci/pciide_machdep.c deleted file mode 100644 index 61044182840d..000000000000 --- a/sys/arch/i386/pci/pciide_machdep.c +++ /dev/null @@ -1,75 +0,0 @@ -/* $NetBSD: pciide_machdep.c,v 1.4 2001/11/15 07:03:35 lukem Exp $ */ - -/* - * Copyright (c) 1998 Christopher G. Demetriou. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christopher G. Demetriou - * for the NetBSD Project. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * PCI IDE controller driver (i386 machine-dependent portion). - * - * Author: Christopher G. Demetriou, March 2, 1998 (derived from NetBSD - * sys/dev/pci/ppb.c, revision 1.16). - * - * See "PCI IDE Controller Specification, Revision 1.0 3/4/94" from the - * PCI SIG. - */ - -#include -__KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.4 2001/11/15 07:03:35 lukem Exp $"); - -#include -#include -#include - -#include -#include -#include -#include - -#include - -void * -pciide_machdep_compat_intr_establish(dev, pa, chan, func, arg) - struct device *dev; - struct pci_attach_args *pa; - int chan; - int (*func) __P((void *)); - void *arg; -{ - int irq; - void *cookie; - - irq = PCIIDE_COMPAT_IRQ(chan); - cookie = isa_intr_establish(NULL, irq, IST_EDGE, IPL_BIO, func, arg); - if (cookie == NULL) - return (NULL); - printf("%s: %s channel interrupting at irq %d\n", dev->dv_xname, - PCIIDE_CHANNEL_NAME(chan), irq); - return (cookie); -} diff --git a/sys/arch/x86/conf/files.x86 b/sys/arch/x86/conf/files.x86 index 0db91cbe55b7..ef28b5346819 100644 --- a/sys/arch/x86/conf/files.x86 +++ b/sys/arch/x86/conf/files.x86 @@ -1,4 +1,4 @@ -# $NetBSD: files.x86,v 1.8 2003/05/29 20:22:31 fvdl Exp $ +# $NetBSD: files.x86,v 1.9 2003/09/06 17:44:39 fvdl Exp $ # options for MP configuration through the MP spec defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI @@ -39,3 +39,5 @@ file arch/x86/x86/acpi_machdep.c acpi file arch/x86/pci/pci_machdep.c pci file arch/x86/isa/isa_machdep.c isa + +file arch/x86/pci/pciide_machdep.c pciide diff --git a/sys/arch/x86/include/intr.h b/sys/arch/x86/include/intr.h index 7e0b4ff66730..c86ab99c86de 100644 --- a/sys/arch/x86/include/intr.h +++ b/sys/arch/x86/include/intr.h @@ -1,4 +1,4 @@ -/* $NetBSD: intr.h,v 1.6 2003/08/20 21:48:46 fvdl Exp $ */ +/* $NetBSD: intr.h,v 1.7 2003/09/06 17:44:39 fvdl Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -253,6 +253,7 @@ int intr_allocate_slot(struct pic *, int, int, int, struct cpu_info **, int *, int *); void *intr_establish(int, struct pic *, int, int, int, int (*)(void *), void *); void intr_disestablish(struct intrhand *); +const char *intr_string(int); void cpu_intr_init(struct cpu_info *); int intr_find_mpmapping(int bus, int pin, int *handle); #ifdef INTRDEBUG diff --git a/sys/arch/x86/pci/pci_machdep.c b/sys/arch/x86/pci/pci_machdep.c index dc27c4607996..f386ac3c3899 100644 --- a/sys/arch/x86/pci/pci_machdep.c +++ b/sys/arch/x86/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.c,v 1.6 2003/09/06 14:55:50 fvdl Exp $ */ +/* $NetBSD: pci_machdep.c,v 1.7 2003/09/06 17:44:40 fvdl Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -80,7 +80,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.6 2003/09/06 14:55:50 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.7 2003/09/06 17:44:40 fvdl Exp $"); #include #include @@ -623,37 +623,10 @@ pci_intr_string(pc, ih) pci_chipset_tag_t pc; pci_intr_handle_t ih; { - static char irqstr[64]; -#if NIOAPIC > 0 - struct pic *pic; -#endif - - if (ih == 0) - panic("pci_intr_string: bogus handle 0x%x", ih); - - -#if NIOAPIC > 0 - if (ih & APIC_INT_VIA_APIC) { - pic = (struct pic *)ioapic_find(APIC_IRQ_APIC(ih)); - if (pic != NULL) { - sprintf(irqstr, "%s pin %d (irq %d)", - pic->pic_name, APIC_IRQ_PIN(ih), ih&0xff); - } else { - sprintf(irqstr, "apic %d int %d (irq %d)", - APIC_IRQ_APIC(ih), - APIC_IRQ_PIN(ih), - ih&0xff); - } - } else - sprintf(irqstr, "irq %d", ih&0xff); -#else - - sprintf(irqstr, "irq %d", ih&0xff); -#endif - return (irqstr); - + return intr_string(ih); } + const struct evcnt * pci_intr_evcnt(pc, ih) pci_chipset_tag_t pc; diff --git a/sys/arch/amd64/pci/pciide_machdep.c b/sys/arch/x86/pci/pciide_machdep.c similarity index 81% rename from sys/arch/amd64/pci/pciide_machdep.c rename to sys/arch/x86/pci/pciide_machdep.c index 75b7a1222ed9..7d006e6dde49 100644 --- a/sys/arch/amd64/pci/pciide_machdep.c +++ b/sys/arch/x86/pci/pciide_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: pciide_machdep.c,v 1.2 2003/07/14 23:32:34 lukem Exp $ */ +/* $NetBSD: pciide_machdep.c,v 1.1 2003/09/06 17:44:40 fvdl Exp $ */ /* * Copyright (c) 1998 Christopher G. Demetriou. All rights reserved. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.2 2003/07/14 23:32:34 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.1 2003/09/06 17:44:40 fvdl Exp $"); #include #include @@ -54,6 +54,13 @@ __KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.2 2003/07/14 23:32:34 lukem Exp #include +#include "ioapic.h" + +#if NIOAPIC > 0 +#include +#include +#endif + void * pciide_machdep_compat_intr_establish(dev, pa, chan, func, arg) struct device *dev; @@ -64,11 +71,23 @@ pciide_machdep_compat_intr_establish(dev, pa, chan, func, arg) { int irq; void *cookie; +#if NIOAPIC > 0 + int mpih; +#endif irq = PCIIDE_COMPAT_IRQ(chan); cookie = isa_intr_establish(NULL, irq, IST_EDGE, IPL_BIO, func, arg); if (cookie == NULL) return (NULL); +#if NIOAPIC > 0 + if (mp_busses != NULL && + (intr_find_mpmapping(mp_isa_bus, irq, &mpih) == 0 || + intr_find_mpmapping(mp_eisa_bus, irq, &mpih) == 0)) { + mpih |= irq; + printf("%s: %s channel interrupting at %s\n", dev->dv_xname, + PCIIDE_CHANNEL_NAME(chan), intr_string(mpih)); + } else +#endif printf("%s: %s channel interrupting at irq %d\n", dev->dv_xname, PCIIDE_CHANNEL_NAME(chan), irq); return (cookie); diff --git a/sys/arch/x86/x86/intr.c b/sys/arch/x86/x86/intr.c index 00df145b3f33..974460f299e0 100644 --- a/sys/arch/x86/x86/intr.c +++ b/sys/arch/x86/x86/intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.5 2003/08/20 21:48:47 fvdl Exp $ */ +/* $NetBSD: intr.c,v 1.6 2003/09/06 17:44:40 fvdl Exp $ */ /* * Copyright 2002 (c) Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.5 2003/08/20 21:48:47 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.6 2003/09/06 17:44:40 fvdl Exp $"); #include "opt_multiprocessor.h" @@ -521,6 +521,40 @@ intr_disestablish(struct intrhand *ih) simple_unlock(&ci->ci_slock); } +const char * +intr_string(int ih) +{ + static char irqstr[64]; +#if NIOAPIC > 0 + struct pic *pic; +#endif + + if (ih == 0) + panic("pci_intr_string: bogus handle 0x%x", ih); + + +#if NIOAPIC > 0 + if (ih & APIC_INT_VIA_APIC) { + pic = (struct pic *)ioapic_find(APIC_IRQ_APIC(ih)); + if (pic != NULL) { + sprintf(irqstr, "%s pin %d (irq %d)", + pic->pic_name, APIC_IRQ_PIN(ih), ih&0xff); + } else { + sprintf(irqstr, "apic %d int %d (irq %d)", + APIC_IRQ_APIC(ih), + APIC_IRQ_PIN(ih), + ih&0xff); + } + } else + sprintf(irqstr, "irq %d", ih&0xff); +#else + + sprintf(irqstr, "irq %d", ih&0xff); +#endif + return (irqstr); + +} + #define CONCAT(x,y) __CONCAT(x,y) /*