
ACPI subsystem includes 3 types of parsers that are created during runtime, each one capable of parsing ACPI tables at different level. ACPIParser is the most basic parser which is essentialy a parser that can't parse anything useful, due to a user request to disable ACPI support in a kernel boot parameter. ACPIStaticParser is a derived class from ACPIParser, which is able to parse only static data (e.g. FADT, HPET, MCFG and other tables), thus making it not able to parse AML (ACPI Machine Language) nor to support handling of hardware events and power management. This type of parser can be created with a kernel boot parameter. ACPIDynamicParser is a derived class from ACPIStaticParser, which includes all the capabilities of the latter, but *should* implement an AML interpretation, (by building the ACPI AML namespace) and handling power & hardware events. Currently the methods to support AML interpretation are not implemented. This type of parser is created automatically during runtime if the user didn't specify a boot parameter related to ACPI initialization. Also, adding strncmp function definition in StdLib.h, to be able to use it in ACPIStaticParser class.
84 lines
No EOL
1.7 KiB
C++
84 lines
No EOL
1.7 KiB
C++
#include <Kernel/ACPI/ACPIParser.h>
|
|
|
|
static ACPIParser* s_acpi_parser;
|
|
|
|
ACPIParser& ACPIParser::the()
|
|
{
|
|
ASSERT(s_acpi_parser != nullptr);
|
|
return *s_acpi_parser;
|
|
}
|
|
|
|
void ACPIParser::initialize_limited()
|
|
{
|
|
if (!ACPIParser::is_initialized()) {
|
|
s_acpi_parser = new ACPIParser(false);
|
|
}
|
|
}
|
|
|
|
bool ACPIParser::is_initialized()
|
|
{
|
|
return (s_acpi_parser != nullptr);
|
|
}
|
|
|
|
ACPIParser::ACPIParser(bool usable)
|
|
{
|
|
if (usable) {
|
|
kprintf("ACPI: Setting up a functional parser\n");
|
|
} else {
|
|
kprintf("ACPI: Limited Initialization. Vital functions are disabled by a request\n");
|
|
}
|
|
s_acpi_parser = this;
|
|
}
|
|
|
|
ACPI_RAW::SDTHeader* ACPIParser::find_table(const char*)
|
|
{
|
|
kprintf("ACPI: Requested to search for a table, Abort!\n");
|
|
return nullptr;
|
|
}
|
|
|
|
void ACPIParser::mmap(VirtualAddress, PhysicalAddress, u32)
|
|
{
|
|
ASSERT_NOT_REACHED();
|
|
}
|
|
|
|
void ACPIParser::mmap_region(Region&, PhysicalAddress)
|
|
{
|
|
ASSERT_NOT_REACHED();
|
|
}
|
|
|
|
void ACPIParser::do_acpi_reboot()
|
|
{
|
|
kprintf("ACPI: Cannot invoke reboot!\n");
|
|
ASSERT_NOT_REACHED();
|
|
}
|
|
|
|
void ACPIParser::do_acpi_shutdown()
|
|
{
|
|
kprintf("ACPI: Cannot invoke shutdown!\n");
|
|
ASSERT_NOT_REACHED();
|
|
}
|
|
|
|
void ACPIParser::enable_aml_interpretation()
|
|
{
|
|
kprintf("ACPI: No AML Interpretation Allowed\n");
|
|
ASSERT_NOT_REACHED();
|
|
}
|
|
void ACPIParser::enable_aml_interpretation(File&)
|
|
{
|
|
kprintf("ACPI: No AML Interpretation Allowed\n");
|
|
ASSERT_NOT_REACHED();
|
|
}
|
|
void ACPIParser::enable_aml_interpretation(u8*, u32)
|
|
{
|
|
kprintf("ACPI: No AML Interpretation Allowed\n");
|
|
ASSERT_NOT_REACHED();
|
|
}
|
|
void ACPIParser::disable_aml_interpretation()
|
|
{
|
|
kprintf("ACPI Limited: No AML Interpretation Allowed\n");
|
|
ASSERT_NOT_REACHED();
|
|
}
|
|
bool ACPIParser::is_operable()
|
|
{
|
|
return false;
|
|
} |