From 7e15f71f4f1c5f94eb545e4a349a6594ca5ccba7 Mon Sep 17 00:00:00 2001 From: imp Date: Sun, 27 May 2001 05:53:37 +0000 Subject: Allow a shareable interrupts. Note, the bridge must set this flag or the irq will be unshareable, as things are now. More work likely is needed, but this is a good checkpoint. # pcic_pci.c is getting closer :-) --- sys/pccard/pcic.c | 30 +++++++++++++++--------------- sys/pccard/pcicvar.h | 1 + 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'sys/pccard') diff --git a/sys/pccard/pcic.c b/sys/pccard/pcic.c index 7e3496c..8a3598c 100644 --- a/sys/pccard/pcic.c +++ b/sys/pccard/pcic.c @@ -286,7 +286,8 @@ int pcic_attach(device_t dev) { int error; - int irq; + u_int flags; + int irq = 0; int i; device_t kid; struct resource *r; @@ -320,29 +321,30 @@ pcic_attach(device_t dev) sp->sc = sc; } - irq = bus_get_resource_start(dev, SYS_RES_IRQ, 0); - if (irq == 0) { - /* See if the user has requested a specific IRQ */ - if (!getenv_int("machdep.pccard.pcic_irq", &irq)) - irq = 0; - } rid = 0; - r = 0; - if (irq > 0) { - r = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, irq, - irq, 1, RF_ACTIVE); + r = NULL; + flags = RF_ACTIVE; + if (sc->flags & PCIC_SHARED_IRQ) + flags |= RF_SHAREABLE; + r = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, flags); + if (r == NULL) { + /* See if the user has requested a specific IRQ */ + if (getenv_int("machdep.pccard.pcic_irq", &irq)) + r = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, + irq, irq, 1, flags); } if (r && ((1 << (rman_get_start(r))) & PCIC_INT_MASK_ALLOWED) == 0) { device_printf(dev, "Hardware does not support irq %d, trying polling.\n", irq); bus_release_resource(dev, SYS_RES_IRQ, rid, r); - r = 0; irq = 0; + r = NULL; } sc->irqrid = rid; sc->irqres = r; - if (r) { + irq = 0; + if (r != NULL) { error = bus_setup_intr(dev, r, INTR_TYPE_MISC, pcicintr, (void *) sc, &sc->ih); if (error) { @@ -351,8 +353,6 @@ pcic_attach(device_t dev) } irq = rman_get_start(r); device_printf(dev, "management irq %d\n", irq); - } else { - irq = 0; } if (irq == 0) { sc->timeout_ch = timeout(pcictimeout, (void *) sc, hz/2); diff --git a/sys/pccard/pcicvar.h b/sys/pccard/pcicvar.h index 7fd6c562..81db1eb 100644 --- a/sys/pccard/pcicvar.h +++ b/sys/pccard/pcicvar.h @@ -50,6 +50,7 @@ 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 0x00000020 /* Uses the ricoh power regs */ +#define PCIC_SHARED_IRQ 0x00000040 /* Allow IRQs to be shared */ int iorid; /* Rid of I/O region */ struct resource *iores; /* resource for I/O region */ int memrid; /* Memory rid */ -- cgit v1.1