Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/stand/efiboot Align output of "version" command.



details:   https://anonhg.NetBSD.org/src/rev/1e8254c7f4d3
branches:  trunk
changeset: 368959:1e8254c7f4d3
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Aug 14 11:26:41 2022 +0000

description:
Align output of "version" command.

diffstat:

 sys/stand/efiboot/boot.c                 |  27 +++++++++++++++++++++------
 sys/stand/efiboot/bootaa64/efibootaa64.c |   4 ++--
 sys/stand/efiboot/efiacpi.c              |  12 +++++++-----
 sys/stand/efiboot/efiboot.h              |   3 ++-
 sys/stand/efiboot/efifdt.c               |  10 ++++++----
 sys/stand/efiboot/efigop.c               |   9 +++++++--
 sys/stand/efiboot/efirng.c               |   8 +++++---
 7 files changed, 50 insertions(+), 23 deletions(-)

diffs (205 lines):

diff -r ff9761963bc1 -r 1e8254c7f4d3 sys/stand/efiboot/boot.c
--- a/sys/stand/efiboot/boot.c  Sun Aug 14 10:14:58 2022 +0000
+++ b/sys/stand/efiboot/boot.c  Sun Aug 14 11:26:41 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: boot.c,v 1.43 2022/03/25 21:23:00 jmcneill Exp $       */
+/*     $NetBSD: boot.c,v 1.44 2022/08/14 11:26:41 jmcneill Exp $       */
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
@@ -380,6 +380,18 @@
 }
 
 void
+command_printtab(const char *key, const char *fmt, ...)
+{
+       va_list ap;
+
+       printf("%-16s: ", key);
+
+       va_start(ap, fmt);
+       vprintf(fmt, ap);
+       va_end(ap);
+}
+
+void
 command_version(char *arg)
 {
        char pathbuf[80];
@@ -387,23 +399,26 @@
        const UINT64 *osindsup;
        int rv;
 
-       printf("Version: %s (%s)\n", bootprog_rev, bootprog_kernrev);
-       printf("EFI: %d.%02d\n",
+       command_printtab("Version", "%s (%s)\n",
+           bootprog_rev, bootprog_kernrev);
+       command_printtab("EFI", "%d.%02d\n",
            ST->Hdr.Revision >> 16, ST->Hdr.Revision & 0xffff);
+
        ufirmware = NULL;
        rv = ucs2_to_utf8(ST->FirmwareVendor, &ufirmware);
        if (rv == 0) {
-               printf("Firmware: %s (rev 0x%x)\n", ufirmware,
+               command_printtab("Firmware", "%s (rev 0x%x)\n", ufirmware,
                    ST->FirmwareRevision);
                FreePool(ufirmware);
        }
        if (bootcfg_path(pathbuf, sizeof(pathbuf)) == 0) {
-               printf("Config path: %s\n", pathbuf);
+               command_printtab("Config path", "%s\n", pathbuf);
        }
 
        osindsup = LibGetVariable(L"OsIndicationsSupported", &EfiGlobalVariable);
        if (osindsup != NULL) {
-               printf("UEFI OS indications supported: 0x%" PRIx64 "\n", *osindsup);
+               command_printtab("OS Indications", "0x%" PRIx64 "\n",
+                   *osindsup);
        }
 
 #ifdef EFIBOOT_FDT
diff -r ff9761963bc1 -r 1e8254c7f4d3 sys/stand/efiboot/bootaa64/efibootaa64.c
--- a/sys/stand/efiboot/bootaa64/efibootaa64.c  Sun Aug 14 10:14:58 2022 +0000
+++ b/sys/stand/efiboot/bootaa64/efibootaa64.c  Sun Aug 14 11:26:41 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: efibootaa64.c,v 1.5 2021/01/09 13:19:27 jmcneill Exp $ */
+/*     $NetBSD: efibootaa64.c,v 1.6 2022/08/14 11:26:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
@@ -79,5 +79,5 @@
 void
 efi_md_show(void)
 {
-       printf("Current Exception Level: EL%u\n", efi_aarch64_current_el());
+       command_printtab("CurrentEL", "EL%u\n", efi_aarch64_current_el());
 }
diff -r ff9761963bc1 -r 1e8254c7f4d3 sys/stand/efiboot/efiacpi.c
--- a/sys/stand/efiboot/efiacpi.c       Sun Aug 14 10:14:58 2022 +0000
+++ b/sys/stand/efiboot/efiacpi.c       Sun Aug 14 11:26:41 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efiacpi.c,v 1.12 2021/11/03 22:02:36 skrll Exp $ */
+/* $NetBSD: efiacpi.c,v 1.13 2022/08/14 11:26:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -145,13 +145,15 @@
 {
        struct acpi_rdsp *rsdp = acpi_root;
 
-       if (!efi_acpi_available())
+       if (!efi_acpi_available()) {
                return;
+       }
 
-       printf("ACPI: v%02d %c%c%c%c%c%c\n", rsdp->revision,
+       command_printtab("ACPI", "v%02d %c%c%c%c%c%c\n", rsdp->revision,
            rsdp->oemid[0], rsdp->oemid[1], rsdp->oemid[2],
            rsdp->oemid[3], rsdp->oemid[4], rsdp->oemid[5]);
 
-       if (smbios_table)
-               printf("SMBIOS: %s\n", efi_acpi_get_model());
+       if (smbios_table) {
+               command_printtab("SMBIOS", "%s\n", efi_acpi_get_model());
+       }
 }
diff -r ff9761963bc1 -r 1e8254c7f4d3 sys/stand/efiboot/efiboot.h
--- a/sys/stand/efiboot/efiboot.h       Sun Aug 14 10:14:58 2022 +0000
+++ b/sys/stand/efiboot/efiboot.h       Sun Aug 14 11:26:41 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: efiboot.h,v 1.19 2022/03/25 21:23:00 jmcneill Exp $    */
+/*     $NetBSD: efiboot.h,v 1.20 2022/08/14 11:26:41 jmcneill Exp $    */
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
@@ -58,6 +58,7 @@
 void clearit(void);
 extern const struct boot_command commands[];
 void command_help(char *);
+void command_printtab(const char *, const char *, ...);
 int set_default_device(const char *);
 char *get_default_device(void);
 void set_default_fstype(int);
diff -r ff9761963bc1 -r 1e8254c7f4d3 sys/stand/efiboot/efifdt.c
--- a/sys/stand/efiboot/efifdt.c        Sun Aug 14 10:14:58 2022 +0000
+++ b/sys/stand/efiboot/efifdt.c        Sun Aug 14 11:26:41 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efifdt.c,v 1.34 2022/03/25 21:23:00 jmcneill Exp $ */
+/* $NetBSD: efifdt.c,v 1.35 2022/08/14 11:26:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jason R. Thorpe
@@ -205,12 +205,14 @@
        const char *model, *compat;
        int n, ncompat;
 
-       if (fdt_data == NULL)
+       if (fdt_data == NULL) {
                return;
+       }
 
        model = fdt_getprop(fdt_data, fdt_path_offset(fdt_data, "/"), "model", NULL);
-       if (model)
-               printf("FDT: %s [", model);
+       if (model) {
+               command_printtab("FDT", "%s [", model);
+       }
        ncompat = fdt_stringlist_count(fdt_data, fdt_path_offset(fdt_data, "/"), "compatible");
        for (n = 0; n < ncompat; n++) {
                compat = fdt_stringlist_get(fdt_data, fdt_path_offset(fdt_data, "/"),
diff -r ff9761963bc1 -r 1e8254c7f4d3 sys/stand/efiboot/efigop.c
--- a/sys/stand/efiboot/efigop.c        Sun Aug 14 10:14:58 2022 +0000
+++ b/sys/stand/efiboot/efigop.c        Sun Aug 14 11:26:41 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efigop.c,v 1.2 2021/10/06 10:13:19 jmcneill Exp $ */
+/* $NetBSD: efigop.c,v 1.3 2022/08/14 11:26:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2021 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -87,8 +87,13 @@
                return;
        }
 
-       printf("GOP: ");
+       command_printtab("GOP", "");
        efi_gop_printmode(gop->Mode->Mode, gop->Mode->Info);
+       if (gop->Mode->FrameBufferBase != 0) {
+               printf(" (0x%lx,0x%lx)",
+                   (unsigned long)gop->Mode->FrameBufferBase,
+                   (unsigned long)gop->Mode->FrameBufferSize);
+       }
        printf("\n");
 }
 
diff -r ff9761963bc1 -r 1e8254c7f4d3 sys/stand/efiboot/efirng.c
--- a/sys/stand/efiboot/efirng.c        Sun Aug 14 10:14:58 2022 +0000
+++ b/sys/stand/efiboot/efirng.c        Sun Aug 14 11:26:41 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: efirng.c,v 1.3 2021/06/22 10:19:35 jmcneill Exp $      */
+/*     $NetBSD: efirng.c,v 1.4 2022/08/14 11:26:41 jmcneill Exp $      */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -85,10 +85,12 @@
        if (!efi_rng_available())
                return;
 
+       command_printtab("RNG", "");
+
        /* Query the list of supported algorithms.  */
        status = uefi_call_wrapper(rng->GetInfo, 3, rng, &alglistsz, alglist);
        if (EFI_ERROR(status)) {
-               Print(L"RNG: GetInfo: %r\n", status);
+               Print(L"GetInfo: %r\n", status);
                return;
        }
 
@@ -102,7 +104,7 @@
                                break;
                        }
                }
-               Print(L"RNG: %s (%g)\n", name, &alglist[i]);
+               Print(L"%s (%g)\n", name, &alglist[i]);
        }
 }
 



Home | Main Index | Thread Index | Old Index