acpi: Tidy up the table list
authorSimon Glass <sjg@chromium.org>
Wed, 1 Dec 2021 16:03:06 +0000 (09:03 -0700)
committerSimon Glass <sjg@chromium.org>
Tue, 25 Jan 2022 18:44:36 +0000 (11:44 -0700)
At present this is really just a debugging aid, but it is a bit untidy.
Add proper columns so it is easier to read.

Sample output for coral:

    => acpi list
    Name      Base   Size  Detail
    ----  --------  -----  ------
    RSDP  79925000     24  v02 U-BOOT
    RSDT  79925030     48  v01 U-BOOT U-BOOTBL 20220101 INTL 0
    XSDT  799250e0     6c  v01 U-BOOT U-BOOTBL 20220101 INTL 0
    FACP  79929570     f4  v04 U-BOOT U-BOOTBL 20220101 INTL 1
    DSDT  79925280   32ea  v02 U-BOOT U-BOOTBL 20110725 INTL 20180105
    FACS  79925240     40
    MCFG  79929670     2c  v01 U-BOOT U-BOOTBL 20220101 INTL 0
    SPCR  799296a0     50  v02 U-BOOT U-BOOTBL 20220101 INTL 0
    TPM2  799296f0     4c  v04 U-BOOT U-BOOTBL 20220101 INTL 0
    APIC  79929740     6c  v02 U-BOOT U-BOOTBL 20220101 INTL 0
    SSDT  799297b0   1523  v02 U-BOOT U-BOOTBL 20220101 INTL 1
    NHLT  7992ace0    e60  v05 coral coral 3 INTL 0
    DBG2  7992db40     61  v00 U-BOOT U-BOOTBL 20220101 INTL 0
    HPET  7992dbb0     38  v01 U-BOOT U-BOOTBL 20220101 INTL 0

Signed-off-by: Simon Glass <sjg@chromium.org>
cmd/acpi.c
test/dm/acpi.c

index 1d30299..c543f1e 100644 (file)
@@ -24,10 +24,10 @@ static void dump_hdr(struct acpi_table_header *hdr)
 {
        bool has_hdr = memcmp(hdr->signature, "FACS", ACPI_NAME_LEN);
 
-       printf("%.*s %08lx %06x", ACPI_NAME_LEN, hdr->signature,
+       printf("%.*s  %08lx  %5x", ACPI_NAME_LEN, hdr->signature,
               (ulong)map_to_sysmem(hdr), hdr->length);
        if (has_hdr) {
-               printf(" (v%02d %.6s %.8s %x %.4s %x)\n", hdr->revision,
+               printf("  v%02d %.6s %.8s %x %.4s %x\n", hdr->revision,
                       hdr->oem_id, hdr->oem_table_id, hdr->oem_revision,
                       hdr->aslc_id, hdr->aslc_revision);
        } else {
@@ -129,7 +129,7 @@ static int list_rsdp(struct acpi_rsdp *rsdp)
        struct acpi_rsdt *rsdt;
        struct acpi_xsdt *xsdt;
 
-       printf("RSDP %08lx %06x (v%02d %.6s)\n", (ulong)map_to_sysmem(rsdp),
+       printf("RSDP  %08lx  %5x  v%02d %.6s\n", (ulong)map_to_sysmem(rsdp),
               rsdp->length, rsdp->revision, rsdp->oem_id);
        rsdt = map_sysmem(rsdp->rsdt_address, 0);
        xsdt = map_sysmem(rsdp->xsdt_address, 0);
@@ -148,7 +148,8 @@ static int do_acpi_list(struct cmd_tbl *cmdtp, int flag, int argc,
                printf("No ACPI tables present\n");
                return 0;
        }
-       printf("ACPI tables start at %lx\n", gd_acpi_start());
+       printf("Name      Base   Size  Detail\n");
+       printf("----  --------  -----  ------\n");
        list_rsdp(rsdp);
 
        return 0;
index d648f30..edad913 100644 (file)
@@ -393,25 +393,26 @@ static int dm_test_acpi_cmd_list(struct unit_test_state *uts)
 
        console_record_reset();
        run_command("acpi list", 0);
-       ut_assert_nextline("ACPI tables start at %lx", addr);
-       ut_assert_nextline("RSDP %08lx %06zx (v02 U-BOOT)", addr,
+       ut_assert_nextline("Name      Base   Size  Detail");
+       ut_assert_nextline("----  --------  -----  ------");
+       ut_assert_nextline("RSDP  %08lx  %5zx  v02 U-BOOT", addr,
                           sizeof(struct acpi_rsdp));
        addr = ALIGN(addr + sizeof(struct acpi_rsdp), 16);
-       ut_assert_nextline("RSDT %08lx %06zx (v01 U-BOOT U-BOOTBL %x INTL 0)",
+       ut_assert_nextline("RSDT  %08lx  %5zx  v01 U-BOOT U-BOOTBL %x INTL 0",
                           addr, sizeof(struct acpi_table_header) +
                           3 * sizeof(u32), OEM_REVISION);
        addr = ALIGN(addr + sizeof(struct acpi_rsdt), 16);
-       ut_assert_nextline("XSDT %08lx %06zx (v01 U-BOOT U-BOOTBL %x INTL 0)",
+       ut_assert_nextline("XSDT  %08lx  %5zx  v01 U-BOOT U-BOOTBL %x INTL 0",
                           addr, sizeof(struct acpi_table_header) +
                           3 * sizeof(u64), OEM_REVISION);
        addr = ALIGN(addr + sizeof(struct acpi_xsdt), 64);
-       ut_assert_nextline("DMAR %08lx %06zx (v01 U-BOOT U-BOOTBL %x INTL 0)",
+       ut_assert_nextline("DMAR  %08lx  %5zx  v01 U-BOOT U-BOOTBL %x INTL 0",
                           addr, sizeof(struct acpi_dmar), OEM_REVISION);
        addr = ALIGN(addr + sizeof(struct acpi_dmar), 16);
-       ut_assert_nextline("DMAR %08lx %06zx (v01 U-BOOT U-BOOTBL %x INTL 0)",
+       ut_assert_nextline("DMAR  %08lx  %5zx  v01 U-BOOT U-BOOTBL %x INTL 0",
                           addr, sizeof(struct acpi_dmar), OEM_REVISION);
        addr = ALIGN(addr + sizeof(struct acpi_dmar), 16);
-       ut_assert_nextline("DMAR %08lx %06zx (v01 U-BOOT U-BOOTBL %x INTL 0)",
+       ut_assert_nextline("DMAR  %08lx  %5zx  v01 U-BOOT U-BOOTBL %x INTL 0",
                           addr, sizeof(struct acpi_dmar), OEM_REVISION);
        ut_assert_console_end();