[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/7] acpi: Export a generic grub_acpi_find_table
From: |
Benjamin Herrenschmidt |
Subject: |
[PATCH 1/7] acpi: Export a generic grub_acpi_find_table |
Date: |
Fri, 2 Dec 2022 10:05:20 +1100 |
From: Matthias Lange <matthias.lange () kernkonzept ! com>
And convert grub_acpi_find_fadt to use it
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
grub-core/kern/acpi.c | 43 +++++++++++++++++++++++++------------------
include/grub/acpi.h | 3 +++
2 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/grub-core/kern/acpi.c b/grub-core/kern/acpi.c
index 70898ddcd..5d5b54b72 100644
--- a/grub-core/kern/acpi.c
+++ b/grub-core/kern/acpi.c
@@ -85,35 +85,42 @@ grub_acpi_xsdt_find_table (struct grub_acpi_table_header
*xsdt, const char *sig)
return 0;
}
-struct grub_acpi_fadt *
-grub_acpi_find_fadt (void)
+void *
+grub_acpi_find_table (const char *sig)
{
- struct grub_acpi_fadt *fadt = 0;
+ struct grub_acpi_fadt *r = 0;
struct grub_acpi_rsdp_v10 *rsdpv1;
struct grub_acpi_rsdp_v20 *rsdpv2;
+
rsdpv1 = grub_machine_acpi_get_rsdpv1 ();
if (rsdpv1)
- fadt = grub_acpi_rsdt_find_table ((struct grub_acpi_table_header *)
- (grub_addr_t) rsdpv1->rsdt_addr,
- GRUB_ACPI_FADT_SIGNATURE);
- if (fadt)
- return fadt;
+ r = grub_acpi_rsdt_find_table ((struct grub_acpi_table_header *)
+ (grub_addr_t) rsdpv1->rsdt_addr,
+ sig);
+ if (r)
+ return r;
rsdpv2 = grub_machine_acpi_get_rsdpv2 ();
if (rsdpv2)
- fadt = grub_acpi_rsdt_find_table ((struct grub_acpi_table_header *)
- (grub_addr_t) rsdpv2->rsdpv1.rsdt_addr,
- GRUB_ACPI_FADT_SIGNATURE);
- if (fadt)
- return fadt;
+ r = grub_acpi_rsdt_find_table ((struct grub_acpi_table_header *)
+ (grub_addr_t) rsdpv2->rsdpv1.rsdt_addr,
+ sig);
+ if (r)
+ return r;
if (rsdpv2
#if GRUB_CPU_SIZEOF_VOID_P != 8
&& !(rsdpv2->xsdt_addr >> 32)
#endif
)
- fadt = grub_acpi_xsdt_find_table ((struct grub_acpi_table_header *)
- (grub_addr_t) rsdpv2->xsdt_addr,
- GRUB_ACPI_FADT_SIGNATURE);
- if (fadt)
- return fadt;
+ r = grub_acpi_xsdt_find_table ((struct grub_acpi_table_header *)
+ (grub_addr_t) rsdpv2->xsdt_addr,
+ sig);
+ if (r)
+ return r;
return 0;
}
+
+struct grub_acpi_fadt *
+grub_acpi_find_fadt (void)
+{
+ return grub_acpi_find_table (GRUB_ACPI_FADT_SIGNATURE);
+}
diff --git a/include/grub/acpi.h b/include/grub/acpi.h
index 84f49487d..8c126b2b9 100644
--- a/include/grub/acpi.h
+++ b/include/grub/acpi.h
@@ -244,4 +244,7 @@ enum
struct grub_acpi_fadt *
EXPORT_FUNC(grub_acpi_find_fadt) (void);
+void *
+EXPORT_FUNC(grub_acpi_find_table) (const char *sig);
+
#endif /* ! GRUB_ACPI_HEADER */
--
2.34.1
- [RESEND PATCH 0/7] serial: Add MMIO & SPCR support, Benjamin Herrenschmidt, 2022/12/01
- [PATCH 1/7] acpi: Export a generic grub_acpi_find_table,
Benjamin Herrenschmidt <=
- [PATCH 2/7] acpi: Add SPCR and generic address definitions, Benjamin Herrenschmidt, 2022/12/01
- [PATCH 3/7] ns8250: Add base support for MMIO UARTs, Benjamin Herrenschmidt, 2022/12/01
- [PATCH 4/7] ns8250: Add configuration parameter when adding ports, Benjamin Herrenschmidt, 2022/12/01
- [PATCH 5/7] ns8250: Use ACPI SPCR table when available to configure serial, Benjamin Herrenschmidt, 2022/12/01
- [PATCH 6/7] ns8250: Support more MMIO access sizes, Benjamin Herrenschmidt, 2022/12/01