Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/digi/digi_isa.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
sc->vmem = (u_char *)sc->pmem; | sc->vmem = (u_char *)sc->pmem; | ||||
DLOG(DIGIDB_INIT, (sc->dev, "isa? port 0x%03x mem 0x%lx\n", | DLOG(DIGIDB_INIT, (sc->dev, "isa? port 0x%03x mem 0x%lx\n", | ||||
sc->port, sc->pmem)); | sc->port, sc->pmem)); | ||||
/* Temporarily map our io ports */ | /* Temporarily map our io ports */ | ||||
sc->res.iorid = 0; | sc->res.iorid = 0; | ||||
sc->res.io = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->res.iorid, | sc->res.io = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->res.iorid, | ||||
0ul, ~0ul, IO_SIZE, RF_ACTIVE); | 0, ~0, IO_SIZE, RF_ACTIVE); | ||||
if (sc->res.io == NULL) | if (sc->res.io == NULL) | ||||
return (ENXIO); | return (ENXIO); | ||||
/* Check the type of card and get internal memory characteristics */ | /* Check the type of card and get internal memory characteristics */ | ||||
if (!digi_isa_check(sc)) { | if (!digi_isa_check(sc)) { | ||||
bus_release_resource(dev, SYS_RES_IOPORT, sc->res.iorid, | bus_release_resource(dev, SYS_RES_IOPORT, sc->res.iorid, | ||||
sc->res.io); | sc->res.io); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
/* Temporarily map our memory */ | /* Temporarily map our memory */ | ||||
sc->res.mrid = 0; | sc->res.mrid = 0; | ||||
sc->res.mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->res.mrid, | sc->res.mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->res.mrid, | ||||
0ul, ~0ul, sc->win_size, 0); | 0, ~0, sc->win_size, 0); | ||||
if (sc->res.mem == NULL) { | if (sc->res.mem == NULL) { | ||||
device_printf(dev, "0x%lx: Memory range is in use\n", sc->pmem); | device_printf(dev, "0x%lx: Memory range is in use\n", sc->pmem); | ||||
bus_release_resource(dev, SYS_RES_IOPORT, sc->res.iorid, | bus_release_resource(dev, SYS_RES_IOPORT, sc->res.iorid, | ||||
sc->res.io); | sc->res.io); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
outb(sc->port, FEPCLR); /* drop RESET */ | outb(sc->port, FEPCLR); /* drop RESET */ | ||||
Show All 34 Lines | |||||
bus_get_resource(dev, SYS_RES_IOPORT, 0, &scport, &iosize); | bus_get_resource(dev, SYS_RES_IOPORT, 0, &scport, &iosize); | ||||
bus_get_resource(dev, SYS_RES_MEMORY, 0, &sc->pmem, &msize); | bus_get_resource(dev, SYS_RES_MEMORY, 0, &sc->pmem, &msize); | ||||
sc->port = scport; | sc->port = scport; | ||||
/* sc->altpin = !!(device_get_flags(dev) & DGBFLAG_ALTPIN); */ | /* sc->altpin = !!(device_get_flags(dev) & DGBFLAG_ALTPIN); */ | ||||
/* Allocate resources (verified in digi_isa_probe()) */ | /* Allocate resources (verified in digi_isa_probe()) */ | ||||
sc->res.iorid = 0; | sc->res.iorid = 0; | ||||
sc->res.io = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->res.iorid, | sc->res.io = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->res.iorid, | ||||
0ul, ~0ul, iosize, RF_ACTIVE); | 0, ~0, iosize, RF_ACTIVE); | ||||
if (sc->res.io == NULL) | if (sc->res.io == NULL) | ||||
return (ENXIO); | return (ENXIO); | ||||
/* Check the type of card and get internal memory characteristics */ | /* Check the type of card and get internal memory characteristics */ | ||||
DLOG(DIGIDB_INIT, (sc->dev, "Checking card type\n")); | DLOG(DIGIDB_INIT, (sc->dev, "Checking card type\n")); | ||||
if (!digi_isa_check(sc)) | if (!digi_isa_check(sc)) | ||||
goto failed; | goto failed; | ||||
callout_handle_init(&sc->callout); | callout_handle_init(&sc->callout); | ||||
callout_handle_init(&sc->inttest); | callout_handle_init(&sc->inttest); | ||||
sc->res.mrid = 0; | sc->res.mrid = 0; | ||||
sc->res.mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->res.mrid, | sc->res.mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->res.mrid, | ||||
0ul, ~0ul, msize, RF_ACTIVE); | 0, ~0, msize, RF_ACTIVE); | ||||
if (sc->res.mem == NULL) { | if (sc->res.mem == NULL) { | ||||
device_printf(dev, "0x%lx: Memory range is in use\n", sc->pmem); | device_printf(dev, "0x%lx: Memory range is in use\n", sc->pmem); | ||||
sc->hidewin(sc); | sc->hidewin(sc); | ||||
goto failed; | goto failed; | ||||
} | } | ||||
/* map memory */ | /* map memory */ | ||||
sc->vmem = pmap_mapdev(sc->pmem, msize); | sc->vmem = pmap_mapdev(sc->pmem, msize); | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |