1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:57:43 +00:00

Kernel: Allow to reboot in ACPI via PCI or MMIO access

Also, we determine if ACPI reboot is supported by checking the FADT
flags' field.
This commit is contained in:
Liav A 2020-03-08 16:50:46 +02:00 committed by Andreas Kling
parent 8639ee2640
commit 0f45a1b5e7
9 changed files with 183 additions and 25 deletions

View file

@ -107,11 +107,30 @@ void PCI::Access::disable_bus_mastering(Address address)
}
namespace PCI {
void enumerate_all(Function<void(Address, ID)> callback)
{
PCI::Access::the().enumerate_all(callback);
}
void raw_access(Address address, u32 field, size_t access_size, u32 value)
{
ASSERT(access_size != 0);
if (access_size == 1) {
PCI::Access::the().write8_field(address, field, value);
return;
}
if (access_size == 2) {
PCI::Access::the().write16_field(address, field, value);
return;
}
if (access_size == 4) {
PCI::Access::the().write32_field(address, field, value);
return;
}
ASSERT_NOT_REACHED();
}
ID get_id(Address address)
{
return PCI::Access::the().get_id(address);