summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2001-06-16 06:33:01 +0000
committerimp <imp@FreeBSD.org>2001-06-16 06:33:01 +0000
commit9b40d4fdc235bc4fa04660e68ebf19292c1102e8 (patch)
tree85f82e3d0e50c54dd45921470c257a65c62e5952 /sys
parent9d1e0e392656bbbe77a4873606955970699ada5c (diff)
downloadFreeBSD-src-9b40d4fdc235bc4fa04660e68ebf19292c1102e8.zip
FreeBSD-src-9b40d4fdc235bc4fa04660e68ebf19292c1102e8.tar.gz
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.
Diffstat (limited to 'sys')
-rw-r--r--sys/pccard/pccard.c20
-rw-r--r--sys/pccard/pcic.c6
-rw-r--r--sys/pccard/pcic_pci.c4
3 files changed, 15 insertions, 15 deletions
diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c
index 01c33cc..6a9039e 100644
--- a/sys/pccard/pccard.c
+++ b/sys/pccard/pccard.c
@@ -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);
}
diff --git a/sys/pccard/pcic.c b/sys/pccard/pcic.c
index 28ac7f9..89c14cd 100644
--- a/sys/pccard/pcic.c
+++ b/sys/pccard/pcic.c
@@ -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));
diff --git a/sys/pccard/pcic_pci.c b/sys/pccard/pcic_pci.c
index df7b1ae..132c838 100644
--- a/sys/pccard/pcic_pci.c
+++ b/sys/pccard/pcic_pci.c
@@ -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) {
OpenPOWER on IntegriCloud