On Wed, 2010-01-13 at 13:23 -0600, LAMBA Jaideep wrote:
> >> It means, if the magic is byteswapped, then the rest of the EEPROM
> buffer should be byteswapped as well.
>
> This might actually be true. I compiled ath_info with a workaround for
> MAC version check and ath_info dump is showing this device to be 2Ghz
> device as compared to 5Ghz device. I guess ath_hal needs to read EEPROM
> differently with byte swapping. What would be a good place to start
> making that code change in madwifi ?
It looks like there is some byteswap code in the HAL already. However,
it won't be reached if byteswapping is needed because the magic value is
checked earlier in the same function and there is no fallback for the
byteswapped magic.
Please test this patch:
--- a/ath_hal/ah_eeprom_v14.c
+++ b/ath_hal/ah_eeprom_v14.c
@@ -313,7 +313,11 @@ ath_hal_v14EepromAttach(struct ath_hal *ah)
}
HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s Eeprom Magic = 0x%x\n",
__func__, magic);
- if (magic != AR5416_EEPROM_MAGIC) {
+ if (magic == AR5416_EEPROM_MAGIC)
+ need_swap = 0;
+ else if (magic == __bswap16(AR5416_EEPROM_MAGIC))
+ need_swap = 1;
+ else {
HALDEBUG(ah, HAL_DEBUG_ANY, "Bad magic number\n");
return HAL_EEMAGIC;
}
@@ -335,7 +339,7 @@ ath_hal_v14EepromAttach(struct ath_hal *ah)
}
}
/* Convert to eeprom native eeprom endian format */
- if (isBigEndian()) {
+ if (need_swap) {
for (w = 0; w < NW(struct ar5416eeprom); w++)
eep_data[w] = __bswap16(eep_data[w]);
}
--
Regards,
Pavel Roskin
|