[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 1/8] acpi: Export a generic grub_acpi_find_table
From: |
Benjamin Herrenschmidt |
Subject: |
[PATCH v3 1/8] acpi: Export a generic grub_acpi_find_table |
Date: |
Fri, 23 Dec 2022 12:47:52 +1100 |
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
- [PATCH v2 3/8] ns8250: Add base support for MMIO UARTs, (continued)
- [PATCH v2 3/8] ns8250: Add base support for MMIO UARTs, Benjamin Herrenschmidt, 2022/12/22
- [PATCH v2 5/8] ns8250: Add configuration parameter when adding ports, Benjamin Herrenschmidt, 2022/12/22
- [PATCH v2 4/8] ns8250: Move base clock definition to a header, Benjamin Herrenschmidt, 2022/12/22
- [PATCH v2 8/8] serial: Add ability to specify MMIO ports via 'serial', Benjamin Herrenschmidt, 2022/12/22
- [PATCH v2 6/8] ns8250: Use ACPI SPCR table when available to configure serial, Benjamin Herrenschmidt, 2022/12/22
- [PATCH v2 7/8] ns8250: Support more MMIO access sizes, Benjamin Herrenschmidt, 2022/12/22
- [PATCH v2 0/8] serial: Add MMIO & SPCR support, Benjamin Herrenschmidt, 2022/12/22
- [PATCH v3 2/8] acpi: Add SPCR and generic address definitions, Benjamin Herrenschmidt, 2022/12/22
- [PATCH v3 1/8] acpi: Export a generic grub_acpi_find_table,
Benjamin Herrenschmidt <=
- [PATCH v3 3/8] ns8250: Add base support for MMIO UARTs, Benjamin Herrenschmidt, 2022/12/22
- [PATCH v3 4/8] ns8250: Move base clock definition to a header, Benjamin Herrenschmidt, 2022/12/22
- [PATCH v3 5/8] ns8250: Add configuration parameter when adding ports, Benjamin Herrenschmidt, 2022/12/22
- [PATCH v3 6/8] ns8250: Use ACPI SPCR table when available to configure serial, Benjamin Herrenschmidt, 2022/12/22
- [PATCH v3 8/8] serial: Add ability to specify MMIO ports via 'serial', Benjamin Herrenschmidt, 2022/12/22
- [PATCH v3 7/8] ns8250: Support more MMIO access sizes, Benjamin Herrenschmidt, 2022/12/22