We support up to 8 mac addresses in system eeprom, so we'd limit the mac_count
to 8, and update the number of ethxaddr if there is more than 4 ethernet ports.

Signed-off-by: Haiying Wang <haiying.w...@freescale.com>
---
 board/freescale/common/sys_eeprom.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/board/freescale/common/sys_eeprom.c 
b/board/freescale/common/sys_eeprom.c
index 988cb94..d71a5e4 100644
--- a/board/freescale/common/sys_eeprom.c
+++ b/board/freescale/common/sys_eeprom.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006, 2008 Freescale Semiconductor
+ * Copyright 2006, 2008-2009 Freescale Semiconductor
  * York Sun (york...@freescale.com)
  * Haiying Wang (haiying.w...@freescale.com)
  * Timur Tabi (ti...@freescale.com)
@@ -404,7 +404,14 @@ int mac_read_from_eeprom(void)
                }
        }
 
-       for (i = 0; i < min(4, e.mac_count); i++) {
+       /* Check the number of MAC address which is limited to 8 */
+       if (e.mac_count > 8) {
+               printf("Warning: The number of MAC address is greater"
+                       " than 8, force it to 8.\n");
+               e.mac_count = 8;
+       }
+
+       for (i = 0; i < e.mac_count; i++) {
                if (memcmp(&e.mac[i], "\0\0\0\0\0\0", 6) &&
                    memcmp(&e.mac[i], "\xFF\xFF\xFF\xFF\xFF\xFF", 6)) {
                        char ethaddr[18];
-- 
1.6.0.2

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to