Kernel: Fix entering ACPI mode

My condition to check wheter to enter ACPI mode was incorrect.
I only entered ACPI mode if I already was in ACPI mode :DD
This commit is contained in:
Bananymous 2024-04-15 15:05:48 +03:00
parent 5affc73ee6
commit 9fac5f94ba
2 changed files with 6 additions and 1 deletions

View File

@ -17,6 +17,8 @@ namespace Kernel::ACPI
static void acquire_global_lock(); static void acquire_global_lock();
static void release_global_lock(); static void release_global_lock();
bool hardware_reduced() const { return m_hardware_reduced; }
const SDTHeader* get_header(BAN::StringView signature, uint32_t index); const SDTHeader* get_header(BAN::StringView signature, uint32_t index);
// mode // mode
@ -47,6 +49,7 @@ namespace Kernel::ACPI
}; };
BAN::Vector<MappedPage> m_mapped_headers; BAN::Vector<MappedPage> m_mapped_headers;
bool m_hardware_reduced { false };
BAN::RefPtr<AML::Namespace> m_namespace; BAN::RefPtr<AML::Namespace> m_namespace;
}; };

View File

@ -314,6 +314,8 @@ acpi_release_global_lock:
.paddr = dsdt_paddr, .paddr = dsdt_paddr,
.vaddr = dsdt_vaddr .vaddr = dsdt_vaddr
})); }));
m_hardware_reduced = fadt->flags & (1 << 20);
} }
} }
@ -431,7 +433,7 @@ acpi_release_global_lock:
auto* fadt = static_cast<const FADT*>(get_header("FACP", 0)); auto* fadt = static_cast<const FADT*>(get_header("FACP", 0));
// If not hardware-reduced ACPI and SCI_EN is not set // If not hardware-reduced ACPI and SCI_EN is not set
if (!(fadt->flags & (1 << 20)) && IO::inw(fadt->pm1a_cnt_blk) & PM1_CNT_SCI_EN) if (!hardware_reduced() && !(IO::inw(fadt->pm1a_cnt_blk) & PM1_CNT_SCI_EN))
{ {
// https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/04_ACPI_Hardware_Specification/ACPI_Hardware_Specification.html#legacy-acpi-select-and-the-sci-interrupt // https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/04_ACPI_Hardware_Specification/ACPI_Hardware_Specification.html#legacy-acpi-select-and-the-sci-interrupt
IO::outb(fadt->smi_cmd, fadt->acpi_enable); IO::outb(fadt->smi_cmd, fadt->acpi_enable);