Module Name:    src
Committed By:   jmcneill
Date:           Sun Aug 14 11:26:41 UTC 2022

Modified Files:
        src/sys/stand/efiboot: boot.c efiacpi.c efiboot.h efifdt.c efigop.c
            efirng.c
        src/sys/stand/efiboot/bootaa64: efibootaa64.c

Log Message:
Align output of "version" command.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/stand/efiboot/boot.c
cvs rdiff -u -r1.12 -r1.13 src/sys/stand/efiboot/efiacpi.c
cvs rdiff -u -r1.19 -r1.20 src/sys/stand/efiboot/efiboot.h
cvs rdiff -u -r1.34 -r1.35 src/sys/stand/efiboot/efifdt.c
cvs rdiff -u -r1.2 -r1.3 src/sys/stand/efiboot/efigop.c
cvs rdiff -u -r1.3 -r1.4 src/sys/stand/efiboot/efirng.c
cvs rdiff -u -r1.5 -r1.6 src/sys/stand/efiboot/bootaa64/efibootaa64.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/stand/efiboot/boot.c
diff -u src/sys/stand/efiboot/boot.c:1.43 src/sys/stand/efiboot/boot.c:1.44
--- src/sys/stand/efiboot/boot.c:1.43	Fri Mar 25 21:23:00 2022
+++ src/sys/stand/efiboot/boot.c	Sun Aug 14 11:26:41 2022
@@ -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 <non...@netbsd.org>
@@ -380,6 +380,18 @@ command_menu(char *arg)
 }
 
 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 @@ command_version(char *arg)
 	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

Index: src/sys/stand/efiboot/efiacpi.c
diff -u src/sys/stand/efiboot/efiacpi.c:1.12 src/sys/stand/efiboot/efiacpi.c:1.13
--- src/sys/stand/efiboot/efiacpi.c:1.12	Wed Nov  3 22:02:36 2021
+++ src/sys/stand/efiboot/efiacpi.c	Sun Aug 14 11:26:41 2022
@@ -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 @@ efi_acpi_show(void)
 {
 	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());
+	}
 }

Index: src/sys/stand/efiboot/efiboot.h
diff -u src/sys/stand/efiboot/efiboot.h:1.19 src/sys/stand/efiboot/efiboot.h:1.20
--- src/sys/stand/efiboot/efiboot.h:1.19	Fri Mar 25 21:23:00 2022
+++ src/sys/stand/efiboot/efiboot.h	Sun Aug 14 11:26:41 2022
@@ -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 <non...@netbsd.org>
@@ -58,6 +58,7 @@ void boot(void);
 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);

Index: src/sys/stand/efiboot/efifdt.c
diff -u src/sys/stand/efiboot/efifdt.c:1.34 src/sys/stand/efiboot/efifdt.c:1.35
--- src/sys/stand/efiboot/efifdt.c:1.34	Fri Mar 25 21:23:00 2022
+++ src/sys/stand/efiboot/efifdt.c	Sun Aug 14 11:26:41 2022
@@ -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 @@ efi_fdt_show(void)
 	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, "/"),

Index: src/sys/stand/efiboot/efigop.c
diff -u src/sys/stand/efiboot/efigop.c:1.2 src/sys/stand/efiboot/efigop.c:1.3
--- src/sys/stand/efiboot/efigop.c:1.2	Wed Oct  6 10:13:19 2021
+++ src/sys/stand/efiboot/efigop.c	Sun Aug 14 11:26:41 2022
@@ -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 <jmcne...@invisible.ca>
@@ -87,8 +87,13 @@ efi_gop_show(void)
 		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");
 }
 

Index: src/sys/stand/efiboot/efirng.c
diff -u src/sys/stand/efiboot/efirng.c:1.3 src/sys/stand/efiboot/efirng.c:1.4
--- src/sys/stand/efiboot/efirng.c:1.3	Tue Jun 22 10:19:35 2021
+++ src/sys/stand/efiboot/efirng.c	Sun Aug 14 11:26:41 2022
@@ -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 @@ efi_rng_show(void)
 	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 @@ efi_rng_show(void)
 				break;
 			}
 		}
-		Print(L"RNG: %s (%g)\n", name, &alglist[i]);
+		Print(L"%s (%g)\n", name, &alglist[i]);
 	}
 }
 

Index: src/sys/stand/efiboot/bootaa64/efibootaa64.c
diff -u src/sys/stand/efiboot/bootaa64/efibootaa64.c:1.5 src/sys/stand/efiboot/bootaa64/efibootaa64.c:1.6
--- src/sys/stand/efiboot/bootaa64/efibootaa64.c:1.5	Sat Jan  9 13:19:27 2021
+++ src/sys/stand/efiboot/bootaa64/efibootaa64.c	Sun Aug 14 11:26:41 2022
@@ -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 <non...@netbsd.org>
@@ -79,5 +79,5 @@ efi_aarch64_current_el(void)
 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());
 }

Reply via email to