Deal with lossage caused by recent isa changes [/briq potr]

This commit is contained in:
christos 2002-01-08 17:20:44 +00:00
parent a6f2a36ecc
commit b5d5702d16
4 changed files with 105 additions and 59 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ega.c,v 1.7 2001/11/13 08:01:12 lukem Exp $ */
/* $NetBSD: ega.c,v 1.8 2002/01/08 17:20:44 christos Exp $ */
/*
* Copyright (c) 1999
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ega.c,v 1.7 2001/11/13 08:01:12 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: ega.c,v 1.8 2002/01/08 17:20:44 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -458,33 +458,52 @@ ega_match(parent, match, aux)
struct isa_attach_args *ia = aux;
int mono;
if (ia->ia_nio < 1)
return (0);
if (ia->ia_iomem < 1)
return (0);
if (ia->ia_nirq < 1)
return (0);
if (ia->ia_ndrq < 1)
return (0);
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_io[0].ir_addr != ISACF_PORT_DEFAULT &&
ia->ia_io[0].ir_addr != 0x3d0 &&
ia->ia_io[0].ir_addr != 0x3b0) ||
/* ia->ia_io[0].ir_size != 0 || XXX isa.c */
(ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT &&
ia->ia_iomem[0].ir_addr != 0xb8000 &&
ia->ia_iomem[0].ir_addr != 0xb0000) ||
(ia->ia_iomem[0].ir_size != 0 &&
ia->ia_iomem[0].ir_size != 0x8000) ||
ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT ||
ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT)
return (0);
if (ega_is_console(ia->ia_iot))
mono = ega_console_dc.hdl.vh_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 &&
ega_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 &&
ega_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_io[0].ir_addr = mono ? 0x3b0 : 0x3d0;
ia->ia_io[0].ir_size = 0x10;
ia->ia_iomem[0].ir_addr = mono ? 0xb0000 : 0xb8000;
ia->ia_iomem[0].ir_size = 0x8000;
return (2); /* beat pcdisplay */
}
@ -510,10 +529,12 @@ ega_attach(parent, self, aux)
} else {
dc = malloc(sizeof(struct ega_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 &&
ega_probe_col(ia->ia_iot, ia->ia_memt))
ega_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 &&
ega_probe_mono(ia->ia_iot, ia->ia_memt))
ega_init(dc, ia->ia_iot, ia->ia_memt, 1);
else

View File

@ -1,4 +1,4 @@
/* $NetBSD: esp_isa.c,v 1.23 2001/11/13 08:01:12 lukem Exp $ */
/* $NetBSD: esp_isa.c,v 1.24 2002/01/08 17:20:44 christos Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -113,7 +113,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: esp_isa.c,v 1.23 2001/11/13 08:01:12 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: esp_isa.c,v 1.24 2002/01/08 17:20:44 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -330,12 +330,22 @@ esp_isa_match(parent, match, aux)
struct esp_isa_probe_data epd;
int rv;
if (ia->ia_nio < 1)
return (0);
if (ia->ia_nirq < 1)
return (0);
if (ia->ia_ndrq < 1)
return (0);
if (ISA_DIRECT_CONFIG(ia))
return (0);
ESP_TRACE(("[esp_isa_match] "));
if (ia->ia_iobase == -1)
if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT)
return 0;
if (bus_space_map(iot, ia->ia_iobase, ESP_ISA_IOSIZE, 0, &ioh))
if (bus_space_map(iot, ia->ia_io[0].ir_addr, ESP_ISA_IOSIZE, 0, &ioh))
return 0;
rv = esp_isa_find(iot, ioh, &epd);
@ -343,17 +353,18 @@ esp_isa_match(parent, match, aux)
bus_space_unmap(iot, ioh, ESP_ISA_IOSIZE);
if (rv) {
if (ia->ia_irq != IRQUNK && ia->ia_irq != epd.sc_irq) {
if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT &&
ia->ia_irq[0].ir_irq != epd.sc_irq) {
#ifdef DIAGNOSTIC
printf("esp_isa_match: configured IRQ (%0d) does not "
"match board IRQ (%0d), device not configured\n",
ia->ia_irq, epd.sc_irq);
ia->ia_irq[0].ir_irq, epd.sc_irq);
#endif
return 0;
}
ia->ia_irq = epd.sc_irq;
ia->ia_msize = 0;
ia->ia_iosize = ESP_ISA_IOSIZE;
ia->ia_irq[0].ir_irq = epd.sc_irq;
ia->ia_iomem[0].ir_size = 0;
ia->ia_io[0].ir_size = ESP_ISA_IOSIZE;
}
return (rv);
}
@ -378,7 +389,7 @@ esp_isa_attach(parent, self, aux)
printf("\n");
ESP_TRACE(("[esp_isa_attach] "));
if (bus_space_map(iot, ia->ia_iobase, ESP_ISA_IOSIZE, 0, &ioh)) {
if (bus_space_map(iot, ia->ia_io[0].ir_addr, ESP_ISA_IOSIZE, 0, &ioh)) {
printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname);
return;
}
@ -388,16 +399,16 @@ esp_isa_attach(parent, self, aux)
return;
}
if (ia->ia_drq != DRQUNK) {
if ((error = isa_dmacascade(ic, ia->ia_drq)) != 0) {
if (ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT) {
if ((error = isa_dmacascade(ic, ia->ia_drq[0].ir_drq)) != 0) {
printf("%s: unable to cascade DRQ, error = %d\n",
sc->sc_dev.dv_xname, error);
return;
}
}
esc->sc_ih = isa_intr_establish(ic, ia->ia_irq, IST_EDGE, IPL_BIO,
ncr53c9x_intr, esc);
esc->sc_ih = isa_intr_establish(ic, ia->ia_irq[0].ir_irq, IST_EDGE,
IPL_BIO, ncr53c9x_intr, esc);
if (esc->sc_ih == NULL) {
printf("%s: couldn't establish interrupt\n",
sc->sc_dev.dv_xname);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ix.c,v 1.13 2002/01/07 21:47:08 thorpej Exp $ */
/* $NetBSD: if_ix.c,v 1.14 2002/01/08 17:20:44 christos Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ix.c,v 1.13 2002/01/07 21:47:08 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ix.c,v 1.14 2002/01/08 17:20:44 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -680,7 +680,7 @@ ix_match(parent, cf, aux)
/*
* Get the encoded interrupt number from the EEPROM, check it
* against the passed in IRQ. Issue a warning if they do not
* match, and fail the probe. If irq is 'IRQUNK' then we
* match, and fail the probe. If irq is 'ISACF_IRQ_DEFAULT' then we
* use the EEPROM irq, and continue.
*/
irq_encoded = ix_read_eeprom(iot, ioh, IX_EEPROM_CONFIG1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pss.c,v 1.59 2002/01/07 21:47:12 thorpej Exp $ */
/* $NetBSD: pss.c,v 1.60 2002/01/08 17:20:44 christos Exp $ */
/* XXX THIS DRIVER IS BROKEN. IT WILL NOT EVEN COMPILE. */
@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pss.c,v 1.59 2002/01/07 21:47:12 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: pss.c,v 1.60 2002/01/08 17:20:44 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -705,6 +705,17 @@ pssprobe(parent, match, aux)
void *aux;
{
struct pss_softc probesc, *sc = &probesc;
struct isa_attach_args *ia = aux;
if (ia->ia_nio < 1)
return (0);
if (ia->ia_nirq < 1)
return (0);
if (ia->ia_ndrq < 1)
return (0);
if (ISA_DIRECT_CONFIG(ia))
return (0);
memset(sc, 0, sizeof *sc);
sc->sc_dev.dv_cfdata = match;
@ -718,15 +729,15 @@ pssfind(parent, sc, ia)
struct pss_softc *sc;
struct isa_attach_args *ia;
{
int iobase = ia->ia_iobase;
int iobase = ia->ia_io[0].ir_addr;
if (!PSS_BASE_VALID(iobase)) {
printf("pss: configured iobase %x invalid\n", iobase);
return 0;
}
/* Need to probe for iobase when IOBASEUNK {0x220 0x240} */
if (iobase == IOBASEUNK) {
/* Need to probe for iobase when ISACF_PORT_DEFAULT {0x220 0x240} */
if (iobase == ISACF_PORT_DEFAULT) {
iobase = 0x220;
if ((inw(iobase+PSS_ID_VERS) & 0xff00) == 0x4500)
@ -758,7 +769,7 @@ pss_found:
outw(sc->sc_iobase+MIDI_CONFIG, 0);
outw(sc->sc_iobase+CD_CONFIG, 0);
if (ia->ia_irq == IRQUNK) {
if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT) {
int i;
for (i = 0; i < 16; i++) {
if (pss_testirq(sc, i) != 0)
@ -769,28 +780,30 @@ pss_found:
return 0;
}
else {
ia->ia_irq = i;
ia->ia_irq[0].ir_irq = i;
printf("pss: found IRQ %d free\n", i);
}
}
else {
if (pss_testirq(sc, ia->ia_irq) == 0) {
printf("pss: configured IRQ unavailable (%d)\n", ia->ia_irq);
if (pss_testirq(sc, ia->ia_irq[0].ir_irq) == 0) {
printf("pss: configured IRQ unavailable (%d)\n",
ia->ia_irq[0].ir_irq);
return 0;
}
}
/* XXX Need to deal with DRQUNK */
if (pss_testdma(sc, ia->ia_drq) == 0) {
printf("pss: configured DMA channel unavailable (%d)\n", ia->ia_drq);
/* XXX Need to deal with ISACF_DRQ_DEFAULT */
if (pss_testdma(sc, ia->ia_drq[0].ir_drq) == 0) {
printf("pss: configured DMA channel unavailable (%d)\n",
ia->ia_drq[0].ir_drq);
return 0;
}
ia->ia_iosize = PSS_NPORT;
ia->ia_io[0].ir_size = PSS_NPORT;
/* Initialize PSS irq and dma */
pss_setint(ia->ia_irq, sc->sc_iobase+PSS_CONFIG);
pss_setdma(sc->sc_drq, sc->sc_iobase+PSS_CONFIG);
pss_setint(ia->ia_irq[0].ir_irq, sc->sc_iobase+PSS_CONFIG);
pss_setdma(ia->ia_drq[0].ir_drq, sc->sc_iobase+PSS_CONFIG);
#ifdef notyet
/* Setup the Game port */
@ -847,7 +860,7 @@ spfind(parent, sc, ia)
}
/* Setup WSS interrupt and DMA if auto */
if (cf->cf_irq == IRQUNK) {
if (cf->cf_irq == ISACF_IRQ_DEFAULT) {
/* Find unused IRQ for WSS */
for (i = 0; i < 12; i++) {
@ -874,7 +887,7 @@ spfind(parent, sc, ia)
}
}
if (cf->cf_drq == DRQUNK) {
if (cf->cf_drq == ISACF_DRQ_DEFAULT) {
/* Find unused DMA channel for WSS */
for (i = 0; i < 4; i++) {
if (wss_dma_bits[i]) {
@ -893,7 +906,8 @@ spfind(parent, sc, ia)
}
else {
if (pss_testdma(pc, sc->sc_playdrq) == 0) {
printf("sp: configured DMA channel unavailable (%d)\n", sc->sc_playdrq);
printf("sp: configured DMA channel unavailable (%d)\n",
sc->sc_playdrq);
return 0;
}
sc->sc_playdrq = cf->cf_drq;
@ -949,7 +963,7 @@ pssattach(parent, self, aux)
{
struct pss_softc *sc = (struct pss_softc *)self;
struct isa_attach_args *ia = (struct isa_attach_args *)aux;
int iobase = ia->ia_iobase;
int iobase = ia->ia_io[0].ir_addr;
u_char vers;
struct ad1848_volume vol = {150, 150};
@ -959,11 +973,11 @@ pssattach(parent, self, aux)
}
sc->sc_iobase = iobase;
sc->sc_drq = ia->ia_drq;
sc->sc_drq = ia->ia_drq[0].ir_drq;
/* Setup interrupt handler for PSS */
sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, IPL_AUDIO,
pssintr, sc);
sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE,
IPL_AUDIO, pssintr, sc);
vers = (inw(sc->sc_iobase+PSS_ID_VERS)&0xff) - 1;
printf(": ESC614%c\n", (vers > 0)?'A'+vers:' ');