diff --git a/hal/rtl8188e_hal_init.c b/hal/rtl8188e_hal_init.c index 3b54a04..8617c30 100755 --- a/hal/rtl8188e_hal_init.c +++ b/hal/rtl8188e_hal_init.c @@ -293,7 +293,7 @@ void efuse_read_phymap_from_txpktbuf( u32 start = 0, passing_time = 0; u8 reg_0x143 = 0; u8 reg_0x106 = 0; - u32 lo32 = 0, hi32 = 0; + __le32 lo32 = 0, hi32 = 0; u16 len = 0, count = 0; int i = 0; u16 limit = *size; @@ -329,51 +329,39 @@ void efuse_read_phymap_from_txpktbuf( } - lo32 = rtw_read32(adapter, REG_PKTBUF_DBG_DATA_L); - hi32 = rtw_read32(adapter, REG_PKTBUF_DBG_DATA_H); + /* data from EEPROM needs to be in LE */ + lo32 = cpu_to_le32(rtw_read32(adapter, REG_PKTBUF_DBG_DATA_L)); + hi32 = cpu_to_le32(rtw_read32(adapter, REG_PKTBUF_DBG_DATA_H)); - if(i==0) - { - #if 1 //for debug - u8 lenc[2]; - u16 lenbak, aaabak; - u16 aaa; - lenc[0] = rtw_read8(adapter, REG_PKTBUF_DBG_DATA_L); - lenc[1] = rtw_read8(adapter, REG_PKTBUF_DBG_DATA_L+1); + if (i == 0) { + /* Although lenc is only used in a debug statement, + * do not remove it as the rtw_read16() call consumes + * 2 bytes from the EEPROM source. + */ + u16 lenc = rtw_read16(adapter, REG_PKTBUF_DBG_DATA_L); - aaabak = le16_to_cpup((u16*)lenc); - lenbak = le16_to_cpu(*((u16*)lenc)); - aaa = le16_to_cpup((u16*)&lo32); - #endif - len = le16_to_cpu(*((u16*)&lo32)); + len = le32_to_cpu(lo32) & 0x0000ffff; + limit = (len - 2 < limit) ? len - 2 : limit; - limit = (len-2=count+2)?2:limit-count); + memcpy(pos, ((u8*)&lo32)+2, (limit>=count+2)?2:limit-count); count+= (limit>=count+2)?2:limit-count; pos=content+count; - - } - else - { - _rtw_memcpy(pos, ((u8*)&lo32), (limit>=count+4)?4:limit-count); + } else { + memcpy(pos, ((u8*)&lo32), (limit>=count+4)?4:limit-count); count+=(limit>=count+4)?4:limit-count; pos=content+count; - - } if(limit>count && len-2>count) { - _rtw_memcpy(pos, (u8*)&hi32, (limit>=count+4)?4:limit-count); + memcpy(pos, (u8*)&hi32, (limit>=count+4)?4:limit-count); count+=(limit>=count+4)?4:limit-count; pos=content+count; } if(limit<=count || len-2<=count) break; - i++; } @@ -381,10 +369,8 @@ void efuse_read_phymap_from_txpktbuf( DBG_871X("%s read count:%u\n", __FUNCTION__, count); *size = count; - } - static s32 iol_read_efuse( struct adapter *padapter, u8 txpktbuf_bndy,