changeset 435:6ff2455bd9d2

Save cpu/board names.
author Aleksandr Rybalko <ray@ddteam.net>
date Tue, 20 Mar 2012 00:54:10 +0200
parents a12561d9275a
children 51467235272f
files head/sys/dev/siba/siba.c
diffstat 1 files changed, 29 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/head/sys/dev/siba/siba.c	Tue Mar 20 00:52:12 2012 +0200
+++ b/head/sys/dev/siba/siba.c	Tue Mar 20 00:54:10 2012 +0200
@@ -35,6 +35,7 @@
 #include <sys/rman.h>
 #include <sys/malloc.h>
 #include <sys/interrupt.h>
+#include <sys/sysctl.h>
 
 #include <machine/bus.h>
 
@@ -121,11 +122,8 @@
 		    uint16_t, device_t, struct siba_devinfo *);
 
 extern int 	badaddr(char *addr, int len);
-
-
-
-
-
+extern char cpu_model[80];
+extern char cpu_board[80];
 
 /*
  * Earlier ChipCommon revisions have hardcoded number of cores
@@ -217,8 +215,9 @@
 siba_probe(device_t dev)
 {
 	struct siba_softc *sc = device_get_softc(dev);
-	uint16_t devid, ccid;
-	uint32_t idlo, idhi;
+	uint16_t vid, devid, ccid, cc_id, cc_rev;
+	uint32_t idlo, idhi, ccidreg;
+	char soc_name[20];
 	int idx, rid;
 
 	sc->sc_dev = dev;
@@ -276,10 +275,6 @@
 	 * Determine how many cores are present on this siba bus, so
 	 * that we may map them all.
 	 */
-	uint32_t ccidreg;
-	uint16_t cc_id;
-	uint16_t cc_rev;
-
 	ccidreg = siba_read_4(sc, 0, SIBA_CC_CCID);
 	cc_id = (ccidreg & SIBA_CC_IDMASK);
 	cc_rev = (ccidreg & SIBA_CC_REVMASK) >> SIBA_CC_REVSHIFT;
@@ -288,7 +283,29 @@
 		     ccidreg, cc_id, cc_rev);
 	}
 
-
+	if (strlen(cpu_model) == 0) {
+		vid = (siba_read_4(sc, 0, SIBA_CORE_IDHI) & SIBA_IDHIGH_VC) >>
+		    SIBA_IDHIGH_VC_SHIFT;
+		if (vid == SIBA_VID_BROADCOM) {
+			sprintf(soc_name,
+			    "Vendor: %04x Core: BCM%04x rev: %d",
+			    vid, cc_id, cc_rev);
+		} else {
+			sprintf(soc_name, "Vendor: %04x Core: %04x rev: %d",
+			    vid, cc_id, cc_rev);
+		}
+		(void)snprintf(cpu_model, sizeof(cpu_model)-1, "%s", soc_name);
+	}
+	/* Get board name */
+	if (strlen(cpu_board) == 0) {
+#ifdef	TARGET_BOARD_NAME
+		(void)snprintf(cpu_board, sizeof(cpu_board)-1, "%s",
+		    TARGET_BOARD_NAME);
+#else
+		(void)snprintf(cpu_board, sizeof(cpu_board)-1, "%s",
+		    kern_ident);
+#endif
+	}
 
 	sc->sc_ncores = siba_getncores(dev, cc_id);