mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
Kernel: Move FADT finding code to Parser
There's no reason to find the table ahead of time now that we don't need the interrupt line immedietely. It was also one of the only users of the StaticParsing find_table code.
This commit is contained in:
1 parent
3a825ccec0
commit
8207cfb956
3 files changed
+13
-12
No files matched your search
@@ -24,11 +24,7 @@ UNMAP_AFTER_INIT ErrorOr<void> initialize()
|
||||
if (!rsdp.has_value())
|
||||
return ENOENT;
|
||||
|
||||
auto facp = TRY(StaticParsing::find_table(rsdp.value(), "FACP"sv));
|
||||
if (!facp.has_value())
|
||||
return ENOENT;
|
||||
|
||||
TRY(Parser::initialize(rsdp.value(), facp.value()));
|
||||
TRY(Parser::initialize(rsdp.value()));
|
||||
|
||||
if (kernel_command_line().acpi_feature_level() == AcpiFeatureLevel::Enabled)
|
||||
Parser::the()->enable_aml_parsing();
|
||||
|
||||
@@ -34,7 +34,7 @@ Parser* Parser::the()
|
||||
return s_acpi_parser;
|
||||
}
|
||||
|
||||
ErrorOr<void> Parser::initialize(PhysicalAddress rsdp, PhysicalAddress fadt)
|
||||
ErrorOr<void> Parser::initialize(PhysicalAddress rsdp)
|
||||
{
|
||||
VERIFY(!s_acpi_parser);
|
||||
|
||||
@@ -44,7 +44,7 @@ ErrorOr<void> Parser::initialize(PhysicalAddress rsdp, PhysicalAddress fadt)
|
||||
s_acpi_parser = nullptr;
|
||||
};
|
||||
|
||||
s_acpi_parser = new (nothrow) Parser(rsdp, fadt);
|
||||
s_acpi_parser = new (nothrow) Parser(rsdp);
|
||||
if (!s_acpi_parser)
|
||||
return ENOMEM;
|
||||
|
||||
@@ -179,7 +179,13 @@ UNMAP_AFTER_INIT ErrorOr<void> Parser::process_fadt_data()
|
||||
{
|
||||
dmesgln("ACPI: Initializing Fixed ACPI data");
|
||||
|
||||
VERIFY(!m_fadt.is_null());
|
||||
auto maybe_fadt = find_table("FACP"sv);
|
||||
if (!maybe_fadt.has_value() || maybe_fadt->is_null()) {
|
||||
dbgln("ACPI: Failed to find the FADT table");
|
||||
return ENOENT;
|
||||
}
|
||||
m_fadt = maybe_fadt.release_value();
|
||||
|
||||
dbgln_if(ACPI_DEBUG, "ACPI: FADT @ {}", m_fadt);
|
||||
|
||||
auto sdt = TRY(Memory::map_typed<::ACPI::Structures::FADT>(m_fadt));
|
||||
@@ -423,9 +429,8 @@ UNMAP_AFTER_INIT ErrorOr<void> Parser::locate_main_system_description_table()
|
||||
return {};
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT Parser::Parser(PhysicalAddress rsdp, PhysicalAddress fadt)
|
||||
UNMAP_AFTER_INIT Parser::Parser(PhysicalAddress rsdp)
|
||||
: m_rsdp(rsdp)
|
||||
, m_fadt(fadt)
|
||||
{
|
||||
dmesgln("ACPI: Using RSDP @ {}", rsdp);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class Parser final {
|
||||
public:
|
||||
static Parser* the();
|
||||
|
||||
static ErrorOr<void> initialize(PhysicalAddress rsdp, PhysicalAddress fadt);
|
||||
static ErrorOr<void> initialize(PhysicalAddress rsdp);
|
||||
|
||||
Optional<PhysicalAddress> find_table(StringView signature);
|
||||
|
||||
@@ -105,7 +105,7 @@ private:
|
||||
Parser& m_parser;
|
||||
};
|
||||
|
||||
Parser(PhysicalAddress rsdp, PhysicalAddress fadt);
|
||||
Parser(PhysicalAddress rsdp);
|
||||
|
||||
bool handle_interrupt();
|
||||
|
||||
|
||||
Reference in new issue
Block a user