]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[acpi] Allow for platforms that provide ACPI tables individually
authorMichael Brown <mcb30@ipxe.org>
Mon, 1 Mar 2021 00:08:23 +0000 (00:08 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 1 Mar 2021 00:08:23 +0000 (00:08 +0000)
The ACPI API currently expects platforms to provide access to a single
contiguous ACPI table.  Some platforms (e.g. Linux userspace) do not
provide a convenient way to obtain the entire ACPI table, but do
provide access to individual tables.

All iPXE consumers of the ACPI API require access only to individual
tables.

Redefine the internal API to make acpi_find() an API method, with all
existing implementations delegating to the current RSDT-based
implementation.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/x86/include/ipxe/rsdp.h
src/arch/x86/interface/pcbios/rsdp.c
src/core/acpi.c
src/core/null_acpi.c
src/include/ipxe/acpi.h
src/include/ipxe/efi/efi_acpi.h
src/include/ipxe/null_acpi.h
src/interface/efi/efi_acpi.c

index 7e32c0011f1f7d5766f92983ed4e57995dbacce5..14afcd774bc857030c7e3567962acea09e126c46 100644 (file)
@@ -15,4 +15,17 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #define ACPI_PREFIX_rsdp __rsdp_
 #endif
 
+/**
+ * Locate ACPI table
+ *
+ * @v signature                Requested table signature
+ * @v index            Requested index of table with this signature
+ * @ret table          Table, or UNULL if not found
+ */
+static inline __attribute__ (( always_inline )) userptr_t
+ACPI_INLINE ( rsdp, acpi_find ) ( uint32_t signature, unsigned int index ) {
+
+       return acpi_find_via_rsdt ( signature, index );
+}
+
 #endif /* _IPXE_RSDP_H */
index 8da0b558844b15886fd5866029f5a63458956dfc..3c67b7525e1c3b63da0b36ab7855679bfb453f8b 100644 (file)
@@ -123,3 +123,4 @@ static userptr_t rsdp_find_rsdt ( void ) {
 }
 
 PROVIDE_ACPI ( rsdp, acpi_find_rsdt, rsdp_find_rsdt );
+PROVIDE_ACPI_INLINE ( rsdp, acpi_find );
index 75511736db1aece8d0ec8301cb802b6eb0b7f873..52eb63a0419c856b2f83af15d56aaeeeade38af1 100644 (file)
@@ -83,13 +83,13 @@ void acpi_fix_checksum ( struct acpi_header *acpi ) {
 }
 
 /**
- * Locate ACPI table
+ * Locate ACPI table via RSDT
  *
  * @v signature                Requested table signature
  * @v index            Requested index of table with this signature
  * @ret table          Table, or UNULL if not found
  */
-userptr_t acpi_find ( uint32_t signature, unsigned int index ) {
+userptr_t acpi_find_via_rsdt ( uint32_t signature, unsigned int index ) {
        struct acpi_header acpi;
        struct acpi_rsdt *rsdtab;
        typeof ( rsdtab->entry[0] ) entry;
index 90c7848553dd29a02f5919d2cf3e1e2160852183..acca378726ac50eb4a1593a27eb9ada443059e29 100644 (file)
@@ -1,3 +1,3 @@
 #include <ipxe/acpi.h>
 
-PROVIDE_ACPI_INLINE ( null, acpi_find_rsdt );
+PROVIDE_ACPI_INLINE ( null, acpi_find );
index f979ace45a784ea948f3417838ffebacde8ebf8f..6d19f05fad27646498b819e8631522b79b2d557c 100644 (file)
@@ -355,6 +355,8 @@ struct acpi_model {
 #define PROVIDE_ACPI_INLINE( _subsys, _api_func ) \
        PROVIDE_SINGLE_API_INLINE ( ACPI_PREFIX_ ## _subsys, _api_func )
 
+extern userptr_t acpi_find_via_rsdt ( uint32_t signature, unsigned int index );
+
 /* Include all architecture-independent ACPI API headers */
 #include <ipxe/null_acpi.h>
 #include <ipxe/efi/efi_acpi.h>
@@ -369,13 +371,21 @@ struct acpi_model {
  */
 userptr_t acpi_find_rsdt ( void );
 
+/**
+ * Locate ACPI table
+ *
+ * @v signature                Requested table signature
+ * @v index            Requested index of table with this signature
+ * @ret table          Table, or UNULL if not found
+ */
+userptr_t acpi_find ( uint32_t signature, unsigned int index );
+
 extern struct acpi_descriptor *
 acpi_describe ( struct interface *interface );
 #define acpi_describe_TYPE( object_type )                              \
        typeof ( struct acpi_descriptor * ( object_type ) )
 
 extern void acpi_fix_checksum ( struct acpi_header *acpi );
-extern userptr_t acpi_find ( uint32_t signature, unsigned int index );
 extern int acpi_sx ( uint32_t signature );
 extern void acpi_add ( struct acpi_descriptor *desc );
 extern void acpi_del ( struct acpi_descriptor *desc );
index 01456f137c1d35cf2221e4b12e2999d1bc46f211..a698863a6a9b073648710ff6493bb3e5b45528d9 100644 (file)
@@ -15,4 +15,17 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #define ACPI_PREFIX_efi __efi_
 #endif
 
+/**
+ * Locate ACPI table
+ *
+ * @v signature                Requested table signature
+ * @v index            Requested index of table with this signature
+ * @ret table          Table, or UNULL if not found
+ */
+static inline __attribute__ (( always_inline )) userptr_t
+ACPI_INLINE ( efi, acpi_find ) ( uint32_t signature, unsigned int index ) {
+
+       return acpi_find_via_rsdt ( signature, index );
+}
+
 #endif /* _IPXE_EFI_ACPI_H */
index 1e469e33d4a6fa4a47db3f5dfdd2ffe931032d8d..cedb02839eb06f785b3c5debf0ae9de875192b5d 100644 (file)
@@ -15,8 +15,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #define ACPI_PREFIX_null __null_
 #endif
 
-static inline __always_inline userptr_t
-ACPI_INLINE ( null, acpi_find_rsdt ) ( void ) {
+static inline __attribute__ (( always_inline )) userptr_t
+ACPI_INLINE ( null, acpi_find ) ( uint32_t signature __unused,
+                                 unsigned int index __unused ) {
+
        return UNULL;
 }
 
index a347eaf3ad253a4c29eb97eb28c7f6d6350293ed..07a2256329eace53c624e47d422b6bbcc0d227ff 100644 (file)
@@ -54,3 +54,4 @@ static userptr_t efi_find_rsdt ( void ) {
 }
 
 PROVIDE_ACPI ( efi, acpi_find_rsdt, efi_find_rsdt );
+PROVIDE_ACPI_INLINE ( efi, acpi_find );