mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-18 22:33:39 +00:00
When we allocate our bus address via the kludge that we have in the
code to do it when the bios doesn't do it for us, flag it. Then, when we dealloc, do an equal kludge to get rid of the address. This should address the can't get IRQ and panic bug in a more graceful way. # really should write a dealloc routine and just call it instead, since # this might not fix things in the kldunload case.
This commit is contained in:
parent
44d0da39f0
commit
673cffefc7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=101633
|
@ -609,15 +609,14 @@ pccbb_attach(device_t brdev)
|
|||
cv_destroy(&sc->cv);
|
||||
return (ENOMEM);
|
||||
}
|
||||
sc->flags |= PCCBB_KLUDGE_ALLOC;
|
||||
pci_write_config(brdev, CBBR_SOCKBASE,
|
||||
rman_get_start(sc->base_res), 4);
|
||||
DEVPRINTF((brdev, "PCI Memory allocated: %08lx\n",
|
||||
rman_get_start(sc->base_res)));
|
||||
} else {
|
||||
device_printf(brdev, "Could not map register memory\n");
|
||||
mtx_destroy(&sc->mtx);
|
||||
cv_destroy(&sc->cv);
|
||||
return (ENOMEM);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -650,22 +649,14 @@ pccbb_attach(device_t brdev)
|
|||
RF_SHAREABLE | RF_ACTIVE);
|
||||
if (sc->irq_res == NULL) {
|
||||
printf("pccbb: Unable to map IRQ...\n");
|
||||
bus_release_resource(brdev, SYS_RES_MEMORY, CBBR_SOCKBASE,
|
||||
sc->base_res);
|
||||
mtx_destroy(&sc->mtx);
|
||||
cv_destroy(&sc->cv);
|
||||
goto err;
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
if (bus_setup_intr(brdev, sc->irq_res, INTR_TYPE_AV, pccbb_intr, sc,
|
||||
&sc->intrhand)) {
|
||||
device_printf(brdev, "couldn't establish interrupt");
|
||||
bus_release_resource(brdev, SYS_RES_IRQ, 0, sc->irq_res);
|
||||
bus_release_resource(brdev, SYS_RES_MEMORY, CBBR_SOCKBASE,
|
||||
sc->base_res);
|
||||
mtx_destroy(&sc->mtx);
|
||||
cv_destroy(&sc->cv);
|
||||
return (ENOMEM);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* reset 16-bit pcmcia bus */
|
||||
|
@ -688,6 +679,21 @@ pccbb_attach(device_t brdev)
|
|||
}
|
||||
|
||||
return (0);
|
||||
err:
|
||||
if (sc->irq_res)
|
||||
bus_release_resource(brdev, SYS_RES_IRQ, 0, sc->irq_res);
|
||||
if (sc->base_res) {
|
||||
if (sc->flags & PCCBB_KLUDGE_ALLOC)
|
||||
bus_generic_release_resource(device_get_parent(brdev),
|
||||
brdev, SYS_RES_MEMORY, CBBR_SOCKBASE,
|
||||
sc->base_res);
|
||||
else
|
||||
bus_release_resource(brdev, SYS_RES_MEMORY,
|
||||
CBBR_SOCKBASE, sc->base_res);
|
||||
}
|
||||
mtx_destroy(&sc->mtx);
|
||||
cv_destroy(&sc->cv);
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -65,9 +65,10 @@ struct pccbb_softc {
|
|||
struct mtx mtx;
|
||||
struct cv cv;
|
||||
u_int32_t flags;
|
||||
#define PCCBB_16BIT_CARD 0x02000000
|
||||
#define PCCBB_KTHREAD_RUNNING 0x04000000
|
||||
#define PCCBB_KTHREAD_DONE 0x08000000
|
||||
#define PCCBB_KLUDGE_ALLOC 0x10000000
|
||||
#define PCCBB_16BIT_CARD 0x20000000
|
||||
#define PCCBB_KTHREAD_RUNNING 0x40000000
|
||||
#define PCCBB_KTHREAD_DONE 0x80000000
|
||||
int chipset; /* chipset id */
|
||||
#define CB_UNKNOWN 0 /* NOT Cardbus-PCI bridge */
|
||||
#define CB_TI113X 1 /* TI PCI1130/1131 */
|
||||
|
|
Loading…
Reference in a new issue