diff --git a/sys/dev/isa/pcdisplay.c b/sys/dev/isa/pcdisplay.c index c8bbec7b8b7f..1ef6d0559c20 100644 --- a/sys/dev/isa/pcdisplay.c +++ b/sys/dev/isa/pcdisplay.c @@ -1,4 +1,4 @@ -/* $NetBSD: pcdisplay.c,v 1.12 2001/11/13 08:01:27 lukem Exp $ */ +/* $NetBSD: pcdisplay.c,v 1.13 2001/12/16 22:30:26 thorpej Exp $ */ /* * Copyright (c) 1998 @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pcdisplay.c,v 1.12 2001/11/13 08:01:27 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcdisplay.c,v 1.13 2001/12/16 22:30:26 thorpej Exp $"); #include #include @@ -235,33 +235,57 @@ pcdisplay_match(parent, match, aux) struct isa_attach_args *ia = aux; int mono; + if (ISA_DIRECT_CONFIG(ia)) + return (0); + /* If values are hardwired to something that they can't be, punt. */ - if ((ia->ia_iobase != IOBASEUNK && - ia->ia_iobase != 0x3d0 && - ia->ia_iobase != 0x3b0) || - /* ia->ia_iosize != 0 || XXX isa.c */ - (ia->ia_maddr != MADDRUNK && - ia->ia_maddr != 0xb8000 && - ia->ia_maddr != 0xb0000) || - (ia->ia_msize != 0 && ia->ia_msize != 0x8000) || - ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK) + if (ia->ia_nio < 1 || + (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT && + ia->ia_io[0].ir_addr != 0x3d0 && + ia->ia_io[0].ir_addr != 0x3b0)) + return (0); + + if (ia->ia_niomem < 1 || + (ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT && + ia->ia_iomem[0].ir_addr != 0xb8000 && + ia->ia_iomem[0].ir_addr != 0xb0000)) + return (0); + if (ia->ia_iomem[0].ir_size != 0 && + ia->ia_iomem[0].ir_size != 0x8000) + return (0); + + if (ia->ia_nirq > 0 && + ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT) + return (0); + + if (ia->ia_ndrq > 0 && + ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT) return (0); if (pcdisplay_is_console(ia->ia_iot)) mono = pcdisplay_console_dc.mono; - else if (ia->ia_iobase != 0x3b0 && ia->ia_maddr != 0xb0000 && + else if (ia->ia_io[0].ir_addr != 0x3b0 && + ia->ia_iomem[0].ir_addr != 0xb0000 && pcdisplay_probe_col(ia->ia_iot, ia->ia_memt)) mono = 0; - else if (ia->ia_iobase != 0x3d0 && ia->ia_maddr != 0xb8000 && + else if (ia->ia_io[0].ir_addr != 0x3d0 && + ia->ia_iomem[0].ir_addr != 0xb8000 && pcdisplay_probe_mono(ia->ia_iot, ia->ia_memt)) mono = 1; else return (0); - ia->ia_iobase = mono ? 0x3b0 : 0x3d0; - ia->ia_iosize = 0x10; - ia->ia_maddr = mono ? 0xb0000 : 0xb8000; - ia->ia_msize = 0x8000; + ia->ia_nio = 1; + ia->ia_io[0].ir_addr = mono ? 0x3b0 : 0x3d0; + ia->ia_io[0].ir_size = 0x10; + + ia->ia_niomem = 1; + ia->ia_iomem[0].ir_size = mono ? 0xb0000 : 0xb8000; + ia->ia_iomem[0].ir_size = 0x8000; + + ia->ia_nirq = 0; + ia->ia_ndrq = 0; + return (1); } @@ -287,10 +311,12 @@ pcdisplay_attach(parent, self, aux) } else { dc = malloc(sizeof(struct pcdisplay_config), M_DEVBUF, M_WAITOK); - if (ia->ia_iobase != 0x3b0 && ia->ia_maddr != 0xb0000 && + if (ia->ia_io[0].ir_addr != 0x3b0 && + ia->ia_iomem[0].ir_addr != 0xb0000 && pcdisplay_probe_col(ia->ia_iot, ia->ia_memt)) pcdisplay_init(dc, ia->ia_iot, ia->ia_memt, 0); - else if (ia->ia_iobase != 0x3d0 && ia->ia_maddr != 0xb8000 && + else if (ia->ia_io[0].ir_addr != 0x3d0 && + ia->ia_iomem[0].ir_addr != 0xb8000 && pcdisplay_probe_mono(ia->ia_iot, ia->ia_memt)) pcdisplay_init(dc, ia->ia_iot, ia->ia_memt, 1); else @@ -307,7 +333,7 @@ pcdisplay_attach(parent, self, aux) sc->sc_weasel.wh_st = dc->dc_ph.ph_memt; sc->sc_weasel.wh_sh = dc->dc_ph.ph_memh; sc->sc_weasel.wh_parent = &sc->sc_dev; - weasel_init(&sc->sc_weasel); + weasel_isa_init(&sc->sc_weasel); } #endif /* NPCWEASEL > 0 */ diff --git a/sys/dev/isa/weasel.c b/sys/dev/isa/weasel.c index 3e5a3cf6dd91..c4af7a98b7af 100644 --- a/sys/dev/isa/weasel.c +++ b/sys/dev/isa/weasel.c @@ -1,4 +1,4 @@ -/* $NetBSD: weasel.c,v 1.4 2001/11/13 08:01:34 lukem Exp $ */ +/* $NetBSD: weasel.c,v 1.5 2001/12/16 22:30:26 thorpej Exp $ */ /*- * Copyright (c) 2000 Zembu Labs, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: weasel.c,v 1.4 2001/11/13 08:01:34 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: weasel.c,v 1.5 2001/12/16 22:30:26 thorpej Exp $"); #include #include @@ -56,10 +56,10 @@ __KERNEL_RCSID(0, "$NetBSD: weasel.c,v 1.4 2001/11/13 08:01:34 lukem Exp $"); #include -int weasel_wdog_setmode(struct sysmon_wdog *); -int weasel_wdog_tickle(struct sysmon_wdog *); -int weasel_wdog_arm_disarm(struct weasel_handle *, u_int8_t); -int weasel_wdog_query_state(struct weasel_handle *); +int weasel_isa_wdog_setmode(struct sysmon_wdog *); +int weasel_isa_wdog_tickle(struct sysmon_wdog *); +int weasel_isa_wdog_arm_disarm(struct weasel_handle *, u_int8_t); +int weasel_isa_wdog_query_state(struct weasel_handle *); void pcweaselattach(int); @@ -73,7 +73,7 @@ pcweaselattach(int count) } void -weasel_init(struct weasel_handle *wh) +weasel_isa_init(struct weasel_handle *wh) { struct weasel_config_block cfg; int i, j; @@ -195,7 +195,7 @@ weasel_init(struct weasel_handle *wh) cfg.wdt_msec = 3000; } - if ((wh->wh_wdog_armed = weasel_wdog_query_state(wh)) == -1) + if ((wh->wh_wdog_armed = weasel_isa_wdog_query_state(wh)) == -1) wh->wh_wdog_armed = 0; wh->wh_wdog_period = cfg.wdt_msec / 1000; @@ -207,8 +207,8 @@ weasel_init(struct weasel_handle *wh) */ wh->wh_smw.smw_name = "weasel"; wh->wh_smw.smw_cookie = wh; - wh->wh_smw.smw_setmode = weasel_wdog_setmode; - wh->wh_smw.smw_tickle = weasel_wdog_tickle; + wh->wh_smw.smw_setmode = weasel_isa_wdog_setmode; + wh->wh_smw.smw_tickle = weasel_isa_wdog_tickle; wh->wh_smw.smw_period = wh->wh_wdog_period; if (sysmon_wdog_register(&wh->wh_smw) != 0) @@ -217,13 +217,13 @@ weasel_init(struct weasel_handle *wh) } int -weasel_wdog_setmode(struct sysmon_wdog *smw) +weasel_isa_wdog_setmode(struct sysmon_wdog *smw) { struct weasel_handle *wh = smw->smw_cookie; int error = 0; if ((smw->smw_mode & WDOG_MODE_MASK) == WDOG_MODE_DISARMED) { - error = weasel_wdog_arm_disarm(wh, WDT_DISABLE); + error = weasel_isa_wdog_arm_disarm(wh, WDT_DISABLE); } else { if (smw->smw_period == WDOG_PERIOD_DEFAULT) smw->smw_period = wh->wh_wdog_period; @@ -231,15 +231,15 @@ weasel_wdog_setmode(struct sysmon_wdog *smw) /* Can't change the period on the Weasel. */ return (EINVAL); } - error = weasel_wdog_arm_disarm(wh, WDT_ENABLE); - weasel_wdog_tickle(smw); + error = weasel_isa_wdog_arm_disarm(wh, WDT_ENABLE); + weasel_isa_wdog_tickle(smw); } return (error); } int -weasel_wdog_tickle(struct sysmon_wdog *smw) +weasel_isa_wdog_tickle(struct sysmon_wdog *smw) { struct weasel_handle *wh = smw->smw_cookie; u_int8_t reg; @@ -261,7 +261,7 @@ weasel_wdog_tickle(struct sysmon_wdog *smw) * servicing nothing. Let the user know that the machine is no * longer being monitored by the weasel. */ - if((x = weasel_wdog_query_state(wh)) == -1) + if((x = weasel_isa_wdog_query_state(wh)) == -1) error = EIO; if (x == 1) { error = 0; @@ -277,7 +277,7 @@ weasel_wdog_tickle(struct sysmon_wdog *smw) } int -weasel_wdog_arm_disarm(struct weasel_handle *wh, u_int8_t mode) +weasel_isa_wdog_arm_disarm(struct weasel_handle *wh, u_int8_t mode) { u_int8_t reg; int timeout; @@ -324,7 +324,7 @@ weasel_wdog_arm_disarm(struct weasel_handle *wh, u_int8_t mode) * Ensure that the Weasel thinks it's in the same mode we want it to * be in. EIO if not. */ - x = weasel_wdog_query_state(wh); + x = weasel_isa_wdog_query_state(wh); switch (x) { case -1: error = EIO; @@ -350,7 +350,7 @@ weasel_wdog_arm_disarm(struct weasel_handle *wh, u_int8_t mode) } int -weasel_wdog_query_state(struct weasel_handle *wh) +weasel_isa_wdog_query_state(struct weasel_handle *wh) { int timeout, reg; diff --git a/sys/dev/isa/weaselvar.h b/sys/dev/isa/weaselvar.h index 709f9d399585..cacb27ea5fae 100644 --- a/sys/dev/isa/weaselvar.h +++ b/sys/dev/isa/weaselvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: weaselvar.h,v 1.1 2000/11/04 18:47:20 thorpej Exp $ */ +/* $NetBSD: weaselvar.h,v 1.2 2001/12/16 22:30:27 thorpej Exp $ */ /*- * Copyright (c) 2000 Zembu Labs, Inc. @@ -52,4 +52,4 @@ struct weasel_handle { u_int wh_wdog_period; }; -void weasel_init(struct weasel_handle *); +void weasel_isa_init(struct weasel_handle *);