diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-05-29 11:03:35 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-05-29 11:03:35 +0000 |
commit | b87a9f5ba0185641ded7402c3a12c77c36371a5e (patch) | |
tree | b167b9971eaa45055aa631e09fcc98c1c1a7bd21 /sys/arch/arm | |
parent | d3578b30c965c9f784c30f8c7b68652f9c9a0338 (diff) |
use fdt "model" string for hw.product
ok kettenis@
Diffstat (limited to 'sys/arch/arm')
-rw-r--r-- | sys/arch/arm/mainbus/mainbus.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/arch/arm/mainbus/mainbus.c b/sys/arch/arm/mainbus/mainbus.c index 91b5811f043..5687b2a4ebf 100644 --- a/sys/arch/arm/mainbus/mainbus.c +++ b/sys/arch/arm/mainbus/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.9 2016/05/18 22:55:23 kettenis Exp $ */ +/* $OpenBSD: mainbus.c,v 1.10 2016/05/29 11:03:34 jsg Exp $ */ /* * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se> * @@ -19,6 +19,7 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/device.h> +#include <sys/malloc.h> #include <dev/ofw/openfirm.h> @@ -75,12 +76,14 @@ mainbus_match(struct device *parent, void *cfdata, void *aux) return (1); } +extern char *hw_prod; + void mainbus_attach(struct device *parent, struct device *self, void *aux) { struct mainbus_softc *sc = (struct mainbus_softc *)self; char buffer[128]; - int node; + int node, len; if ((node = OF_peer(0)) == 0) { printf(": no device tree\n"); @@ -94,9 +97,12 @@ mainbus_attach(struct device *parent, struct device *self, void *aux) #endif sc->sc_dmat = &mainbus_dma_tag; - if (OF_getprop(node, "model", buffer, sizeof(buffer))) + if ((len = OF_getprop(node, "model", buffer, sizeof(buffer))) > 0) { printf(": %s\n", buffer); - else + hw_prod = malloc(len, M_DEVBUF, M_NOWAIT); + if (hw_prod) + strlcpy(hw_prod, buffer, len); + } else printf(": unknown model\n"); /* Attach CPU first. */ |