Author: gonzo
Date: Sat Jan  5 23:08:10 2013
New Revision: 245079
URL: http://svnweb.freebsd.org/changeset/base/245079

Log:
  Add hw.board.serial and hw.board.revision for exporting board-specific info

Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm/include/machdep.h

Modified: head/sys/arm/arm/machdep.c
==============================================================================
--- head/sys/arm/arm/machdep.c  Sat Jan  5 22:56:16 2013        (r245078)
+++ head/sys/arm/arm/machdep.c  Sat Jan  5 23:08:10 2013        (r245079)
@@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/ptrace.h>
 #include <sys/signalvar.h>
 #include <sys/syscallsubr.h>
+#include <sys/sysctl.h>
 #include <sys/sysent.h>
 #include <sys/sysproto.h>
 #include <sys/uio.h>
@@ -162,8 +163,6 @@ const struct pmap_devmap *pmap_devmap_bo
 
 uint32_t board_id;
 struct arm_lbabi_tag *atag_list;
-uint32_t revision;
-uint64_t serial;
 char linux_command_line[LBABI_MAX_COMMAND_LINE + 1];
 char atags[LBABI_MAX_COMMAND_LINE * 2];
 uint32_t memstart[LBABI_MAX_BANKS];
@@ -171,6 +170,31 @@ uint32_t memsize[LBABI_MAX_BANKS];
 uint32_t membanks;
 #endif
 
+static uint32_t board_revision;
+/* hex representation of uint64_t */
+static char board_serial[32];
+
+SYSCTL_NODE(_hw, OID_AUTO, board, CTLFLAG_RD, 0, "Board attributes");
+SYSCTL_UINT(_hw_board, OID_AUTO, revision, CTLFLAG_RD,
+    &board_revision, 0, "Board revision");
+SYSCTL_STRING(_hw_board, OID_AUTO, serial, CTLFLAG_RD,
+    board_serial, 0, "Board serial");
+
+void
+board_set_serial(uint64_t serial)
+{
+
+       snprintf(board_serial, sizeof(board_serial)-1, 
+                   "%016jx", serial);
+}
+
+void
+board_set_revision(uint32_t revision)
+{
+
+       board_revision = revision;
+}
+
 void
 sendsig(catcher, ksi, mask)
        sig_t catcher;
@@ -849,6 +873,8 @@ vm_offset_t
 linux_parse_boot_param(struct arm_boot_params *abp)
 {
        struct arm_lbabi_tag *walker;
+       uint32_t revision;
+       uint64_t serial;
 
        /*
         * Linux boot ABI: r0 = 0, r1 is the board type (!= 0) and r2
@@ -883,9 +909,11 @@ linux_parse_boot_param(struct arm_boot_p
                case ATAG_SERIAL:
                        serial = walker->u.tag_sn.low |
                            ((uint64_t)walker->u.tag_sn.high << 32);
+                       board_set_serial(serial);
                        break;
                case ATAG_REVISION:
                        revision = walker->u.tag_rev.rev;
+                       board_set_revision(revision);
                        break;
                case ATAG_CMDLINE:
                        /* XXX open question: Parse this for boothowto? */

Modified: head/sys/arm/include/machdep.h
==============================================================================
--- head/sys/arm/include/machdep.h      Sat Jan  5 22:56:16 2013        
(r245078)
+++ head/sys/arm/include/machdep.h      Sat Jan  5 23:08:10 2013        
(r245079)
@@ -37,6 +37,10 @@ void initarm_gpio_init(void);
 void initarm_late_init(void);
 int platform_devmap_init(void);
 
+/* Board-specific attributes */
+void board_set_serial(uint64_t);
+void board_set_revision(uint32_t);
+
 /* Needs to be initialised by platform_devmap_init */
 extern const struct pmap_devmap *pmap_devmap_bootstrap_table;
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to