Skip to contentSkip to conversation

cmd_bdinfo: move implementation to arch instead of common

PATCH Superseded Jean-Christophe PLAGNIOL-VILLARD 5 participants 11 messages Feb 21, 2009 – Apr 3, 2009

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 cmd_bdinfo: move implementation to arch instead of common

introduce two new weak functions board_bdinfo and cpu_bdinfo to allow board and cpu to print more information

---
rebase for-next
Precedent version

 common/cmd_bdinfo.c     |  455 ++++++++---------------------------------------
 include/bdinfo.h        |   48 +++++
 lib_arm/Makefile        |    1 +
 lib_arm/bdinfo.c        |   53 ++++++
 lib_avr32/Makefile      |    1 +
 lib_avr32/bdinfo.c      |   47 +++++
 lib_blackfin/Makefile   |    1 +
 lib_blackfin/bdinfo.c   |   55 ++++++
 lib_i386/Makefile       |    1 +
 lib_i386/bdinfo.c       |   47 +++++
 lib_m68k/Makefile       |    1 +
 lib_m68k/bdinfo.c       |   75 ++++++++
 lib_microblaze/Makefile |    1 +
 lib_microblaze/bdinfo.c |   51 ++++++
 lib_mips/Makefile       |    1 +
 lib_mips/bdinfo.c       |   47 +++++
 lib_nios/Makefile       |    1 +
 lib_nios/bdinfo.c       |   46 +++++
 lib_nios2/Makefile      |    1 +
 lib_nios2/bdinfo.c      |   54 ++++++
 lib_ppc/Makefile        |    1 +
 lib_ppc/bdinfo.c        |  107 +++++++++++
 lib_sh/Makefile         |    1 +
 lib_sh/bdinfo.c         |   47 +++++
 lib_sparc/Makefile      |   13 +-
 lib_sparc/bdinfo.c      |   61 +++++++
 26 files changed, 829 insertions(+), 388 deletions(-)
 rewrite common/cmd_bdinfo.c (88%)
 create mode 100644 include/bdinfo.h
 create mode 100644 lib_arm/bdinfo.c
 create mode 100644 lib_avr32/bdinfo.c
 create mode 100644 lib_blackfin/bdinfo.c
 create mode 100644 lib_i386/bdinfo.c
 create mode 100644 lib_m68k/bdinfo.c
 create mode 100644 lib_microblaze/bdinfo.c
 create mode 100644 lib_mips/bdinfo.c
 create mode 100644 lib_nios/bdinfo.c
 create mode 100644 lib_nios2/bdinfo.c
 create mode 100644 lib_ppc/bdinfo.c
 create mode 100644 lib_sh/bdinfo.c
 create mode 100644 lib_sparc/bdinfo.c
common/cmd_bdinfo.c +71 -384
dissimilarity index 88%
index 700314b..75e5e83 100644
@@ -1,384 +1,71 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * Boot support
- */
-#include <common.h>
-#include <command.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static void print_num(const char *, ulong);
-
-static void print_eth(int idx);
-
-#ifndef CONFIG_ARM	/* PowerPC and other */
-static void print_lnum(const char *, u64);
-
-#ifdef CONFIG_PPC
-static void print_str(const char *, const char *);
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-	char buf[32];
-
-#ifdef DEBUG
-	print_num ("bd address",    (ulong)bd		);
-#endif
-	print_num ("memstart",	    bd->bi_memstart	);
-	print_lnum ("memsize", 	    bd->bi_memsize	);
-	print_num ("flashstart",    bd->bi_flashstart	);
-	print_num ("flashsize",	    bd->bi_flashsize	);
-	print_num ("flashoffset",   bd->bi_flashoffset	);
-	print_num ("sramstart",	    bd->bi_sramstart	);
-	print_num ("sramsize",	    bd->bi_sramsize	);
-#if defined(CONFIG_5xx)  || defined(CONFIG_8xx) || \
-    defined(CONFIG_8260) || defined(CONFIG_E500)
-	print_num ("immr_base",	    bd->bi_immr_base	);
-#endif
-	print_num ("bootflags",	    bd->bi_bootflags	);
-#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
-    defined(CONFIG_405EP) || defined(CONFIG_XILINX_405) || \
-    defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
-    defined(CONFIG_440EPX) || defined(CONFIG_440GRX) ||	\
-    defined(CONFIG_440SP) || defined(CONFIG_440SPE)
-	print_str ("procfreq",	    strmhz(buf, bd->bi_procfreq));
-	print_str ("plb_busfreq",   strmhz(buf, bd->bi_plb_busfreq));
-#if defined(CONFIG_405GP) || defined(CONFIG_405EP) || defined(CONFIG_XILINX_405) || \
-    defined(CONFIG_440EP) || defined(CONFIG_440GR) || defined(CONFIG_440SPE) || \
-    defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-	print_str ("pci_busfreq",   strmhz(buf, bd->bi_pci_busfreq));
-#endif
-#else	/* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
-#if defined(CONFIG_CPM2)
-	print_str ("vco",	    strmhz(buf, bd->bi_vco));
-	print_str ("sccfreq",	    strmhz(buf, bd->bi_sccfreq));
-	print_str ("brgfreq",	    strmhz(buf, bd->bi_brgfreq));
-#endif
-	print_str ("intfreq",	    strmhz(buf, bd->bi_intfreq));
-#if defined(CONFIG_CPM2)
-	print_str ("cpmfreq",	    strmhz(buf, bd->bi_cpmfreq));
-#endif
-	print_str ("busfreq",	    strmhz(buf, bd->bi_busfreq));
-#endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
-#if defined(CONFIG_MPC8220)
-	print_str ("inpfreq",	    strmhz(buf, bd->bi_inpfreq));
-	print_str ("flbfreq",	    strmhz(buf, bd->bi_flbfreq));
-	print_str ("pcifreq",	    strmhz(buf, bd->bi_pcifreq));
-	print_str ("vcofreq",	    strmhz(buf, bd->bi_vcofreq));
-	print_str ("pevfreq",	    strmhz(buf, bd->bi_pevfreq));
-#endif
-
-	print_eth(0);
-#if defined(CONFIG_HAS_ETH1)
-	print_eth(1);
-#endif
-#if defined(CONFIG_HAS_ETH2)
-	print_eth(2);
-#endif
-#if defined(CONFIG_HAS_ETH3)
-	print_eth(3);
-#endif
-#if defined(CONFIG_HAS_ETH4)
-	print_eth(4);
-#endif
-#if defined(CONFIG_HAS_ETH5)
-	print_eth(5);
-#endif
-
-#ifdef CONFIG_HERMES
-	print_str ("ethspeed",	    strmhz(buf, bd->bi_ethspeed));
-#endif
-	printf ("IP addr     = %pI4\n", &bd->bi_ip_addr);
-	printf ("baudrate    = %6ld bps\n", bd->bi_baudrate   );
-	return 0;
-}
-
-#elif defined(CONFIG_NIOS) /* NIOS*/
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_num ("memstart",		(ulong)bd->bi_memstart);
-	print_lnum ("memsize",		(u64)bd->bi_memsize);
-	print_num ("flashstart",	(ulong)bd->bi_flashstart);
-	print_num ("flashsize",		(ulong)bd->bi_flashsize);
-	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
-
-	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-	printf ("baudrate    = %ld bps\n", bd->bi_baudrate);
-
-	return 0;
-}
-
-#elif defined(CONFIG_NIOS2) /* Nios-II */
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_num ("mem start",		(ulong)bd->bi_memstart);
-	print_lnum ("mem size",		(u64)bd->bi_memsize);
-	print_num ("flash start",	(ulong)bd->bi_flashstart);
-	print_num ("flash size",	(ulong)bd->bi_flashsize);
-	print_num ("flash offset",	(ulong)bd->bi_flashoffset);
-
-#if defined(CONFIG_SYS_SRAM_BASE)
-	print_num ("sram start",	(ulong)bd->bi_sramstart);
-	print_num ("sram size",		(ulong)bd->bi_sramsize);
-#endif
-
-#if defined(CONFIG_CMD_NET)
-	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-#endif
-
-	printf ("baudrate    = %ld bps\n", bd->bi_baudrate);
-
-	return 0;
-}
-#elif defined(CONFIG_MICROBLAZE) /* ! PPC, which leaves Microblaze */
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-	print_num ("mem start      ",	(ulong)bd->bi_memstart);
-	print_lnum ("mem size       ",	(u64)bd->bi_memsize);
-	print_num ("flash start    ",	(ulong)bd->bi_flashstart);
-	print_num ("flash size     ",	(ulong)bd->bi_flashsize);
-	print_num ("flash offset   ",	(ulong)bd->bi_flashoffset);
-#if defined(CONFIG_SYS_SRAM_BASE)
-	print_num ("sram start     ",	(ulong)bd->bi_sramstart);
-	print_num ("sram size      ",	(ulong)bd->bi_sramsize);
-#endif
-#if defined(CONFIG_CMD_NET)
-	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-#endif
-	printf ("baudrate    = %ld bps\n", (ulong)bd->bi_baudrate);
-	return 0;
-}
-
-#elif defined(CONFIG_SPARC)	/* SPARC */
-int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-
-#ifdef DEBUG
-	print_num("bd address             ", (ulong) bd);
-#endif
-	print_num("memstart               ", bd->bi_memstart);
-	print_lnum("memsize                ", bd->bi_memsize);
-	print_num("flashstart             ", bd->bi_flashstart);
-	print_num("CONFIG_SYS_MONITOR_BASE       ", CONFIG_SYS_MONITOR_BASE);
-	print_num("CONFIG_ENV_ADDR           ", CONFIG_ENV_ADDR);
-	printf("CONFIG_SYS_RELOC_MONITOR_BASE = 0x%lx (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE,
-	       CONFIG_SYS_MONITOR_LEN);
-	printf("CONFIG_SYS_MALLOC_BASE        = 0x%lx (%d)\n", CONFIG_SYS_MALLOC_BASE,
-	       CONFIG_SYS_MALLOC_LEN);
-	printf("CONFIG_SYS_INIT_SP_OFFSET     = 0x%lx (%d)\n", CONFIG_SYS_INIT_SP_OFFSET,
-	       CONFIG_SYS_STACK_SIZE);
-	printf("CONFIG_SYS_PROM_OFFSET        = 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET,
-	       CONFIG_SYS_PROM_SIZE);
-	printf("CONFIG_SYS_GBL_DATA_OFFSET    = 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET,
-	       CONFIG_SYS_GBL_DATA_SIZE);
-
-#if defined(CONFIG_CMD_NET)
-	print_eth(0);
-	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-#endif
-	printf("baudrate               = %6ld bps\n", bd->bi_baudrate);
-	return 0;
-}
-
-#elif defined(CONFIG_M68K) /* M68K */
-static void print_str(const char *, const char *);
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-	char buf[32];
-
-	print_num ("memstart",		(ulong)bd->bi_memstart);
-	print_lnum ("memsize",		(u64)bd->bi_memsize);
-	print_num ("flashstart",	(ulong)bd->bi_flashstart);
-	print_num ("flashsize",		(ulong)bd->bi_flashsize);
-	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
-#if defined(CONFIG_SYS_INIT_RAM_ADDR)
-	print_num ("sramstart",		(ulong)bd->bi_sramstart);
-	print_num ("sramsize",		(ulong)bd->bi_sramsize);
-#endif
-#if defined(CONFIG_SYS_MBAR)
-	print_num ("mbar",		bd->bi_mbar_base);
-#endif
-	print_str ("cpufreq",		strmhz(buf, bd->bi_intfreq));
-	print_str ("busfreq",		strmhz(buf, bd->bi_busfreq));
-#ifdef CONFIG_PCI
-	print_str ("pcifreq",		strmhz(buf, bd->bi_pcifreq));
-#endif
-#ifdef CONFIG_EXTRA_CLOCK
-	print_str ("flbfreq",		strmhz(buf, bd->bi_flbfreq));
-	print_str ("inpfreq",		strmhz(buf, bd->bi_inpfreq));
-	print_str ("vcofreq",		strmhz(buf, bd->bi_vcofreq));
-#endif
-#if defined(CONFIG_CMD_NET)
-	print_eth(0);
-#if defined(CONFIG_HAS_ETH1)
-	print_eth(1);
-#endif
-#if defined(CONFIG_HAS_ETH2)
-	print_eth(2);
-#endif
-#if defined(CONFIG_HAS_ETH3)
-	print_eth(3);
-#endif
-
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-#endif
-	printf ("baudrate    = %ld bps\n", bd->bi_baudrate);
-
-	return 0;
-}
-
-#elif defined(CONFIG_BLACKFIN)
-static void print_str(const char *, const char *);
-
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-	char buf[32];
-
-	printf("U-Boot      = %s\n", bd->bi_r_version);
-	printf("CPU         = %s\n", bd->bi_cpu);
-	printf("Board       = %s\n", bd->bi_board_name);
-	print_str("VCO",         strmhz(buf, bd->bi_vco));
-	print_str("CCLK",        strmhz(buf, bd->bi_cclk));
-	print_str("SCLK",        strmhz(buf, bd->bi_sclk));
-
-	print_num("boot_params", (ulong)bd->bi_boot_params);
-	print_num("memstart",    (ulong)bd->bi_memstart);
-	print_lnum("memsize",    (u64)bd->bi_memsize);
-	print_num("flashstart",  (ulong)bd->bi_flashstart);
-	print_num("flashsize",   (ulong)bd->bi_flashsize);
-	print_num("flashoffset", (ulong)bd->bi_flashoffset);
-
-	print_eth(0);
-	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-	printf("baudrate    = %d bps\n", bd->bi_baudrate);
-
-	return 0;
-}
-
-#else /* ! PPC, which leaves MIPS */
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_num ("boot_params",	(ulong)bd->bi_boot_params);
-	print_num ("memstart",		(ulong)bd->bi_memstart);
-	print_lnum ("memsize",		(u64)bd->bi_memsize);
-	print_num ("flashstart",	(ulong)bd->bi_flashstart);
-	print_num ("flashsize",		(ulong)bd->bi_flashsize);
-	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
-
-	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-	printf ("baudrate    = %d bps\n", bd->bi_baudrate);
-
-	return 0;
-}
-#endif  /* MIPS */
-
-#else	/* ARM */
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	int i;
-	bd_t *bd = gd->bd;
-
-	print_num ("arch_number",	bd->bi_arch_number);
-	print_num ("env_t",		(ulong)bd->bi_env);
-	print_num ("boot_params",	(ulong)bd->bi_boot_params);
-
-	for (i=0; i<CONFIG_NR_DRAM_BANKS; ++i) {
-		print_num("DRAM bank",	i);
-		print_num("-> start",	bd->bi_dram[i].start);
-		print_num("-> size",	bd->bi_dram[i].size);
-	}
-
-#if defined(CONFIG_CMD_NET)
-	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-#endif
-	printf ("baudrate    = %d bps\n", bd->bi_baudrate);
-
-	return 0;
-}
-
-#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
-
-static void print_num(const char *name, ulong value)
-{
-	printf ("%-12s= 0x%08lX\n", name, value);
-}
-
-static void print_eth(int idx)
-{
-	char name[10], *val;
-	if (idx)
-		sprintf(name, "eth%iaddr", idx);
-	else
-		strcpy(name, "ethaddr");
-	val = getenv(name);
-	if (!val)
-		val = "(not set)";
-	printf("%-12s= %s\n", name, val);
-}
-
-#ifndef CONFIG_ARM
-static void print_lnum(const char *name, u64 value)
-{
-	printf ("%-12s= 0x%.8llX\n", name, value);
-}
-#endif
-
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_BLACKFIN)
-static void print_str(const char *name, const char *str)
-{
-	printf ("%-12s= %6s MHz\n", name, str);
-}
-#endif	/* CONFIG_PPC */
-
-
-/* -------------------------------------------------------------------- */
-
-U_BOOT_CMD(
-	bdinfo,	1,	1,	do_bdinfo,
-	"print Board Info structure",
-	NULL
-);
+/*
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * Boot support
+ */
+#include <common.h>
+#include <command.h>
+#include <bdinfo.h>
+
+void board_bdinfo(cmd_tbl_t *, int, int, char **) __attribute__((weak));
+void cpu_bdinfo(cmd_tbl_t *, int, int, char **) __attribute__((weak));
+
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	/* call arch bdinfo */
+	arch_bdinfo(cmdtp, flag, argc, argv);
+
+	/* call soc bdinfo */
+	if(cpu_bdinfo) {
+		printf("CPU Info\n");
+		cpu_bdinfo(cmdtp, flag, argc, argv);
+	}
+
+	/* call board bdinfo */
+	if(board_bdinfo) {
+		printf("Board Info\n");
+		board_bdinfo(cmdtp, flag, argc, argv);
+	}
+
+	return 0;
+}
+
+void print_eth(int idx)
+{
+	char name[10], *val;
+	if (idx)
+		sprintf(name, "eth%iaddr", idx);
+	else
+		strcpy(name, "ethaddr");
+	val = getenv(name);
+	if (!val)
+		val = "(not set)";
+	printf("%-12s= %s\n", name, val);
+}
+
+U_BOOT_CMD(
+	bdinfo,	1,	1,	do_bdinfo,
+	"print Board Info structure",
+	NULL
+);
include/bdinfo.h new file +48 -0

48 lines not on this page · raw message

lib_arm/Makefile +1 -0
index c8795b2..3ca7c74 100644
@@ -32,6 +32,7 @@ SOBJS-y	+= _modsi3.o
 SOBJS-y	+= _udivsi3.o
 SOBJS-y	+= _umodsi3.o
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= cache.o
lib_arm/bdinfo.c new file +53 -0

53 lines not on this page · raw message

lib_avr32/Makefile +1 -0
index 37b8051..b014721 100644
@@ -29,6 +29,7 @@ LIB	= $(obj)lib$(ARCH).a
 
 SOBJS-y	+= memset.o
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= interrupts.o
lib_avr32/bdinfo.c new file +47 -0

47 lines not on this page · raw message

lib_blackfin/Makefile +1 -0
index 46ef7f3..44b9660 100644
@@ -36,6 +36,7 @@ SOBJS-y	+= memcpy.o
 SOBJS-y	+= memmove.o
 SOBJS-y	+= memset.o
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= boot.o
 COBJS-y	+= cache.o
lib_blackfin/bdinfo.c new file +55 -0

55 lines not on this page · raw message

lib_i386/Makefile +1 -0
index 4fbcd08..7ed130e 100644
@@ -29,6 +29,7 @@ SOBJS-y	+= bios.o
 SOBJS-y	+= bios_pci.o
 SOBJS-y	+= realmode_switch.o
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= bios_setup.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
lib_i386/bdinfo.c new file +47 -0

47 lines not on this page · raw message

lib_m68k/Makefile +1 -0
index 6db35ed..d261d7e 100644
@@ -27,6 +27,7 @@ LIB	= $(obj)lib$(ARCH).a
 
 SOBJS-y	+=
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= cache.o
lib_m68k/bdinfo.c new file +75 -0

75 lines not on this page · raw message

lib_microblaze/Makefile +1 -0
index 9b0f296..821d1cf 100644
@@ -27,6 +27,7 @@ LIB	= $(obj)lib$(ARCH).a
 
 SOBJS-y	+=
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= cache.o
lib_microblaze/bdinfo.c new file +51 -0

51 lines not on this page · raw message

lib_mips/Makefile +1 -0
index 7967e58..a42219c 100644
@@ -27,6 +27,7 @@ LIB	= $(obj)lib$(ARCH).a
 
 SOBJS-y	+=
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 ifeq ($(CONFIG_QEMU_MIPS),y)
 COBJS-y	+= bootm_qemu_mips.o
lib_mips/bdinfo.c new file +47 -0

47 lines not on this page · raw message

lib_nios/Makefile +1 -0
index f66e989..f50605c 100644
@@ -27,6 +27,7 @@ LIB	= $(obj)lib$(ARCH).a
 
 SOBJS-y	+=
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= cache.o
lib_nios/bdinfo.c new file +46 -0

46 lines not on this page · raw message

lib_nios2/Makefile +1 -0
index b69bc38..f5a7bbe 100644
@@ -27,6 +27,7 @@ LIB	= $(obj)lib$(ARCH).a
 
 SOBJS-y	+= cache.o
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= divmod.o
lib_nios2/bdinfo.c new file +54 -0

54 lines not on this page · raw message

lib_ppc/Makefile +1 -0
index 60ea0c9..865cfc0 100644
@@ -30,6 +30,7 @@ SOBJS-y	+= ppcstring.o
 SOBJS-y	+= ticks.o
 
 COBJS-y	+= bat_rw.o
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= cache.o
lib_ppc/bdinfo.c new file +107 -0

107 lines not on this page · raw message

lib_sh/Makefile +1 -0
index f7c6479..e7ff16d 100644
@@ -24,6 +24,7 @@ LIB	= $(obj)lib$(ARCH).a
 
 SOBJS-y	+=
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 ifeq ($(CONFIG_SH2),y)
lib_sh/bdinfo.c new file +47 -0

47 lines not on this page · raw message

lib_sparc/Makefile +9 -4
index 040ca10..0952bd9 100644
@@ -25,12 +25,17 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(ARCH).a
 
-SOBJS	=
+SOBJS-y	+=
 
-COBJS	= board.o cache.o interrupts.o time.o bootm.o
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
+COBJS-y	+= board.o
+COBJS-y	+= cache.o
+COBJS-y	+= interrupts.o
+COBJS-y	+= time.o
+COBJS-y	+= bootm.o
 
-SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
+SRCS	:= $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
 
 $(LIB):	$(obj).depend $(OBJS)
 	$(AR) $(ARFLAGS) $@ $(OBJS)
lib_sparc/bdinfo.c new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
1.5.6.5
#1 lore raw

PATCH v3 1/1 cmd_bdinfo: move implementation to arch instead of common

Hi

Two minor code style comments.

2009/2/21 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:

Quoted 473 lines

introduce two new weak functions board_bdinfo and cpu_bdinfo to allow board and cpu to print more information

---
rebase for-next
Precedent version

 common/cmd_bdinfo.c     |  455 ++++++++---------------------------------------
 include/bdinfo.h        |   48 +++++
 lib_arm/Makefile        |    1 +
 lib_arm/bdinfo.c        |   53 ++++++
 lib_avr32/Makefile      |    1 +
 lib_avr32/bdinfo.c      |   47 +++++
 lib_blackfin/Makefile   |    1 +
 lib_blackfin/bdinfo.c   |   55 ++++++
 lib_i386/Makefile       |    1 +
 lib_i386/bdinfo.c       |   47 +++++
 lib_m68k/Makefile       |    1 +
 lib_m68k/bdinfo.c       |   75 ++++++++
 lib_microblaze/Makefile |    1 +
 lib_microblaze/bdinfo.c |   51 ++++++
 lib_mips/Makefile       |    1 +
 lib_mips/bdinfo.c       |   47 +++++
 lib_nios/Makefile       |    1 +
 lib_nios/bdinfo.c       |   46 +++++
 lib_nios2/Makefile      |    1 +
 lib_nios2/bdinfo.c      |   54 ++++++
 lib_ppc/Makefile        |    1 +
 lib_ppc/bdinfo.c        |  107 +++++++++++
 lib_sh/Makefile         |    1 +
 lib_sh/bdinfo.c         |   47 +++++
 lib_sparc/Makefile      |   13 +-
 lib_sparc/bdinfo.c      |   61 +++++++
 26 files changed, 829 insertions(+), 388 deletions(-)
 rewrite common/cmd_bdinfo.c (88%)
 create mode 100644 include/bdinfo.h
 create mode 100644 lib_arm/bdinfo.c
 create mode 100644 lib_avr32/bdinfo.c
 create mode 100644 lib_blackfin/bdinfo.c
 create mode 100644 lib_i386/bdinfo.c
 create mode 100644 lib_m68k/bdinfo.c
 create mode 100644 lib_microblaze/bdinfo.c
 create mode 100644 lib_mips/bdinfo.c
 create mode 100644 lib_nios/bdinfo.c
 create mode 100644 lib_nios2/bdinfo.c
 create mode 100644 lib_ppc/bdinfo.c
 create mode 100644 lib_sh/bdinfo.c
 create mode 100644 lib_sparc/bdinfo.c
common/cmd_bdinfo.c +30 -384
dissimilarity index 88%
index 700314b..75e5e83 100644
@@ -1,384 +1,71 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * Boot support
- */
-#include <common.h>
-#include <command.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static void print_num(const char *, ulong);
-
-static void print_eth(int idx);
-
-#ifndef CONFIG_ARM     /* PowerPC and other */
-static void print_lnum(const char *, u64);
-
-#ifdef CONFIG_PPC
-static void print_str(const char *, const char *);
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-       bd_t *bd = gd->bd;
-       char buf[32];
-
-#ifdef DEBUG
-       print_num ("bd address",    (ulong)bd           );
-#endif
-       print_num ("memstart",      bd->bi_memstart     );
-       print_lnum ("memsize",      bd->bi_memsize      );
-       print_num ("flashstart",    bd->bi_flashstart   );
-       print_num ("flashsize",     bd->bi_flashsize    );
-       print_num ("flashoffset",   bd->bi_flashoffset  );
-       print_num ("sramstart",     bd->bi_sramstart    );
-       print_num ("sramsize",      bd->bi_sramsize     );
-#if defined(CONFIG_5xx)  || defined(CONFIG_8xx) || \
-    defined(CONFIG_8260) || defined(CONFIG_E500)
-       print_num ("immr_base",     bd->bi_immr_base    );
-#endif
-       print_num ("bootflags",     bd->bi_bootflags    );
-#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
-    defined(CONFIG_405EP) || defined(CONFIG_XILINX_405) || \
-    defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
-    defined(CONFIG_440EPX) || defined(CONFIG_440GRX) ||        \
-    defined(CONFIG_440SP) || defined(CONFIG_440SPE)
-       print_str ("procfreq",      strmhz(buf, bd->bi_procfreq));
-       print_str ("plb_busfreq",   strmhz(buf, bd->bi_plb_busfreq));
-#if defined(CONFIG_405GP) || defined(CONFIG_405EP) || defined(CONFIG_XILINX_405) || \
-    defined(CONFIG_440EP) || defined(CONFIG_440GR) || defined(CONFIG_440SPE) || \
-    defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-       print_str ("pci_busfreq",   strmhz(buf, bd->bi_pci_busfreq));
-#endif
-#else  /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
-#if defined(CONFIG_CPM2)
-       print_str ("vco",           strmhz(buf, bd->bi_vco));
-       print_str ("sccfreq",       strmhz(buf, bd->bi_sccfreq));
-       print_str ("brgfreq",       strmhz(buf, bd->bi_brgfreq));
-#endif
-       print_str ("intfreq",       strmhz(buf, bd->bi_intfreq));
-#if defined(CONFIG_CPM2)
-       print_str ("cpmfreq",       strmhz(buf, bd->bi_cpmfreq));
-#endif
-       print_str ("busfreq",       strmhz(buf, bd->bi_busfreq));
-#endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
-#if defined(CONFIG_MPC8220)
-       print_str ("inpfreq",       strmhz(buf, bd->bi_inpfreq));
-       print_str ("flbfreq",       strmhz(buf, bd->bi_flbfreq));
-       print_str ("pcifreq",       strmhz(buf, bd->bi_pcifreq));
-       print_str ("vcofreq",       strmhz(buf, bd->bi_vcofreq));
-       print_str ("pevfreq",       strmhz(buf, bd->bi_pevfreq));
-#endif
-
-       print_eth(0);
-#if defined(CONFIG_HAS_ETH1)
-       print_eth(1);
-#endif
-#if defined(CONFIG_HAS_ETH2)
-       print_eth(2);
-#endif
-#if defined(CONFIG_HAS_ETH3)
-       print_eth(3);
-#endif
-#if defined(CONFIG_HAS_ETH4)
-       print_eth(4);
-#endif
-#if defined(CONFIG_HAS_ETH5)
-       print_eth(5);
-#endif
-
-#ifdef CONFIG_HERMES
-       print_str ("ethspeed",      strmhz(buf, bd->bi_ethspeed));
-#endif
-       printf ("IP addr     = %pI4\n", &bd->bi_ip_addr);
-       printf ("baudrate    = %6ld bps\n", bd->bi_baudrate   );
-       return 0;
-}
-
-#elif defined(CONFIG_NIOS) /* NIOS*/
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-       bd_t *bd = gd->bd;
-
-       print_num ("memstart",          (ulong)bd->bi_memstart);
-       print_lnum ("memsize",          (u64)bd->bi_memsize);
-       print_num ("flashstart",        (ulong)bd->bi_flashstart);
-       print_num ("flashsize",         (ulong)bd->bi_flashsize);
-       print_num ("flashoffset",       (ulong)bd->bi_flashoffset);
-
-       print_eth(0);
-       printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-       printf ("baudrate    = %ld bps\n", bd->bi_baudrate);
-
-       return 0;
-}
-
-#elif defined(CONFIG_NIOS2) /* Nios-II */
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-       bd_t *bd = gd->bd;
-
-       print_num ("mem start",         (ulong)bd->bi_memstart);
-       print_lnum ("mem size",         (u64)bd->bi_memsize);
-       print_num ("flash start",       (ulong)bd->bi_flashstart);
-       print_num ("flash size",        (ulong)bd->bi_flashsize);
-       print_num ("flash offset",      (ulong)bd->bi_flashoffset);
-
-#if defined(CONFIG_SYS_SRAM_BASE)
-       print_num ("sram start",        (ulong)bd->bi_sramstart);
-       print_num ("sram size",         (ulong)bd->bi_sramsize);
-#endif
-
-#if defined(CONFIG_CMD_NET)
-       print_eth(0);
-       printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-#endif
-
-       printf ("baudrate    = %ld bps\n", bd->bi_baudrate);
-
-       return 0;
-}
-#elif defined(CONFIG_MICROBLAZE) /* ! PPC, which leaves Microblaze */
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-       bd_t *bd = gd->bd;
-       print_num ("mem start      ",   (ulong)bd->bi_memstart);
-       print_lnum ("mem size       ",  (u64)bd->bi_memsize);
-       print_num ("flash start    ",   (ulong)bd->bi_flashstart);
-       print_num ("flash size     ",   (ulong)bd->bi_flashsize);
-       print_num ("flash offset   ",   (ulong)bd->bi_flashoffset);
-#if defined(CONFIG_SYS_SRAM_BASE)
-       print_num ("sram start     ",   (ulong)bd->bi_sramstart);
-       print_num ("sram size      ",   (ulong)bd->bi_sramsize);
-#endif
-#if defined(CONFIG_CMD_NET)
-       print_eth(0);
-       printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-#endif
-       printf ("baudrate    = %ld bps\n", (ulong)bd->bi_baudrate);
-       return 0;
-}
-
-#elif defined(CONFIG_SPARC)    /* SPARC */
-int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
-{
-       bd_t *bd = gd->bd;
-
-#ifdef DEBUG
-       print_num("bd address             ", (ulong) bd);
-#endif
-       print_num("memstart               ", bd->bi_memstart);
-       print_lnum("memsize                ", bd->bi_memsize);
-       print_num("flashstart             ", bd->bi_flashstart);
-       print_num("CONFIG_SYS_MONITOR_BASE       ", CONFIG_SYS_MONITOR_BASE);
-       print_num("CONFIG_ENV_ADDR           ", CONFIG_ENV_ADDR);
-       printf("CONFIG_SYS_RELOC_MONITOR_BASE = 0x%lx (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE,
-              CONFIG_SYS_MONITOR_LEN);
-       printf("CONFIG_SYS_MALLOC_BASE        = 0x%lx (%d)\n", CONFIG_SYS_MALLOC_BASE,
-              CONFIG_SYS_MALLOC_LEN);
-       printf("CONFIG_SYS_INIT_SP_OFFSET     = 0x%lx (%d)\n", CONFIG_SYS_INIT_SP_OFFSET,
-              CONFIG_SYS_STACK_SIZE);
-       printf("CONFIG_SYS_PROM_OFFSET        = 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET,
-              CONFIG_SYS_PROM_SIZE);
-       printf("CONFIG_SYS_GBL_DATA_OFFSET    = 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET,
-              CONFIG_SYS_GBL_DATA_SIZE);
-
-#if defined(CONFIG_CMD_NET)
-       print_eth(0);
-       printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-#endif
-       printf("baudrate               = %6ld bps\n", bd->bi_baudrate);
-       return 0;
-}
-
-#elif defined(CONFIG_M68K) /* M68K */
-static void print_str(const char *, const char *);
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-       bd_t *bd = gd->bd;
-       char buf[32];
-
-       print_num ("memstart",          (ulong)bd->bi_memstart);
-       print_lnum ("memsize",          (u64)bd->bi_memsize);
-       print_num ("flashstart",        (ulong)bd->bi_flashstart);
-       print_num ("flashsize",         (ulong)bd->bi_flashsize);
-       print_num ("flashoffset",       (ulong)bd->bi_flashoffset);
-#if defined(CONFIG_SYS_INIT_RAM_ADDR)
-       print_num ("sramstart",         (ulong)bd->bi_sramstart);
-       print_num ("sramsize",          (ulong)bd->bi_sramsize);
-#endif
-#if defined(CONFIG_SYS_MBAR)
-       print_num ("mbar",              bd->bi_mbar_base);
-#endif
-       print_str ("cpufreq",           strmhz(buf, bd->bi_intfreq));
-       print_str ("busfreq",           strmhz(buf, bd->bi_busfreq));
-#ifdef CONFIG_PCI
-       print_str ("pcifreq",           strmhz(buf, bd->bi_pcifreq));
-#endif
-#ifdef CONFIG_EXTRA_CLOCK
-       print_str ("flbfreq",           strmhz(buf, bd->bi_flbfreq));
-       print_str ("inpfreq",           strmhz(buf, bd->bi_inpfreq));
-       print_str ("vcofreq",           strmhz(buf, bd->bi_vcofreq));
-#endif
-#if defined(CONFIG_CMD_NET)
-       print_eth(0);
-#if defined(CONFIG_HAS_ETH1)
-       print_eth(1);
-#endif
-#if defined(CONFIG_HAS_ETH2)
-       print_eth(2);
-#endif
-#if defined(CONFIG_HAS_ETH3)
-       print_eth(3);
-#endif
-
-       printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-#endif
-       printf ("baudrate    = %ld bps\n", bd->bi_baudrate);
-
-       return 0;
-}
-
-#elif defined(CONFIG_BLACKFIN)
-static void print_str(const char *, const char *);
-
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-       bd_t *bd = gd->bd;
-       char buf[32];
-
-       printf("U-Boot      = %s\n", bd->bi_r_version);
-       printf("CPU         = %s\n", bd->bi_cpu);
-       printf("Board       = %s\n", bd->bi_board_name);
-       print_str("VCO",         strmhz(buf, bd->bi_vco));
-       print_str("CCLK",        strmhz(buf, bd->bi_cclk));
-       print_str("SCLK",        strmhz(buf, bd->bi_sclk));
-
-       print_num("boot_params", (ulong)bd->bi_boot_params);
-       print_num("memstart",    (ulong)bd->bi_memstart);
-       print_lnum("memsize",    (u64)bd->bi_memsize);
-       print_num("flashstart",  (ulong)bd->bi_flashstart);
-       print_num("flashsize",   (ulong)bd->bi_flashsize);
-       print_num("flashoffset", (ulong)bd->bi_flashoffset);
-
-       print_eth(0);
-       printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-       printf("baudrate    = %d bps\n", bd->bi_baudrate);
-
-       return 0;
-}
-
-#else /* ! PPC, which leaves MIPS */
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-       bd_t *bd = gd->bd;
-
-       print_num ("boot_params",       (ulong)bd->bi_boot_params);
-       print_num ("memstart",          (ulong)bd->bi_memstart);
-       print_lnum ("memsize",          (u64)bd->bi_memsize);
-       print_num ("flashstart",        (ulong)bd->bi_flashstart);
-       print_num ("flashsize",         (ulong)bd->bi_flashsize);
-       print_num ("flashoffset",       (ulong)bd->bi_flashoffset);
-
-       print_eth(0);
-       printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-       printf ("baudrate    = %d bps\n", bd->bi_baudrate);
-
-       return 0;
-}
-#endif  /* MIPS */
-
-#else  /* ARM */
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-       int i;
-       bd_t *bd = gd->bd;
-
-       print_num ("arch_number",       bd->bi_arch_number);
-       print_num ("env_t",             (ulong)bd->bi_env);
-       print_num ("boot_params",       (ulong)bd->bi_boot_params);
-
-       for (i=0; i<CONFIG_NR_DRAM_BANKS; ++i) {
-               print_num("DRAM bank",  i);
-               print_num("-> start",   bd->bi_dram[i].start);
-               print_num("-> size",    bd->bi_dram[i].size);
-       }
-
-#if defined(CONFIG_CMD_NET)
-       print_eth(0);
-       printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-#endif
-       printf ("baudrate    = %d bps\n", bd->bi_baudrate);
-
-       return 0;
-}
-
-#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
-
-static void print_num(const char *name, ulong value)
-{
-       printf ("%-12s= 0x%08lX\n", name, value);
-}
-
-static void print_eth(int idx)
-{
-       char name[10], *val;
-       if (idx)
-               sprintf(name, "eth%iaddr", idx);
-       else
-               strcpy(name, "ethaddr");
-       val = getenv(name);
-       if (!val)
-               val = "(not set)";
-       printf("%-12s= %s\n", name, val);
-}
-
-#ifndef CONFIG_ARM
-static void print_lnum(const char *name, u64 value)
-{
-       printf ("%-12s= 0x%.8llX\n", name, value);
-}
-#endif
-
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_BLACKFIN)
-static void print_str(const char *name, const char *str)
-{
-       printf ("%-12s= %6s MHz\n", name, str);
-}
-#endif /* CONFIG_PPC */
-
-
-/* -------------------------------------------------------------------- */
-
-U_BOOT_CMD(
-       bdinfo, 1,      1,      do_bdinfo,
-       "print Board Info structure",
-       NULL
-);
+/*
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * Boot support
+ */
+#include <common.h>
+#include <command.h>
+#include <bdinfo.h>
+

common/cmd_bdinfo.c line 40

Quoted 10 lines
common/cmd_bdinfo.c +10 -0
+void board_bdinfo(cmd_tbl_t *, int, int, char **) __attribute__((weak));
+void cpu_bdinfo(cmd_tbl_t *, int, int, char **) __attribute__((weak));
+
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       /* call arch bdinfo */
+       arch_bdinfo(cmdtp, flag, argc, argv);
+
+       /* call soc bdinfo */
+       if(cpu_bdinfo) {

Space after if.

common/cmd_bdinfo.c line 46

Quoted 6 lines
common/cmd_bdinfo.c +6 -0
+               printf("CPU Info\n");
+               cpu_bdinfo(cmdtp, flag, argc, argv);
+       }
+
+       /* call board bdinfo */
+       if(board_bdinfo) {

Space after if.

common/cmd_bdinfo.c line 52

Quoted 6 lines
common/cmd_bdinfo.c +6 -0
+               printf("Board Info\n");
+               board_bdinfo(cmdtp, flag, argc, argv);
+       }
+
+       return 0;
+}

Regards, Magnus

#2 lore raw

PATCH v3 1/1 cmd_bdinfo: move implementation to arch instead of common

Quoted 1 line · On Saturday 21 February 2009 04:13:53 Magnus Lilja wrote:

Two minor code style comments.

you dont need to quote everything up to the point where you actually comment. snipping unrelated context you arent talking about makes reading replies a lot easier. otherwise, we need to scroll over ~15 pages just to figure out what you added ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090221/7266dc69/attachment.pgp

#3 lore raw

PATCH v3 1/1 cmd_bdinfo: move implementation to arch instead of common

In reply to Jean-Christophe PLAGNIOL-VILLARD

common/cmd_bdinfo.c line 32

Quoted 4 lines · On Saturday 21 February 2009 03:46:20 Jean-Christophe PLAGNIOL-VILLARD wrote:
common/cmd_bdinfo.c +2 -0
+void board_bdinfo(cmd_tbl_t *, int, int, char **) __attribute__((weak));
+void cpu_bdinfo(cmd_tbl_t *, int, int, char **) __attribute__((weak));

since other people are expected to implement these functions, better to put the prototype into a common header so that the implementation and the caller agree on the function signature. the compiler can check this way.

Quoted 6 lines
common/cmd_bdinfo.c +6 -0
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	/* call arch bdinfo */
+	arch_bdinfo(cmdtp, flag, argc, argv);
+
+	/* call soc bdinfo */

common/cmd_bdinfo.c line 49

Quoted 10 lines
common/cmd_bdinfo.c +10 -0
+	if(cpu_bdinfo) {
+		printf("CPU Info\n");
+		cpu_bdinfo(cmdtp, flag, argc, argv);
+	}
+
+	/* call board bdinfo */
+	if(board_bdinfo) {
+		printf("Board Info\n");
+		board_bdinfo(cmdtp, flag, argc, argv);
+	}

there should be a space after that "if". i would use "puts" instead of "printf" since you arent using any format strings.

otherwise, the Blackfin part looks fine, thanks

-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090221/ee3caba7/attachment.pgp

#4 lore raw

PATCH v3 1/1 cmd_bdinfo: move implementation to arch instead of common

Quoted 9 lines · Mike Frysinger

common/cmd_bdinfo.c line 32

Quoted 4 lines · On Saturday 21 February 2009 03:46:20 Jean-Christophe PLAGNIOL-VILLARD wrote:
common/cmd_bdinfo.c +2 -0
+void board_bdinfo(cmd_tbl_t *, int, int, char **) __attribute__((weak));
+void cpu_bdinfo(cmd_tbl_t *, int, int, char **) __attribute__((weak));

since other people are expected to implement these functions, better to put the prototype into a common header so that the implementation and the caller agree on the function signature. the compiler can check this way.

done in the bdinfo.h
but IIRC we specify it's weak here not in the header

Quoted 12 lines
Quoted 12 lines
common/cmd_bdinfo.c +11 -0
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	/* call arch bdinfo */
+	arch_bdinfo(cmdtp, flag, argc, argv);
+
+	/* call soc bdinfo */
+	if(cpu_bdinfo) {
+		printf("CPU Info\n");
+		cpu_bdinfo(cmdtp, flag, argc, argv);
+	}
+
Quoted 8 lines

common/cmd_bdinfo.c line 49

Quoted 5 lines
common/cmd_bdinfo.c +5 -0
+	/* call board bdinfo */
+	if(board_bdinfo) {
+		printf("Board Info\n");
+		board_bdinfo(cmdtp, flag, argc, argv);
+	}

there should be a space after that "if". i would use "puts" instead of "printf" since you arent using any format strings.

ok

Best Regards,
J.

#5 lore raw

PATCH v3 1/1 cmd_bdinfo: move implementation to arch instead of common

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD

introduce two new weak functions board_bdinfo and cpu_bdinfo to allow board and cpu to print more information

---
rebase for-next
Precedent version

Aren't the Acked-by lines supposed to go above the '---' line?

Haavard

#6 lore raw

PATCH v3 1/1 cmd_bdinfo: move implementation to arch instead of common

Quoted 13 lines · On Monday 23 February 2009 03:22:55 Haavard Skinnemoen wrote:
Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD

introduce two new weak functions board_bdinfo and cpu_bdinfo to allow board and cpu to print more information

---
rebase for-next
Precedent version

Quoted 1 line

Aren't the Acked-by lines supposed to go above the '---' line?

yes, and they replace the CC: lines
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090223/6e47b84c/attachment.pgp

#7 lore raw

PATCH v3 1/1 cmd_bdinfo: move implementation to arch instead of common

In reply to Haavard Skinnemoen
Quoted 13 lines · Haavard Skinnemoen
Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD

introduce two new weak functions board_bdinfo and cpu_bdinfo to allow board and cpu to print more information

---
rebase for-next
Precedent version

Quoted 1 line

Aren't the Acked-by lines supposed to go above the '---' line?

due to a lost of change on this part I've just put you two on Cc

but If you are ok I've put your Ack-by

Best Regards,
J.

#8 lore raw

PATCH v4 1/2 cmd_bdinfo: move implementation to arch instead of common

In reply to Jean-Christophe PLAGNIOL-VILLARD

introduce 3 new weak functions board_bdinfo, cpu_bdinfo and soc_bdinfo to allow board, cpu and soc to print more information

---
Change from V3
SOC weak function
and Mike Suggestion

Best Regards,
J.

 common/cmd_bdinfo.c     |  462 ++++++++---------------------------------------
 include/bdinfo.h        |   49 +++++
 lib_arm/Makefile        |    1 +
 lib_arm/bdinfo.c        |   53 ++++++
 lib_avr32/Makefile      |    1 +
 lib_avr32/bdinfo.c      |   47 +++++
 lib_blackfin/Makefile   |    1 +
 lib_blackfin/bdinfo.c   |   55 ++++++
 lib_i386/Makefile       |    1 +
 lib_i386/bdinfo.c       |   47 +++++
 lib_m68k/Makefile       |    1 +
 lib_m68k/bdinfo.c       |   75 ++++++++
 lib_microblaze/Makefile |    1 +
 lib_microblaze/bdinfo.c |   51 +++++
 lib_mips/Makefile       |    1 +
 lib_mips/bdinfo.c       |   47 +++++
 lib_nios/Makefile       |    1 +
 lib_nios/bdinfo.c       |   46 +++++
 lib_nios2/Makefile      |    1 +
 lib_nios2/bdinfo.c      |   54 ++++++
 lib_ppc/Makefile        |    1 +
 lib_ppc/bdinfo.c        |  107 +++++++++++
 lib_sh/Makefile         |    1 +
 lib_sh/bdinfo.c         |   47 +++++
 lib_sparc/Makefile      |   13 +-
 lib_sparc/bdinfo.c      |   61 ++++++
 26 files changed, 837 insertions(+), 388 deletions(-)
 rewrite common/cmd_bdinfo.c (88%)
 create mode 100644 include/bdinfo.h
 create mode 100644 lib_arm/bdinfo.c
 create mode 100644 lib_avr32/bdinfo.c
 create mode 100644 lib_blackfin/bdinfo.c
 create mode 100644 lib_i386/bdinfo.c
 create mode 100644 lib_m68k/bdinfo.c
 create mode 100644 lib_microblaze/bdinfo.c
 create mode 100644 lib_mips/bdinfo.c
 create mode 100644 lib_nios/bdinfo.c
 create mode 100644 lib_nios2/bdinfo.c
 create mode 100644 lib_ppc/bdinfo.c
 create mode 100644 lib_sh/bdinfo.c
 create mode 100644 lib_sparc/bdinfo.c
common/cmd_bdinfo.c +78 -384
dissimilarity index 88%
index 700314b..2d83b93 100644
@@ -1,384 +1,78 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * Boot support
- */
-#include <common.h>
-#include <command.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static void print_num(const char *, ulong);
-
-static void print_eth(int idx);
-
-#ifndef CONFIG_ARM	/* PowerPC and other */
-static void print_lnum(const char *, u64);
-
-#ifdef CONFIG_PPC
-static void print_str(const char *, const char *);
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-	char buf[32];
-
-#ifdef DEBUG
-	print_num ("bd address",    (ulong)bd		);
-#endif
-	print_num ("memstart",	    bd->bi_memstart	);
-	print_lnum ("memsize", 	    bd->bi_memsize	);
-	print_num ("flashstart",    bd->bi_flashstart	);
-	print_num ("flashsize",	    bd->bi_flashsize	);
-	print_num ("flashoffset",   bd->bi_flashoffset	);
-	print_num ("sramstart",	    bd->bi_sramstart	);
-	print_num ("sramsize",	    bd->bi_sramsize	);
-#if defined(CONFIG_5xx)  || defined(CONFIG_8xx) || \
-    defined(CONFIG_8260) || defined(CONFIG_E500)
-	print_num ("immr_base",	    bd->bi_immr_base	);
-#endif
-	print_num ("bootflags",	    bd->bi_bootflags	);
-#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
-    defined(CONFIG_405EP) || defined(CONFIG_XILINX_405) || \
-    defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
-    defined(CONFIG_440EPX) || defined(CONFIG_440GRX) ||	\
-    defined(CONFIG_440SP) || defined(CONFIG_440SPE)
-	print_str ("procfreq",	    strmhz(buf, bd->bi_procfreq));
-	print_str ("plb_busfreq",   strmhz(buf, bd->bi_plb_busfreq));
-#if defined(CONFIG_405GP) || defined(CONFIG_405EP) || defined(CONFIG_XILINX_405) || \
-    defined(CONFIG_440EP) || defined(CONFIG_440GR) || defined(CONFIG_440SPE) || \
-    defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-	print_str ("pci_busfreq",   strmhz(buf, bd->bi_pci_busfreq));
-#endif
-#else	/* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
-#if defined(CONFIG_CPM2)
-	print_str ("vco",	    strmhz(buf, bd->bi_vco));
-	print_str ("sccfreq",	    strmhz(buf, bd->bi_sccfreq));
-	print_str ("brgfreq",	    strmhz(buf, bd->bi_brgfreq));
-#endif
-	print_str ("intfreq",	    strmhz(buf, bd->bi_intfreq));
-#if defined(CONFIG_CPM2)
-	print_str ("cpmfreq",	    strmhz(buf, bd->bi_cpmfreq));
-#endif
-	print_str ("busfreq",	    strmhz(buf, bd->bi_busfreq));
-#endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
-#if defined(CONFIG_MPC8220)
-	print_str ("inpfreq",	    strmhz(buf, bd->bi_inpfreq));
-	print_str ("flbfreq",	    strmhz(buf, bd->bi_flbfreq));
-	print_str ("pcifreq",	    strmhz(buf, bd->bi_pcifreq));
-	print_str ("vcofreq",	    strmhz(buf, bd->bi_vcofreq));
-	print_str ("pevfreq",	    strmhz(buf, bd->bi_pevfreq));
-#endif
-
-	print_eth(0);
-#if defined(CONFIG_HAS_ETH1)
-	print_eth(1);
-#endif
-#if defined(CONFIG_HAS_ETH2)
-	print_eth(2);
-#endif
-#if defined(CONFIG_HAS_ETH3)
-	print_eth(3);
-#endif
-#if defined(CONFIG_HAS_ETH4)
-	print_eth(4);
-#endif
-#if defined(CONFIG_HAS_ETH5)
-	print_eth(5);
-#endif
-
-#ifdef CONFIG_HERMES
-	print_str ("ethspeed",	    strmhz(buf, bd->bi_ethspeed));
-#endif
-	printf ("IP addr     = %pI4\n", &bd->bi_ip_addr);
-	printf ("baudrate    = %6ld bps\n", bd->bi_baudrate   );
-	return 0;
-}
-
-#elif defined(CONFIG_NIOS) /* NIOS*/
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_num ("memstart",		(ulong)bd->bi_memstart);
-	print_lnum ("memsize",		(u64)bd->bi_memsize);
-	print_num ("flashstart",	(ulong)bd->bi_flashstart);
-	print_num ("flashsize",		(ulong)bd->bi_flashsize);
-	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
-
-	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-	printf ("baudrate    = %ld bps\n", bd->bi_baudrate);
-
-	return 0;
-}
-
-#elif defined(CONFIG_NIOS2) /* Nios-II */
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_num ("mem start",		(ulong)bd->bi_memstart);
-	print_lnum ("mem size",		(u64)bd->bi_memsize);
-	print_num ("flash start",	(ulong)bd->bi_flashstart);
-	print_num ("flash size",	(ulong)bd->bi_flashsize);
-	print_num ("flash offset",	(ulong)bd->bi_flashoffset);
-
-#if defined(CONFIG_SYS_SRAM_BASE)
-	print_num ("sram start",	(ulong)bd->bi_sramstart);
-	print_num ("sram size",		(ulong)bd->bi_sramsize);
-#endif
-
-#if defined(CONFIG_CMD_NET)
-	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-#endif
-
-	printf ("baudrate    = %ld bps\n", bd->bi_baudrate);
-
-	return 0;
-}
-#elif defined(CONFIG_MICROBLAZE) /* ! PPC, which leaves Microblaze */
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-	print_num ("mem start      ",	(ulong)bd->bi_memstart);
-	print_lnum ("mem size       ",	(u64)bd->bi_memsize);
-	print_num ("flash start    ",	(ulong)bd->bi_flashstart);
-	print_num ("flash size     ",	(ulong)bd->bi_flashsize);
-	print_num ("flash offset   ",	(ulong)bd->bi_flashoffset);
-#if defined(CONFIG_SYS_SRAM_BASE)
-	print_num ("sram start     ",	(ulong)bd->bi_sramstart);
-	print_num ("sram size      ",	(ulong)bd->bi_sramsize);
-#endif
-#if defined(CONFIG_CMD_NET)
-	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-#endif
-	printf ("baudrate    = %ld bps\n", (ulong)bd->bi_baudrate);
-	return 0;
-}
-
-#elif defined(CONFIG_SPARC)	/* SPARC */
-int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-
-#ifdef DEBUG
-	print_num("bd address             ", (ulong) bd);
-#endif
-	print_num("memstart               ", bd->bi_memstart);
-	print_lnum("memsize                ", bd->bi_memsize);
-	print_num("flashstart             ", bd->bi_flashstart);
-	print_num("CONFIG_SYS_MONITOR_BASE       ", CONFIG_SYS_MONITOR_BASE);
-	print_num("CONFIG_ENV_ADDR           ", CONFIG_ENV_ADDR);
-	printf("CONFIG_SYS_RELOC_MONITOR_BASE = 0x%lx (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE,
-	       CONFIG_SYS_MONITOR_LEN);
-	printf("CONFIG_SYS_MALLOC_BASE        = 0x%lx (%d)\n", CONFIG_SYS_MALLOC_BASE,
-	       CONFIG_SYS_MALLOC_LEN);
-	printf("CONFIG_SYS_INIT_SP_OFFSET     = 0x%lx (%d)\n", CONFIG_SYS_INIT_SP_OFFSET,
-	       CONFIG_SYS_STACK_SIZE);
-	printf("CONFIG_SYS_PROM_OFFSET        = 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET,
-	       CONFIG_SYS_PROM_SIZE);
-	printf("CONFIG_SYS_GBL_DATA_OFFSET    = 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET,
-	       CONFIG_SYS_GBL_DATA_SIZE);
-
-#if defined(CONFIG_CMD_NET)
-	print_eth(0);
-	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-#endif
-	printf("baudrate               = %6ld bps\n", bd->bi_baudrate);
-	return 0;
-}
-
-#elif defined(CONFIG_M68K) /* M68K */
-static void print_str(const char *, const char *);
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-	char buf[32];
-
-	print_num ("memstart",		(ulong)bd->bi_memstart);
-	print_lnum ("memsize",		(u64)bd->bi_memsize);
-	print_num ("flashstart",	(ulong)bd->bi_flashstart);
-	print_num ("flashsize",		(ulong)bd->bi_flashsize);
-	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
-#if defined(CONFIG_SYS_INIT_RAM_ADDR)
-	print_num ("sramstart",		(ulong)bd->bi_sramstart);
-	print_num ("sramsize",		(ulong)bd->bi_sramsize);
-#endif
-#if defined(CONFIG_SYS_MBAR)
-	print_num ("mbar",		bd->bi_mbar_base);
-#endif
-	print_str ("cpufreq",		strmhz(buf, bd->bi_intfreq));
-	print_str ("busfreq",		strmhz(buf, bd->bi_busfreq));
-#ifdef CONFIG_PCI
-	print_str ("pcifreq",		strmhz(buf, bd->bi_pcifreq));
-#endif
-#ifdef CONFIG_EXTRA_CLOCK
-	print_str ("flbfreq",		strmhz(buf, bd->bi_flbfreq));
-	print_str ("inpfreq",		strmhz(buf, bd->bi_inpfreq));
-	print_str ("vcofreq",		strmhz(buf, bd->bi_vcofreq));
-#endif
-#if defined(CONFIG_CMD_NET)
-	print_eth(0);
-#if defined(CONFIG_HAS_ETH1)
-	print_eth(1);
-#endif
-#if defined(CONFIG_HAS_ETH2)
-	print_eth(2);
-#endif
-#if defined(CONFIG_HAS_ETH3)
-	print_eth(3);
-#endif
-
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-#endif
-	printf ("baudrate    = %ld bps\n", bd->bi_baudrate);
-
-	return 0;
-}
-
-#elif defined(CONFIG_BLACKFIN)
-static void print_str(const char *, const char *);
-
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-	char buf[32];
-
-	printf("U-Boot      = %s\n", bd->bi_r_version);
-	printf("CPU         = %s\n", bd->bi_cpu);
-	printf("Board       = %s\n", bd->bi_board_name);
-	print_str("VCO",         strmhz(buf, bd->bi_vco));
-	print_str("CCLK",        strmhz(buf, bd->bi_cclk));
-	print_str("SCLK",        strmhz(buf, bd->bi_sclk));
-
-	print_num("boot_params", (ulong)bd->bi_boot_params);
-	print_num("memstart",    (ulong)bd->bi_memstart);
-	print_lnum("memsize",    (u64)bd->bi_memsize);
-	print_num("flashstart",  (ulong)bd->bi_flashstart);
-	print_num("flashsize",   (ulong)bd->bi_flashsize);
-	print_num("flashoffset", (ulong)bd->bi_flashoffset);
-
-	print_eth(0);
-	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-	printf("baudrate    = %d bps\n", bd->bi_baudrate);
-
-	return 0;
-}
-
-#else /* ! PPC, which leaves MIPS */
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	bd_t *bd = gd->bd;
-
-	print_num ("boot_params",	(ulong)bd->bi_boot_params);
-	print_num ("memstart",		(ulong)bd->bi_memstart);
-	print_lnum ("memsize",		(u64)bd->bi_memsize);
-	print_num ("flashstart",	(ulong)bd->bi_flashstart);
-	print_num ("flashsize",		(ulong)bd->bi_flashsize);
-	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
-
-	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-	printf ("baudrate    = %d bps\n", bd->bi_baudrate);
-
-	return 0;
-}
-#endif  /* MIPS */
-
-#else	/* ARM */
-
-int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-	int i;
-	bd_t *bd = gd->bd;
-
-	print_num ("arch_number",	bd->bi_arch_number);
-	print_num ("env_t",		(ulong)bd->bi_env);
-	print_num ("boot_params",	(ulong)bd->bi_boot_params);
-
-	for (i=0; i<CONFIG_NR_DRAM_BANKS; ++i) {
-		print_num("DRAM bank",	i);
-		print_num("-> start",	bd->bi_dram[i].start);
-		print_num("-> size",	bd->bi_dram[i].size);
-	}
-
-#if defined(CONFIG_CMD_NET)
-	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-#endif
-	printf ("baudrate    = %d bps\n", bd->bi_baudrate);
-
-	return 0;
-}
-
-#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
-
-static void print_num(const char *name, ulong value)
-{
-	printf ("%-12s= 0x%08lX\n", name, value);
-}
-
-static void print_eth(int idx)
-{
-	char name[10], *val;
-	if (idx)
-		sprintf(name, "eth%iaddr", idx);
-	else
-		strcpy(name, "ethaddr");
-	val = getenv(name);
-	if (!val)
-		val = "(not set)";
-	printf("%-12s= %s\n", name, val);
-}
-
-#ifndef CONFIG_ARM
-static void print_lnum(const char *name, u64 value)
-{
-	printf ("%-12s= 0x%.8llX\n", name, value);
-}
-#endif
-
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_BLACKFIN)
-static void print_str(const char *name, const char *str)
-{
-	printf ("%-12s= %6s MHz\n", name, str);
-}
-#endif	/* CONFIG_PPC */
-
-
-/* -------------------------------------------------------------------- */
-
-U_BOOT_CMD(
-	bdinfo,	1,	1,	do_bdinfo,
-	"print Board Info structure",
-	NULL
-);
+/*
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * Boot support
+ */
+#include <common.h>
+#include <command.h>
+#include <bdinfo.h>
+
+void board_bdinfo(cmd_tbl_t *, int, int, char **) __attribute__((weak));
+void cpu_bdinfo(cmd_tbl_t *, int, int, char **) __attribute__((weak));
+void soc_bdinfo(cmd_tbl_t *, int, int, char **) __attribute__((weak));
+
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	/* call arch bdinfo */
+	arch_bdinfo(cmdtp, flag, argc, argv);
+
+	/* call cpu bdinfo */
+	if (cpu_bdinfo) {
+		puts("CPU Info\n");
+		cpu_bdinfo(cmdtp, flag, argc, argv);
+	}
+
+	/* call soc bdinfo */
+	if (soc_bdinfo) {
+		puts("SOC Info\n");
+		soc_bdinfo(cmdtp, flag, argc, argv);
+	}
+
+	/* call board bdinfo */
+	if (board_bdinfo) {
+		puts("Board Info\n");
+		board_bdinfo(cmdtp, flag, argc, argv);
+	}
+
+	return 0;
+}
+
+void print_eth(int idx)
+{
+	char name[10], *val;
+	if (idx)
+		sprintf(name, "eth%iaddr", idx);
+	else
+		strcpy(name, "ethaddr");
+	val = getenv(name);
+	if (!val)
+		val = "(not set)";
+	printf("%-12s= %s\n", name, val);
+}
+
+U_BOOT_CMD(
+	bdinfo,	1,	1,	do_bdinfo,
+	"print Board Info structure",
+	NULL
+);
include/bdinfo.h new file +49 -0

49 lines not on this page · raw message

lib_arm/Makefile +1 -0
index c8795b2..3ca7c74 100644
@@ -32,6 +32,7 @@ SOBJS-y	+= _modsi3.o
 SOBJS-y	+= _udivsi3.o
 SOBJS-y	+= _umodsi3.o
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= cache.o
lib_arm/bdinfo.c new file +53 -0

53 lines not on this page · raw message

lib_avr32/Makefile +1 -0
index 37b8051..b014721 100644
@@ -29,6 +29,7 @@ LIB	= $(obj)lib$(ARCH).a
 
 SOBJS-y	+= memset.o
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= interrupts.o
lib_avr32/bdinfo.c new file +47 -0

47 lines not on this page · raw message

lib_blackfin/Makefile +1 -0
index 46ef7f3..44b9660 100644
@@ -36,6 +36,7 @@ SOBJS-y	+= memcpy.o
 SOBJS-y	+= memmove.o
 SOBJS-y	+= memset.o
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= boot.o
 COBJS-y	+= cache.o
lib_blackfin/bdinfo.c new file +55 -0

55 lines not on this page · raw message

lib_i386/Makefile +1 -0
index 4fbcd08..7ed130e 100644
@@ -29,6 +29,7 @@ SOBJS-y	+= bios.o
 SOBJS-y	+= bios_pci.o
 SOBJS-y	+= realmode_switch.o
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= bios_setup.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
lib_i386/bdinfo.c new file +47 -0

47 lines not on this page · raw message

lib_m68k/Makefile +1 -0
index 6db35ed..d261d7e 100644
@@ -27,6 +27,7 @@ LIB	= $(obj)lib$(ARCH).a
 
 SOBJS-y	+=
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= cache.o
lib_m68k/bdinfo.c new file +75 -0

75 lines not on this page · raw message

lib_microblaze/Makefile +1 -0
index 9b0f296..821d1cf 100644
@@ -27,6 +27,7 @@ LIB	= $(obj)lib$(ARCH).a
 
 SOBJS-y	+=
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= cache.o
lib_microblaze/bdinfo.c new file +51 -0

51 lines not on this page · raw message

lib_mips/Makefile +1 -0
index 7967e58..a42219c 100644
@@ -27,6 +27,7 @@ LIB	= $(obj)lib$(ARCH).a
 
 SOBJS-y	+=
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 ifeq ($(CONFIG_QEMU_MIPS),y)
 COBJS-y	+= bootm_qemu_mips.o
lib_mips/bdinfo.c new file +47 -0

47 lines not on this page · raw message

lib_nios/Makefile +1 -0
index f66e989..f50605c 100644
@@ -27,6 +27,7 @@ LIB	= $(obj)lib$(ARCH).a
 
 SOBJS-y	+=
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= cache.o
lib_nios/bdinfo.c new file +46 -0

46 lines not on this page · raw message

lib_nios2/Makefile +1 -0
index b69bc38..f5a7bbe 100644
@@ -27,6 +27,7 @@ LIB	= $(obj)lib$(ARCH).a
 
 SOBJS-y	+= cache.o
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= divmod.o
lib_nios2/bdinfo.c new file +54 -0

54 lines not on this page · raw message

lib_ppc/Makefile +1 -0
index 60ea0c9..865cfc0 100644
@@ -30,6 +30,7 @@ SOBJS-y	+= ppcstring.o
 SOBJS-y	+= ticks.o
 
 COBJS-y	+= bat_rw.o
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= cache.o
lib_ppc/bdinfo.c new file +107 -0

107 lines not on this page · raw message

lib_sh/Makefile +1 -0
index f7c6479..e7ff16d 100644
@@ -24,6 +24,7 @@ LIB	= $(obj)lib$(ARCH).a
 
 SOBJS-y	+=
 
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 ifeq ($(CONFIG_SH2),y)
lib_sh/bdinfo.c new file +47 -0

47 lines not on this page · raw message

lib_sparc/Makefile +9 -4
index 040ca10..0952bd9 100644
@@ -25,12 +25,17 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(ARCH).a
 
-SOBJS	=
+SOBJS-y	+=
 
-COBJS	= board.o cache.o interrupts.o time.o bootm.o
+COBJS-$(CONFIG_CMD_BDI)	+= bdinfo.o
+COBJS-y	+= board.o
+COBJS-y	+= cache.o
+COBJS-y	+= interrupts.o
+COBJS-y	+= time.o
+COBJS-y	+= bootm.o
 
-SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
+SRCS	:= $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
 
 $(LIB):	$(obj).depend $(OBJS)
 	$(AR) $(ARFLAGS) $@ $(OBJS)
lib_sparc/bdinfo.c new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
1.5.6.5
#9 lore raw

PATCH 2/2 bdinfo: coding style cleanup

---
 common/cmd_bdinfo.c     |    6 ++++-
 lib_arm/bdinfo.c        |   10 ++++----
 lib_avr32/bdinfo.c      |   16 +++++++-------
 lib_i386/bdinfo.c       |   16 +++++++-------
 lib_m68k/bdinfo.c       |   32 ++++++++++++++--------------
 lib_microblaze/bdinfo.c |   18 +++++++-------
 lib_mips/bdinfo.c       |   16 +++++++-------
 lib_nios/bdinfo.c       |   14 ++++++------
 lib_nios2/bdinfo.c      |   18 +++++++-------
 lib_ppc/bdinfo.c        |   54 +++++++++++++++++++++++-----------------------
 lib_sh/bdinfo.c         |   16 +++++++-------
 11 files changed, 110 insertions(+), 106 deletions(-)
common/cmd_bdinfo.c +5 -1
index 2d83b93..db25330 100644
@@ -60,14 +60,18 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 void print_eth(int idx)
 {
-	char name[10], *val;
+	char name[10];
+	char *val;
+
 	if (idx)
 		sprintf(name, "eth%iaddr", idx);
 	else
 		strcpy(name, "ethaddr");
+
 	val = getenv(name);
 	if (!val)
 		val = "(not set)";
+
 	printf("%-12s= %s\n", name, val);
 }
 
lib_arm/bdinfo.c +5 -5
index 0e5084b..d5b5a4b 100644
@@ -35,9 +35,9 @@ void arch_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	int i;
 	bd_t *bd = gd->bd;
 
-	print_num ("arch_number",	bd->bi_arch_number);
-	print_num ("env_t",		(ulong)bd->bi_env);
-	print_num ("boot_params",	(ulong)bd->bi_boot_params);
+	print_num("arch_number",	bd->bi_arch_number);
+	print_num("env_t",		(ulong)bd->bi_env);
+	print_num("boot_params",	(ulong)bd->bi_boot_params);
 
 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
 		print_num("DRAM bank",	i);
@@ -47,7 +47,7 @@ void arch_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 #if defined(CONFIG_CMD_NET)
 	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
+	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
 #endif
-	printf ("baudrate    = %d bps\n", bd->bi_baudrate);
+	printf("baudrate    = %d bps\n", bd->bi_baudrate);
 }
lib_avr32/bdinfo.c +8 -8
index 616481d..a040c7a 100644
@@ -34,14 +34,14 @@ void arch_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	bd_t *bd = gd->bd;
 
-	print_num ("boot_params",	(ulong)bd->bi_boot_params);
-	print_num ("memstart",		(ulong)bd->bi_memstart);
-	print_lnum ("memsize",		(u64)bd->bi_memsize);
-	print_num ("flashstart",	(ulong)bd->bi_flashstart);
-	print_num ("flashsize",		(ulong)bd->bi_flashsize);
-	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
+	print_num("boot_params",	(ulong)bd->bi_boot_params);
+	print_num("memstart",		(ulong)bd->bi_memstart);
+	print_lnum("memsize",		(u64)bd->bi_memsize);
+	print_num("flashstart",		(ulong)bd->bi_flashstart);
+	print_num("flashsize",		(ulong)bd->bi_flashsize);
+	print_num("flashoffset",	(ulong)bd->bi_flashoffset);
 
 	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-	printf ("baudrate    = %d bps\n", bd->bi_baudrate);
+	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
+	printf("baudrate    = %d bps\n", bd->bi_baudrate);
 }
lib_i386/bdinfo.c +8 -8
index 616481d..a040c7a 100644
@@ -34,14 +34,14 @@ void arch_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	bd_t *bd = gd->bd;
 
-	print_num ("boot_params",	(ulong)bd->bi_boot_params);
-	print_num ("memstart",		(ulong)bd->bi_memstart);
-	print_lnum ("memsize",		(u64)bd->bi_memsize);
-	print_num ("flashstart",	(ulong)bd->bi_flashstart);
-	print_num ("flashsize",		(ulong)bd->bi_flashsize);
-	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
+	print_num("boot_params",	(ulong)bd->bi_boot_params);
+	print_num("memstart",		(ulong)bd->bi_memstart);
+	print_lnum("memsize",		(u64)bd->bi_memsize);
+	print_num("flashstart",		(ulong)bd->bi_flashstart);
+	print_num("flashsize",		(ulong)bd->bi_flashsize);
+	print_num("flashoffset",	(ulong)bd->bi_flashoffset);
 
 	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-	printf ("baudrate    = %d bps\n", bd->bi_baudrate);
+	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
+	printf("baudrate    = %d bps\n", bd->bi_baudrate);
 }
lib_m68k/bdinfo.c +16 -16
index e77a1cf..e271145 100644
@@ -35,27 +35,27 @@ void arch_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	bd_t *bd = gd->bd;
 	char buf[32];
 
-	print_num ("memstart",		(ulong)bd->bi_memstart);
-	print_lnum ("memsize",		(u64)bd->bi_memsize);
-	print_num ("flashstart",	(ulong)bd->bi_flashstart);
-	print_num ("flashsize",		(ulong)bd->bi_flashsize);
-	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
+	print_num("memstart",		(ulong)bd->bi_memstart);
+	print_lnum("memsize",		(u64)bd->bi_memsize);
+	print_num("flashstart",		(ulong)bd->bi_flashstart);
+	print_num("flashsize",		(ulong)bd->bi_flashsize);
+	print_num("flashoffset",	(ulong)bd->bi_flashoffset);
 #if defined(CONFIG_SYS_INIT_RAM_ADDR)
-	print_num ("sramstart",		(ulong)bd->bi_sramstart);
-	print_num ("sramsize",		(ulong)bd->bi_sramsize);
+	print_num("sramstart",		(ulong)bd->bi_sramstart);
+	print_num("sramsize",		(ulong)bd->bi_sramsize);
 #endif
 #if defined(CONFIG_SYS_MBAR)
-	print_num ("mbar",		bd->bi_mbar_base);
+	print_num("mbar",		bd->bi_mbar_base);
 #endif
-	print_str ("cpufreq",		strmhz(buf, bd->bi_intfreq));
-	print_str ("busfreq",		strmhz(buf, bd->bi_busfreq));
+	print_str("cpufreq",		strmhz(buf, bd->bi_intfreq));
+	print_str("busfreq",		strmhz(buf, bd->bi_busfreq));
 #ifdef CONFIG_PCI
-	print_str ("pcifreq",		strmhz(buf, bd->bi_pcifreq));
+	print_str("pcifreq",		strmhz(buf, bd->bi_pcifreq));
 #endif
 #ifdef CONFIG_EXTRA_CLOCK
-	print_str ("flbfreq",		strmhz(buf, bd->bi_flbfreq));
-	print_str ("inpfreq",		strmhz(buf, bd->bi_inpfreq));
-	print_str ("vcofreq",		strmhz(buf, bd->bi_vcofreq));
+	print_str("flbfreq",		strmhz(buf, bd->bi_flbfreq));
+	print_str("inpfreq",		strmhz(buf, bd->bi_inpfreq));
+	print_str("vcofreq",		strmhz(buf, bd->bi_vcofreq));
 #endif
 #if defined(CONFIG_CMD_NET)
 	print_eth(0);
@@ -69,7 +69,7 @@ void arch_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	print_eth(3);
 #endif
 
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
+	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
 #endif
-	printf ("baudrate    = %ld bps\n", bd->bi_baudrate);
+	printf("baudrate    = %ld bps\n", bd->bi_baudrate);
 }
lib_microblaze/bdinfo.c +9 -9
index eba2f4d..908f94e 100644
@@ -34,18 +34,18 @@ void arch_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	bd_t *bd = gd->bd;
 
-	print_num ("mem start      ",	(ulong)bd->bi_memstart);
-	print_lnum ("mem size       ",	(u64)bd->bi_memsize);
-	print_num ("flash start    ",	(ulong)bd->bi_flashstart);
-	print_num ("flash size     ",	(ulong)bd->bi_flashsize);
-	print_num ("flash offset   ",	(ulong)bd->bi_flashoffset);
+	print_num("mem start      ",	(ulong)bd->bi_memstart);
+	print_lnum("mem size       ",	(u64)bd->bi_memsize);
+	print_num("flash start    ",	(ulong)bd->bi_flashstart);
+	print_num("flash size     ",	(ulong)bd->bi_flashsize);
+	print_num("flash offset   ",	(ulong)bd->bi_flashoffset);
 #if defined(CONFIG_SYS_SRAM_BASE)
-	print_num ("sram start     ",	(ulong)bd->bi_sramstart);
-	print_num ("sram size      ",	(ulong)bd->bi_sramsize);
+	print_num("sram start     ",	(ulong)bd->bi_sramstart);
+	print_num("sram size      ",	(ulong)bd->bi_sramsize);
 #endif
 #if defined(CONFIG_CMD_NET)
 	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
+	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
 #endif
-	printf ("baudrate    = %ld bps\n", (ulong)bd->bi_baudrate);
+	printf("baudrate    = %ld bps\n", (ulong)bd->bi_baudrate);
 }
lib_mips/bdinfo.c +8 -8
index 616481d..a040c7a 100644
@@ -34,14 +34,14 @@ void arch_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	bd_t *bd = gd->bd;
 
-	print_num ("boot_params",	(ulong)bd->bi_boot_params);
-	print_num ("memstart",		(ulong)bd->bi_memstart);
-	print_lnum ("memsize",		(u64)bd->bi_memsize);
-	print_num ("flashstart",	(ulong)bd->bi_flashstart);
-	print_num ("flashsize",		(ulong)bd->bi_flashsize);
-	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
+	print_num("boot_params",	(ulong)bd->bi_boot_params);
+	print_num("memstart",		(ulong)bd->bi_memstart);
+	print_lnum("memsize",		(u64)bd->bi_memsize);
+	print_num("flashstart",		(ulong)bd->bi_flashstart);
+	print_num("flashsize",		(ulong)bd->bi_flashsize);
+	print_num("flashoffset",	(ulong)bd->bi_flashoffset);
 
 	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-	printf ("baudrate    = %d bps\n", bd->bi_baudrate);
+	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
+	printf("baudrate    = %d bps\n", bd->bi_baudrate);
 }
lib_nios/bdinfo.c +7 -7
index 6e42c24..2959c9d 100644
@@ -34,13 +34,13 @@ void arch_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	bd_t *bd = gd->bd;
 
-	print_num ("memstart",		(ulong)bd->bi_memstart);
-	print_lnum ("memsize",		(u64)bd->bi_memsize);
-	print_num ("flashstart",	(ulong)bd->bi_flashstart);
-	print_num ("flashsize",		(ulong)bd->bi_flashsize);
-	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
+	print_num("memstart",		(ulong)bd->bi_memstart);
+	print_lnum("memsize",		(u64)bd->bi_memsize);
+	print_num("flashstart",		(ulong)bd->bi_flashstart);
+	print_num("flashsize",		(ulong)bd->bi_flashsize);
+	print_num("flashoffset",	(ulong)bd->bi_flashoffset);
 
 	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-	printf ("baudrate    = %ld bps\n", bd->bi_baudrate);
+	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
+	printf("baudrate    = %ld bps\n", bd->bi_baudrate);
 }
lib_nios2/bdinfo.c +9 -9
index 5b39fb1..95836c6 100644
@@ -34,21 +34,21 @@ void arch_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	bd_t *bd = gd->bd;
 
-	print_num ("mem start",		(ulong)bd->bi_memstart);
-	print_lnum ("mem size",		(u64)bd->bi_memsize);
-	print_num ("flash start",	(ulong)bd->bi_flashstart);
-	print_num ("flash size",	(ulong)bd->bi_flashsize);
-	print_num ("flash offset",	(ulong)bd->bi_flashoffset);
+	print_num("mem start",		(ulong)bd->bi_memstart);
+	print_lnum("mem size",		(u64)bd->bi_memsize);
+	print_num("flash start",	(ulong)bd->bi_flashstart);
+	print_num("flash size",		(ulong)bd->bi_flashsize);
+	print_num("flash offset",	(ulong)bd->bi_flashoffset);
 
 #if defined(CONFIG_SYS_SRAM_BASE)
-	print_num ("sram start",	(ulong)bd->bi_sramstart);
-	print_num ("sram size",		(ulong)bd->bi_sramsize);
+	print_num("sram start",	(ulong)bd->bi_sramstart);
+	print_num("sram size",		(ulong)bd->bi_sramsize);
 #endif
 
 #if defined(CONFIG_CMD_NET)
 	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
+	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
 #endif
 
-	printf ("baudrate    = %ld bps\n", bd->bi_baudrate);
+	printf("baudrate    = %ld bps\n", bd->bi_baudrate);
 }
lib_ppc/bdinfo.c +27 -27

85 lines not on this page · raw message

lib_sh/bdinfo.c +8 -8
index 616481d..a040c7a 100644
@@ -34,14 +34,14 @@ void arch_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	bd_t *bd = gd->bd;
 
-	print_num ("boot_params",	(ulong)bd->bi_boot_params);
-	print_num ("memstart",		(ulong)bd->bi_memstart);
-	print_lnum ("memsize",		(u64)bd->bi_memsize);
-	print_num ("flashstart",	(ulong)bd->bi_flashstart);
-	print_num ("flashsize",		(ulong)bd->bi_flashsize);
-	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
+	print_num("boot_params",	(ulong)bd->bi_boot_params);
+	print_num("memstart",		(ulong)bd->bi_memstart);
+	print_lnum("memsize",		(u64)bd->bi_memsize);
+	print_num("flashstart",		(ulong)bd->bi_flashstart);
+	print_num("flashsize",		(ulong)bd->bi_flashsize);
+	print_num("flashoffset",	(ulong)bd->bi_flashoffset);
 
 	print_eth(0);
-	printf ("ip_addr     = %pI4\n", &bd->bi_ip_addr);
-	printf ("baudrate    = %d bps\n", bd->bi_baudrate);
+	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
+	printf("baudrate    = %d bps\n", bd->bi_baudrate);
 }
Signature · 1 line
1.5.6.5
#10 lore raw

PATCH v4 1/2 cmd_bdinfo: move implementation to arch instead of common

In reply to Jean-Christophe PLAGNIOL-VILLARD

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 46 lines · In message <[email protected]> you wrote:

introduce 3 new weak functions board_bdinfo, cpu_bdinfo and soc_bdinfo to allow board, cpu and soc to print more information

---
Change from V3
SOC weak function
and Mike Suggestion

Best Regards,
J.

 common/cmd_bdinfo.c     |  462 ++++++++---------------------------------------
 include/bdinfo.h        |   49 +++++
 lib_arm/Makefile        |    1 +
 lib_arm/bdinfo.c        |   53 ++++++
 lib_avr32/Makefile      |    1 +
 lib_avr32/bdinfo.c      |   47 +++++
 lib_blackfin/Makefile   |    1 +
 lib_blackfin/bdinfo.c   |   55 ++++++
 lib_i386/Makefile       |    1 +
 lib_i386/bdinfo.c       |   47 +++++
 lib_m68k/Makefile       |    1 +
 lib_m68k/bdinfo.c       |   75 ++++++++
 lib_microblaze/Makefile |    1 +
 lib_microblaze/bdinfo.c |   51 +++++
 lib_mips/Makefile       |    1 +
 lib_mips/bdinfo.c       |   47 +++++
 lib_nios/Makefile       |    1 +
 lib_nios/bdinfo.c       |   46 +++++
 lib_nios2/Makefile      |    1 +
 lib_nios2/bdinfo.c      |   54 ++++++
 lib_ppc/Makefile        |    1 +
 lib_ppc/bdinfo.c        |  107 +++++++++++
 lib_sh/Makefile         |    1 +
 lib_sh/bdinfo.c         |   47 +++++
 lib_sparc/Makefile      |   13 +-
 lib_sparc/bdinfo.c      |   61 ++++++
 26 files changed, 837 insertions(+), 388 deletions(-)
 rewrite common/cmd_bdinfo.c (88%)
 create mode 100644 include/bdinfo.h
 create mode 100644 lib_arm/bdinfo.c
 create mode 100644 lib_avr32/bdinfo.c
 create mode 100644 lib_blackfin/bdinfo.c
 create mode 100644 lib_i386/bdinfo.c
Quoted 8 lines
 create mode 100644 lib_m68k/bdinfo.c
 create mode 100644 lib_microblaze/bdinfo.c
 create mode 100644 lib_mips/bdinfo.c
 create mode 100644 lib_nios/bdinfo.c
 create mode 100644 lib_nios2/bdinfo.c
 create mode 100644 lib_ppc/bdinfo.c
 create mode 100644 lib_sh/bdinfo.c
 create mode 100644 lib_sparc/bdinfo.c

Sorry, does not apply any more.

Please rebase and resubmit (also "[PATCH 2/2] bdinfo: coding style cleanup" which depends on this).

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I'm not a god, I was misquoted."                 - Lister, Red Dwarf