Change isa_get/set_flags() to device_get/set_flags().
This commit is contained in:
parent
751f03e159
commit
9c18fa9b4a
@ -382,7 +382,7 @@ ed_probe_WD80x3(dev)
|
||||
struct ed_softc *sc = device_get_softc(dev);
|
||||
int error;
|
||||
int i;
|
||||
int flags = isa_get_flags(dev);
|
||||
int flags = device_get_flags(dev);
|
||||
u_int memsize, maddr;
|
||||
u_char iptr, isa16bit, sum;
|
||||
u_long conf_maddr, conf_msize, irq, junk;
|
||||
@ -795,7 +795,7 @@ ed_probe_3Com(dev)
|
||||
struct ed_softc *sc = device_get_softc(dev);
|
||||
int error;
|
||||
int i;
|
||||
int flags = isa_get_flags(dev);
|
||||
int flags = device_get_flags(dev);
|
||||
u_int memsize;
|
||||
u_char isa16bit;
|
||||
u_long conf_maddr, conf_msize, irq, junk;
|
||||
@ -1301,7 +1301,7 @@ static int
|
||||
ed_probe_Novell(dev)
|
||||
device_t dev;
|
||||
{
|
||||
return ed_probe_Novell_generic(dev, 0, isa_get_flags(dev));
|
||||
return ed_probe_Novell_generic(dev, 0, device_get_flags(dev));
|
||||
}
|
||||
|
||||
#if NCARDxx > 0
|
||||
@ -1539,7 +1539,7 @@ ed_probe_HP_pclanp(dev)
|
||||
|
||||
sc->tx_page_start = ED_HPP_TX_PAGE_OFFSET;
|
||||
|
||||
if (isa_get_flags(dev) & ED_FLAGS_NO_MULTI_BUFFERING)
|
||||
if (device_get_flags(dev) & ED_FLAGS_NO_MULTI_BUFFERING)
|
||||
sc->txb_cnt = 1;
|
||||
else
|
||||
sc->txb_cnt = 2;
|
||||
@ -1864,7 +1864,7 @@ ed_isa_attach(dev)
|
||||
device_t dev;
|
||||
{
|
||||
struct ed_softc *sc = device_get_softc(dev);
|
||||
int flags = isa_get_flags(dev);
|
||||
int flags = device_get_flags(dev);
|
||||
int error;
|
||||
|
||||
if (sc->port_used > 0)
|
||||
|
@ -817,7 +817,7 @@ fd_probe(device_t dev)
|
||||
/* look up what bios thinks we have */
|
||||
switch (fd->fdu) {
|
||||
case 0:
|
||||
if (isa_get_flags(fdc->fdc_dev) & FDC_PRETEND_D0)
|
||||
if (device_get_flags(fdc->fdc_dev) & FDC_PRETEND_D0)
|
||||
fdt = RTCFDT_144M | RTCFDT_144M_PRETENDED;
|
||||
else
|
||||
fdt = (rtcin(RTC_FDISKETTE) & 0xf0);
|
||||
|
@ -464,11 +464,11 @@ mss_probe(device_t dev)
|
||||
if (!mss->io_base) goto no;
|
||||
|
||||
/* got irq/dma regs? */
|
||||
flags = isa_get_flags(dev);
|
||||
flags = device_get_flags(dev);
|
||||
irq = isa_get_irq(dev);
|
||||
drq = isa_get_drq(dev);
|
||||
|
||||
if (!(isa_get_flags(dev) & DV_F_TRUE_MSS)) goto mss_probe_end;
|
||||
if (!(device_get_flags(dev) & DV_F_TRUE_MSS)) goto mss_probe_end;
|
||||
|
||||
/*
|
||||
* Check if the IO port returns valid signature. The original MS
|
||||
@ -480,7 +480,7 @@ mss_probe(device_t dev)
|
||||
tmpx = tmp = io_rd(mss, 3);
|
||||
if (tmp == 0xff) { /* Bus float */
|
||||
BVDDB(printf("I/O addr inactive (%x), try pseudo_mss\n", tmp));
|
||||
isa_set_flags(dev, flags & ~DV_F_TRUE_MSS);
|
||||
device_set_flags(dev, flags & ~DV_F_TRUE_MSS);
|
||||
goto mss_probe_end;
|
||||
}
|
||||
tmp &= 0x3f;
|
||||
@ -732,8 +732,9 @@ mss_detect(device_t dev, struct mss_info *mss)
|
||||
gotit:
|
||||
BVDDB(printf("mss_detect() - Detected %s\n", name));
|
||||
device_set_desc(dev, name);
|
||||
isa_set_flags(dev, ((isa_get_flags(dev) & ~DV_F_DEV_MASK) |
|
||||
((mss->bd_id << DV_F_DEV_SHIFT) & DV_F_DEV_MASK)));
|
||||
device_set_flags(dev,
|
||||
((device_get_flags(dev) & ~DV_F_DEV_MASK) |
|
||||
((mss->bd_id << DV_F_DEV_SHIFT) & DV_F_DEV_MASK)));
|
||||
return 0;
|
||||
no:
|
||||
return ENXIO;
|
||||
@ -786,7 +787,7 @@ mss_doattach(device_t dev, struct mss_info *mss)
|
||||
{
|
||||
snddev_info *d = device_get_softc(dev);
|
||||
void *ih;
|
||||
int flags = isa_get_flags(dev);
|
||||
int flags = device_get_flags(dev);
|
||||
char status[SND_STATUSLEN];
|
||||
|
||||
if (!mss_alloc_resources(mss, dev)) goto no;
|
||||
@ -863,7 +864,7 @@ static int
|
||||
mss_attach(device_t dev)
|
||||
{
|
||||
struct mss_info *mss;
|
||||
int flags = isa_get_flags(dev);
|
||||
int flags = device_get_flags(dev);
|
||||
|
||||
mss = (struct mss_info *)malloc(sizeof *mss, M_DEVBUF, M_NOWAIT);
|
||||
if (!mss) return ENXIO;
|
||||
@ -879,7 +880,7 @@ mss_attach(device_t dev)
|
||||
flags & DV_F_DRQ_MASK, 1);
|
||||
mss->drq2_rid = 1;
|
||||
}
|
||||
mss->bd_id = (isa_get_flags(dev) & DV_F_DEV_MASK) >> DV_F_DEV_SHIFT;
|
||||
mss->bd_id = (device_get_flags(dev) & DV_F_DEV_MASK) >> DV_F_DEV_SHIFT;
|
||||
if (mss->bd_id == MD_YM0020) ymf_test(dev, mss);
|
||||
return mss_doattach(dev, mss);
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ static int
|
||||
sb_attach(device_t dev)
|
||||
{
|
||||
struct sb_info *sb;
|
||||
int flags = isa_get_flags(dev);
|
||||
int flags = device_get_flags(dev);
|
||||
|
||||
if (flags & DV_F_DUAL_DMA) {
|
||||
ISA_SET_RESOURCE(device_get_parent(dev), dev, SYS_RES_DRQ, 1,
|
||||
|
@ -464,11 +464,11 @@ mss_probe(device_t dev)
|
||||
if (!mss->io_base) goto no;
|
||||
|
||||
/* got irq/dma regs? */
|
||||
flags = isa_get_flags(dev);
|
||||
flags = device_get_flags(dev);
|
||||
irq = isa_get_irq(dev);
|
||||
drq = isa_get_drq(dev);
|
||||
|
||||
if (!(isa_get_flags(dev) & DV_F_TRUE_MSS)) goto mss_probe_end;
|
||||
if (!(device_get_flags(dev) & DV_F_TRUE_MSS)) goto mss_probe_end;
|
||||
|
||||
/*
|
||||
* Check if the IO port returns valid signature. The original MS
|
||||
@ -480,7 +480,7 @@ mss_probe(device_t dev)
|
||||
tmpx = tmp = io_rd(mss, 3);
|
||||
if (tmp == 0xff) { /* Bus float */
|
||||
BVDDB(printf("I/O addr inactive (%x), try pseudo_mss\n", tmp));
|
||||
isa_set_flags(dev, flags & ~DV_F_TRUE_MSS);
|
||||
device_set_flags(dev, flags & ~DV_F_TRUE_MSS);
|
||||
goto mss_probe_end;
|
||||
}
|
||||
tmp &= 0x3f;
|
||||
@ -732,8 +732,9 @@ mss_detect(device_t dev, struct mss_info *mss)
|
||||
gotit:
|
||||
BVDDB(printf("mss_detect() - Detected %s\n", name));
|
||||
device_set_desc(dev, name);
|
||||
isa_set_flags(dev, ((isa_get_flags(dev) & ~DV_F_DEV_MASK) |
|
||||
((mss->bd_id << DV_F_DEV_SHIFT) & DV_F_DEV_MASK)));
|
||||
device_set_flags(dev,
|
||||
((device_get_flags(dev) & ~DV_F_DEV_MASK) |
|
||||
((mss->bd_id << DV_F_DEV_SHIFT) & DV_F_DEV_MASK)));
|
||||
return 0;
|
||||
no:
|
||||
return ENXIO;
|
||||
@ -786,7 +787,7 @@ mss_doattach(device_t dev, struct mss_info *mss)
|
||||
{
|
||||
snddev_info *d = device_get_softc(dev);
|
||||
void *ih;
|
||||
int flags = isa_get_flags(dev);
|
||||
int flags = device_get_flags(dev);
|
||||
char status[SND_STATUSLEN];
|
||||
|
||||
if (!mss_alloc_resources(mss, dev)) goto no;
|
||||
@ -863,7 +864,7 @@ static int
|
||||
mss_attach(device_t dev)
|
||||
{
|
||||
struct mss_info *mss;
|
||||
int flags = isa_get_flags(dev);
|
||||
int flags = device_get_flags(dev);
|
||||
|
||||
mss = (struct mss_info *)malloc(sizeof *mss, M_DEVBUF, M_NOWAIT);
|
||||
if (!mss) return ENXIO;
|
||||
@ -879,7 +880,7 @@ mss_attach(device_t dev)
|
||||
flags & DV_F_DRQ_MASK, 1);
|
||||
mss->drq2_rid = 1;
|
||||
}
|
||||
mss->bd_id = (isa_get_flags(dev) & DV_F_DEV_MASK) >> DV_F_DEV_SHIFT;
|
||||
mss->bd_id = (device_get_flags(dev) & DV_F_DEV_MASK) >> DV_F_DEV_SHIFT;
|
||||
if (mss->bd_id == MD_YM0020) ymf_test(dev, mss);
|
||||
return mss_doattach(dev, mss);
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ static int
|
||||
sb_attach(device_t dev)
|
||||
{
|
||||
struct sb_info *sb;
|
||||
int flags = isa_get_flags(dev);
|
||||
int flags = device_get_flags(dev);
|
||||
|
||||
if (flags & DV_F_DUAL_DMA) {
|
||||
ISA_SET_RESOURCE(device_get_parent(dev), dev, SYS_RES_DRQ, 1,
|
||||
|
@ -644,7 +644,7 @@ static int
|
||||
sb_attach(device_t dev)
|
||||
{
|
||||
struct sb_info *sb;
|
||||
int flags = isa_get_flags(dev);
|
||||
int flags = device_get_flags(dev);
|
||||
|
||||
if (flags & DV_F_DUAL_DMA) {
|
||||
ISA_SET_RESOURCE(device_get_parent(dev), dev, SYS_RES_DRQ, 1,
|
||||
|
@ -644,7 +644,7 @@ static int
|
||||
sb_attach(device_t dev)
|
||||
{
|
||||
struct sb_info *sb;
|
||||
int flags = isa_get_flags(dev);
|
||||
int flags = device_get_flags(dev);
|
||||
|
||||
if (flags & DV_F_DUAL_DMA) {
|
||||
ISA_SET_RESOURCE(device_get_parent(dev), dev, SYS_RES_DRQ, 1,
|
||||
|
@ -382,7 +382,7 @@ ed_probe_WD80x3(dev)
|
||||
struct ed_softc *sc = device_get_softc(dev);
|
||||
int error;
|
||||
int i;
|
||||
int flags = isa_get_flags(dev);
|
||||
int flags = device_get_flags(dev);
|
||||
u_int memsize, maddr;
|
||||
u_char iptr, isa16bit, sum;
|
||||
u_long conf_maddr, conf_msize, irq, junk;
|
||||
@ -795,7 +795,7 @@ ed_probe_3Com(dev)
|
||||
struct ed_softc *sc = device_get_softc(dev);
|
||||
int error;
|
||||
int i;
|
||||
int flags = isa_get_flags(dev);
|
||||
int flags = device_get_flags(dev);
|
||||
u_int memsize;
|
||||
u_char isa16bit;
|
||||
u_long conf_maddr, conf_msize, irq, junk;
|
||||
@ -1301,7 +1301,7 @@ static int
|
||||
ed_probe_Novell(dev)
|
||||
device_t dev;
|
||||
{
|
||||
return ed_probe_Novell_generic(dev, 0, isa_get_flags(dev));
|
||||
return ed_probe_Novell_generic(dev, 0, device_get_flags(dev));
|
||||
}
|
||||
|
||||
#if NCARDxx > 0
|
||||
@ -1539,7 +1539,7 @@ ed_probe_HP_pclanp(dev)
|
||||
|
||||
sc->tx_page_start = ED_HPP_TX_PAGE_OFFSET;
|
||||
|
||||
if (isa_get_flags(dev) & ED_FLAGS_NO_MULTI_BUFFERING)
|
||||
if (device_get_flags(dev) & ED_FLAGS_NO_MULTI_BUFFERING)
|
||||
sc->txb_cnt = 1;
|
||||
else
|
||||
sc->txb_cnt = 2;
|
||||
@ -1864,7 +1864,7 @@ ed_isa_attach(dev)
|
||||
device_t dev;
|
||||
{
|
||||
struct ed_softc *sc = device_get_softc(dev);
|
||||
int flags = isa_get_flags(dev);
|
||||
int flags = device_get_flags(dev);
|
||||
int error;
|
||||
|
||||
if (sc->port_used > 0)
|
||||
|
@ -99,7 +99,6 @@ struct old_isa_driver {
|
||||
|
||||
extern struct isa_driver vtdriver;
|
||||
extern struct isa_driver advdriver;
|
||||
extern struct isa_driver ahadriver;
|
||||
extern struct isa_driver wdcdriver;
|
||||
extern struct isa_driver msedriver;
|
||||
extern struct isa_driver ardriver;
|
||||
@ -313,10 +312,6 @@ static struct old_isa_driver old_drivers[] = {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if NAHA > 0
|
||||
{ INTR_TYPE_CAM, &ahadriver },
|
||||
#endif
|
||||
|
||||
#ifdef PC98
|
||||
#if NBS > 0
|
||||
{ INTR_TYPE_CAM, &bsdriver },
|
||||
|
@ -817,7 +817,7 @@ fd_probe(device_t dev)
|
||||
/* look up what bios thinks we have */
|
||||
switch (fd->fdu) {
|
||||
case 0:
|
||||
if (isa_get_flags(fdc->fdc_dev) & FDC_PRETEND_D0)
|
||||
if (device_get_flags(fdc->fdc_dev) & FDC_PRETEND_D0)
|
||||
fdt = RTCFDT_144M | RTCFDT_144M_PRETENDED;
|
||||
else
|
||||
fdt = (rtcin(RTC_FDISKETTE) & 0xf0);
|
||||
|
@ -497,7 +497,6 @@ isa_add_child(device_t dev, int order, const char *name, int unit)
|
||||
bzero(idev, sizeof *idev);
|
||||
|
||||
resource_list_init(&idev->id_resources);
|
||||
idev->id_flags = 0;
|
||||
TAILQ_INIT(&idev->id_configs);
|
||||
|
||||
return device_add_child_ordered(dev, order, name, unit, idev);
|
||||
@ -541,15 +540,15 @@ isa_print_child(device_t bus, device_t dev)
|
||||
|
||||
retval += bus_print_child_header(bus, dev);
|
||||
|
||||
if (SLIST_FIRST(rl) || idev->id_flags)
|
||||
if (SLIST_FIRST(rl) || device_get_flags(dev))
|
||||
retval += printf(" at");
|
||||
|
||||
isa_print_resources(rl, "port", SYS_RES_IOPORT, "%#lx");
|
||||
isa_print_resources(rl, "iomem", SYS_RES_MEMORY, "%#lx");
|
||||
isa_print_resources(rl, "irq", SYS_RES_IRQ, "%ld");
|
||||
isa_print_resources(rl, "drq", SYS_RES_DRQ, "%ld");
|
||||
if (idev->id_flags)
|
||||
retval += printf(" flags %#x", idev->id_flags);
|
||||
if (device_get_flags(dev))
|
||||
retval += printf(" flags %#x", device_get_flags(dev));
|
||||
|
||||
retval += bus_print_child_footer(bus, dev);
|
||||
|
||||
@ -660,10 +659,6 @@ isa_read_ivar(device_t bus, device_t dev, int index, uintptr_t * result)
|
||||
*result = -1;
|
||||
break;
|
||||
|
||||
case ISA_IVAR_FLAGS:
|
||||
*result = idev->id_flags;
|
||||
break;
|
||||
|
||||
case ISA_IVAR_VENDORID:
|
||||
*result = idev->id_vendorid;
|
||||
break;
|
||||
@ -708,10 +703,6 @@ isa_write_ivar(device_t bus, device_t dev,
|
||||
case ISA_IVAR_DRQ_1:
|
||||
return EINVAL;
|
||||
|
||||
case ISA_IVAR_FLAGS:
|
||||
idev->id_flags = value;
|
||||
break;
|
||||
|
||||
case ISA_IVAR_VENDORID:
|
||||
idev->id_vendorid = value;
|
||||
break;
|
||||
|
@ -50,7 +50,6 @@ struct isa_config_entry {
|
||||
*/
|
||||
struct isa_device {
|
||||
struct resource_list id_resources;
|
||||
int id_flags;
|
||||
u_int32_t id_vendorid; /* pnp vendor id */
|
||||
u_int32_t id_serial; /* pnp serial */
|
||||
u_int32_t id_logicalid; /* pnp logical device id */
|
||||
|
@ -76,7 +76,7 @@ isahint_add_device(device_t parent, const char *name, int unit)
|
||||
ISA_SET_RESOURCE(parent, child, SYS_RES_DRQ, 0, start, 1);
|
||||
|
||||
if (resource_int_value(name, unit, "flags", &t) == 0)
|
||||
isa_set_flags(child, t);
|
||||
device_set_flags(child, t);
|
||||
|
||||
if (resource_int_value(name, unit, "disabled", &t) == 0 && t != 0)
|
||||
device_disable(child);
|
||||
|
@ -100,7 +100,6 @@ enum isa_device_ivars {
|
||||
ISA_IVAR_MSIZE,
|
||||
ISA_IVAR_MSIZE_0 = ISA_IVAR_MSIZE,
|
||||
ISA_IVAR_MSIZE_1,
|
||||
ISA_IVAR_FLAGS,
|
||||
ISA_IVAR_IRQ,
|
||||
ISA_IVAR_IRQ_0 = ISA_IVAR_IRQ,
|
||||
ISA_IVAR_IRQ_1,
|
||||
@ -137,7 +136,6 @@ ISA_ACCESSOR(irq, IRQ, int)
|
||||
ISA_ACCESSOR(drq, DRQ, int)
|
||||
ISA_ACCESSOR(maddr, MADDR, int)
|
||||
ISA_ACCESSOR(msize, MSIZE, int)
|
||||
ISA_ACCESSOR(flags, FLAGS, int)
|
||||
ISA_ACCESSOR(vendorid, VENDORID, int)
|
||||
ISA_ACCESSOR(serial, SERIAL, int)
|
||||
ISA_ACCESSOR(logicalid, LOGICALID, int)
|
||||
|
@ -92,13 +92,13 @@ scprobe(device_t dev)
|
||||
return (ENXIO);
|
||||
|
||||
device_set_desc(dev, "System console");
|
||||
return sc_probe_unit(device_get_unit(dev), isa_get_flags(dev));
|
||||
return sc_probe_unit(device_get_unit(dev), device_get_flags(dev));
|
||||
}
|
||||
|
||||
static int
|
||||
scattach(device_t dev)
|
||||
{
|
||||
return sc_attach_unit(device_get_unit(dev), isa_get_flags(dev));
|
||||
return sc_attach_unit(device_get_unit(dev), device_get_flags(dev));
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -126,7 +126,7 @@ isavga_probe(device_t dev)
|
||||
return (ENXIO);
|
||||
|
||||
device_set_desc(dev, "Generic ISA VGA");
|
||||
error = vga_probe_unit(device_get_unit(dev), &adp, isa_get_flags(dev));
|
||||
error = vga_probe_unit(device_get_unit(dev), &adp, device_get_flags(dev));
|
||||
if (error == 0) {
|
||||
bus = device_get_parent(dev);
|
||||
ISA_SET_RESOURCE(bus, dev, SYS_RES_IOPORT, 0,
|
||||
@ -163,7 +163,7 @@ isavga_attach(device_t dev)
|
||||
mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
|
||||
0, ~0, 0, RF_ACTIVE | RF_SHAREABLE);
|
||||
|
||||
error = vga_attach_unit(unit, sc, isa_get_flags(dev));
|
||||
error = vga_attach_unit(unit, sc, device_get_flags(dev));
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
@ -610,6 +610,7 @@ make_device(device_t parent, const char *name,
|
||||
dev->nameunit = NULL;
|
||||
dev->desc = NULL;
|
||||
dev->busy = 0;
|
||||
dev->devflags = 0;
|
||||
dev->flags = DF_ENABLED;
|
||||
dev->order = 0;
|
||||
if (unit == -1)
|
||||
@ -892,6 +893,12 @@ device_get_desc(device_t dev)
|
||||
return dev->desc;
|
||||
}
|
||||
|
||||
u_int32_t
|
||||
device_get_flags(device_t dev)
|
||||
{
|
||||
return dev->devflags;
|
||||
}
|
||||
|
||||
int
|
||||
device_print_prettyname(device_t dev)
|
||||
{
|
||||
@ -955,6 +962,12 @@ device_set_desc_copy(device_t dev, const char* desc)
|
||||
device_set_desc_internal(dev, desc, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
device_set_flags(device_t dev, u_int32_t flags)
|
||||
{
|
||||
dev->devflags = flags;
|
||||
}
|
||||
|
||||
void *
|
||||
device_get_softc(device_t dev)
|
||||
{
|
||||
|
@ -228,6 +228,7 @@ device_t device_find_child(device_t dev, const char *classname,
|
||||
const char *device_get_desc(device_t dev);
|
||||
devclass_t device_get_devclass(device_t dev);
|
||||
driver_t *device_get_driver(device_t dev);
|
||||
u_int32_t device_get_flags(device_t dev);
|
||||
device_t device_get_parent(device_t dev);
|
||||
int device_get_children(device_t dev, device_t **listp, int *countp);
|
||||
void *device_get_ivars(device_t dev);
|
||||
@ -247,6 +248,7 @@ void device_set_desc(device_t dev, const char* desc);
|
||||
void device_set_desc_copy(device_t dev, const char* desc);
|
||||
int device_set_devclass(device_t dev, const char *classname);
|
||||
int device_set_driver(device_t dev, driver_t *driver);
|
||||
void device_set_flags(device_t dev, u_int32_t flags);
|
||||
int device_shutdown(device_t dev);
|
||||
void device_unbusy(device_t dev);
|
||||
void device_verbose(device_t dev);
|
||||
|
@ -127,6 +127,7 @@ struct device {
|
||||
char* desc; /* driver specific description */
|
||||
int busy; /* count of calls to device_busy() */
|
||||
device_state_t state;
|
||||
u_int32_t devflags; /* api level flags for device_get_flags() */
|
||||
u_short flags;
|
||||
#define DF_ENABLED 1 /* device should be probed/attached */
|
||||
#define DF_FIXEDCLASS 2 /* devclass specified at create time */
|
||||
|
Loading…
Reference in New Issue
Block a user