aboutsummaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorJoshua Oreman <oremanj@rwcr.net>2009-10-23 17:04:38 +0200
committerMichael Brown <mcb30@etherboot.org>2009-10-24 19:10:15 +0100
commit858b5fd253b50ad662ab34ec5be86c3ee004ec2d (patch)
tree6bfa19bafb8c66776a5fd984f430511494a8dc62 /src/drivers
parent8912e24fdc6b74c59f420c4e345730a974708d2f (diff)
downloadipxe-858b5fd253b50ad662ab34ec5be86c3ee004ec2d.zip
ipxe-858b5fd253b50ad662ab34ec5be86c3ee004ec2d.tar.gz
ipxe-858b5fd253b50ad662ab34ec5be86c3ee004ec2d.tar.bz2
[atl1e] Fix compilation on gcc-4.4.1-2.fc11.i586.
Error message was: [BUILD] bin/atl1e.oncc1: warnings being treated as errors drivers/net/atl1e.c: In function 'atl1e_get_permanent_address': drivers/net/atl1e.c:1326: error: dereferencing type-punned pointer will break strict-aliasing rules make: *** [bin/atl1e.o] Error 1 Reported-by: Giandomenico De Tullio <ghisha@email.it> Signed-off-by: Michael Brown <mcb30@etherboot.org> Modified-by: Michael Brown <mcb30@etherboot.org>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/net/atl1e.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/drivers/net/atl1e.c b/src/drivers/net/atl1e.c
index 664eba0..6c0b050 100644
--- a/src/drivers/net/atl1e.c
+++ b/src/drivers/net/atl1e.c
@@ -1296,14 +1296,14 @@ void atl1e_hw_set_mac_addr(struct atl1e_hw *hw)
*/
static int atl1e_get_permanent_address(struct atl1e_hw *hw)
{
- u32 addr[2];
+ union {
+ u32 dword[2];
+ u8 byte[8];
+ } hw_addr;
u32 i;
u32 twsi_ctrl_data;
u8 eth_addr[ETH_ALEN];
- /* init */
- addr[0] = addr[1] = 0;
-
if (!atl1e_check_eeprom_exist(hw)) {
/* eeprom exist */
twsi_ctrl_data = AT_READ_REG(hw, REG_TWSI_CTRL);
@@ -1320,10 +1320,11 @@ static int atl1e_get_permanent_address(struct atl1e_hw *hw)
}
/* maybe MAC-address is from BIOS */
- addr[0] = AT_READ_REG(hw, REG_MAC_STA_ADDR);
- addr[1] = AT_READ_REG(hw, REG_MAC_STA_ADDR + 4);
- *(u32 *) &eth_addr[2] = swap32(addr[0]);
- *(u16 *) &eth_addr[0] = swap16(*(u16 *)&addr[1]);
+ hw_addr.dword[0] = AT_READ_REG(hw, REG_MAC_STA_ADDR);
+ hw_addr.dword[1] = AT_READ_REG(hw, REG_MAC_STA_ADDR + 4);
+ for (i = 0; i < ETH_ALEN; i++) {
+ eth_addr[ETH_ALEN - i - 1] = hw_addr.byte[i];
+ }
memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN);
return 0;