version 1.14.24.2, 2008/03/23 02:04:40 |
version 1.15, 2007/10/19 12:00:16 |
|
|
/* fdc_isa.c,v 1.14.24.1 2007/11/06 23:27:35 matt Exp */ |
/* $NetBSD$ */ |
|
|
/*- |
/*- |
* Copyright (c) 1998 The NetBSD Foundation, Inc. |
* Copyright (c) 1998 The NetBSD Foundation, Inc. |
|
|
*/ |
*/ |
|
|
#include <sys/cdefs.h> |
#include <sys/cdefs.h> |
__KERNEL_RCSID(0, "fdc_isa.c,v 1.14.24.1 2007/11/06 23:27:35 matt Exp"); |
__KERNEL_RCSID(0, "$NetBSD$"); |
|
|
#include "rnd.h" |
#include "rnd.h" |
|
|
Line 94 __KERNEL_RCSID(0, "fdc_isa.c,v 1.14.24.1 |
|
Line 94 __KERNEL_RCSID(0, "fdc_isa.c,v 1.14.24.1 |
|
#include <dev/isa/fdreg.h> |
#include <dev/isa/fdreg.h> |
#include <dev/isa/fdcvar.h> |
#include <dev/isa/fdcvar.h> |
|
|
static int fdc_isa_probe(device_t, cfdata_t, void *); |
int fdc_isa_probe(struct device *, struct cfdata *, void *); |
static void fdc_isa_attach(device_t, device_t, void *); |
void fdc_isa_attach(struct device *, struct device *, void *); |
static int fdc_isa_detach(device_t, int); |
|
|
|
struct fdc_isa_softc { |
struct fdc_isa_softc { |
struct fdc_softc sc_fdc; /* base fdc device */ |
struct fdc_softc sc_fdc; /* base fdc device */ |
Line 104 struct fdc_isa_softc { |
|
Line 103 struct fdc_isa_softc { |
|
bus_space_handle_t sc_baseioh; /* base I/O handle */ |
bus_space_handle_t sc_baseioh; /* base I/O handle */ |
}; |
}; |
|
|
CFATTACH_DECL2_NEW(fdc_isa, sizeof(struct fdc_isa_softc), |
CFATTACH_DECL(fdc_isa, sizeof(struct fdc_isa_softc), |
fdc_isa_probe, fdc_isa_attach, fdc_isa_detach, NULL, NULL, fdc_childdet); |
fdc_isa_probe, fdc_isa_attach, NULL, NULL); |
|
|
#ifdef NEWCONFIG |
#ifdef NEWCONFIG |
void fdc_isa_forceintr(void *); |
void fdc_isa_forceintr(void *); |
#endif |
#endif |
|
|
static int |
int |
fdc_isa_probe(device_t parent, cfdata_t match, void *aux) |
fdc_isa_probe(struct device *parent, |
|
struct cfdata *match, |
|
void *aux) |
{ |
{ |
struct isa_attach_args *ia = aux; |
struct isa_attach_args *ia = aux; |
bus_space_tag_t iot; |
bus_space_tag_t iot; |
Line 186 fdc_isa_probe(device_t parent, cfdata_t |
|
Line 187 fdc_isa_probe(device_t parent, cfdata_t |
|
return (rv); |
return (rv); |
} |
} |
|
|
static int |
void |
fdc_isa_detach(device_t self, int flags) |
fdc_isa_attach(struct device *parent, |
|
struct device *self, |
|
void *aux) |
{ |
{ |
int rc; |
struct fdc_softc *fdc = (void *) self; |
struct fdc_isa_softc *isc = device_private(self); |
struct fdc_isa_softc *isc = (void *) self; |
struct fdc_softc *fdc = &isc->sc_fdc; |
|
|
|
if ((rc = fdcdetach(self, flags)) != 0) |
|
return rc; |
|
|
|
isa_intr_disestablish(fdc->sc_ic, fdc->sc_ih); |
|
|
|
bus_space_unmap(fdc->sc_iot, fdc->sc_fdctlioh, 1); |
|
|
|
bus_space_unmap(fdc->sc_iot, isc->sc_baseioh, 6 /* FDC_NPORT */); |
|
|
|
return 0; |
|
} |
|
|
|
static void |
|
fdc_isa_attach(device_t parent, device_t self, void *aux) |
|
{ |
|
struct fdc_isa_softc *isc = device_private(self); |
|
struct fdc_softc *fdc = &isc->sc_fdc; |
|
struct isa_attach_args *ia = aux; |
struct isa_attach_args *ia = aux; |
|
|
aprint_naive("\n"); |
printf("\n"); |
aprint_normal("\n"); |
|
|
|
fdc->sc_dev = self; |
|
fdc->sc_iot = ia->ia_iot; |
fdc->sc_iot = ia->ia_iot; |
fdc->sc_ic = ia->ia_ic; |
fdc->sc_ic = ia->ia_ic; |
fdc->sc_drq = ia->ia_drq[0].ir_drq; |
fdc->sc_drq = ia->ia_drq[0].ir_drq; |
|
|
if (bus_space_map(fdc->sc_iot, ia->ia_io[0].ir_addr, |
if (bus_space_map(fdc->sc_iot, ia->ia_io[0].ir_addr, |
6 /* FDC_NPORT */, 0, &isc->sc_baseioh)) { |
6 /* FDC_NPORT */, 0, &isc->sc_baseioh)) { |
aprint_normal_dev(fdc->sc_dev, "unable to map I/O space\n"); |
printf("%s: unable to map I/O space\n", fdc->sc_dev.dv_xname); |
return; |
return; |
} |
} |
|
|
if (bus_space_subregion(fdc->sc_iot, isc->sc_baseioh, 2, 4, |
if (bus_space_subregion(fdc->sc_iot, isc->sc_baseioh, 2, 4, |
&fdc->sc_ioh)) { |
&fdc->sc_ioh)) { |
aprint_normal_dev(fdc->sc_dev, |
printf("%s: unable to subregion I/O space\n", |
"unable to subregion I/O space\n"); |
fdc->sc_dev.dv_xname); |
return; |
return; |
} |
} |
|
|
if (bus_space_map(fdc->sc_iot, ia->ia_io[0].ir_addr + fdctl + 2, 1, 0, |
if (bus_space_map(fdc->sc_iot, ia->ia_io[0].ir_addr + fdctl + 2, 1, 0, |
&fdc->sc_fdctlioh)) { |
&fdc->sc_fdctlioh)) { |
aprint_normal_dev(fdc->sc_dev, |
printf("%s: unable to map CTL I/O space\n", |
"unable to map CTL I/O space\n"); |
fdc->sc_dev.dv_xname); |
return; |
return; |
} |
} |
|
|