mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-25 16:13:17 +00:00
- Do not hang if the resource allocation fails.
- Add another quirk entry of SB AWE64. PR: kern/32530 Submitted by: Magnus Backstrom <b@etek.chalmers.se>
This commit is contained in:
parent
93deb2ae12
commit
38b968c3a5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90234
@ -1910,30 +1910,39 @@ emu_status(sc_p scp, int reg, int chn)
|
||||
static int
|
||||
emu_allocres(sc_p scp, device_t dev)
|
||||
{
|
||||
int iobase;
|
||||
int i;
|
||||
|
||||
if (scp->io[0] == NULL) {
|
||||
scp->io_rid[0] = 0;
|
||||
scp->io[0] = bus_alloc_resource(dev, SYS_RES_IOPORT, &scp->io_rid[0], 0, ~0, 4, RF_ACTIVE);
|
||||
}
|
||||
if (scp->io[0] == NULL)
|
||||
return (1);
|
||||
iobase = rman_get_start(scp->io[0]);
|
||||
if (scp->io[1] == NULL) {
|
||||
scp->io_rid[1] = 1;
|
||||
scp->io[1] = bus_alloc_resource(dev, SYS_RES_IOPORT, &scp->io_rid[1], iobase + 0x400, iobase + 0x400 + 3, 4, RF_ACTIVE);
|
||||
}
|
||||
if (scp->io[2] == NULL) {
|
||||
scp->io_rid[2] = 2;
|
||||
scp->io[2] = bus_alloc_resource(dev, SYS_RES_IOPORT, &scp->io_rid[2], iobase + 0x800, iobase + 0x800 + 3, 4, RF_ACTIVE);
|
||||
/*
|
||||
* Attempt to allocate the EMU8000's three I/O port ranges.
|
||||
*/
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (scp->io[i] == NULL)
|
||||
{
|
||||
scp->io_rid[i] = i;
|
||||
scp->io[i] = bus_alloc_resource(dev, SYS_RES_IOPORT,
|
||||
&(scp->io_rid[i]),
|
||||
0, ~0, 4, RF_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
if (scp->io[0] == NULL || scp->io[1] == NULL || scp->io[2] == NULL) {
|
||||
printf("emu_allocres: failed.\n");
|
||||
return (1);
|
||||
/*
|
||||
* Fail if any of the I/O ranges failed (I.e. weren't identified and
|
||||
* configured by PNP, which can happen if the ID of the card isn't
|
||||
* known by the PNP quirk-handling logic)
|
||||
*/
|
||||
if (scp->io[0] == NULL || scp->io[1] == NULL || scp->io[2] == NULL)
|
||||
{
|
||||
printf("emu%d: Resource alloc failed, pnp_quirks "
|
||||
"may need { 0x%08x, 0x%08x }\n",
|
||||
device_get_unit(dev),
|
||||
isa_get_vendorid(dev),
|
||||
isa_get_logicalid(dev));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Releases resources. */
|
||||
|
@ -83,6 +83,8 @@ struct pnp_quirk pnp_quirks[] = {
|
||||
PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
|
||||
{ 0xc1008c0e /* SB64(CTL00c1) */, 0x22008c0e,
|
||||
PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
|
||||
{ 0xc5008c0e /* SB64(CTL00c5) */, 0x22008c0e,
|
||||
PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
|
||||
{ 0xe4008c0e /* SB64(CTL00e4) */, 0x22008c0e,
|
||||
PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user