diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/acpi/acpi/acpi.hpp | 1 | ||||
| -rw-r--r-- | libs/acpi/acpi/common/basic_table.hpp | 25 | ||||
| -rw-r--r-- | libs/acpi/acpi/common/vla_table.hpp | 4 | ||||
| -rw-r--r-- | libs/acpi/acpi/data/madt.test.cpp | 2 | ||||
| -rw-r--r-- | libs/acpi/acpi/data/rsdt.cpp | 1 | ||||
| -rw-r--r-- | libs/acpi/acpi/data/rsdt.hpp | 1 | ||||
| -rw-r--r-- | libs/acpi/acpi/data/rsdt.test.cpp | 2 |
7 files changed, 9 insertions, 27 deletions
diff --git a/libs/acpi/acpi/acpi.hpp b/libs/acpi/acpi/acpi.hpp index 4cfcede..385ddc9 100644 --- a/libs/acpi/acpi/acpi.hpp +++ b/libs/acpi/acpi/acpi.hpp @@ -5,6 +5,7 @@ #include <acpi/common/table_signature.hpp> // IWYU pragma: export #include <acpi/common/table_type.hpp> // IWYU pragma: export #include <acpi/data/madt.hpp> // IWYU pragma: export +#include <acpi/data/rsdt.hpp> // IWYU pragma: export #include <acpi/pointers.hpp> // IWYU pragma: export #endif diff --git a/libs/acpi/acpi/common/basic_table.hpp b/libs/acpi/acpi/common/basic_table.hpp index b0ead96..33f23d5 100644 --- a/libs/acpi/acpi/common/basic_table.hpp +++ b/libs/acpi/acpi/common/basic_table.hpp @@ -7,46 +7,27 @@ #include <cstddef> #include <span> -#include <string_view> namespace acpi { template<typename TableType> - struct basic_table + struct basic_table : table_header { [[nodiscard]] auto validate_checksum() const noexcept -> bool { - return acpi::validate_checksum({reinterpret_cast<std::byte const *>(this), m_header.length().value}); + return acpi::validate_checksum(as_span()); } [[nodiscard]] auto as_span() const noexcept -> std::span<std::byte const> { - return {reinterpret_cast<std::byte const *>(this), m_header.length().value}; - } - - [[nodiscard]] auto header() const noexcept -> table_header const & - { - return m_header; - } - - [[nodiscard]] auto length() const noexcept -> std::size_t - { - return m_header.length().value; - } - - [[nodiscard]] auto signature() const noexcept -> std::string_view - { - return m_header.signature(); + return {reinterpret_cast<std::byte const *>(this), length().value}; } [[nodiscard]] auto validate() const noexcept -> bool { return signature() == table_signature_v<TableType> && validate_checksum(); } - - private: - table_header m_header; }; } // namespace acpi diff --git a/libs/acpi/acpi/common/vla_table.hpp b/libs/acpi/acpi/common/vla_table.hpp index 450209c..a65a28e 100644 --- a/libs/acpi/acpi/common/vla_table.hpp +++ b/libs/acpi/acpi/common/vla_table.hpp @@ -77,7 +77,7 @@ namespace acpi auto base = std::bit_cast<std::byte *>(this); base += sizeof(TableType); auto limit = std::bit_cast<std::byte *>(this); - limit += this->length(); + limit += this->length().value; return iterator{std::bit_cast<entry_type *>(base), std::bit_cast<entry_type *>(limit)}; } @@ -91,7 +91,7 @@ namespace acpi auto base = std::bit_cast<std::byte *>(this); base += sizeof(TableType); auto limit = std::bit_cast<std::byte *>(this); - limit += this->length(); + limit += this->length().value; return const_iterator{std::bit_cast<entry_type const *>(base), std::bit_cast<entry_type const *>(limit)}; } diff --git a/libs/acpi/acpi/data/madt.test.cpp b/libs/acpi/acpi/data/madt.test.cpp index 2b74d4c..6795499 100644 --- a/libs/acpi/acpi/data/madt.test.cpp +++ b/libs/acpi/acpi/data/madt.test.cpp @@ -38,7 +38,7 @@ SCENARIO("MADT parsing", "[madt]") THEN("the length is sizeof(madt) + sizeof(processor_local_apic)") { - REQUIRE(madt->length() == sizeof(acpi::madt) + sizeof(acpi::processor_local_apic_entry)); + REQUIRE(madt->length().value == sizeof(acpi::madt) + sizeof(acpi::processor_local_apic_entry)); } THEN("the first entry has type processor_local_apic") diff --git a/libs/acpi/acpi/data/rsdt.cpp b/libs/acpi/acpi/data/rsdt.cpp index 8e20b6c..fe108c7 100644 --- a/libs/acpi/acpi/data/rsdt.cpp +++ b/libs/acpi/acpi/data/rsdt.cpp @@ -5,6 +5,7 @@ #include <cstddef> #include <cstdint> +#include <span> namespace acpi { diff --git a/libs/acpi/acpi/data/rsdt.hpp b/libs/acpi/acpi/data/rsdt.hpp index b43f066..88c5fd1 100644 --- a/libs/acpi/acpi/data/rsdt.hpp +++ b/libs/acpi/acpi/data/rsdt.hpp @@ -1,7 +1,6 @@ #ifndef ACPI_DATA_RSDT_HPP #define ACPI_DATA_RSDT_HPP -#include <acpi/acpi.hpp> #include <acpi/common/table_signature.hpp> #include <acpi/common/table_type.hpp> #include <acpi/common/vla_table.hpp> diff --git a/libs/acpi/acpi/data/rsdt.test.cpp b/libs/acpi/acpi/data/rsdt.test.cpp index e1bd1df..937dce0 100644 --- a/libs/acpi/acpi/data/rsdt.test.cpp +++ b/libs/acpi/acpi/data/rsdt.test.cpp @@ -39,7 +39,7 @@ SCENARIO("RSDT parsing", "[rsdt]") THEN("the length is sizeof(rsdt) + 8 * sizeof(rsdt_entry)") { - REQUIRE(rsdt->length() == sizeof(acpi::rsdt) + 8 * sizeof(acpi::rsdt_entry)); + REQUIRE(rsdt->length().value == sizeof(acpi::rsdt) + 8 * sizeof(acpi::rsdt_entry)); } } } |
