From: Wolfgang Denk Date: Wed, 20 May 2009 21:39:46 +0200 Subject: [U-Boot] [PATCH 10/15] Update the number of ethxaddr in reading system eeprom In-Reply-To: <1242837043-8243-10-git-send-email-Haiying.Wang@freescale.com> References: <1242837043-8243-1-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-2-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-3-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-4-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-5-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-6-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-7-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-8-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-9-git-send-email-Haiying.Wang@freescale.com> <1242837043-8243-10-git-send-email-Haiying.Wang@freescale.com> Message-ID: <20090520193946.5F100832E416@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Haiying Wang, In message <1242837043-8243-10-git-send-email-Haiying.Wang@freescale.com> you wrote: > 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 > --- > 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 (yorksun at freescale.com) > * Haiying Wang (haiying.wang at freescale.com) > * Timur Tabi (timur at 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; > + } Instead of repeatedly using the magic number 8 here, this should be a #define in som eheader file. Best regards, Wolfgang Denk -- 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 If you're not part of the solution, then you're part of the precipi- tate.