Merge pull request #4 from 86Box/master

Bring up to par with main master.
This commit is contained in:
Miran Grča
2025-05-24 07:12:19 +02:00
committed by GitHub
15 changed files with 144 additions and 45 deletions

View File

@@ -1621,7 +1621,10 @@ piix_init(const device_t *info)
else
cpu_set_isa_pci_div(3);
dma_alias_set();
if (dev->type > 1)
dma_alias_set();
else
dma_alias_set_piix();
if (dev->type < 4)
pci_enable_mirq(0);

View File

@@ -355,7 +355,23 @@ sio_config_read(uint16_t port, UNUSED(void *priv))
ret = 0xff;
break;
case 5:
ret = 0xd3;
/*
Dell Dimension XPS P60 jumpers:
- Bit 5: Disable CMOS Setup (1 = yes, 0 = no).
Dell OptiPlex 560/L jumpers:
- Bit 1: Password (1 = disable, 0 = enable);
- Bit 5: Clear CMOS (1 = no, 0 = yes).
- Bits 7, 6: Board type:
- 0, 0 = L;
- 0, 1 = MT;
- 1, 0 = M;
- 1, 1 = M.
*/
if (!strcmp(machine_get_internal_name(), "opti560l"))
ret = 0x20;
else
ret = 0xd3;
switch (cpu_pci_speed) {
case 20000000:

View File

@@ -22,6 +22,7 @@ add_library(dev OBJECT
cartridge.c
cassette.c
clock_ics9xxx.c
dell_jumper.c
hasp.c
hwm.c
hwm_gl518sm.c

View File

@@ -1125,7 +1125,9 @@ write_cmd_generic(void *priv, uint8_t val)
*/
uint8_t p1 = 0x30;
kbc_delay_to_ob(dev, p1, 0, 0x00);
} else if (!strcmp(machine_get_internal_name(), "dellplato") || !strcmp(machine_get_internal_name(), "dellhannibalp")) {
} else if (!strcmp(machine_get_internal_name(), "dellplato") ||
!strcmp(machine_get_internal_name(), "dellhannibalp") ||
!strcmp(machine_get_internal_name(), "dellxp60")) {
/*
Dell Dimension XPS Pxxx & Pxxxa/Mxxxa:
- Bit 3: Password disable jumper (must be clear);

View File

@@ -30,8 +30,10 @@
#include <86box/mem.h>
#include <86box/device.h>
#include <86box/pci.h>
#include <86box/plat_fallthrough.h>
#define PCI_BRIDGE_DEC_21150 0x10110022
#define PCI_BRIDGE_DEC_21152 0x10110024
#define AGP_BRIDGE_ALI_M5243 0x10b95243
#define AGP_BRIDGE_ALI_M5247 0x10b95247
#define AGP_BRIDGE_INTEL_440LX 0x80867181
@@ -242,12 +244,15 @@ pci_bridge_write(int func, int addr, uint8_t val, void *priv)
case 0x40:
if (dev->local == PCI_BRIDGE_DEC_21150)
val &= 0x32;
else if (dev->local == PCI_BRIDGE_DEC_21152)
val &= 0x12;
break;
case 0x41:
if (AGP_BRIDGE_VIA(dev->local))
val &= 0x7e;
else if (dev->local == PCI_BRIDGE_DEC_21150)
else if ((dev->local == PCI_BRIDGE_DEC_21150) ||
(dev->local == PCI_BRIDGE_DEC_21152))
val &= 0x07;
break;
@@ -257,18 +262,22 @@ pci_bridge_write(int func, int addr, uint8_t val, void *priv)
break;
case 0x43:
if (dev->local == PCI_BRIDGE_DEC_21150)
if ((dev->local == PCI_BRIDGE_DEC_21150) ||
(dev->local == PCI_BRIDGE_DEC_21152))
val &= 0x03;
break;
case 0x64:
if (dev->local == PCI_BRIDGE_DEC_21150)
if ((dev->local == PCI_BRIDGE_DEC_21150) ||
(dev->local == PCI_BRIDGE_DEC_21152))
val &= 0x7e;
break;
case 0x69:
if (dev->local == PCI_BRIDGE_DEC_21150)
val &= 0x3f;
else if (dev->local == PCI_BRIDGE_DEC_21152)
val = (val & 0x01) | 0x3e;
break;
case 0x86:
@@ -302,6 +311,15 @@ pci_bridge_write(int func, int addr, uint8_t val, void *priv)
break;
case 0xe0:
if (AGP_BRIDGE_ALI(dev->local)) {
if (!(dev->ctl & 0x20))
return;
} else if (dev->local == PCI_BRIDGE_DEC_21152)
val &= 0x03;
else
return;
break;
case 0xe1:
if (AGP_BRIDGE_ALI(dev->local)) {
if (!(dev->ctl & 0x20))
@@ -399,6 +417,14 @@ pci_bridge_reset(void *priv)
/* command and status */
switch (dev->local) {
case PCI_BRIDGE_DEC_21152:
dev->regs[0x08] = 0x03;
dev->regs[0x34] = 0xdc;
dev->regs[0x69] = 0x3e;
dev->regs[0xdc] = 0x01;
dev->regs[0xde] = 0x01;
dev->regs[0xe2] = 0x80;
fallthrough;
case PCI_BRIDGE_DEC_21150:
dev->regs[0x06] = 0x80;
dev->regs[0x07] = 0x02;
@@ -490,6 +516,8 @@ pci_bridge_init(const device_t *info)
uint8_t interrupt_count;
uint8_t interrupt_mask;
uint8_t slot_count;
uint8_t dell_slots[3] = { 0x09, 0x0a, 0x0b };
uint8_t dell_interrupts[3][4] = { { 1, 2, 3, 4 }, { 4, 2, 1, 3 }, { 1, 3, 4, 2 } };
pci_bridge_t *dev = (pci_bridge_t *) calloc(1, sizeof(pci_bridge_t));
@@ -499,7 +527,10 @@ pci_bridge_init(const device_t *info)
pci_bridge_reset(dev);
pci_add_bridge(AGP_BRIDGE(dev->local), pci_bridge_read, pci_bridge_write, dev, &dev->slot);
if (info->local == PCI_BRIDGE_DEC_21152)
pci_add_card(PCI_ADD_BRIDGE, pci_bridge_read, pci_bridge_write, dev, &dev->slot);
else
pci_add_bridge(AGP_BRIDGE(dev->local), pci_bridge_read, pci_bridge_write, dev, &dev->slot);
interrupt_count = sizeof(interrupts);
interrupt_mask = interrupt_count - 1;
@@ -513,16 +544,23 @@ pci_bridge_init(const device_t *info)
if (info->local == PCI_BRIDGE_DEC_21150)
slot_count = 9; /* 9 bus masters */
else if (info->local == PCI_BRIDGE_DEC_21152)
slot_count = 3; /* 3 bus masters */
else
slot_count = 1; /* AGP bridges always have 1 slot */
for (uint8_t i = 0; i < slot_count; i++) {
uint8_t slot = i;
if (info->local == PCI_BRIDGE_DEC_21152) {
slot = dell_slots[i];
memcpy(interrupts, dell_interrupts[i], 4);
}
/* Interrupts for bridge slots are assigned in round-robin: ABCD, BCDA, CDAB and so on. */
pci_bridge_log("PCI Bridge %d: downstream slot %02X interrupts %02X %02X %02X %02X\n",
dev->bus_index, i, interrupts[i & interrupt_mask],
dev->bus_index, slot, interrupts[i & interrupt_mask],
interrupts[(i + 1) & interrupt_mask], interrupts[(i + 2) & interrupt_mask],
interrupts[(i + 3) & interrupt_mask]);
pci_register_bus_slot(dev->bus_index, i, AGP_BRIDGE(dev->local) ? PCI_CARD_AGP : PCI_CARD_NORMAL,
pci_register_bus_slot(dev->bus_index, slot, AGP_BRIDGE(dev->local) ? PCI_CARD_AGP : PCI_CARD_NORMAL,
interrupts[i & interrupt_mask],
interrupts[(i + 1) & interrupt_mask],
interrupts[(i + 2) & interrupt_mask],
@@ -547,6 +585,20 @@ const device_t dec21150_device = {
.config = NULL
};
const device_t dec21152_device = {
.name = "DEC 21152 PCI Bridge",
.internal_name = "dec21152",
.flags = DEVICE_PCI,
.local = PCI_BRIDGE_DEC_21152,
.init = pci_bridge_init,
.close = NULL,
.reset = pci_bridge_reset,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
/* AGP bridges */
const device_t ali5243_agp_device = {
.name = "ALi M5243 AGP Bridge",

View File

@@ -99,7 +99,8 @@ postcard_setui(void)
ps[1][0], ps[1][1], ps[1][2], ps[1][3]);
break;
}
} else if (strstr(machines[machine].name, " Dell ")) {
} else if (strstr(machines[machine].name, " Dell ") &&
(machine_get_chipset(machine) >= MACHINE_CHIPSET_INTEL_430FX)) {
char dell_diags[10] = { 0 };
if (!postcard_written[1])
@@ -223,7 +224,8 @@ postcard_init(UNUSED(const device_t *info))
io_sethandler(postcard_port, postcard_ports_num,
NULL, NULL, NULL, postcard_write, NULL, NULL, NULL);
if (strstr(machines[machine].name, " Dell "))
if (strstr(machines[machine].name, " Dell ") &&
(machine_get_chipset(machine) >= MACHINE_CHIPSET_INTEL_430FX))
io_sethandler(0x00e0, 0x0001,
NULL, NULL, NULL, NULL, NULL, postcard_writel, NULL);

View File

@@ -197,6 +197,8 @@ extern const device_t vlsi_scamp_device;
extern const device_t wd76c10_device;
/* Miscellaneous Hardware */
extern const device_t dell_jumper_device;
extern const device_t nec_mate_unk_device;
extern const device_t phoenix_486_jumper_device;

View File

@@ -385,6 +385,7 @@ extern int machine_get_min_ram(int m);
extern int machine_get_max_ram(int m);
extern int machine_get_ram_granularity(int m);
extern int machine_get_type(int m);
extern int machine_get_chipset(int m);
extern void machine_close(void);
extern int machine_has_mouse(void);
extern int machine_is_sony(void);

View File

@@ -286,6 +286,7 @@ extern void pci_bridge_set_ctl(void *priv, uint8_t ctl);
#ifdef EMU_DEVICE_H
extern const device_t dec21150_device;
extern const device_t dec21152_device;
extern const device_t ali5243_agp_device;
extern const device_t ali5247_agp_device;

View File

@@ -164,18 +164,20 @@ machine_at_optiplex_gxa_init(const machine_t *model)
machine_at_common_init_ex(model, 2);
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 1, 2, 3, 4);
pci_register_slot(0x0D, PCI_CARD_NORMAL, 2, 1, 3, 4);
pci_register_slot(0x0E, PCI_CARD_NORMAL, 3, 4, 2, 1);
pci_register_slot(0x11, PCI_CARD_NETWORK, 4, 0, 0, 0);
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 4);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 1, 2, 3, 4);
pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4);
pci_register_slot(0x11, PCI_CARD_NETWORK, 4, 0, 0, 0);
pci_register_slot(0x0E, PCI_CARD_NORMAL, 3, 4, 2, 1);
pci_register_slot(0x0D, PCI_CARD_NORMAL, 2, 1, 3, 4);
pci_register_slot(0x0F, PCI_CARD_BRIDGE, 1, 2, 3, 4);
if (sound_card_current[0] == SOUND_INTERNAL)
device_add(machine_get_snd_device(machine));
device_add(&i440lx_device);
device_add(&piix4_device);
device_add(&dec21152_device);
device_add_params(&pc87307_device, (void *) (PCX730X_PHOENIX_42 | PCX7307_PC87307));
device_add(&intel_flash_bxt_device);
spd_register(SPD_TYPE_SDRAM, 0x7, 256);

View File

@@ -157,7 +157,9 @@ machine_at_dellxp60_init(const machine_t *model)
if (bios_only || !ret)
return ret;
machine_at_common_init(model);
machine_at_common_init_ex(model, 2);
device_add(&amstrad_megapc_nvr_device);
device_add(&ide_pci_device);
pci_init(PCI_CONFIG_TYPE_2);
@@ -170,7 +172,7 @@ machine_at_dellxp60_init(const machine_t *model)
pci_register_slot(0x06, PCI_CARD_NORMAL, 2, 1, 3, 4);
pci_register_slot(0x02, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0);
device_add(&i430lx_device);
device_add(&keyboard_ps2_intel_ami_pci_device);
device_add(&keyboard_ps2_phoenix_device);
device_add(&sio_zb_device);
device_add(&fdc37c665_device);
device_add(&intel_flash_bxt_ami_device);
@@ -189,8 +191,10 @@ machine_at_opti560l_init(const machine_t *model)
if (bios_only || !ret)
return ret;
machine_at_common_init(model);
device_add(&ide_pci_2ch_device);
machine_at_common_init_ex(model, 2);
device_add(&amstrad_megapc_nvr_device);
device_add(&ide_pci_device);
pci_init(PCI_CONFIG_TYPE_2);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
@@ -199,7 +203,7 @@ machine_at_opti560l_init(const machine_t *model)
pci_register_slot(0x08, PCI_CARD_NORMAL, 2, 1, 3, 4);
pci_register_slot(0x02, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0);
device_add(&i430lx_device);
device_add(&keyboard_ps2_intel_ami_pci_device);
device_add(&keyboard_ps2_phoenix_device);
device_add(&sio_zb_device);
device_add(&i82091aa_device);
device_add(&intel_flash_bxt_ami_device);

View File

@@ -268,6 +268,7 @@ machine_at_optiplex_gxl_init(const machine_t *model)
device_add(&i430fx_device);
device_add(&piix_device);
device_add(&pc87332_device);
device_add(&dell_jumper_device);
device_add(&intel_flash_bxt_device);
return ret;

View File

@@ -24,7 +24,6 @@
#include <86box/mem.h>
#include <86box/io.h>
#include <86box/rom.h>
#include <86box/pci.h>
#include <86box/device.h>
#include <86box/chipset.h>
#include <86box/hdc.h>
@@ -45,6 +44,7 @@
#include <86box/scsi_ncr53c8xx.h>
#include <86box/thread.h>
#include <86box/network.h>
#include <86box/pci.h>
int
machine_at_acerv35n_init(const machine_t *model)
@@ -989,6 +989,7 @@ machine_at_optiplex_gn_init(const machine_t *model)
pci_register_slot(0x10, PCI_CARD_VIDEO, 4, 0, 0, 0); /* Trio64V2/GX, temporarily Trio64V2/DX is given */
pci_register_slot(0x11, PCI_CARD_NETWORK, 4, 0, 0, 0); /* 3C905, not yet emulated */
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 4);
pci_register_slot(0x0F, PCI_CARD_BRIDGE, 1, 2, 3, 4);
if (gfxcard[0] == VID_INTERNAL)
device_add(machine_get_vid_device(machine));
@@ -998,6 +999,7 @@ machine_at_optiplex_gn_init(const machine_t *model)
device_add(&i430tx_device);
device_add(&piix4_device);
device_add(&dec21152_device);
device_add_params(&pc87307_device, (void *) (PCX730X_PHOENIX_42 | PCX7307_PC87307));
device_add(&intel_flash_bxt_device);
spd_register(SPD_TYPE_SDRAM, 0x3, 128);

View File

@@ -17346,6 +17346,12 @@ machine_get_type(int m)
return (machines[m].type);
}
int
machine_get_chipset(int m)
{
return (machines[m].chipset);
}
int
machine_get_machine_from_internal_name(const char *s)
{

View File

@@ -2091,35 +2091,39 @@ sb_vibra16s_onboard_relocate_base(uint16_t new_addr, void *priv)
sb_t *sb = (sb_t *) priv;
uint16_t addr = sb->dsp.sb_addr;
io_removehandler(addr, 0x0004,
sb->opl.read, NULL, NULL,
sb->opl.write, NULL, NULL,
sb->opl.priv);
io_removehandler(addr + 8, 0x0002,
sb->opl.read, NULL, NULL,
sb->opl.write, NULL, NULL,
sb->opl.priv);
io_removehandler(addr + 4, 0x0002,
sb_ct1745_mixer_read, NULL, NULL,
sb_ct1745_mixer_write, NULL, NULL,
sb);
if (addr != 0x0000) {
io_removehandler(addr, 0x0004,
sb->opl.read, NULL, NULL,
sb->opl.write, NULL, NULL,
sb->opl.priv);
io_removehandler(addr + 8, 0x0002,
sb->opl.read, NULL, NULL,
sb->opl.write, NULL, NULL,
sb->opl.priv);
io_removehandler(addr + 4, 0x0002,
sb_ct1745_mixer_read, NULL, NULL,
sb_ct1745_mixer_write, NULL, NULL,
sb);
}
sb_dsp_setaddr(&sb->dsp, 0);
addr = new_addr;
io_sethandler(addr, 0x0004,
sb->opl.read, NULL, NULL,
sb->opl.write, NULL, NULL,
sb->opl.priv);
io_sethandler(addr + 8, 0x0002,
sb->opl.read, NULL, NULL,
sb->opl.write, NULL, NULL,
sb->opl.priv);
io_sethandler(addr + 4, 0x0002,
sb_ct1745_mixer_read, NULL, NULL,
sb_ct1745_mixer_write, NULL, NULL,
sb);
if (addr != 0x0000) {
io_sethandler(addr, 0x0004,
sb->opl.read, NULL, NULL,
sb->opl.write, NULL, NULL,
sb->opl.priv);
io_sethandler(addr + 8, 0x0002,
sb->opl.read, NULL, NULL,
sb->opl.write, NULL, NULL,
sb->opl.priv);
io_sethandler(addr + 4, 0x0002,
sb_ct1745_mixer_read, NULL, NULL,
sb_ct1745_mixer_write, NULL, NULL,
sb);
}
sb_dsp_setaddr(&sb->dsp, addr);
}