2005-03-30 23:28:18 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2004, Psyent Corporation <www.psyent.com>
|
|
|
|
* Scott McNutt <smcnutt@psyent.com>
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2005-03-30 23:28:18 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
#if defined (CONFIG_SYS_NIOS_SYSID_BASE)
|
2005-03-30 23:28:18 +00:00
|
|
|
|
|
|
|
#include <command.h>
|
2006-06-08 15:59:57 +00:00
|
|
|
#include <asm/io.h>
|
2005-03-30 23:28:18 +00:00
|
|
|
#include <linux/time.h>
|
|
|
|
|
2014-08-25 08:50:14 +00:00
|
|
|
typedef volatile struct {
|
|
|
|
unsigned id; /* The system build id */
|
|
|
|
unsigned timestamp; /* Timestamp */
|
|
|
|
} nios_sysid_t;
|
|
|
|
|
2005-03-30 23:28:18 +00:00
|
|
|
void display_sysid (void)
|
|
|
|
{
|
2014-08-25 08:50:14 +00:00
|
|
|
nios_sysid_t *sysid = (nios_sysid_t *)CONFIG_SYS_NIOS_SYSID_BASE;
|
2005-03-30 23:28:18 +00:00
|
|
|
struct tm t;
|
|
|
|
char asc[32];
|
2006-06-08 15:59:57 +00:00
|
|
|
time_t stamp;
|
2005-03-30 23:28:18 +00:00
|
|
|
|
2006-06-08 15:59:57 +00:00
|
|
|
stamp = readl (&sysid->timestamp);
|
|
|
|
localtime_r (&stamp, &t);
|
2005-03-30 23:28:18 +00:00
|
|
|
asctime_r (&t, asc);
|
2008-08-06 12:05:38 +00:00
|
|
|
printf ("SYSID : %08lx, %s", readl (&sysid->id), asc);
|
2005-03-30 23:28:18 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-06-28 20:00:46 +00:00
|
|
|
int do_sysid (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
2005-03-30 23:28:18 +00:00
|
|
|
{
|
|
|
|
display_sysid ();
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
U_BOOT_CMD(
|
|
|
|
sysid, 1, 1, do_sysid,
|
2009-01-28 00:03:12 +00:00
|
|
|
"display Nios-II system id",
|
2009-05-24 15:06:54 +00:00
|
|
|
""
|
2005-03-30 23:28:18 +00:00
|
|
|
);
|
2008-10-16 13:01:15 +00:00
|
|
|
#endif /* CONFIG_SYS_NIOS_SYSID_BASE */
|