mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
Kernel: Only do i8042 existence check via probing as a fallback
This caused an initialization failure of the i8042 when I tested on bare metal. We cannot entirely get rid of this method as QEMU for example doesn't indicate the existence of an i8042 via ACPI, but we can get away with only doing the manual probing if ACPI is disabled or we didn't get a 'yes' from it. Increasing the number of maximum loops did eventually lead to a successful return from the function, but would later fail the actual self test.
This commit is contained in:
parent
ee9125fa9a
commit
37a04b739a
Notes:
sideshowbarker
2024-07-17 18:32:30 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/37a04b739a Pull-request: https://github.com/SerenityOS/serenity/pull/12641 Reviewed-by: https://github.com/IdanHo ✅ Reviewed-by: https://github.com/supercomputer7
3 changed files with 13 additions and 5 deletions
|
@ -107,12 +107,20 @@ UNMAP_AFTER_INIT ErrorOr<void> HIDManagement::enumerate()
|
|||
// set to emulate PS/2, we should not initialize the PS/2 controller.
|
||||
if (kernel_command_line().disable_ps2_controller())
|
||||
return {};
|
||||
if (ACPI::Parser::the() && !ACPI::Parser::the()->have_8042())
|
||||
return {};
|
||||
m_i8042_controller = I8042Controller::initialize();
|
||||
|
||||
// Note: If ACPI is disabled or doesn't indicate that we have an i8042, we
|
||||
// still perform a manual existence check via probing, which is relevant on
|
||||
// QEMU, for example. This probing check is known to not work on bare metal
|
||||
// in all cases, so if we can get a 'yes' from ACPI, we skip it.
|
||||
auto has_i8042_controller = false;
|
||||
if (ACPI::Parser::the() && ACPI::Parser::the()->have_8042())
|
||||
has_i8042_controller = true;
|
||||
else if (m_i8042_controller->check_existence_via_probing({}))
|
||||
has_i8042_controller = true;
|
||||
|
||||
// Note: If we happen to not have i8042 just return "gracefully" for now.
|
||||
if (!m_i8042_controller->check_existence({}))
|
||||
if (!has_i8042_controller)
|
||||
return {};
|
||||
TRY(m_i8042_controller->detect_devices());
|
||||
if (m_i8042_controller->mouse())
|
||||
|
|
|
@ -31,7 +31,7 @@ UNMAP_AFTER_INIT I8042Controller::I8042Controller()
|
|||
{
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT bool I8042Controller::check_existence(Badge<HIDManagement>)
|
||||
UNMAP_AFTER_INIT bool I8042Controller::check_existence_via_probing(Badge<HIDManagement>)
|
||||
{
|
||||
{
|
||||
SpinlockLocker lock(m_lock);
|
||||
|
|
|
@ -143,7 +143,7 @@ public:
|
|||
RefPtr<KeyboardDevice> keyboard() const;
|
||||
|
||||
// Note: This function exists only for the initialization process of the controller
|
||||
bool check_existence(Badge<HIDManagement>);
|
||||
bool check_existence_via_probing(Badge<HIDManagement>);
|
||||
|
||||
private:
|
||||
I8042Controller();
|
||||
|
|
Loading…
Reference in a new issue