diff options
-rw-r--r-- | sys/pccard/pcic.c | 12 | ||||
-rw-r--r-- | sys/pccard/pcic_isa.c | 4 | ||||
-rw-r--r-- | sys/pccard/pcic_pci.c | 57 | ||||
-rw-r--r-- | sys/pccard/pcicvar.h | 6 |
4 files changed, 45 insertions, 34 deletions
diff --git a/sys/pccard/pcic.c b/sys/pccard/pcic.c index 6208bd7..78548e2 100644 --- a/sys/pccard/pcic.c +++ b/sys/pccard/pcic.c @@ -307,7 +307,7 @@ pcic_do_mgt_irq(struct pcic_slot *sp, int irq) { u_int32_t reg; - if (sp->sc->csc_route == pci_parallel) { + if (sp->sc->csc_route == pcic_iw_pci) { /* Do the PCI side of things: Enable the Card Change int */ reg = CB_SM_CD; bus_space_write_4(sp->bst, sp->bsh, CB_SOCKET_MASK, reg); @@ -412,7 +412,7 @@ pcic_sresource(struct slot *slt, caddr_t data) * return in pr->resource_addr). */ if (pr->type == SYS_RES_IRQ) { - if (sp->sc->func_route >= pci_parallel) { + if (sp->sc->func_route >= pcic_iw_pci) { pr->resource_addr = sp->sc->irq; return (0); } @@ -613,7 +613,7 @@ static void pcic_mapirq(struct slot *slt, int irq) { struct pcic_slot *sp = slt->cdata; - if (sp->sc->csc_route == pci_parallel) + if (sp->sc->csc_route == pcic_iw_pci) return; irq = host_irq_to_pcic(irq); if (irq == 0) @@ -794,9 +794,9 @@ pcic_setup_intr(device_t dev, device_t child, struct resource *irq, int err; #if __FreeBSD_version >= 500000 - if (sc->csc_route == pci_parallel && (flags & INTR_FAST)) + if (sc->csc_route == pcic_iw_pci && (flags & INTR_FAST)) #else - if (sc->csc_route == pci_parallel && (flags & INTR_TYPE_FAST)) + if (sc->csc_route == pcic_iw_pci && (flags & INTR_TYPE_FAST)) #endif return (EINVAL); @@ -927,7 +927,7 @@ pcic_alloc_resource(device_t dev, device_t child, int type, int *rid, /* * If we're routing via pci, we can share. */ - if (sc->func_route == pci_parallel && type == SYS_RES_IRQ) { + if (sc->func_route == pcic_iw_pci && type == SYS_RES_IRQ) { if (bootverbose) device_printf(child, "Forcing IRQ to %d\n", sc->irq); start = end = sc->irq; diff --git a/sys/pccard/pcic_isa.c b/sys/pccard/pcic_isa.c index 4b0072e..ce39f26 100644 --- a/sys/pccard/pcic_isa.c +++ b/sys/pccard/pcic_isa.c @@ -289,8 +289,8 @@ pcic_isa_attach(device_t dev) } sc->iorid = rid; sc->iores = r; - sc->csc_route = isa_parallel; - sc->func_route = isa_parallel; + sc->csc_route = pcic_iw_isa; + sc->func_route = pcic_iw_isa; rid = 0; r = NULL; diff --git a/sys/pccard/pcic_pci.c b/sys/pccard/pcic_pci.c index 18c7a70..0534cfb 100644 --- a/sys/pccard/pcic_pci.c +++ b/sys/pccard/pcic_pci.c @@ -73,11 +73,20 @@ SYSCTL_INT(_hw_pcic, OID_AUTO, ignore_function_1, CTLFLAG_RD, * routing doesn't work. It is purposely vague and undocumented * at the moment. */ -static int pcic_interrupt_route = (int) pci_parallel; -TUNABLE_INT("hw.pcic.interrupt_route", &pcic_interrupt_route); -SYSCTL_INT(_hw_pcic, OID_AUTO, interrupt_route, CTLFLAG_RD, - &pcic_interrupt_route, (int) pci_parallel, - "Interrupt routing type for pci cardbus bridges."); +static int pcic_intr_path = (int) pcic_iw_pci; +TUNABLE_INT("hw.pcic.intr_path", &pcic_intr_path); +SYSCTL_INT(_hw_pcic, OID_AUTO, intr_path, CTLFLAG_RD, + &pcic_intr_path, (int) pcic_iw_pci, + "Which path to send the interrupts over. 1 -- isa, 2 -- pci"); + +static int pcic_init_routing = 0; +TUNABLE_INT("hw.pcic.init_routing", &pcic_init_routing); +SYSCTL_INT(_hw_pcic, OID_AUTO, init_routing, CTLFLAG_RD, + &pcic_init_routing, 0, + "Force the interrupt routing to be initialized on those bridges where\n\ +doing so will cause probelms. Often when no interrupts appear to be routed\n\ +setting this tunable to 1 will resolve the problem. PCI Cards will almost\n\ +always require this, while builtin bridges need it less often"); struct pcic_pci_table { @@ -239,19 +248,19 @@ pcic_pci_pd683x_init(device_t dev) */ bcr = pci_read_config(dev, CB_PCI_BRIDGE_CTRL, 2); if (device_id == PCI_DEVICE_ID_PCIC_CLPD6832) { - if (sc->csc_route >= pci_parallel) + if (sc->csc_route == pcic_iw_pci) bcr &= ~CLPD6832_BCR_MGMT_IRQ_ENA; else bcr |= CLPD6832_BCR_MGMT_IRQ_ENA; } - if (sc->func_route >= pci_parallel) + if (sc->func_route == pcic_iw_pci) bcr &= ~CB_BCR_INT_EXCA; else bcr |= CB_BCR_INT_EXCA; pci_write_config(dev, CB_PCI_BRIDGE_CTRL, bcr, 2); if (device_id == PCI_DEVICE_ID_PCIC_CLPD6833) { cm1 = pci_read_config(dev, CLPD6833_CFG_MISC_1, 4); - if (sc->csc_route >= pci_parallel) + if (sc->csc_route == pcic_iw_pci) cm1 &= ~CLPD6833_CM1_MGMT_EXCA_ENA; else cm1 |= CLPD6833_CM1_MGMT_EXCA_ENA; @@ -287,13 +296,13 @@ pcic_pci_ti_init(device_t dev) * newer cards also use offset 0x3e (the Bridge Control * register). */ - if (sc->func_route >= pci_parallel) { + if (sc->func_route == pcic_iw_pci) { cardcntl |= TI113X_CARDCNTL_PCI_IRQ_ENA; cardcntl &= ~TI113X_CARDCNTL_PCI_IREQ; } else { cardcntl |= TI113X_CARDCNTL_PCI_IREQ; } - if (sc->csc_route >= pci_parallel) + if (sc->csc_route == pcic_iw_pci) cardcntl |= TI113X_CARDCNTL_PCI_CSC; else cardcntl &= ~TI113X_CARDCNTL_PCI_CSC; @@ -333,13 +342,15 @@ pcic_pci_ti_init(device_t dev) * 7 of Bridge Control Register(Offset:0x3e,0x13e). * Takeshi Shibagaki(shiba@jp.freebsd.org) */ - if (sc->func_route >= pci_parallel) { -#ifdef PCI_CARDBUS_CARD - devcntl &= ~TI113X_DEVCNTL_INTR_MASK; - pci_write_config(dev, TI113X_PCI_DEVICE_CONTROL, devcntl, 1); - devcntl = pci_read_config(dev, TI113X_PCI_DEVICE_CONTROL, 1); - syscntl |= TI113X_SYSCNTL_INTRTIE; -#endif + if (sc->func_route == pcic_iw_pci) { + if (pcic_init_routing) { + devcntl &= ~TI113X_DEVCNTL_INTR_MASK; + pci_write_config(dev, TI113X_PCI_DEVICE_CONTROL, + devcntl, 1); + devcntl = pci_read_config(dev, + TI113X_PCI_DEVICE_CONTROL, 1); + syscntl |= TI113X_SYSCNTL_INTRTIE; + } syscntl &= ~TI113X_SYSCNTL_SMIENB; pci_write_config(dev, TI113X_PCI_SYSTEM_CONTROL, syscntl, 1); } @@ -375,8 +386,8 @@ pcic_pci_cardbus_init(device_t dev) unit = device_get_unit(dev); - if (sc->func_route >= pci_parallel) { - /* Use INTA for routing interrupts via pci bus */ + if (sc->func_route == pcic_iw_pci) { + /* Use INTA for routing function interrupts via pci bus */ brgcntl = pci_read_config(dev, CB_PCI_BRIDGE_CTRL, 2); brgcntl &= ~CB_BCR_INT_EXCA; brgcntl |= CB_BCR_WRITE_POST_EN | CB_BCR_MASTER_ABORT; @@ -574,7 +585,7 @@ pcic_pci_probe(device_t dev) * We only need to route interrupts when we're doing pci * parallel interrupt routing. */ - if (pcic_interrupt_route >= pci_parallel) { + if (pcic_intr_path == pcic_iw_pci) { rid = 0; res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, RF_ACTIVE); @@ -658,8 +669,8 @@ pcic_pci_attach(device_t dev) } sp->slt = (struct slot *) 1; sc->dev = dev; - sc->csc_route = pcic_interrupt_route; - sc->func_route = pcic_interrupt_route; + sc->csc_route = pcic_intr_path; + sc->func_route = pcic_intr_path; switch (device_id) { case PCI_DEVICE_ID_RICOH_RL5C465: @@ -706,7 +717,7 @@ pcic_pci_attach(device_t dev) break; } - if (sc->csc_route >= pci_parallel) { + if (sc->csc_route == pcic_iw_pci) { start = 0; end = ~0; } else { diff --git a/sys/pccard/pcicvar.h b/sys/pccard/pcicvar.h index eef0e7f..04626ef 100644 --- a/sys/pccard/pcicvar.h +++ b/sys/pccard/pcicvar.h @@ -41,7 +41,7 @@ struct pcic_slot { void *argp; }; -enum pcic_irq_type { isa_parallel = 1, isa_serial, pci_parallel, pci_serial }; +enum pcic_intr_way { pcic_iw_isa = 1, pcic_iw_pci = 2 }; struct pcic_softc { @@ -53,8 +53,8 @@ struct pcic_softc #define PCIC_VG_POWER 0x00000008 /* Uses VG power regs */ #define PCIC_KING_POWER 0x00000010 /* Uses IBM KING regs */ #define PCIC_RICOH_POWER 0x0000020 /* Uses the ricoh power regs */ - enum pcic_irq_type csc_route; /* How to route csc interrupts */ - enum pcic_irq_type func_route; /* How to route function ints */ + enum pcic_intr_way csc_route; /* How to route csc interrupts */ + enum pcic_intr_way func_route; /* How to route function ints */ int iorid; /* Rid of I/O region */ struct resource *iores; /* resource for I/O region */ int memrid; /* Memory rid */ |