diff options
author | msmith <msmith@FreeBSD.org> | 2000-12-08 22:11:23 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 2000-12-08 22:11:23 +0000 |
commit | c27f2d3c492a3d78680bb4c52f0be2c345735e1d (patch) | |
tree | ab8e18698d3c3ee4b4443c78e8ba86065bed1ff3 /sys/alpha/pci | |
parent | 3e12cdd63653239c3c71bf1e7042f1149134e630 (diff) | |
download | FreeBSD-src-c27f2d3c492a3d78680bb4c52f0be2c345735e1d.zip FreeBSD-src-c27f2d3c492a3d78680bb4c52f0be2c345735e1d.tar.gz |
Next phase in the PCI subsystem cleanup.
- Move PCI core code to dev/pci.
- Split bridge code out into separate modules.
- Remove the descriptive strings from the bridge drivers. If you
want to know what a device is, use pciconf. Add support for
broadly identifying devices based on class/subclass, and for
parsing a preloaded device identification database so that if
you want to waste the memory, you can identify *anything* we know
about.
- Remove machine-dependant code from the core PCI code. APIC interrupt
mapping is performed by shadowing the intline register in machine-
dependant code.
- Bring interrupt routing support to the Alpha
(although many platforms don't yet support routing or mapping
interrupts entirely correctly). This resulted in spamming
<sys/bus.h> into more places than it really should have gone.
- Put sys/dev on the kernel/modules include path. This avoids
having to change *all* the pci*.h includes.
Diffstat (limited to 'sys/alpha/pci')
-rw-r--r-- | sys/alpha/pci/apecs_pci.c | 2 | ||||
-rw-r--r-- | sys/alpha/pci/cia_pci.c | 1 | ||||
-rw-r--r-- | sys/alpha/pci/irongate_pci.c | 2 | ||||
-rw-r--r-- | sys/alpha/pci/lca_pci.c | 2 | ||||
-rw-r--r-- | sys/alpha/pci/pcibus.c | 15 | ||||
-rw-r--r-- | sys/alpha/pci/t2.c | 63 | ||||
-rw-r--r-- | sys/alpha/pci/t2_pci.c | 2 | ||||
-rw-r--r-- | sys/alpha/pci/t2var.h | 2 | ||||
-rw-r--r-- | sys/alpha/pci/tsunami_pci.c | 1 |
9 files changed, 54 insertions, 36 deletions
diff --git a/sys/alpha/pci/apecs_pci.c b/sys/alpha/pci/apecs_pci.c index 7030111..2190748 100644 --- a/sys/alpha/pci/apecs_pci.c +++ b/sys/alpha/pci/apecs_pci.c @@ -35,6 +35,7 @@ #include <sys/rman.h> #include <pci/pcivar.h> #include <machine/swiz.h> +#include <machine/md_var.h> #include <alpha/pci/apecsreg.h> #include <alpha/pci/apecsvar.h> @@ -188,6 +189,7 @@ static device_method_t apecs_pcib_methods[] = { DEVMETHOD(pcib_maxslots, apecs_pcib_maxslots), DEVMETHOD(pcib_read_config, apecs_pcib_read_config), DEVMETHOD(pcib_write_config, apecs_pcib_write_config), + DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt), { 0, 0 } }; diff --git a/sys/alpha/pci/cia_pci.c b/sys/alpha/pci/cia_pci.c index aa09f41..2a36ba2 100644 --- a/sys/alpha/pci/cia_pci.c +++ b/sys/alpha/pci/cia_pci.c @@ -410,6 +410,7 @@ static device_method_t cia_pcib_methods[] = { DEVMETHOD(pcib_maxslots, cia_pcib_maxslots), DEVMETHOD(pcib_read_config, cia_pcib_read_config), DEVMETHOD(pcib_write_config, cia_pcib_write_config), + DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt), { 0, 0 } }; diff --git a/sys/alpha/pci/irongate_pci.c b/sys/alpha/pci/irongate_pci.c index 00c90aa..4950547 100644 --- a/sys/alpha/pci/irongate_pci.c +++ b/sys/alpha/pci/irongate_pci.c @@ -202,6 +202,8 @@ static device_method_t irongate_pcib_methods[] = { DEVMETHOD(pcib_maxslots, irongate_pcib_maxslots), DEVMETHOD(pcib_read_config, irongate_pcib_read_config), DEVMETHOD(pcib_write_config, irongate_pcib_write_config), + DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt), + { 0, 0 } }; diff --git a/sys/alpha/pci/lca_pci.c b/sys/alpha/pci/lca_pci.c index 36ede70..f139b59a 100644 --- a/sys/alpha/pci/lca_pci.c +++ b/sys/alpha/pci/lca_pci.c @@ -35,6 +35,7 @@ #include <sys/rman.h> #include <pci/pcivar.h> #include <machine/swiz.h> +#include <machine/md_var.h> #include <alpha/pci/lcareg.h> #include <alpha/pci/lcavar.h> @@ -184,6 +185,7 @@ static device_method_t lca_pcib_methods[] = { DEVMETHOD(pcib_maxslots, lca_pcib_maxslots), DEVMETHOD(pcib_read_config, lca_pcib_read_config), DEVMETHOD(pcib_write_config, lca_pcib_write_config), + DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt), { 0, 0 } }; diff --git a/sys/alpha/pci/pcibus.c b/sys/alpha/pci/pcibus.c index 0d54f63..aea4a88 100644 --- a/sys/alpha/pci/pcibus.c +++ b/sys/alpha/pci/pcibus.c @@ -76,11 +76,18 @@ SYSCTL_LONG(_hw_chipset, OID_AUTO, dense, CTLFLAG_RD, &chipset_dense, 0, SYSCTL_LONG(_hw_chipset, OID_AUTO, hae_mask, CTLFLAG_RD, &chipset_hae_mask, 0, "PCI chipset mask for HAE register"); -void -alpha_platform_assign_pciintr(pcicfgregs *cfg) +int +alpha_pci_route_interrupt(device_t bus, device_t dev, int pin) { - if(platform.pci_intr_map) - platform.pci_intr_map((void *)cfg); + /* + * Validate requested pin number. + */ + if ((pin < 1) || (pin > 4)) + return(255); + + if (platform.pci_intr_route) + return(platform.pci_intr_route(bus, dev, pin)); + return(255); } #if NISA > 0 diff --git a/sys/alpha/pci/t2.c b/sys/alpha/pci/t2.c index 461376e..0e3c2a0 100644 --- a/sys/alpha/pci/t2.c +++ b/sys/alpha/pci/t2.c @@ -382,7 +382,7 @@ t2_attach(device_t dev) */ static int -t2_ICIC_slot_to_STDIO_irq(pcicfgregs *cfg) +t2_ICIC_slot_to_STDIO_irq(device_t bus, device_t dev, int pin) { int ret_irq = 0; @@ -391,36 +391,42 @@ t2_ICIC_slot_to_STDIO_irq(pcicfgregs *cfg) * Return the interrupt pin number for the PCI slots. */ - if ((cfg->intpin < 1) || (cfg->intpin > 4)) - return(-1); - - /* Generate the proper interrupt conversion for the physical + /* + * Generate the proper interrupt conversion for the physical * PCI slots (for both the primary PCI slots and those behind - * a PPB). */ - - if ((cfg->slot >= 6) && (cfg->slot <= 9)) { - ret_irq = (32 + (4 * (cfg->slot - 6))) + - (cfg->intpin - 1) + (16 * cfg->secondarybus); + * a PPB). + */ + /* + * XXX This code is wrong; we need to determine the correct + * swizzle for devices behind the onboard PCI:PCI bridge + * and ensure that the generic bridge code doesn't try to + * reroute them. + */ + if ((pci_get_slot(dev) >= 6) && (pci_get_slot(dev) <= 9)) { + ret_irq = (32 + (4 * (pci_get_slot(dev) - 6))) + + (pin - 1) + (16 * pci_get_bus(dev)); return (ret_irq); } /* Convert the NCR810A chip behind the PPB */ - if (cfg->slot == 1) { + if (pci_get_slot(dev) == 1) { ret_irq = 28; return (ret_irq); } - /* Convert the NCR810A chip on the primary PCI bus or the + /* + * Convert the NCR810A chip on the primary PCI bus or the * TULIP chip behind the PPB. There is no system that has * both, so there really is no sharing going on although it - * looks like it. */ - if ( (cfg->slot == 4) || (cfg->slot == 0) ) { + * looks like it. + */ + if ((pci_get_slot(dev) == 4) || (pci_get_slot(dev) == 0)) { ret_irq = 24; return (ret_irq); } printf("ICIC invalid pci slot: 0x%x intpin: 0x%x bus num:0x%x\n", - cfg->slot, cfg->intpin, cfg->bus); + pci_get_slot(dev), pin, pci_get_bus(dev)); return(-1); } @@ -429,59 +435,54 @@ t2_ICIC_slot_to_STDIO_irq(pcicfgregs *cfg) */ static int -t2_pci0_slot_to_STDIO_irq(pcicfgregs *cfg) +t2_pci0_slot_to_STDIO_irq(device_t bus, device_t dev, int pin) { - switch(cfg->slot) { + switch(pci_get_slot(dev)) { case 0: /* ethernet (tulip) port */ return(0x2); case 1: /* scsi 810 */ return(0x1); case 6: /* optional slot 0 */ - switch (cfg->intpin) { + switch (pin) { case 1: return(0x0); case 2: return(0x18); case 3: return(0x1a); case 4: return(0x1d); } case 7: /* optional slot 1 */ - switch (cfg->intpin) { + switch (pin) { case 1: return(0x4); case 2: return(0x19); case 3: return(0x1b); case 4: return(0x1e); } case 8: /* optional slot 2 */ - switch (cfg->intpin) { + switch (pin) { case 1: return(0x5); case 2: return(0x14); case 3: return(0x1c); case 4: return(0x1f); } default: /* invalid slot */ - printf("PCI slot %d unknown\n", cfg->slot); + printf("PCI slot %d unknown\n", pci_get_slot(dev)); return(-1); } printf("invalid pci0 intpin slot: 0x%x intpin: 0x%x\n", - cfg->slot, cfg->intpin); + pci_get_slot(dev), pin); return (-1); } - -void -t2_intr_map(void *arg) +int +t2_intr_route(device_t bus, device_t dev, int pin) { - pcicfgregs *cfg; - - cfg = (pcicfgregs *)arg; if (pci_int_type[0]) { - t2_ICIC_slot_to_STDIO_irq(cfg); + return (t2_ICIC_slot_to_STDIO_irq(bus, dev, pin)); } else { - t2_pci0_slot_to_STDIO_irq(cfg); + return (t2_pci0_slot_to_STDIO_irq(bus, dev, pin)); } } - /* * magical mystery table partly obtained from Linux * at least some of their values for PCI masks diff --git a/sys/alpha/pci/t2_pci.c b/sys/alpha/pci/t2_pci.c index 73a754a..cd0bf06 100644 --- a/sys/alpha/pci/t2_pci.c +++ b/sys/alpha/pci/t2_pci.c @@ -35,6 +35,7 @@ #include <sys/rman.h> #include <pci/pcivar.h> #include <machine/swiz.h> +#include <machine/md_var.h> #include <alpha/pci/t2reg.h> #include <alpha/pci/t2var.h> @@ -190,6 +191,7 @@ static device_method_t t2_pcib_methods[] = { DEVMETHOD(pcib_maxslots, t2_pcib_maxslots), DEVMETHOD(pcib_read_config, t2_pcib_read_config), DEVMETHOD(pcib_write_config, t2_pcib_write_config), + DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt), { 0, 0 } }; diff --git a/sys/alpha/pci/t2var.h b/sys/alpha/pci/t2var.h index a328633..770f05d 100644 --- a/sys/alpha/pci/t2var.h +++ b/sys/alpha/pci/t2var.h @@ -29,4 +29,4 @@ extern vm_offset_t sable_lynx_base; extern void t2_init(void); -void t2_intr_map(void *); +extern int t2_intr_route(device_t, device_t, int); diff --git a/sys/alpha/pci/tsunami_pci.c b/sys/alpha/pci/tsunami_pci.c index f4a190b..b77754a 100644 --- a/sys/alpha/pci/tsunami_pci.c +++ b/sys/alpha/pci/tsunami_pci.c @@ -276,6 +276,7 @@ static device_method_t tsunami_pcib_methods[] = { DEVMETHOD(pcib_maxslots, tsunami_pcib_maxslots), DEVMETHOD(pcib_read_config, tsunami_pcib_read_config), DEVMETHOD(pcib_write_config, tsunami_pcib_write_config), + DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt), { 0, 0 } }; |