From owner-freebsd-arm@FreeBSD.ORG Fri Jun 8 19:59:05 2007 Return-Path: X-Original-To: arm@freebsd.org Delivered-To: freebsd-arm@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4179816A421 for ; Fri, 8 Jun 2007 19:59:05 +0000 (UTC) (envelope-from bkoenig@alpha-tierchen.de) Received: from mail.liberty-hosting.de (mail.smartterra.de [195.225.132.203]) by mx1.freebsd.org (Postfix) with ESMTP id 016DC13C44C for ; Fri, 8 Jun 2007 19:59:04 +0000 (UTC) (envelope-from bkoenig@alpha-tierchen.de) Received: from mail.liberty-hosting.de ([195.225.132.203]) by localhost (liberty-mail [195.225.132.203]) (amavisd-new, port 10024) with ESMTP id 31719-05; Fri, 8 Jun 2007 21:59:02 +0200 (CEST) Received: from home.alpha-tierchen.de (port-212-202-170-5.dynamic.qsc.de [212.202.170.5]) by mail.liberty-hosting.de (Postfix) with ESMTP id F077615BB5C; Fri, 8 Jun 2007 21:59:01 +0200 (CEST) Received: from webmail.alpha-tierchen.de (localhost [127.0.0.1]) by home.alpha-tierchen.de (Postfix) with ESMTP id 4566945046; Fri, 8 Jun 2007 21:58:59 +0200 (CEST) Received: from 2001:6f8:101e:0:20e:cff:fe6d:6adb (SquirrelMail authenticated user bkoenig) by webmail.alpha-tierchen.de with HTTP; Fri, 8 Jun 2007 21:58:59 +0200 (CEST) Message-ID: <54751.2001:6f8:101e:0:20e:cff:fe6d:6adb.1181332739.squirrel@webmail.alpha-tierchen.de> In-Reply-To: <20070608.120902.-399284744.imp@bsdimp.com> References: <53385.2001:6f8:101e:0:20e:cff:fe6d:6adb.1181314300.squirrel@webmail.alpha-tierchen.de> <20070608.120902.-399284744.imp@bsdimp.com> Date: Fri, 8 Jun 2007 21:58:59 +0200 (CEST) From: =?iso-8859-1?Q?Bj=F6rn_K=F6nig?= To: "M. Warner Losh" User-Agent: SquirrelMail/1.4.10a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: by amavisd-new at mail.smartterra.de Cc: arm@freebsd.org Subject: Re: if_ate handles the bytes of the MAC address in a "wrong" order X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2007 19:59:05 -0000 M. Warner Losh wrote: > We use the following code: > low = RD4(sc, ETH_SA1L); > high = RD4(sc, ETH_SA1H); > if ((low | (high & 0xffff)) == 0) > return (ENXIO); > eaddr[0] = (high >> 8) & 0xff; > eaddr[1] = high & 0xff; > eaddr[2] = (low >> 24) & 0xff; > eaddr[3] = (low >> 16) & 0xff; > eaddr[4] = (low >> 8) & 0xff; > eaddr[5] = low & 0xff; > > which does look like it is wrong, based on what the text says. These are the register contents during execution of U-Boot: U-Boot> md fffbc098 8 fffbc098: 00000000 00000000 3ac25000 000051b4 .........P.:.Q.. fffbc0a8: 00000000 00000000 00000000 00000000 ................ ETH_SA2L = 3ac25000 ETH_SA2H = 000051b4 Our code makes the address 51:b4:3a:c2:50:00. The Linux code looks like this addr[0] = (lo & 0xff); addr[1] = (lo & 0xff00) >> 8; addr[2] = (lo & 0xff0000) >> 16; addr[3] = (lo & 0xff000000) >> 24; addr[4] = (hi & 0xff); addr[5] = (hi & 0xff00) >> 8; and we would get the MAC address 00:50:c2:3a:b4:51. It may be important that Linux makes a case differentiation because there is at least one boot loader out there that stores the MAC address exactly the other way round: addr[0] = (hi & 0xff00) >> 8; addr[1] = (hi & 0xff); addr[2] = (lo & 0xff000000) >> 24; addr[3] = (lo & 0xff0000) >> 16; addr[4] = (lo & 0xff00) >> 8; addr[5] = (lo & 0xff); with the comment "The CSB337 bootloader stores the MAC the wrong-way around." The code is from linux-2.6.21/drivers/net/arm/at91_ether.c line 385ff. Regards nröjB