mirror of
https://github.com/86Box/86Box.git
synced 2025-01-22 17:22:25 -05:00
AHA-1542CP and ISA PnP memory range fixes, fixes AHA-1542CP on Packard Bell PB450.
This commit is contained in:
parent
e833e1da3f
commit
c3faf20226
2 changed files with 44 additions and 11 deletions
|
@ -137,6 +137,8 @@ isapnp_device_config_changed(isapnp_card_t *card, isapnp_device_t *ld)
|
|||
card->config.mem[i].size = (ld->regs[reg_base + 3] << 16) | (ld->regs[reg_base + 4] << 8);
|
||||
if (ld->regs[reg_base + 2] & 0x01) /* upper limit */
|
||||
card->config.mem[i].size -= card->config.mem[i].base;
|
||||
else
|
||||
card->config.mem[i].size = (card->config.mem[i].size | 0xff) ^ 0xffffffff;
|
||||
}
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
reg_base = (i == 0) ? 0x76 : (0x80 + (16 * i));
|
||||
|
@ -789,10 +791,25 @@ isapnp_update_card_rom(void *priv, uint8_t *rom, uint16_t rom_size)
|
|||
break;
|
||||
}
|
||||
|
||||
isapnp_log("ISAPnP: >>%s Memory range %d with %d bytes at %06X-%06X, align %d",
|
||||
in_df ? ">" : "", mem_range,
|
||||
*((uint16_t *) &card->rom[i + 10]) << 8, *((uint16_t *) &card->rom[i + 4]) << 8, ((card->rom[i + 3] & 0x4) ? 0 : (*((uint16_t *) &card->rom[i + 4]) << 8)) + (*((uint16_t *) &card->rom[i + 6]) << 8),
|
||||
(*((uint16_t *) &card->rom[i + 8]) + 1) << 16);
|
||||
isapnp_log("ISAPnP: >>%s Memory range %d with %d bytes at %06X-%06X to %06X-%06X, align %d",
|
||||
/* %s */ in_df ? ">" : "",
|
||||
/* %d */ mem_range,
|
||||
/* %d */ *((uint16_t *) &card->rom[i + 8]),
|
||||
/* %06X */ *((uint16_t *) &card->rom[i + 4]) << 8,
|
||||
/* %06X */ ((card->rom[i + 3] & 0x4) ?
|
||||
/* High address. */
|
||||
(*((uint16_t *) &card->rom[i + 10]) << 8) :
|
||||
/* Range. */
|
||||
(*((uint16_t *) &card->rom[i + 4]) << 8)) +
|
||||
(*((uint16_t *) &card->rom[i + 10]) << 8),
|
||||
/* %06X */ *((uint16_t *) &card->rom[i + 6]) << 8,
|
||||
/* %06X */ ((card->rom[i + 3] & 0x4) ?
|
||||
/* High address. */
|
||||
(*((uint16_t *) &card->rom[i + 10]) << 8) :
|
||||
/* Range. */
|
||||
(*((uint16_t *) &card->rom[i + 6]) << 8)) +
|
||||
(*((uint16_t *) &card->rom[i + 10]) << 8),
|
||||
/* %d */ *((uint16_t *) &card->rom[i + 8]));
|
||||
res = 1 << mem_range;
|
||||
mem_range++;
|
||||
} else {
|
||||
|
@ -806,9 +823,25 @@ isapnp_update_card_rom(void *priv, uint8_t *rom, uint16_t rom_size)
|
|||
break;
|
||||
}
|
||||
|
||||
isapnp_log("ISAPnP: >>%s 32-bit memory range %d with %d bytes at %08X-%08X, align %d", in_df ? ">" : "", mem_range_32,
|
||||
*((uint32_t *) &card->rom[i + 16]) << 8, *((uint32_t *) &card->rom[i + 4]) << 8, ((card->rom[i + 3] & 0x4) ? 0 : (*((uint32_t *) &card->rom[i + 4]) << 8)) + (*((uint32_t *) &card->rom[i + 8]) << 8),
|
||||
*((uint32_t *) &card->rom[i + 12]));
|
||||
isapnp_log("ISAPnP: >>%s 32-bit memory range %d with %d bytes at %08X-%08X, align %d",
|
||||
/* %s */ in_df ? ">" : "",
|
||||
/* %d */ mem_range_32,
|
||||
/* %d */ *((uint32_t *) &card->rom[i + 12]),
|
||||
/* %08X */ *((uint32_t *) &card->rom[i + 4]),
|
||||
/* %08X */ ((card->rom[i + 3] & 0x4) ?
|
||||
/* High address. */
|
||||
*((uint32_t *) &card->rom[i + 16]) :
|
||||
/* Range. */
|
||||
*((uint32_t *) &card->rom[i + 4])) +
|
||||
*((uint32_t *) &card->rom[i + 16]),
|
||||
/* %08X */ *((uint32_t *) &card->rom[i + 8]),
|
||||
/* %08X */ ((card->rom[i + 3] & 0x4) ?
|
||||
/* High address. */
|
||||
*((uint32_t *) &card->rom[i + 16]) :
|
||||
/* Range. */
|
||||
*((uint32_t *) &card->rom[i + 8])) +
|
||||
*((uint32_t *) &card->rom[i + 16]),
|
||||
/* %d */ *((uint32_t *) &card->rom[i + 12]));
|
||||
res = 1 << (4 + mem_range_32);
|
||||
mem_range_32++;
|
||||
}
|
||||
|
|
|
@ -678,6 +678,7 @@ aha_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv)
|
|||
aha_eeprom_save(dev);
|
||||
|
||||
dev->rom_addr = config->mem[0].base;
|
||||
aha_log("Base = %08X, Size = %08X\n", config->mem[0].base, config->mem[0].size);
|
||||
if (dev->rom_addr) {
|
||||
mem_mapping_enable(&dev->bios.mapping);
|
||||
aha_log("SCSI BIOS set to: %08X-%08X\n", dev->rom_addr, dev->rom_addr + config->mem[0].size - 1);
|
||||
|
@ -869,13 +870,12 @@ aha_setmcode(x54x_t *dev)
|
|||
}
|
||||
aha1542cp_pnp_rom = (uint8_t *) malloc(dev->pnp_len + 7);
|
||||
fseek(fp, dev->pnp_offset, SEEK_SET);
|
||||
(void) !fread(aha1542cp_pnp_rom, dev->pnp_len, 1, fp);
|
||||
(void) !fread(aha1542cp_pnp_rom, 4, 1, fp);
|
||||
memset(&(aha1542cp_pnp_rom[4]), 0x00, 5);
|
||||
fseek(fp, dev->pnp_offset + 4, SEEK_SET);
|
||||
(void) !fread(&(aha1542cp_pnp_rom[9]), dev->pnp_len - 4, 1, fp);
|
||||
/* Even the real AHA-1542CP microcode seem to be flipping bit
|
||||
4 to not erroneously indicate there is a range length. */
|
||||
aha1542cp_pnp_rom[0x87] |= 0x04;
|
||||
/* Patch determined from Dizzy's AHA-1542CP PNP ROM dump. */
|
||||
aha1542cp_pnp_rom[0x26] = 0x03;
|
||||
/* Insert the terminator and the checksum byte that will later
|
||||
be filled in by the isapnp code. */
|
||||
aha1542cp_pnp_rom[dev->pnp_len + 5] = 0x79;
|
||||
|
|
Loading…
Reference in a new issue