Save the IRQ that we get in pci attachment.
Print type of pci bridge we find. Force the IRQ of pci bridges upon all its children. Allocate the resources on behalf of the bridge when we're testing to see if they exist. This should help people who don't read updating instructions very well. This patch started out with an idea from Shigeru Yamamoto-san in -current.
This commit is contained in:
parent
b62ddc1363
commit
7077bc34aa
@ -434,14 +434,13 @@ crdioctl_sresource(dev_t dev, caddr_t data)
|
||||
{
|
||||
struct pccard_resource *pr;
|
||||
struct resource *r;
|
||||
int i;
|
||||
int rid = 1;
|
||||
int err;
|
||||
int flags;
|
||||
int rid = 0;
|
||||
device_t bridgedev;
|
||||
|
||||
pr = (struct pccard_resource *)data;
|
||||
pr->resource_addr = ~0ul;
|
||||
bridgedev = device_get_parent(PCCARD_DEV2SOFTC(dev)->dev);
|
||||
bridgedev = PCCARD_DEV2SOFTC(dev)->dev;
|
||||
switch(pr->type) {
|
||||
default:
|
||||
return (EINVAL);
|
||||
@ -450,17 +449,12 @@ crdioctl_sresource(dev_t dev, caddr_t data)
|
||||
case SYS_RES_IOPORT:
|
||||
break;
|
||||
}
|
||||
for (i = pr->min; i + pr->size - 1 <= pr->max; i++) {
|
||||
err = bus_set_resource(bridgedev, pr->type, rid, i, pr->size);
|
||||
if (err != 0)
|
||||
continue;
|
||||
r = bus_alloc_resource(bridgedev, pr->type, &rid, 0ul, ~0ul,
|
||||
pr->size, 0);
|
||||
if (r == NULL)
|
||||
continue;
|
||||
flags = rman_make_alignment_flags(pr->size);
|
||||
r = bus_alloc_resource(bridgedev, pr->type, &rid, pr->min, pr->max,
|
||||
pr->size, flags);
|
||||
if (r != NULL) {
|
||||
pr->resource_addr = (u_long)rman_get_start(r);
|
||||
bus_release_resource(bridgedev, pr->type, rid, r);
|
||||
return (0);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
@ -817,8 +817,12 @@ 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 == pci_parallel && type == SYS_RES_IRQ) {
|
||||
if (bootverbose)
|
||||
device_printf(child, "Forcing IRQ to %d\n", sc->irq);
|
||||
start = end = sc->irq;
|
||||
flags |= RF_SHAREABLE;
|
||||
}
|
||||
|
||||
return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
|
||||
count, flags));
|
||||
|
@ -430,7 +430,7 @@ pcic_pci_attach(device_t dev)
|
||||
sp->sc = sc;
|
||||
sockbase = pci_read_config(dev, 0x10, 4);
|
||||
if (sockbase & 0x1) {
|
||||
device_printf(dev, "I/O mapped device!\n");
|
||||
device_printf(dev, "I/O mapped device, might not work.\n");
|
||||
sc->iorid = CB_PCI_SOCKET_BASE;
|
||||
sc->iores = bus_alloc_resource(dev, SYS_RES_IOPORT,
|
||||
&sc->iorid, 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE);
|
||||
@ -446,6 +446,7 @@ pcic_pci_attach(device_t dev)
|
||||
sc->flags = PCIC_PD_POWER;
|
||||
num6729++;
|
||||
} else {
|
||||
device_printf(dev, "Memory mapped device, will work.\n");
|
||||
sc->memrid = CB_PCI_SOCKET_BASE;
|
||||
sc->memres = bus_alloc_resource(dev, SYS_RES_MEMORY,
|
||||
&sc->memrid, 0, ~0, 1, RF_ACTIVE);
|
||||
@ -523,6 +524,7 @@ pcic_pci_attach(device_t dev)
|
||||
}
|
||||
sc->irqrid = rid;
|
||||
sc->irqres = r;
|
||||
sc->irq = rman_get_start(r);
|
||||
error = bus_setup_intr(dev, r, INTR_TYPE_MISC, pcic_pci_intr,
|
||||
(void *) sc, &sc->ih);
|
||||
if (error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user