summaryrefslogtreecommitdiff
path: root/sys/arch/octeon
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2020-08-28 15:07:56 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2020-08-28 15:07:56 +0000
commit76096eea8b49e1fe478932e7e49312a362eb56db (patch)
treecfb508c0008c1f7b7dd7773e09fadaf126498a88 /sys/arch/octeon
parentb2e6ba7526d95103fb2c2c496a5d44aa144e30d1 (diff)
Make fdt root node's model property readable through sysctl hw.product
Diffstat (limited to 'sys/arch/octeon')
-rw-r--r--sys/arch/octeon/dev/mainbus.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/sys/arch/octeon/dev/mainbus.c b/sys/arch/octeon/dev/mainbus.c
index e0d2afab5fe..0473b9b4524 100644
--- a/sys/arch/octeon/dev/mainbus.c
+++ b/sys/arch/octeon/dev/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.12 2018/04/09 13:46:15 visa Exp $ */
+/* $OpenBSD: mainbus.c,v 1.13 2020/08/28 15:07:55 visa Exp $ */
/*
* Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -29,7 +29,9 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
+#include <sys/malloc.h>
+#include <dev/ofw/openfirm.h>
#include <machine/autoconf.h>
#include <machine/octeonvar.h>
@@ -62,15 +64,30 @@ void
mainbus_attach(struct device *parent, struct device *self, void *aux)
{
struct cpu_attach_args caa;
+ char model[128];
+ int len, node;
#ifdef MULTIPROCESSOR
struct cpu_hwinfo hw;
int cpuid;
#endif
- printf(": board %u rev %u.%u\n", octeon_boot_info->board_type,
+ printf(": board %u rev %u.%u", octeon_boot_info->board_type,
octeon_boot_info->board_rev_major,
octeon_boot_info->board_rev_minor);
+ node = OF_peer(0);
+ if (node != 0) {
+ len = OF_getprop(node, "model", model, sizeof(model));
+ if (len > 0) {
+ printf(", model %s", model);
+ hw_prod = malloc(len, M_DEVBUF, M_NOWAIT);
+ if (hw_prod != NULL)
+ strlcpy(hw_prod, model, len);
+ }
+ }
+
+ printf("\n");
+
bzero(&caa, sizeof caa);
caa.caa_maa.maa_name = "cpu";
caa.caa_hw = &bootcpu_hwinfo;