Turns out that one bit isn't enough. Introduce two new fields
csc_route and func_route to hold the way that each interrupt is routed. csc is Card Status Change in the datasheets and standard, but is called "Management Interrupt" in FreeBSDese. There are three types of interrupt routing: ISA parallel, PCI parallel and ISA serial (some chipsets support other types as well, but I don't plan on supporting them). When we try to allocate an interrupt, and the type for that interrupt is pci_parallel, allow it to be shared by oring in RF_SHAREABLE to the flags argument. Introduce pcic_alloc_resource to allow this to happen.
This commit is contained in:
parent
8a24285612
commit
f83a4e8171
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=77293
@ -324,7 +324,7 @@ pcic_attach(device_t dev)
|
||||
rid = 0;
|
||||
r = NULL;
|
||||
flags = RF_ACTIVE;
|
||||
if (sc->flags & PCIC_SHARED_IRQ)
|
||||
if (sc->csc_route == pci_parallel)
|
||||
flags |= RF_SHAREABLE;
|
||||
r = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, flags);
|
||||
if (r == NULL) {
|
||||
@ -905,3 +905,19 @@ pcic_get_memory_offset(device_t bus, device_t child, int rid, u_int32_t *offset)
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
struct resource *
|
||||
pcic_alloc_resource(device_t dev, device_t child, int type, int *rid,
|
||||
u_long start, u_long end, u_long count, u_int flags)
|
||||
{
|
||||
struct pcic_softc *sc = device_get_softc(dev);
|
||||
|
||||
/*
|
||||
* If we're routing via pci, we can share.
|
||||
*/
|
||||
if (sc->func_route == pci_parallel && type == SYS_RES_IRQ)
|
||||
flags |= RF_SHAREABLE;
|
||||
|
||||
return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
|
||||
count, flags));
|
||||
}
|
||||
|
@ -284,6 +284,8 @@ pcic_isa_attach(device_t dev)
|
||||
}
|
||||
sc->iorid = rid;
|
||||
sc->iores = r;
|
||||
sc->csc_route = isa_parallel;
|
||||
sc->func_route = isa_parallel;
|
||||
return (pcic_attach(dev));
|
||||
}
|
||||
|
||||
@ -298,7 +300,7 @@ static device_method_t pcic_methods[] = {
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
|
||||
DEVMETHOD(bus_alloc_resource, pcic_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, pcic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, pcic_deactivate_resource),
|
||||
|
@ -40,6 +40,8 @@ struct pcic_slot {
|
||||
bus_space_handle_t bsh;
|
||||
};
|
||||
|
||||
enum pcic_irq_type { isa_parallel, pci_parallel, isa_serial };
|
||||
|
||||
struct pcic_softc
|
||||
{
|
||||
u_int32_t slotmask;/* Mask of valid slots */
|
||||
@ -50,7 +52,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 0x00000020 /* Uses the ricoh power regs */
|
||||
#define PCIC_SHARED_IRQ 0x00000040 /* Allow IRQs to be shared */
|
||||
enum pcic_irq_type csc_route; /* How to route csc interrupts */
|
||||
enum pcic_irq_type 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 */
|
||||
@ -67,25 +70,27 @@ struct pcic_softc
|
||||
|
||||
extern devclass_t pcic_devclass;
|
||||
|
||||
int pcic_attach(device_t dev);
|
||||
int pcic_activate_resource(device_t dev, device_t child, int type, int rid,
|
||||
struct resource *r);
|
||||
struct resource *pcic_alloc_resource(device_t dev, device_t child, int type,
|
||||
int *rid, u_long start, u_long end, u_long count, u_int flags);
|
||||
int pcic_attach(device_t dev);
|
||||
void pcic_clrb(struct pcic_slot *sp, int reg, unsigned char mask);
|
||||
int pcic_deactivate_resource(device_t dev, device_t child, int type, int rid,
|
||||
struct resource *r);
|
||||
void pcic_dealloc(device_t dev);
|
||||
int pcic_get_memory_offset(device_t bus, device_t child, int rid,
|
||||
u_int32_t *offset);
|
||||
int pcic_get_res_flags(device_t bus, device_t child, int restype, int rid,
|
||||
u_long *value);
|
||||
unsigned char pcic_getb_io(struct pcic_slot *sp, int reg);
|
||||
void pcic_putb_io(struct pcic_slot *sp, int reg, unsigned char val);
|
||||
int pcic_set_memory_offset(device_t bus, device_t child, int rid,
|
||||
u_int32_t offset, u_int32_t *deltap);
|
||||
int pcic_set_res_flags(device_t bus, device_t child, int restype, int rid,
|
||||
u_long value);
|
||||
void pcic_setb(struct pcic_slot *sp, int reg, unsigned char mask);
|
||||
int pcic_setup_intr(device_t dev, device_t child, struct resource *irq,
|
||||
int flags, driver_intr_t *intr, void *arg, void **cookiep);
|
||||
int pcic_teardown_intr(device_t dev, device_t child, struct resource *irq,
|
||||
void *cookie);
|
||||
int pcic_set_res_flags(device_t bus, device_t child, int restype, int rid,
|
||||
u_long value);
|
||||
int pcic_get_res_flags(device_t bus, device_t child, int restype, int rid,
|
||||
u_long *value);
|
||||
int pcic_get_memory_offset(device_t bus, device_t child, int rid,
|
||||
u_int32_t *offset);
|
||||
int pcic_set_memory_offset(device_t bus, device_t child, int rid,
|
||||
u_int32_t offset, u_int32_t *deltap);
|
||||
void pcic_clrb(struct pcic_slot *sp, int reg, unsigned char mask);
|
||||
void pcic_setb(struct pcic_slot *sp, int reg, unsigned char mask);
|
||||
void pcic_dealloc(device_t dev);
|
||||
unsigned char pcic_getb_io(struct pcic_slot *sp, int reg);
|
||||
void pcic_putb_io(struct pcic_slot *sp, int reg, unsigned char val);
|
||||
|
Loading…
Reference in New Issue
Block a user