diff --git a/src/device/isapnp.c b/src/device/isapnp.c index 341a9ff7e..08290e10b 100644 --- a/src/device/isapnp.c +++ b/src/device/isapnp.c @@ -221,6 +221,11 @@ isapnp_read_data(uint16_t addr, void *priv) case 0x04: /* Resource Data */ CHECK_CURRENT_CARD(); + /* The break; inside CHECK_CURRENT_CARD(); only breaks out of the do { ... } while (0); + so make sure to break again here. */ + if (!card) + break; + isapnp_log("ISAPnP: Read resource data index %02X (%02X) from CSN %02X\n", card->rom_pos, card->rom[card->rom_pos], card->csn); if (card->rom_pos >= card->rom_size) ret = 0xff; @@ -233,6 +238,11 @@ isapnp_read_data(uint16_t addr, void *priv) ret = 0x00; CHECK_CURRENT_CARD(); + /* The break; inside CHECK_CURRENT_CARD(); only breaks out of the do { ... } while (0); + so make sure to break again here. */ + if (!card) + break; + isapnp_log("ISAPnP: Query status for CSN %02X\n", card->csn); ret = 0x01; @@ -242,6 +252,11 @@ isapnp_read_data(uint16_t addr, void *priv) ret = 0x00; CHECK_CURRENT_CARD(); + /* The break; inside CHECK_CURRENT_CARD(); only breaks out of the do { ... } while (0); + so make sure to break again here. */ + if (!card) + break; + isapnp_log("ISAPnP: Query CSN %02X\n", card->csn); ret = card->csn; @@ -261,7 +276,14 @@ isapnp_read_data(uint16_t addr, void *priv) case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f: CHECK_CURRENT_CARD(); + + /* The break; inside CHECK_CURRENT_CARD(); only breaks out of the do { ... } while (0); + so make sure to break again here. */ + if (!card) + break; + isapnp_log("ISAPnP: Read vendor-defined register %02X from CSN %02X\n", dev->reg, card->csn); + if (card->read_vendor_reg) ret = card->read_vendor_reg(0, dev->reg, card->priv); break; @@ -432,6 +454,11 @@ isapnp_write_data(uint16_t addr, uint8_t val, void *priv) case 0x07: /* Logical Device Number */ CHECK_CURRENT_CARD(); + /* The break; inside CHECK_CURRENT_CARD(); only breaks out of the do { ... } while (0); + so make sure to break again here. */ + if (!card) + break; + ld = card->first_ld; while (ld) { if (ld->number == val) { @@ -498,7 +525,14 @@ isapnp_write_data(uint16_t addr, uint8_t val, void *priv) case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f: CHECK_CURRENT_CARD(); + + /* The break; inside CHECK_CURRENT_CARD(); only breaks out of the do { ... } while (0); + so make sure to break again here. */ + if (!card) + break; + isapnp_log("ISAPnP: Write %02X to vendor-defined register %02X on CSN %02X\n", val, dev->reg, card->csn); + if (card->write_vendor_reg) card->write_vendor_reg(0, dev->reg, val, card->priv); break; diff --git a/src/scsi/scsi_aha154x.c b/src/scsi/scsi_aha154x.c index e374de25e..8e4bf93be 100644 --- a/src/scsi/scsi_aha154x.c +++ b/src/scsi/scsi_aha154x.c @@ -193,7 +193,7 @@ aha154x_eeprom(x54x_t *dev, uint8_t cmd,uint8_t arg,uint8_t len,uint8_t off,uint if (dev->type == AHA_154xCF) { if (dev->fdc_address > 0) { fdc_remove(dev->fdc); - fdc_set_base(dev->fdc, dev->fdc_address); + fdc_set_base(dev->fdc, (dev->nvr[0] & EE0_ALTFLOP) ? 0x370 : 0x3f0); } } } @@ -745,6 +745,13 @@ aha_setnvr(x54x_t *dev) f = NULL; } else aha_initnvr(dev); + + if (dev->type == AHA_154xCF) { + if (dev->fdc_address > 0) { + fdc_remove(dev->fdc); + fdc_set_base(dev->fdc, (dev->nvr[0] & EE0_ALTFLOP) ? 0x370 : 0x3f0); + } + } }