ISA PnP and RTL8019AS: More fixes - fixes I/O range check errors in jumperless mode.

This commit is contained in:
OBattler
2025-09-25 05:45:14 +02:00
parent f0b20fddd5
commit e7645e5c39
2 changed files with 43 additions and 9 deletions

View File

@@ -77,6 +77,7 @@ enum {
typedef struct _isapnp_device_ {
uint8_t number;
uint8_t defs[256];
uint8_t regs[256];
uint8_t mem_upperlimit;
uint8_t irq_types;
@@ -278,6 +279,18 @@ isapnp_reset_ld_regs(isapnp_device_t *ld)
/* Reset configuration registers to match the default configuration. */
isapnp_reset_ld_config(ld);
if (ld->defs[0x30] != 0x00)
ld->regs[0x30] = ld->defs[0x30];
if (ld->defs[0x60] != 0x00)
ld->regs[0x60] = ld->defs[0x60];
if (ld->defs[0x61] != 0x00)
ld->regs[0x61] = ld->defs[0x61];
if (ld->defs[0x70] != 0x00)
ld->regs[0x70] = ld->defs[0x70];
}
static uint8_t
@@ -1251,12 +1264,14 @@ isapnp_activate(void *priv, uint16_t base, uint8_t irq)
}
if (ld != NULL) {
ld->regs[0x30] = 0x01;
ld->regs[0x60] = base >> 4;
ld->defs[0x30] = 0x01;
ld->defs[0x60] = base >> 8;
if (!(ld->io_16bit & (1 << ((0x60 >> 1) & 0x07))))
ld->regs[0x60] &= 0x03;
ld->regs[0x61] = base & 0x0f;
ld->regs[0x70] = irq;
ld->defs[0x60] &= 0x03;
ld->defs[0x61] = base & 0xff;
ld->defs[0x70] = irq;
isapnp_reset_ld_regs(ld);
}
}

View File

@@ -172,6 +172,19 @@ nic_interrupt(void *priv, int set)
}
}
static void
nic_config_reset(void *priv)
{
nic_t *dev = (nic_t *) priv;
uint8_t *data = (uint8_t *) nmc93cxx_eeprom_data(dev->eeprom);
dev->config1 = (data[0x00] & 0x7f) | 0x80;
dev->config2 = (data[0x01] & 0xdf);
dev->config3 = (data[0x02] & 0xf7);
isapnp_set_normal(dev->pnp_card, !!(dev->config3 & 0x80));
}
/* reset - restore state to power-up, cancelling all i/o */
static void
nic_reset(void *priv)
@@ -181,6 +194,9 @@ nic_reset(void *priv)
nelog(1, "%s: reset\n", dev->name);
dp8390_reset(dev->dp8390);
if (dev->board >= NE2K_RTL8019AS_PNP)
nic_config_reset(priv);
}
static void
@@ -189,6 +205,9 @@ nic_soft_reset(void *priv)
nic_t *dev = (nic_t *) priv;
dp8390_soft_reset(dev->dp8390);
if (dev->board >= NE2K_RTL8019AS_PNP)
nic_config_reset(priv);
}
/*
@@ -423,7 +442,7 @@ page3_write(nic_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len))
dev->config1 = (data[0x00] & 0x7f) | 0x80;
dev->config2 = (data[0x01] & 0xdf);
dev->config3 = (data[0x02] & 0x77) | 0x80;
dev->config3 = (data[0x02] & 0xf7);
dev->_9346cr = 0x21;
isapnp_set_normal(dev->pnp_card, !!(dev->config3 & 0x80));
@@ -1957,7 +1976,7 @@ const device_t rtl8019as_pnp_device = {
.local = NE2K_RTL8019AS_PNP,
.init = nic_init,
.close = nic_close,
.reset = NULL,
.reset = nic_config_reset,
.available = rtl8019as_available,
.speed_changed = NULL,
.force_redraw = NULL,
@@ -1971,7 +1990,7 @@ const device_t de220p_device = {
.local = NE2K_DE220P,
.init = nic_init,
.close = nic_close,
.reset = NULL,
.reset = nic_config_reset,
.available = de220p_available,
.speed_changed = NULL,
.force_redraw = NULL,
@@ -1985,7 +2004,7 @@ const device_t rtl8029as_device = {
.local = NE2K_RTL8029AS,
.init = nic_init,
.close = nic_close,
.reset = NULL,
.reset = nic_config_reset,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,