From d5a63540067b599350e90669b871b7c75ecd4dea Mon Sep 17 00:00:00 2001 From: rushieda <185547947+rushieda@users.noreply.github.com> Date: Mon, 19 May 2025 15:53:39 +0300 Subject: [PATCH 1/4] Add the Dell OptiPlex GXL/GXM --- src/include/86box/machine.h | 1 + src/machine/m_at_socket5.c | 32 +++++++++++++++++++++++++++++ src/machine/machine_table.c | 40 +++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index c76761b3c..e9dc5bda9 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -672,6 +672,7 @@ extern int machine_at_tek932_init(const machine_t *); extern int machine_at_acerv30_init(const machine_t *); extern int machine_at_apollo_init(const machine_t *); +extern int machine_at_optiplex_gxl_init(const machine_t *); extern int machine_at_zappa_init(const machine_t *); extern int machine_at_powermatev_init(const machine_t *); extern int machine_at_hawk_init(const machine_t *); diff --git a/src/machine/m_at_socket5.c b/src/machine/m_at_socket5.c index 4b3bbd49c..9981f8e85 100644 --- a/src/machine/m_at_socket5.c +++ b/src/machine/m_at_socket5.c @@ -236,6 +236,38 @@ machine_at_apollo_init(const machine_t *model) return ret; } +int +machine_at_optiplex_gxl_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear("roms/machines/optiplex_gxl/DELL.ROM", + 0x000e0000, 131072, 0); + + if (bios_only || !ret) + return ret; + + machine_at_common_init(model); + + pci_init(PCI_CONFIG_TYPE_1); + pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 1, 2, 3, 4); + pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); + pci_register_slot(0x0D, PCI_CARD_NORMAL, 3, 4, 2, 1); + pci_register_slot(0x10, PCI_CARD_VIDEO, 0, 0, 0, 0); + pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); + + if (gfxcard[0] == VID_INTERNAL) + device_add(machine_get_vid_device(machine)); + + device_add(&keyboard_ps2_ami_pci_device); + device_add(&i430fx_device); + device_add(&piix_device); + device_add(&pc87332_device); + device_add(&intel_flash_bxt_device); + + return ret; +} + static void machine_at_zappa_gpio_init(void) { diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 45986a50a..d9e6f2940 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -10553,6 +10553,46 @@ const machine_t machines[] = { .snd_device = NULL, .net_device = NULL }, + /* Has a National Semiconductor PC87332VLJ Super I/O with AMIKey 'F' KBC firmware. */ + { + .name = "[i430FX] Dell OptiPlex GXL/GXM", + .internal_name = "optiplex_gxl", + .type = MACHINE_TYPE_SOCKET5, + .chipset = MACHINE_CHIPSET_INTEL_430FX, + .init = machine_at_optiplex_gxl_init, + .p1_handler = NULL, + .gpio_handler = NULL, + .available_flag = MACHINE_AVAILABLE, + .gpio_acpi_handler = NULL, + .cpu = { + .package = CPU_PKG_SOCKET5_7, + .block = CPU_BLOCK_NONE, + .min_bus = 60000000, + .max_bus = 66666667, + .min_voltage = 3380, + .max_voltage = 3520, + .min_multi = 1.5, + .max_multi = 3.0 + }, + .bus_flags = MACHINE_PS2_PCI, + .flags = MACHINE_IDE_DUAL | MACHINE_VIDEO | MACHINE_APM, /* Video: S3 Trio64V+ (86C765), Network: 3Com ETHERLINK III (3C509B) */ + .ram = { + .min = 8192, + .max = 131072, + .step = 8192 + }, + .nvrmask = 127, + .kbc_device = NULL, + .kbc_p1 = 0xff, + .gpio = 0xffffffff, + .gpio_acpi = 0xffffffff, + .device = NULL, + .fdc_device = NULL, + .sio_device = NULL, + .vid_device = &s3_phoenix_trio64vplus_onboard_pci_device, + .snd_device = NULL, + .net_device = NULL /* not yet emulated */ + }, /* According to tests from real hardware: This has AMI MegaKey KBC firmware on the PC87306 Super I/O chip, command 0xA1 returns '5'. Command 0xA0 copyright string: (C)1994 AMI . */ From ec613f16085fe70ce6fe02518f0e716cc2117a58 Mon Sep 17 00:00:00 2001 From: rushieda <185547947+rushieda@users.noreply.github.com> Date: Mon, 19 May 2025 16:18:32 +0300 Subject: [PATCH 2/4] Add the onboard sound for the OptiPlex GXL/GXM --- src/machine/m_at_socket5.c | 4 ++++ src/machine/machine_table.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/machine/m_at_socket5.c b/src/machine/m_at_socket5.c index 9981f8e85..7c5ab697a 100644 --- a/src/machine/m_at_socket5.c +++ b/src/machine/m_at_socket5.c @@ -40,6 +40,7 @@ #include <86box/sio.h> #include <86box/video.h> #include <86box/machine.h> +#include <86box/sound.h> int machine_at_plato_init(const machine_t *model) @@ -259,6 +260,9 @@ machine_at_optiplex_gxl_init(const machine_t *model) if (gfxcard[0] == VID_INTERNAL) device_add(machine_get_vid_device(machine)); + if (sound_card_current[0] == SOUND_INTERNAL) + machine_snd = device_add(machine_get_snd_device(machine)); + device_add(&keyboard_ps2_ami_pci_device); device_add(&i430fx_device); device_add(&piix_device); diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index d9e6f2940..3e50442c1 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -10575,7 +10575,7 @@ const machine_t machines[] = { .max_multi = 3.0 }, .bus_flags = MACHINE_PS2_PCI, - .flags = MACHINE_IDE_DUAL | MACHINE_VIDEO | MACHINE_APM, /* Video: S3 Trio64V+ (86C765), Network: 3Com ETHERLINK III (3C509B) */ + .flags = MACHINE_IDE_DUAL | MACHINE_VIDEO | MACHINE_SOUND | MACHINE_APM, /* Video: S3 Trio64V+ (86C765), Sound: Creative ViBRA 16S (CT2504), Network: 3Com ETHERLINK III (3C509B) */ .ram = { .min = 8192, .max = 131072, @@ -10590,7 +10590,7 @@ const machine_t machines[] = { .fdc_device = NULL, .sio_device = NULL, .vid_device = &s3_phoenix_trio64vplus_onboard_pci_device, - .snd_device = NULL, + .snd_device = &sb_vibra16s_onboard_device, .net_device = NULL /* not yet emulated */ }, /* According to tests from real hardware: This has AMI MegaKey KBC firmware on the From d7282ddc46d2059cf1973d0b07d8dacfd5592850 Mon Sep 17 00:00:00 2001 From: rushieda <185547947+rushieda@users.noreply.github.com> Date: Mon, 19 May 2025 16:28:01 +0300 Subject: [PATCH 3/4] Block the Cyrix Cx6x86 from the Dell OptiPlex GXL/GXM as it cannot POST with it --- src/machine/machine_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 3e50442c1..f4031c0b7 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -10566,7 +10566,7 @@ const machine_t machines[] = { .gpio_acpi_handler = NULL, .cpu = { .package = CPU_PKG_SOCKET5_7, - .block = CPU_BLOCK_NONE, + .block = CPU_BLOCK(CPU_Cx6x86), .min_bus = 60000000, .max_bus = 66666667, .min_voltage = 3380, From 9f46d0b9d8c700e5c04d89e4229958a75906e310 Mon Sep 17 00:00:00 2001 From: rushieda <185547947+rushieda@users.noreply.github.com> Date: Mon, 19 May 2025 20:59:08 +0300 Subject: [PATCH 4/4] Fix the initialization and general purpose I/O (GPIO) pins for the OptiPlex GXL/GXM --- src/device/kbc_at.c | 11 ++++++++++- src/machine/m_at_socket5.c | 5 +++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/device/kbc_at.c b/src/device/kbc_at.c index 58aab476c..7413b45cf 100644 --- a/src/device/kbc_at.c +++ b/src/device/kbc_at.c @@ -1096,7 +1096,16 @@ write64_generic(void *priv, uint8_t val) - Bit 5: Manufacturing jumper (must be set); */ uint8_t p1 = 0x24; - kbc_delay_to_ob(dev, p1, 0, 0x01); + kbc_delay_to_ob(dev, p1, 0, 0x00); + } else if (!strcmp(machine_get_internal_name(), "optiplex_gxl")) { + /* + Dell OptiPlex GXL/GXM: + - Bit 3: Password disable jumper (must be clear); + - Bit 4: Keyboard fuse (must be set); + - Bit 5: Manufacturing jumper (must be set); + */ + uint8_t p1 = 0x30; + kbc_delay_to_ob(dev, p1, 0, 0x00); } else { /* (B0 or F0) | (0x08 or 0x0c) */ uint8_t p1_out = ((dev->p1 | fixed_bits) & 0xf0) | diff --git a/src/machine/m_at_socket5.c b/src/machine/m_at_socket5.c index 7c5ab697a..5572d0484 100644 --- a/src/machine/m_at_socket5.c +++ b/src/machine/m_at_socket5.c @@ -248,7 +248,8 @@ machine_at_optiplex_gxl_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); pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 1, 2, 3, 4); @@ -263,7 +264,7 @@ machine_at_optiplex_gxl_init(const machine_t *model) if (sound_card_current[0] == SOUND_INTERNAL) machine_snd = device_add(machine_get_snd_device(machine)); - device_add(&keyboard_ps2_ami_pci_device); + device_add(&keyboard_ps2_phoenix_pci_device); device_add(&i430fx_device); device_add(&piix_device); device_add(&pc87332_device);