From a680ab7537e08c1387ff7d4da351b2046bc46242 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Fri, 29 Mar 1996 15:01:51 +0000 Subject: [PATCH] Count PCI irqs in up to 4 ISAish counters named `pci irqnn' instead of in the clk0 counter. Reviewed by: s --- sys/amd64/pci/pci_bus.c | 33 ++++++++++++++++++++++++++++++--- sys/amd64/pci/pci_cfgreg.c | 33 ++++++++++++++++++++++++++++++--- sys/i386/isa/pcibus.c | 33 ++++++++++++++++++++++++++++++--- sys/i386/pci/pci_bus.c | 33 ++++++++++++++++++++++++++++++--- sys/i386/pci/pci_cfgreg.c | 33 ++++++++++++++++++++++++++++++--- sys/i386/pci/pci_pir.c | 33 ++++++++++++++++++++++++++++++--- 6 files changed, 180 insertions(+), 18 deletions(-) diff --git a/sys/amd64/pci/pci_bus.c b/sys/amd64/pci/pci_bus.c index bfa88999b3f1..b4c3b8a87c77 100644 --- a/sys/amd64/pci/pci_bus.c +++ b/sys/amd64/pci/pci_bus.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pcibus.c,v 1.20 1995/12/10 13:39:04 phk Exp $ +** $Id: pcibus.c,v 1.21 1995/12/16 00:27:59 bde Exp $ ** ** pci bus subroutines for i386 architecture. ** @@ -35,6 +35,8 @@ *************************************************************************** */ +#include "vector.h" + #include #include #include @@ -425,10 +427,35 @@ pcibus_write (pcici_t tag, u_long reg, u_long data) static int pcibus_ihandler_attach (int irq, inthand2_t *func, int arg, unsigned * maskptr) { - int result; + char buf[16]; + char *cp; + int free_id, id, result; + + sprintf(buf, "pci irq%d", irq); + for (cp = intrnames, free_id = 0, id = 0; id < NR_DEVICES; id++) { + if (strcmp(cp, buf) == 0) + break; + if (free_id <= 0 && strcmp(cp, "pci irqnn") == 0) + free_id = id; + while (*cp++ != '\0') + ; + } + if (id == NR_DEVICES) { + id = free_id; + if (id == 0) { + /* + * All pci irq counters are in use, perhaps because + * config is old so there aren't any. Abuse the + * clk0 counter. + */ + printf ( + "pcibus_ihandler_attach: counting pci irq%d's as clk0 irqs\n", + irq); + } + } result = register_intr( irq, /* isa irq */ - 0, /* deviced?? */ + id, /* device id */ 0, /* flags? */ func, /* handler */ maskptr, /* mask pointer */ diff --git a/sys/amd64/pci/pci_cfgreg.c b/sys/amd64/pci/pci_cfgreg.c index bfa88999b3f1..b4c3b8a87c77 100644 --- a/sys/amd64/pci/pci_cfgreg.c +++ b/sys/amd64/pci/pci_cfgreg.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pcibus.c,v 1.20 1995/12/10 13:39:04 phk Exp $ +** $Id: pcibus.c,v 1.21 1995/12/16 00:27:59 bde Exp $ ** ** pci bus subroutines for i386 architecture. ** @@ -35,6 +35,8 @@ *************************************************************************** */ +#include "vector.h" + #include #include #include @@ -425,10 +427,35 @@ pcibus_write (pcici_t tag, u_long reg, u_long data) static int pcibus_ihandler_attach (int irq, inthand2_t *func, int arg, unsigned * maskptr) { - int result; + char buf[16]; + char *cp; + int free_id, id, result; + + sprintf(buf, "pci irq%d", irq); + for (cp = intrnames, free_id = 0, id = 0; id < NR_DEVICES; id++) { + if (strcmp(cp, buf) == 0) + break; + if (free_id <= 0 && strcmp(cp, "pci irqnn") == 0) + free_id = id; + while (*cp++ != '\0') + ; + } + if (id == NR_DEVICES) { + id = free_id; + if (id == 0) { + /* + * All pci irq counters are in use, perhaps because + * config is old so there aren't any. Abuse the + * clk0 counter. + */ + printf ( + "pcibus_ihandler_attach: counting pci irq%d's as clk0 irqs\n", + irq); + } + } result = register_intr( irq, /* isa irq */ - 0, /* deviced?? */ + id, /* device id */ 0, /* flags? */ func, /* handler */ maskptr, /* mask pointer */ diff --git a/sys/i386/isa/pcibus.c b/sys/i386/isa/pcibus.c index bfa88999b3f1..b4c3b8a87c77 100644 --- a/sys/i386/isa/pcibus.c +++ b/sys/i386/isa/pcibus.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pcibus.c,v 1.20 1995/12/10 13:39:04 phk Exp $ +** $Id: pcibus.c,v 1.21 1995/12/16 00:27:59 bde Exp $ ** ** pci bus subroutines for i386 architecture. ** @@ -35,6 +35,8 @@ *************************************************************************** */ +#include "vector.h" + #include #include #include @@ -425,10 +427,35 @@ pcibus_write (pcici_t tag, u_long reg, u_long data) static int pcibus_ihandler_attach (int irq, inthand2_t *func, int arg, unsigned * maskptr) { - int result; + char buf[16]; + char *cp; + int free_id, id, result; + + sprintf(buf, "pci irq%d", irq); + for (cp = intrnames, free_id = 0, id = 0; id < NR_DEVICES; id++) { + if (strcmp(cp, buf) == 0) + break; + if (free_id <= 0 && strcmp(cp, "pci irqnn") == 0) + free_id = id; + while (*cp++ != '\0') + ; + } + if (id == NR_DEVICES) { + id = free_id; + if (id == 0) { + /* + * All pci irq counters are in use, perhaps because + * config is old so there aren't any. Abuse the + * clk0 counter. + */ + printf ( + "pcibus_ihandler_attach: counting pci irq%d's as clk0 irqs\n", + irq); + } + } result = register_intr( irq, /* isa irq */ - 0, /* deviced?? */ + id, /* device id */ 0, /* flags? */ func, /* handler */ maskptr, /* mask pointer */ diff --git a/sys/i386/pci/pci_bus.c b/sys/i386/pci/pci_bus.c index bfa88999b3f1..b4c3b8a87c77 100644 --- a/sys/i386/pci/pci_bus.c +++ b/sys/i386/pci/pci_bus.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pcibus.c,v 1.20 1995/12/10 13:39:04 phk Exp $ +** $Id: pcibus.c,v 1.21 1995/12/16 00:27:59 bde Exp $ ** ** pci bus subroutines for i386 architecture. ** @@ -35,6 +35,8 @@ *************************************************************************** */ +#include "vector.h" + #include #include #include @@ -425,10 +427,35 @@ pcibus_write (pcici_t tag, u_long reg, u_long data) static int pcibus_ihandler_attach (int irq, inthand2_t *func, int arg, unsigned * maskptr) { - int result; + char buf[16]; + char *cp; + int free_id, id, result; + + sprintf(buf, "pci irq%d", irq); + for (cp = intrnames, free_id = 0, id = 0; id < NR_DEVICES; id++) { + if (strcmp(cp, buf) == 0) + break; + if (free_id <= 0 && strcmp(cp, "pci irqnn") == 0) + free_id = id; + while (*cp++ != '\0') + ; + } + if (id == NR_DEVICES) { + id = free_id; + if (id == 0) { + /* + * All pci irq counters are in use, perhaps because + * config is old so there aren't any. Abuse the + * clk0 counter. + */ + printf ( + "pcibus_ihandler_attach: counting pci irq%d's as clk0 irqs\n", + irq); + } + } result = register_intr( irq, /* isa irq */ - 0, /* deviced?? */ + id, /* device id */ 0, /* flags? */ func, /* handler */ maskptr, /* mask pointer */ diff --git a/sys/i386/pci/pci_cfgreg.c b/sys/i386/pci/pci_cfgreg.c index bfa88999b3f1..b4c3b8a87c77 100644 --- a/sys/i386/pci/pci_cfgreg.c +++ b/sys/i386/pci/pci_cfgreg.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pcibus.c,v 1.20 1995/12/10 13:39:04 phk Exp $ +** $Id: pcibus.c,v 1.21 1995/12/16 00:27:59 bde Exp $ ** ** pci bus subroutines for i386 architecture. ** @@ -35,6 +35,8 @@ *************************************************************************** */ +#include "vector.h" + #include #include #include @@ -425,10 +427,35 @@ pcibus_write (pcici_t tag, u_long reg, u_long data) static int pcibus_ihandler_attach (int irq, inthand2_t *func, int arg, unsigned * maskptr) { - int result; + char buf[16]; + char *cp; + int free_id, id, result; + + sprintf(buf, "pci irq%d", irq); + for (cp = intrnames, free_id = 0, id = 0; id < NR_DEVICES; id++) { + if (strcmp(cp, buf) == 0) + break; + if (free_id <= 0 && strcmp(cp, "pci irqnn") == 0) + free_id = id; + while (*cp++ != '\0') + ; + } + if (id == NR_DEVICES) { + id = free_id; + if (id == 0) { + /* + * All pci irq counters are in use, perhaps because + * config is old so there aren't any. Abuse the + * clk0 counter. + */ + printf ( + "pcibus_ihandler_attach: counting pci irq%d's as clk0 irqs\n", + irq); + } + } result = register_intr( irq, /* isa irq */ - 0, /* deviced?? */ + id, /* device id */ 0, /* flags? */ func, /* handler */ maskptr, /* mask pointer */ diff --git a/sys/i386/pci/pci_pir.c b/sys/i386/pci/pci_pir.c index bfa88999b3f1..b4c3b8a87c77 100644 --- a/sys/i386/pci/pci_pir.c +++ b/sys/i386/pci/pci_pir.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pcibus.c,v 1.20 1995/12/10 13:39:04 phk Exp $ +** $Id: pcibus.c,v 1.21 1995/12/16 00:27:59 bde Exp $ ** ** pci bus subroutines for i386 architecture. ** @@ -35,6 +35,8 @@ *************************************************************************** */ +#include "vector.h" + #include #include #include @@ -425,10 +427,35 @@ pcibus_write (pcici_t tag, u_long reg, u_long data) static int pcibus_ihandler_attach (int irq, inthand2_t *func, int arg, unsigned * maskptr) { - int result; + char buf[16]; + char *cp; + int free_id, id, result; + + sprintf(buf, "pci irq%d", irq); + for (cp = intrnames, free_id = 0, id = 0; id < NR_DEVICES; id++) { + if (strcmp(cp, buf) == 0) + break; + if (free_id <= 0 && strcmp(cp, "pci irqnn") == 0) + free_id = id; + while (*cp++ != '\0') + ; + } + if (id == NR_DEVICES) { + id = free_id; + if (id == 0) { + /* + * All pci irq counters are in use, perhaps because + * config is old so there aren't any. Abuse the + * clk0 counter. + */ + printf ( + "pcibus_ihandler_attach: counting pci irq%d's as clk0 irqs\n", + irq); + } + } result = register_intr( irq, /* isa irq */ - 0, /* deviced?? */ + id, /* device id */ 0, /* flags? */ func, /* handler */ maskptr, /* mask pointer */