Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ofw If we are attaching the OFW root, print out the ...



details:   https://anonhg.NetBSD.org/src/rev/ba631f3cb7e7
branches:  trunk
changeset: 378896:ba631f3cb7e7
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Apr 27 20:31:01 2021 +0000

description:
If we are attaching the OFW root, print out the banner-name and model
properties, if they exist.

diffstat:

 sys/dev/ofw/ofbus.c |  27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diffs (48 lines):

diff -r 1cc2102781e7 -r ba631f3cb7e7 sys/dev/ofw/ofbus.c
--- a/sys/dev/ofw/ofbus.c       Tue Apr 27 19:52:06 2021 +0000
+++ b/sys/dev/ofw/ofbus.c       Tue Apr 27 20:31:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ofbus.c,v 1.27 2021/04/24 23:36:57 thorpej Exp $       */
+/*     $NetBSD: ofbus.c,v 1.28 2021/04/27 20:31:01 thorpej Exp $       */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofbus.c,v 1.27 2021/04/24 23:36:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofbus.c,v 1.28 2021/04/27 20:31:01 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -79,7 +79,28 @@ ofbus_attach(device_t parent, device_t d
        char name[64], type[64];
        int child, units;
 
-       printf("\n");
+       /*
+        * If we are the OFW root, get the banner-name and model
+        * properties and display them for informational purposes.
+        */
+       if (oba->oba_phandle == OF_finddevice("/")) {
+               int model_len, banner_len;
+
+               model_len = OF_getprop(oba->oba_phandle, "model",
+                   name, sizeof(name));
+               banner_len = OF_getprop(oba->oba_phandle, "banner-name",
+                   type, sizeof(type));
+
+               if (banner_len > 0 && model_len > 0) {
+                       printf(": %s (%s)\n", type, name);
+               } else if (model_len > 0) {
+                       printf(": %s\n", name);
+               } else {
+                       printf("\n");
+               }
+       } else {
+               printf("\n");
+       }
 
        /*
         * This is a hack to make the probe work on the scsi (and ide) bus.



Home | Main Index | Thread Index | Old Index