mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
Kernel: Add make_generic_address_from_io_port
This will be needed to deduplicate ACPI shutdown code for accessing both the new generic address field and the legacy x86 port field.
This commit is contained in:
1 parent
f85dbe582f
commit
53b4ea3d31
2 files changed
+13
No files matched your search
@@ -14,6 +14,17 @@
|
||||
|
||||
namespace Kernel::ACPI {
|
||||
|
||||
::ACPI::Structures::GenericAddressStructure make_generic_address_from_io_port(u32 io_port)
|
||||
{
|
||||
return ::ACPI::Structures::GenericAddressStructure {
|
||||
.address_space = ::ACPI::GenericAddressStructure::AddressSpace::SystemIO,
|
||||
.bit_width = ::ACPI::GenericAddressStructure::BitWidth::Word,
|
||||
.bit_offset = 0,
|
||||
.access_size = ::ACPI::GenericAddressStructure::AccessSize::Word,
|
||||
.address = io_port,
|
||||
};
|
||||
}
|
||||
|
||||
static ErrorOr<u8> get_bit_width(::ACPI::Structures::GenericAddressStructure const& structure)
|
||||
{
|
||||
// NOTE: We need to do a more complicated algorithm because for legacy reasons there are,
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
namespace Kernel::ACPI {
|
||||
|
||||
::ACPI::Structures::GenericAddressStructure make_generic_address_from_io_port(u32 io_port);
|
||||
|
||||
ErrorOr<u64> read_generic_address(::ACPI::Structures::GenericAddressStructure const& structure);
|
||||
ErrorOr<void> write_generic_address(::ACPI::Structures::GenericAddressStructure const& structure, u64 value);
|
||||
|
||||
|
||||
Reference in new issue
Block a user