[U-Boot] [PATCH 28/30] ppc: mark global bi_enet*addr as legacy

Mike Frysinger vapier at gentoo.org
Tue Feb 17 06:10:49 CET 2009


The environment is the canonical storage location of the mac address, so
we're killing off the global data location and moving everything to
querying the env directly.

In the ppc case, these things are part of the legacy ABI, so keep them
around but mark them as legacy so no new code will touch them.

Also stop calling load_sernum_ethaddr() since all boards now implement
this as a stub.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
CC: Ben Warren <biggerbadderben at gmail.com>
---
 include/asm-ppc/u-boot.h |   14 ++++------
 lib_ppc/board.c          |   60 +++++----------------------------------------
 2 files changed, 13 insertions(+), 61 deletions(-)

diff --git a/include/asm-ppc/u-boot.h b/include/asm-ppc/u-boot.h
index 7451905..e6c56e9 100644
--- a/include/asm-ppc/u-boot.h
+++ b/include/asm-ppc/u-boot.h
@@ -64,7 +64,7 @@ typedef struct bd_info {
 #endif
 	unsigned long	bi_bootflags;	/* boot / reboot flag (for LynxOS) */
 	unsigned long	bi_ip_addr;	/* IP Address */
-	unsigned char	bi_enetaddr[6];	/* Ethernet adress */
+	unsigned char	bi_enetaddr[6];	/* OLD: see README.enetaddr */
 	unsigned short	bi_ethspeed;	/* Ethernet speed in Mbps */
 	unsigned long	bi_intfreq;	/* Internal Freq, in MHz */
 	unsigned long	bi_busfreq;	/* Bus Freq, in MHz */
@@ -101,21 +101,19 @@ typedef struct bd_info {
 #endif
 
 #ifdef CONFIG_HAS_ETH1
-	/* second onboard ethernet port */
-	unsigned char   bi_enet1addr[6];
+	unsigned char   bi_enet1addr[6];	/* OLD: see README.enetaddr */
 #endif
 #ifdef CONFIG_HAS_ETH2
-	/* third onboard ethernet port */
-	unsigned char	bi_enet2addr[6];
+	unsigned char	bi_enet2addr[6];	/* OLD: see README.enetaddr */
 #endif
 #ifdef CONFIG_HAS_ETH3
-	unsigned char   bi_enet3addr[6];
+	unsigned char   bi_enet3addr[6];	/* OLD: see README.enetaddr */
 #endif
 #ifdef CONFIG_HAS_ETH4
-	unsigned char   bi_enet4addr[6];
+	unsigned char   bi_enet4addr[6];	/* OLD: see README.enetaddr */
 #endif
 #ifdef CONFIG_HAS_ETH5
-	unsigned char   bi_enet5addr[6];
+	unsigned char   bi_enet5addr[6];	/* OLD: see README.enetaddr */
 #endif
 
 #if defined(CONFIG_405GP) || defined(CONFIG_405EP) || \
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index 1160d2e..165cd1f 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -882,12 +882,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	mac_read_from_eeprom();
 #endif
 
-	s = getenv ("ethaddr");
-		for (i = 0; i < 6; ++i) {
-			bd->bi_enetaddr[i] = s ? simple_strtoul (s, &e, 16) : 0;
-			if (s)
-				s = (*e) ? e + 1 : e;
-		}
 #ifdef	CONFIG_HERMES
 	if ((gd->board_type >> 16) == 2)
 		bd->bi_ethspeed = gd->board_type & 0xFFFF;
@@ -895,64 +889,24 @@ void board_init_r (gd_t *id, ulong dest_addr)
 		bd->bi_ethspeed = 0xFFFF;
 #endif
 
+	/* kept around for legacy kernels only ... ignore the next section */
+	eth_getenv_enetaddr("ethaddr", bd->bi_enetaddr);
 #ifdef CONFIG_HAS_ETH1
-	/* handle the 2nd ethernet address */
-
-	s = getenv ("eth1addr");
-
-	for (i = 0; i < 6; ++i) {
-		bd->bi_enet1addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
-		if (s)
-			s = (*e) ? e + 1 : e;
-	}
+	eth_getenv_enetaddr("eth1addr", bd->bi_enet1addr);
 #endif
 #ifdef CONFIG_HAS_ETH2
-	/* handle the 3rd ethernet address */
-
-	s = getenv ("eth2addr");
-	for (i = 0; i < 6; ++i) {
-		bd->bi_enet2addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
-		if (s)
-			s = (*e) ? e + 1 : e;
-	}
+	eth_getenv_enetaddr("eth2addr", bd->bi_enet2addr);
 #endif
-
 #ifdef CONFIG_HAS_ETH3
-	/* handle 4th ethernet address */
-	s = getenv("eth3addr");
-	for (i = 0; i < 6; ++i) {
-		bd->bi_enet3addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
-		if (s)
-			s = (*e) ? e + 1 : e;
-	}
+	eth_getenv_enetaddr("eth3addr", bd->bi_enet3addr);
 #endif
-
 #ifdef CONFIG_HAS_ETH4
-	/* handle 5th ethernet address */
-	s = getenv("eth4addr");
-	for (i = 0; i < 6; ++i) {
-		bd->bi_enet4addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
-		if (s)
-			s = (*e) ? e + 1 : e;
-	}
+	eth_getenv_enetaddr("eth4addr", bd->bi_enet4addr);
 #endif
-
 #ifdef CONFIG_HAS_ETH5
-	/* handle 6th ethernet address */
-	s = getenv("eth5addr");
-	for (i = 0; i < 6; ++i) {
-		bd->bi_enet5addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
-		if (s)
-			s = (*e) ? e + 1 : e;
-	}
+	eth_getenv_enetaddr("eth5addr", bd->bi_enet5addr);
 #endif
 
-#if defined(CONFIG_TQM8xxL) || defined(CONFIG_TQM8260) || \
-    defined(CONFIG_TQM8272) || \
-    defined(CONFIG_CCM) || defined(CONFIG_KUP4K) || \
-    defined(CONFIG_KUP4X) || defined(CONFIG_PCS440EP)
-	load_sernum_ethaddr ();
-#endif
 	/* IP Address */
 	bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
 
-- 
1.6.1.3



More information about the U-Boot mailing list