From b77af1eb3859dabb2d620e9a79afef7a4985b01c Mon Sep 17 00:00:00 2001 From: angelosa Date: Sat, 23 Mar 2024 01:51:50 +0100 Subject: [PATCH] machine/sis950_lpc: replace PS/2 controller back to LLE - resolve hangs described in PR #11797 by using a microsoft serial mouse --- src/devices/machine/it8705f.cpp | 6 ++-- src/devices/machine/sis950_lpc.cpp | 56 ++++++++++++------------------ src/devices/machine/sis950_lpc.h | 11 +++--- src/mame/pc/sis630.cpp | 18 +++++----- 4 files changed, 40 insertions(+), 51 deletions(-) diff --git a/src/devices/machine/it8705f.cpp b/src/devices/machine/it8705f.cpp index cbfec4fc3dd..002d7eede66 100644 --- a/src/devices/machine/it8705f.cpp +++ b/src/devices/machine/it8705f.cpp @@ -442,7 +442,7 @@ template void it8705f_device::uart_address_w(offs_t offset, u8 data m_pc_com_address[N] &= 0xff << shift; m_pc_com_address[N] |= data << (shift ^ 8); m_pc_com_address[N] &= ~0xf007; - LOG("LDN%d (UART): remap %04x ([%d] %02x)\n", N, m_pc_com_address[N], offset, data); + LOG("LDN%d (COM%d): remap %04x ([%d] %02x)\n", N, N + 1, m_pc_com_address[N], offset, data); remap(AS_IO, 0, 0x400); } @@ -479,14 +479,14 @@ void it8705f_device::irq_serial1_w(int state) { if (!m_activate[1]) return; - request_irq(3, state ? ASSERT_LINE : CLEAR_LINE); + request_irq(m_pc_com_irq_line[0], state ? ASSERT_LINE : CLEAR_LINE); } void it8705f_device::irq_serial2_w(int state) { if (!m_activate[2]) return; - request_irq(4, state ? ASSERT_LINE : CLEAR_LINE); + request_irq(m_pc_com_irq_line[1], state ? ASSERT_LINE : CLEAR_LINE); } void it8705f_device::txd_serial1_w(int state) diff --git a/src/devices/machine/sis950_lpc.cpp b/src/devices/machine/sis950_lpc.cpp index 9ebd0444fa7..2cac38194fa 100644 --- a/src/devices/machine/sis950_lpc.cpp +++ b/src/devices/machine/sis950_lpc.cpp @@ -68,6 +68,8 @@ sis950_lpc_device::sis950_lpc_device(const machine_config &mconfig, const char * , m_isabus(*this, "isabus") , m_speaker(*this, "speaker") , m_rtc(*this, "rtc") + , m_ps2_con(*this, "ps2_con") + , m_aux_con(*this, "aux_con") , m_acpi(*this, "acpi") , m_smbus(*this, "smbus") , m_fast_reset_cb(*this) @@ -160,18 +162,26 @@ void sis950_lpc_device::device_add_mconfig(machine_config &config) // TODO: EISA, from virtual bridge - // TODO: selectable between PCI clock / 4 (33 MHz) or 7.159 MHz, via reg $47 bit 5 - KBDC8042(config, m_keybc); - m_keybc->set_keyboard_type(kbdc8042_device::KBDC8042_PS2); - m_keybc->set_interrupt_type(kbdc8042_device::KBDC8042_DOUBLE); - m_keybc->input_buffer_full_callback().set(m_pic_master, FUNC(pic8259_device::ir1_w)); - m_keybc->input_buffer_full_mouse_callback().set(m_pic_slave, FUNC(pic8259_device::ir4_w)); - m_keybc->system_reset_callback().set(FUNC(sis950_lpc_device::cpu_reset_w)); - m_keybc->gate_a20_callback().set(FUNC(sis950_lpc_device::cpu_a20_w)); - m_keybc->set_keyboard_tag("at_keyboard"); + // TODO: selectable between PCI clock / 4 or 7.159 MHz, via reg $47 bit 5 + PS2_KEYBOARD_CONTROLLER(config, m_keybc, DERIVED_CLOCK(1, 4)); + m_keybc->set_default_bios_tag("compaq"); + m_keybc->hot_res().set(FUNC(sis950_lpc_device::cpu_reset_w)); + m_keybc->gate_a20().set(FUNC(sis950_lpc_device::cpu_a20_w)); + m_keybc->kbd_irq().set(m_pic_master, FUNC(pic8259_device::ir1_w)); + m_keybc->kbd_clk().set(m_ps2_con, FUNC(pc_kbdc_device::clock_write_from_mb)); + m_keybc->kbd_data().set(m_ps2_con, FUNC(pc_kbdc_device::data_write_from_mb)); + m_keybc->aux_irq().set(m_pic_slave, FUNC(pic8259_device::ir4_w)); + m_keybc->aux_clk().set(m_aux_con, FUNC(pc_kbdc_device::clock_write_from_mb)); + m_keybc->aux_data().set(m_aux_con, FUNC(pc_kbdc_device::data_write_from_mb)); - at_keyboard_device &at_keyb(AT_KEYB(config, "at_keyboard", pc_keyboard_device::KEYBOARD_TYPE::AT, 1)); - at_keyb.keypress().set(m_keybc, FUNC(kbdc8042_device::keyboard_w)); + PC_KBDC(config, m_ps2_con, pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL); + m_ps2_con->out_clock_cb().set(m_keybc, FUNC(ps2_keyboard_controller_device::kbd_clk_w)); + m_ps2_con->out_data_cb().set(m_keybc, FUNC(ps2_keyboard_controller_device::kbd_data_w)); + + // TODO: doesn't work (wrong PS/2 BIOS?), worked around by disabling for now + PC_KBDC(config, m_aux_con, ps2_mice, nullptr); + m_aux_con->out_clock_cb().set(m_keybc, FUNC(ps2_keyboard_controller_device::aux_clk_w)); + m_aux_con->out_data_cb().set(m_keybc, FUNC(ps2_keyboard_controller_device::aux_data_w)); // TODO: unknown RTC type // Has external RTC bank select at $48, using this one as convenience @@ -400,26 +410,6 @@ void sis950_lpc_device::acpi_base_w(u8 data) remap_cb(); } -u8 sis950_lpc_device::at_keybc_r(offs_t offset) -{ - return m_keybc->data_r(0); -} - -void sis950_lpc_device::at_keybc_w(offs_t offset, u8 data) -{ - m_keybc->data_w(0, data); -} - -u8 sis950_lpc_device::keybc_status_r(offs_t offset) -{ - return (m_keybc->data_r(4) & 0xfb) | 0x10; // bios needs bit 2 to be 0 as powerup and bit 4 to be 1 -} - -void sis950_lpc_device::keybc_command_w(offs_t offset, u8 data) -{ - m_keybc->data_w(4, data); -} - template void sis950_lpc_device::memory_map(address_map &map) { map(0x00000000, 0x0001ffff).lrw8( @@ -437,11 +427,11 @@ void sis950_lpc_device::io_map(address_map &map) map(0x0020, 0x0021).rw(m_pic_master, FUNC(pic8259_device::read), FUNC(pic8259_device::write)); // map(0x0040, 0x0043) PIT map(0x0040, 0x0043).rw(m_pit, FUNC(pit8254_device::read), FUNC(pit8254_device::write)); - map(0x0060, 0x0060).rw(FUNC(sis950_lpc_device::at_keybc_r), FUNC(sis950_lpc_device::at_keybc_w)); + map(0x0060, 0x0060).rw(m_keybc, FUNC(ps2_keyboard_controller_device::data_r), FUNC(ps2_keyboard_controller_device::data_w)); // map(0x0061, 0x0061) NMI Status Register map(0x0061, 0x0061).rw(FUNC(sis950_lpc_device::nmi_status_r), FUNC(sis950_lpc_device::nmi_control_w)); // undocumented but read, assume LPC complaint - map(0x0064, 0x0064).rw(FUNC(sis950_lpc_device::keybc_status_r), FUNC(sis950_lpc_device::keybc_command_w)); + map(0x0064, 0x0064).rw(m_keybc, FUNC(ps2_keyboard_controller_device::status_r), FUNC(ps2_keyboard_controller_device::command_w)); // map(0x0070, 0x0070) CMOS and NMI Mask map(0x0070, 0x0070).w(FUNC(sis950_lpc_device::rtc_index_w)); map(0x0071, 0x0071).rw(FUNC(sis950_lpc_device::rtc_data_r), FUNC(sis950_lpc_device::rtc_data_w)); diff --git a/src/devices/machine/sis950_lpc.h b/src/devices/machine/sis950_lpc.h index 65d23efa02b..286241a8c25 100644 --- a/src/devices/machine/sis950_lpc.h +++ b/src/devices/machine/sis950_lpc.h @@ -15,7 +15,8 @@ #include "cpu/i386/i386.h" -#include "machine/8042kbdc.h" +#include "bus/pc_kbd/pc_kbdc.h" +#include "machine/at_keybc.h" #include "machine/am9517a.h" #include "machine/ds128x.h" #include "machine/intelfsh.h" @@ -88,10 +89,12 @@ private: required_device m_dmac_master; required_device m_dmac_slave; required_device m_pit; - required_device m_keybc; + required_device m_keybc; required_device m_isabus; required_device m_speaker; required_device m_rtc; + required_device m_ps2_con; + required_device m_aux_con; required_device m_acpi; required_device m_smbus; @@ -176,10 +179,6 @@ private: void at_page8_w(offs_t offset, uint8_t data); u8 nmi_status_r(); void nmi_control_w(uint8_t data); - u8 at_keybc_r(offs_t offset); - void at_keybc_w(offs_t offset, u8 data); - u8 keybc_status_r(offs_t offset); - void keybc_command_w(offs_t offset, u8 data); void at_speaker_set_spkrdata(uint8_t data); void iochck_w(int state); }; diff --git a/src/mame/pc/sis630.cpp b/src/mame/pc/sis630.cpp index 3bc3e8e1434..75d2b518368 100644 --- a/src/mame/pc/sis630.cpp +++ b/src/mame/pc/sis630.cpp @@ -6,18 +6,15 @@ SiS 630 chipset based PC TODO (main): - - PS/2 loses IRQs, mouse is unusable, "ibm" BIOS doesn't work at all; - - Super I/O handling of ITE 8705F (I/O $2e / $2f) - \- We currently (wrongly) handle most stuff in PCI LPC instead; - \- Another Super I/O is the HW motherboard monitor, - cfr. I/O $294 reads in shutms11 BIOS fan tests; - - '900 Ethernet (missing ROM dump); + - Finalize Super I/O handling of ITE 8705F (I/O $2e / $2f) + \- fan monitor, cfr. I/O $294 reads in shutms11 BIOS fan tests; + \- FDC doesn't work, moans on first boot; + - '900 Ethernet PXE (missing ROM dump); - USB controllers (OpenHCI complaint); - - Floppy drive, unsupported SMC37C673 default; - ACPI is not fully lpc-acpi complaint; - EISA slots; - - PnP from LPC; - SMBus; + - PS/2 mouse is unstable, worked around by disabling and using a serial mouse instead. TODO (usability, to be moved in a SW list): - windows xp sp3: tests HW then does an ACPI devtrap write ($48), will eventually BSoD with @@ -55,6 +52,9 @@ - Red Hat 6.2: Triple Faults on x87 exception check \- prints the type of mounted floating point exception if bypassed. + NOTES: + - BeOS 5 hardwires serial mouse checks at $2e8, ignoring BIOS PnP. + =================================================================================================== Cristaltec "Game Cristal" (MAME bootleg) @@ -299,7 +299,7 @@ void sis630_state::sis630(machine_config &config) // (some unsupported variants uses W83697HF, namely Gigabyte GA-6SMZ7) ISA16_SLOT(config, "superio", 0, "pci:01.0:isabus", isa_internal_devices, "it8705f", true).set_option_machine_config("it8705f", ite_superio_config); - rs232_port_device& serport0(RS232_PORT(config, "serport0", isa_com, nullptr)); + rs232_port_device& serport0(RS232_PORT(config, "serport0", isa_com, "microsoft_mouse")); serport0.rxd_handler().set("superio:it8705f", FUNC(it8705f_device::rxd1_w)); serport0.dcd_handler().set("superio:it8705f", FUNC(it8705f_device::ndcd1_w)); serport0.dsr_handler().set("superio:it8705f", FUNC(it8705f_device::ndsr1_w));