Subject: Re: CVS commit: syssrc
To: None <soren@netbsd.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: source-changes
Date: 05/24/2000 21:57:47
In <200005240804.BAA03756@nb00.nas.nasa.gov>
soren@netbsd.org wrote:
> Module Name: syssrc
> Committed By: soren
> Date: Wed May 24 08:04:25 UTC 2000
>
> Modified Files:
> syssrc/sys/dev/ic: i82557.c
>
> Log Message:
> The EEPROM is little-endian.
I think using le16toh() in fxp_read_eeprom() is wrong.
The 93c46 EEPROM can be accessed only in 16bit word and
fxp_read_eeprom() just returns u_int16_t data.
There is no endianness dependency.
The problem is caused by using bcopy() to copy
myea[] (which is u_int16_t) to enaddr[] (which is u_int8_t).
It should be just like:
enaddr[0] = myea[0] & 0xff;
enaddr[1] = myea[0] >> 8;
enaddr[2] = myea[1] & 0xff;
enaddr[3] = myea[1] >> 8;
enaddr[4] = myea[2] & 0xff;
enaddr[5] = myea[2] >> 8;
Then no byte-swap code is needed.
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp