From 5a146187cf51f03eae6f5556d4ec5fe5a59e1341 Mon Sep 17 00:00:00 2001 From: Liav A Date: Thu, 17 Dec 2020 21:37:37 +0200 Subject: [PATCH] Kernel: Workaround QEMU bug and initialize i8042 controller ACPI 2 declared the third revision of FADT, that should have IAPC_BOOT_ARCH flags in it, also to indicate if i8042 is present. Q35 machine reports that it has FADT with revision 3, but the code in QEMU simply ignores these flags and put zero on them no matter the revision of FADT. --- Kernel/ACPI/Parser.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Kernel/ACPI/Parser.cpp b/Kernel/ACPI/Parser.cpp index d4fee6a896..18d4e52266 100644 --- a/Kernel/ACPI/Parser.cpp +++ b/Kernel/ACPI/Parser.cpp @@ -104,7 +104,11 @@ void Parser::init_fadt() klog() << "ACPI: Fixed ACPI data, Revision " << sdt->h.revision << ", Length " << sdt->h.length << " bytes"; klog() << "ACPI: DSDT " << PhysicalAddress(sdt->dsdt_ptr); m_x86_specific_flags.cmos_rtc_not_present = (sdt->ia_pc_boot_arch_flags & (u8)FADTFlags::IA_PC_Flags::CMOS_RTC_Not_Present); - m_x86_specific_flags.keyboard_8042 = (sdt->h.revision <= 1) || (sdt->ia_pc_boot_arch_flags & (u8)FADTFlags::IA_PC_Flags::PS2_8042); + + // FIXME: QEMU doesn't report that we have an i8042 controller in these flags, even if it should (when FADT revision is 3), + // Later on, we need to make sure that we enumerate the ACPI namespace (AML encoded), instead of just using this value. + m_x86_specific_flags.keyboard_8042 = (sdt->h.revision <= 3) || (sdt->ia_pc_boot_arch_flags & (u8)FADTFlags::IA_PC_Flags::PS2_8042); + m_x86_specific_flags.legacy_devices = (sdt->ia_pc_boot_arch_flags & (u8)FADTFlags::IA_PC_Flags::Legacy_Devices); m_x86_specific_flags.msi_not_supported = (sdt->ia_pc_boot_arch_flags & (u8)FADTFlags::IA_PC_Flags::MSI_Not_Supported); m_x86_specific_flags.vga_not_present = (sdt->ia_pc_boot_arch_flags & (u8)FADTFlags::IA_PC_Flags::VGA_Not_Present);