Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/wl/if_wl.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
*/ | */ | ||||
static int | static int | ||||
wlprobe(device_t device) | wlprobe(device_t device) | ||||
{ | { | ||||
struct wl_softc *sc; | struct wl_softc *sc; | ||||
char *str = "wl%d: board out of range [0..%d]\n"; | char *str = "wl%d: board out of range [0..%d]\n"; | ||||
u_char inbuf[100]; | u_char inbuf[100]; | ||||
unsigned long junk, sirq; | rman_res_t junk, sirq; | ||||
int error, irq; | int error, irq; | ||||
error = ISA_PNP_PROBE(device_get_parent(device), device, wl_ids); | error = ISA_PNP_PROBE(device_get_parent(device), device, wl_ids); | ||||
if (error == ENXIO || error == 0) | if (error == ENXIO || error == 0) | ||||
return (error); | return (error); | ||||
sc = device_get_softc(device); | sc = device_get_softc(device); | ||||
error = wl_allocate_resources(device); | error = wl_allocate_resources(device); | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
error = wl_allocate_resources(device); | error = wl_allocate_resources(device); | ||||
if (error) { | if (error) { | ||||
wl_deallocate_resources(device); | wl_deallocate_resources(device); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
#ifdef WLDEBUG | #ifdef WLDEBUG | ||||
printf("wlattach: base %lx, unit %d\n", rman_get_start(sc->res_ioport), | printf("wlattach: base %jx, unit %d\n", rman_get_start(sc->res_ioport), | ||||
device_get_unit(device)); | device_get_unit(device)); | ||||
#endif | #endif | ||||
sc->flags = 0; | sc->flags = 0; | ||||
sc->mode = 0; | sc->mode = 0; | ||||
sc->hacr = HACR_RESET; | sc->hacr = HACR_RESET; | ||||
CMD(sc); /* reset the board */ | CMD(sc); /* reset the board */ | ||||
DELAY(DELAYCONST); /* >> 4 clocks at 6MHz */ | DELAY(DELAYCONST); /* >> 4 clocks at 6MHz */ | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
wl_allocate_resources(device_t device) | wl_allocate_resources(device_t device) | ||||
{ | { | ||||
struct wl_softc *sc = device_get_softc(device); | struct wl_softc *sc = device_get_softc(device); | ||||
int ports = 16; /* Number of ports */ | int ports = 16; /* Number of ports */ | ||||
sc->res_ioport = bus_alloc_resource(device, SYS_RES_IOPORT, | sc->res_ioport = bus_alloc_resource(device, SYS_RES_IOPORT, | ||||
&sc->rid_ioport, 0ul, ~0ul, ports, RF_ACTIVE); | &sc->rid_ioport, 0, ~0, ports, RF_ACTIVE); | ||||
if (sc->res_ioport == NULL) | if (sc->res_ioport == NULL) | ||||
goto errexit; | goto errexit; | ||||
sc->res_irq = bus_alloc_resource_any(device, SYS_RES_IRQ, | sc->res_irq = bus_alloc_resource_any(device, SYS_RES_IRQ, | ||||
&sc->rid_irq, RF_SHAREABLE|RF_ACTIVE); | &sc->rid_irq, RF_SHAREABLE|RF_ACTIVE); | ||||
if (sc->res_irq == NULL) | if (sc->res_irq == NULL) | ||||
goto errexit; | goto errexit; | ||||
return (0); | return (0); | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |