Module Name:    src
Committed By:   jmcneill
Date:           Mon Sep  3 00:17:00 UTC 2018

Modified Files:
        src/sys/stand/efiboot: boot.c efifdt.c efifdt.h

Log Message:
Print FDT model and compatible strings with "version" command


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/stand/efiboot/boot.c
cvs rdiff -u -r1.6 -r1.7 src/sys/stand/efiboot/efifdt.c
cvs rdiff -u -r1.1 -r1.2 src/sys/stand/efiboot/efifdt.h

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.4 src/sys/stand/efiboot/boot.c:1.5
--- src/sys/stand/efiboot/boot.c:1.4	Mon Sep  3 00:04:02 2018
+++ src/sys/stand/efiboot/boot.c	Mon Sep  3 00:17:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.4 2018/09/03 00:04:02 jmcneill Exp $	*/
+/*	$NetBSD: boot.c,v 1.5 2018/09/03 00:17:00 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka <non...@netbsd.org>
@@ -29,6 +29,7 @@
 
 #include "efiboot.h"
 #include "efiblock.h"
+#include "efifdt.h"
 
 #include <sys/bootblock.h>
 #include <sys/boot_flag.h>
@@ -131,6 +132,8 @@ command_version(char *arg)
 		    ST->FirmwareRevision & 0xffff);
 		FreePool(ufirmware);
 	}
+
+	efi_fdt_show();
 }
 
 void

Index: src/sys/stand/efiboot/efifdt.c
diff -u src/sys/stand/efiboot/efifdt.c:1.6 src/sys/stand/efiboot/efifdt.c:1.7
--- src/sys/stand/efiboot/efifdt.c:1.6	Sun Sep  2 23:54:25 2018
+++ src/sys/stand/efiboot/efifdt.c	Mon Sep  3 00:17:00 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: efifdt.c,v 1.6 2018/09/02 23:54:25 jmcneill Exp $ */
+/* $NetBSD: efifdt.c,v 1.7 2018/09/03 00:17:00 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcne...@invisible.ca>
@@ -78,6 +78,27 @@ efi_fdt_size(void)
 }
 
 void
+efi_fdt_show(void)
+{
+	const char *model, *compat;
+	int n, ncompat;
+
+	if (fdt_data == NULL)
+		return;
+
+	model = fdt_getprop(fdt_data, fdt_path_offset(fdt_data, "/"), "model", NULL);
+	if (model)
+		printf("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, "/"),
+		    "compatible", n, NULL);
+		printf("%s%s", n == 0 ? "" : ", ", compat);
+	}
+	printf("]\n");
+}
+
+void
 efi_fdt_memory_map(void)
 {
 	UINTN nentries = 0, mapkey, descsize;

Index: src/sys/stand/efiboot/efifdt.h
diff -u src/sys/stand/efiboot/efifdt.h:1.1 src/sys/stand/efiboot/efifdt.h:1.2
--- src/sys/stand/efiboot/efifdt.h:1.1	Fri Aug 24 02:01:06 2018
+++ src/sys/stand/efiboot/efifdt.h	Mon Sep  3 00:17:00 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: efifdt.h,v 1.1 2018/08/24 02:01:06 jmcneill Exp $ */
+/* $NetBSD: efifdt.h,v 1.2 2018/09/03 00:17:00 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcne...@invisible.ca>
@@ -30,4 +30,5 @@ int efi_fdt_probe(void);
 void efi_fdt_memory_map(void);
 void *efi_fdt_data(void);
 int efi_fdt_size(void);
+void efi_fdt_show(void);
 void efi_fdt_bootargs(const char *);

Reply via email to