diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp b/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp index 442561a34e..27c837d8d1 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp @@ -125,7 +125,7 @@ ps2_selftest() static status_t -ps2_setup_command_byte() +ps2_setup_command_byte(bool interruptsEnabled) { status_t res; uint8 cmdbyte; @@ -135,10 +135,14 @@ ps2_setup_command_byte() if (res != B_OK) cmdbyte = 0x47; - cmdbyte |= PS2_BITS_TRANSLATE_SCANCODES | PS2_BITS_KEYBOARD_INTERRUPT - | PS2_BITS_AUX_INTERRUPT; + cmdbyte |= PS2_BITS_TRANSLATE_SCANCODES; cmdbyte &= ~(PS2_BITS_KEYBOARD_DISABLED | PS2_BITS_MOUSE_DISABLED); + if (interruptsEnabled) + cmdbyte |= PS2_BITS_KEYBOARD_INTERRUPT | PS2_BITS_AUX_INTERRUPT; + else + cmdbyte &= ~(PS2_BITS_KEYBOARD_INTERRUPT | PS2_BITS_AUX_INTERRUPT); + res = ps2_command(PS2_CTRL_WRITE_CMD, &cmdbyte, 1, NULL, 0); TRACE("ps2: set command byte: res 0x%08lx, cmdbyte 0x%02x\n", res, cmdbyte); @@ -357,9 +361,12 @@ ps2_init(void) // after that //ps2_selftest(); - status = ps2_setup_command_byte(); + // Setup the command byte with disabled keyboard and AUX interrupts + // to prevent interrupts storm on some KBCs during active multiplexing + // activation procedure. Fixes #7635. + status = ps2_setup_command_byte(false); if (status) { - INFO("ps2: setting up command byte failed\n"); + INFO("ps2: initial setup of command byte failed\n"); goto err5; } @@ -370,6 +377,12 @@ ps2_init(void) goto err5; } + status = ps2_setup_command_byte(true); + if (status) { + INFO("ps2: setting up command byte with enabled interrupts failed\n"); + goto err5; + } + if (gActiveMultiplexingEnabled) { if (ps2_dev_command_timeout(&ps2_device[PS2_DEVICE_MOUSE], 0xe6, NULL, 0, NULL, 0, 100000) == B_TIMED_OUT) {