From 3416ea1dbd6d1b3167440feb9a5a6dcf0beb0799 Mon Sep 17 00:00:00 2001 From: Christian B Date: Mon, 11 Dec 2017 20:17:51 +0100 Subject: [PATCH 1/6] Various EFUSE fixes * Several fixes for 8812au EFUSE (TODO: 8814au) --- hal/rtl8812a/rtl8812a_hal_init.c | 1201 +++++++++++++++--------------- 1 file changed, 620 insertions(+), 581 deletions(-) diff --git a/hal/rtl8812a/rtl8812a_hal_init.c b/hal/rtl8812a/rtl8812a_hal_init.c index a2d3032..4d56edf 100644 --- a/hal/rtl8812a/rtl8812a_hal_init.c +++ b/hal/rtl8812a/rtl8812a_hal_init.c @@ -1796,15 +1796,6 @@ Hal_EfusePowerSwitch8812A( } } -static VOID -rtl8812_EfusePowerSwitch( - IN PADAPTER pAdapter, - IN u8 bWrite, - IN u8 PwrState) -{ - Hal_EfusePowerSwitch8812A(pAdapter, bWrite, PwrState); -} - static BOOLEAN Hal_EfuseSwitchToBank8812A( IN PADAPTER pAdapter, @@ -1825,14 +1816,14 @@ Hal_EfuseReadEFuse8812A( ) { u8 *efuseTbl = NULL; + u8 rtemp8[1]; u16 eFuse_Addr = 0; - u8 offset = 0, wden = 0; + u8 offset, wren; u16 i, j; u16 **eFuseWord = NULL; u16 efuse_utilized = 0; u8 efuse_usage = 0; - u8 offset_2_0 = 0; - u8 efuseHeader = 0, efuseExtHdr = 0, efuseData = 0; + u8 u1temp = 0; /* */ /* Do NOT excess total size of EFuse table. Added by Roger, 2008.11.10. */ @@ -1864,99 +1855,105 @@ Hal_EfuseReadEFuse8812A( /* 1. Read the first byte to check if efuse is empty!!! */ /* */ /* */ - efuse_OneByteRead(Adapter, eFuse_Addr++, &efuseHeader, bPseudoTest); - - if (efuseHeader != 0xFF) + ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); + if (*rtemp8 != 0xFF) { efuse_utilized++; - else { - RTW_INFO("EFUSE is empty\n"); - efuse_utilized = 0; + /* RTW_INFO("efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8); */ + eFuse_Addr++; + } else { + RTW_INFO("EFUSE is empty efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8); goto exit; } - /* RT_DISP(FEEPROM, EFUSE_READ_ALL, ("Hal_EfuseReadEFuse8812A(): efuse_utilized: %d\n", efuse_utilized)); */ /* */ /* 2. Read real efuse content. Filter PG header and every section data. */ /* */ - while ((efuseHeader != 0xFF) && AVAILABLE_EFUSE_ADDR_8812(eFuse_Addr)) { + while ((*rtemp8 != 0xFF) && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_JAGUAR)) { /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("efuse_Addr-%d efuse_data=%x\n", eFuse_Addr-1, *rtemp8)); */ /* Check PG header for section num. */ - if (EXT_HEADER(efuseHeader)) { /* extended header */ - offset_2_0 = GET_HDR_OFFSET_2_0(efuseHeader); - /* RT_DISP(FEEPROM, EFUSE_READ_ALL, ("extended header offset_2_0=%X\n", offset_2_0)); */ + if ((*rtemp8 & 0x1F) == 0x0F) { /* extended header */ + u1temp = ((*rtemp8 & 0xE0) >> 5); + /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header u1temp=%x *rtemp&0xE0 0x%x\n", u1temp, *rtemp8 & 0xE0)); */ - efuse_OneByteRead(Adapter, eFuse_Addr++, &efuseExtHdr, bPseudoTest); + /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header u1temp=%x\n", u1temp)); */ - /* RT_DISP(FEEPROM, EFUSE_READ_ALL, ("efuse[%X]=%X\n", eFuse_Addr-1, efuseExtHdr)); */ + ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); - if (efuseExtHdr != 0xff) { - efuse_utilized++; - if (ALL_WORDS_DISABLED(efuseExtHdr)) { - efuse_OneByteRead(Adapter, eFuse_Addr++, &efuseHeader, bPseudoTest); - if (efuseHeader != 0xff) - efuse_utilized++; - break; - } else { - offset = ((efuseExtHdr & 0xF0) >> 1) | offset_2_0; - wden = (efuseExtHdr & 0x0F); - } + /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8)); */ + + if ((*rtemp8 & 0x0F) == 0x0F) { + eFuse_Addr++; + ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); + + if (*rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_JAGUAR)) + eFuse_Addr++; + continue; } else { - RTW_INFO("Error condition, extended = 0xff\n"); - /* We should handle this condition. */ - break; + offset = ((*rtemp8 & 0xF0) >> 1) | u1temp; + wren = (*rtemp8 & 0x0F); + eFuse_Addr++; } } else { - offset = ((efuseHeader >> 4) & 0x0f); - wden = (efuseHeader & 0x0f); + offset = ((*rtemp8 >> 4) & 0x0f); + wren = (*rtemp8 & 0x0f); } if (offset < EFUSE_MAX_SECTION_JAGUAR) { /* Get word enable value from PG header */ - /* RT_DISP(FEEPROM, EFUSE_READ_ALL, ("Offset-%X Worden=%X\n", offset, wden)); */ + /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Offset-%d Worden=%x\n", offset, wren)); */ for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) { /* Check word enable condition in the section */ - if (!(wden & (0x01 << i))) { - efuse_OneByteRead(Adapter, eFuse_Addr++, &efuseData, bPseudoTest); - /* RT_DISP(FEEPROM, EFUSE_READ_ALL, ("efuse[%X]=%X\n", eFuse_Addr-1, efuseData)); */ + if (!(wren & 0x01)) { + /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d\n", eFuse_Addr)); */ + ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); + eFuse_Addr++; efuse_utilized++; - eFuseWord[offset][i] = (efuseData & 0xff); + eFuseWord[offset][i] = (*rtemp8 & 0xff); - if (!AVAILABLE_EFUSE_ADDR_8812(eFuse_Addr)) + + if (eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_JAGUAR) break; - efuse_OneByteRead(Adapter, eFuse_Addr++, &efuseData, bPseudoTest); - /* RT_DISP(FEEPROM, EFUSE_READ_ALL, ("efuse[%X]=%X\n", eFuse_Addr-1, efuseData)); */ - efuse_utilized++; - eFuseWord[offset][i] |= (((u16)efuseData << 8) & 0xff00); + /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d", eFuse_Addr)); */ + ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); + eFuse_Addr++; - if (!AVAILABLE_EFUSE_ADDR_8812(eFuse_Addr)) + efuse_utilized++; + eFuseWord[offset][i] |= (((u2Byte)*rtemp8 << 8) & 0xff00); + + if (eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_JAGUAR) break; } + + wren >>= 1; + } } else { /* deal with error offset,skip error data */ RTW_PRINT("invalid offset:0x%02x\n", offset); for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) { /* Check word enable condition in the section */ - if (!(wden & 0x01)) { + if (!(wren & 0x01)) { eFuse_Addr++; efuse_utilized++; - if (!AVAILABLE_EFUSE_ADDR_8812(eFuse_Addr)) + if (eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_JAGUAR) break; eFuse_Addr++; efuse_utilized++; - if (!AVAILABLE_EFUSE_ADDR_8812(eFuse_Addr)) + if (eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_JAGUAR) break; } } } /* Read next PG header */ - efuse_OneByteRead(Adapter, eFuse_Addr++, &efuseHeader, bPseudoTest); + ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d rtemp 0x%x\n", eFuse_Addr, *rtemp8)); */ - if (efuseHeader != 0xFF) + if (*rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_JAGUAR)) { efuse_utilized++; + eFuse_Addr++; + } } /* */ @@ -1969,7 +1966,6 @@ Hal_EfuseReadEFuse8812A( } } - /* RT_DISP(FEEPROM, EFUSE_READ_ALL, ("Hal_EfuseReadEFuse8812A(): efuse_utilized: %d\n", efuse_utilized)); */ /* */ /* 4. Copy from Efuse map to output pointer memory!!! */ @@ -1982,6 +1978,7 @@ Hal_EfuseReadEFuse8812A( /* */ efuse_usage = (u1Byte)((eFuse_Addr * 100) / EFUSE_REAL_CONTENT_LEN_JAGUAR); rtw_hal_set_hwreg(Adapter, HW_VAR_EFUSE_BYTES, (u8 *)&eFuse_Addr); + RTW_INFO("%s: eFuse_Addr offset(%#x) !!\n", __FUNCTION__, eFuse_Addr); exit: if (efuseTbl) @@ -2445,7 +2442,7 @@ hal_EfuseGetCurrentSize_8812A(IN PADAPTER pAdapter, efuse_addr = (u16)(fakeEfuseUsedBytes); else rtw_hal_get_hwreg(pAdapter, HW_VAR_EFUSE_BYTES, (u8 *)&efuse_addr); - /* RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfuseGetCurrentSize_8723A(), start_efuse_addr = %d\n", efuse_addr)); */ + RTW_INFO("%s(), start_efuse_addr = %d\n", __func__, efuse_addr); while (bContinual && efuse_OneByteRead(pAdapter, efuse_addr , &efuse_data, bPseudoTest) && @@ -2475,10 +2472,10 @@ hal_EfuseGetCurrentSize_8812A(IN PADAPTER pAdapter, if (bPseudoTest) { fakeEfuseUsedBytes = efuse_addr; - /* RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfuseGetCurrentSize_8723A(), return %d\n", fakeEfuseUsedBytes)); */ + RTW_INFO("%s(), return %d\n", __func__, fakeEfuseUsedBytes); } else { rtw_hal_set_hwreg(pAdapter, HW_VAR_EFUSE_BYTES, (u8 *)&efuse_addr); - /* RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfuseGetCurrentSize_8723A(), return %d\n", efuse_addr)); */ + RTW_INFO("%s(), return %d\n", __func__, efuse_addr); } return efuse_addr; @@ -2712,423 +2709,593 @@ rtl8812_Efuse_PgPacketRead(IN PADAPTER pAdapter, return ret; } -int -hal_EfusePgPacketWrite_8812A(IN PADAPTER pAdapter, - IN u8 offset, - IN u8 word_en, - IN u8 *data, - IN BOOLEAN bPseudoTest) + +BOOLEAN +hal_EfuseFixHeaderProcess( + IN PADAPTER pAdapter, + IN u8 efuseType, + IN PPGPKT_STRUCT pFixPkt, + IN u16 *pAddr, + IN BOOLEAN bPseudoTest +) { - u8 WriteState = PG_STATE_HEADER; + u8 originaldata[8], badworden = 0; + u16 efuse_addr = *pAddr; + u32 PgWriteSuccess = 0; - int bContinual = _TRUE, bDataEmpty = _TRUE; - /* int bResult = _TRUE; */ - u16 efuse_addr = 0; - u8 efuse_data; + _rtw_memset((PVOID)originaldata, 0xff, 8); - u8 pg_header = 0, pg_header_temp = 0; + if (Efuse_PgPacketRead(pAdapter, pFixPkt->offset, originaldata, bPseudoTest)) { + /* check if data exist */ + badworden = Efuse_WordEnableDataWrite(pAdapter, efuse_addr + 1, pFixPkt->word_en, originaldata, bPseudoTest); - u8 tmp_word_cnts = 0, target_word_cnts = 0; - u8 tmp_header, match_word_en, tmp_word_en; + if (badworden != 0xf) { /* write fail */ + PgWriteSuccess = Efuse_PgPacketWrite(pAdapter, pFixPkt->offset, badworden, originaldata, bPseudoTest); + if (!PgWriteSuccess) + return _FALSE; - PGPKT_STRUCT target_pkt; - PGPKT_STRUCT tmp_pkt; + else + efuse_addr = Efuse_GetCurrentSize(pAdapter, efuseType, bPseudoTest); + } else + efuse_addr = efuse_addr + (pFixPkt->word_cnts * 2) + 1; + } else + efuse_addr = efuse_addr + (pFixPkt->word_cnts * 2) + 1; + *pAddr = efuse_addr; + return _TRUE; +} - u8 originaldata[sizeof(u8) * 8]; - u8 tmpindex = 0, badworden = 0x0F; +static u8 +hal_EfusePgPacketWrite2ByteHeader( + PADAPTER padapter, + u8 efuseType, + u16 *pAddr, + PPGPKT_STRUCT pTargetPkt, + u8 bPseudoTest) +{ + u16 efuse_addr, efuse_max_available_len = 0; + u8 pg_header = 0, tmp_header = 0, pg_header_temp = 0; + u8 repeatcnt = 0; - static int repeat_times = 0; + /* RTW_INFO("%s\n", __FUNCTION__); */ + EFUSE_GetEfuseDefinition(padapter, efuseType, TYPE_AVAILABLE_EFUSE_BYTES_BANK, &efuse_max_available_len, bPseudoTest); - BOOLEAN bExtendedHeader = _FALSE; - u8 efuseType = EFUSE_WIFI; + efuse_addr = *pAddr; - /* */ - /* Efuse has been pre-programmed dummy 5Bytes at the end of Efuse by CP. */ - /* So we have to prevent unexpected data string connection, which will cause */ - /* incorrect data auto-load from HW. The total size is equal or smaller than 498bytes */ - /* (i.e., offset 0~497, and dummy 1bytes) expected after CP test. */ - /* 2009.02.19. */ - /* */ - if (Efuse_GetCurrentSize(pAdapter, efuseType, bPseudoTest) >= (EFUSE_REAL_CONTENT_LEN_JAGUAR - EFUSE_OOB_PROTECT_BYTES_JAGUAR)) { - RTW_INFO("hal_EfusePgPacketWrite_8812A() error: %x >= %x\n", Efuse_GetCurrentSize(pAdapter, efuseType, bPseudoTest), (EFUSE_REAL_CONTENT_LEN_JAGUAR - EFUSE_OOB_PROTECT_BYTES_JAGUAR)); + if (efuse_addr >= efuse_max_available_len) { + RTW_INFO("%s: addr(%d) over available(%d)!!\n", __FUNCTION__, efuse_addr, efuse_max_available_len); return _FALSE; } - /* Init the 8 bytes content as 0xff */ - target_pkt.offset = offset; - target_pkt.word_en = word_en; - /* Initial the value to avoid compile warning */ - tmp_pkt.offset = 0; - tmp_pkt.word_en = 0; - - /* RTW_INFO("hal_EfusePgPacketWrite_8812A target offset 0x%x word_en 0x%x\n", target_pkt.offset, target_pkt.word_en); */ - - _rtw_memset((PVOID)target_pkt.data, 0xFF, sizeof(u8) * 8); - - efuse_WordEnableDataRead(word_en, data, target_pkt.data); - target_word_cnts = Efuse_CalculateWordCnts(target_pkt.word_en); - - /* efuse_reg_ctrl(pAdapter,_TRUE); */ /* power on */ - /* RTW_INFO("EFUSE Power ON\n"); */ - - /* */ - /* Efuse has been pre-programmed dummy 5Bytes at the end of Efuse by CP. */ - /* So we have to prevent unexpected data string connection, which will cause */ - /* incorrect data auto-load from HW. Dummy 1bytes is additional. */ - /* 2009.02.19. */ - /* */ - while (bContinual && (efuse_addr < (EFUSE_REAL_CONTENT_LEN_JAGUAR - EFUSE_OOB_PROTECT_BYTES_JAGUAR))) { - if (WriteState == PG_STATE_HEADER) { - bDataEmpty = _TRUE; - badworden = 0x0F; - /* ************ so ******************* */ - /* RTW_INFO("EFUSE PG_STATE_HEADER\n"); */ - if (efuse_OneByteRead(pAdapter, efuse_addr , &efuse_data, bPseudoTest) && - (efuse_data != 0xFF)) { - if ((efuse_data & 0x1F) == 0x0F) { /* extended header */ - tmp_header = efuse_data; - efuse_addr++; - efuse_OneByteRead(pAdapter, efuse_addr , &efuse_data, bPseudoTest); - if ((efuse_data & 0x0F) == 0x0F) { /* wren fail */ - u8 next = 0, next_next = 0, data = 0, i = 0; - u8 s = ((tmp_header & 0xF0) >> 4); - efuse_OneByteRead(pAdapter, efuse_addr + 1, &next, bPseudoTest); - efuse_OneByteRead(pAdapter, efuse_addr + 2, &next_next, bPseudoTest); - if (next == 0xFF && next_next == 0xFF) { /* Have enough space to make fake data to recover bad header. */ - switch (s) { - case 0x0: - case 0x2: - case 0x4: - case 0x6: - case 0x8: - case 0xA: - case 0xC: - for (i = 0; i < 3; ++i) { - efuse_OneByteWrite(pAdapter, efuse_addr, 0x27, bPseudoTest); - efuse_OneByteRead(pAdapter, efuse_addr, &data, bPseudoTest); - if (data == 0x27) - break; - } - break; - case 0xE: - for (i = 0; i < 3; ++i) { - efuse_OneByteWrite(pAdapter, efuse_addr, 0x17, bPseudoTest); - efuse_OneByteRead(pAdapter, efuse_addr, &data, bPseudoTest); - if (data == 0x17) - break; - } - break; - default: - break; - } - efuse_OneByteWrite(pAdapter, efuse_addr + 1, 0xFF, bPseudoTest); - efuse_OneByteWrite(pAdapter, efuse_addr + 2, 0xFF, bPseudoTest); - efuse_addr += 3; - } else - efuse_addr++; - continue; - } else { - tmp_pkt.offset = ((tmp_header & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1); - tmp_pkt.word_en = efuse_data & 0x0F; - } - } else { - u8 i = 0, data = 0; - tmp_header = efuse_data; - tmp_pkt.offset = (tmp_header >> 4) & 0x0F; - tmp_pkt.word_en = tmp_header & 0x0F; - - if (tmp_pkt.word_en == 0xF) { - u8 next = 0; - efuse_OneByteRead(pAdapter, efuse_addr + 1, &next, bPseudoTest); - if (next == 0xFF) { /* Have enough space to make fake data to recover bad header. */ - tmp_header = (tmp_header & 0xF0) | 0x7; - for (i = 0; i < 3; ++i) { - efuse_OneByteWrite(pAdapter, efuse_addr, tmp_header, bPseudoTest); - efuse_OneByteRead(pAdapter, efuse_addr, &data, bPseudoTest); - if (data == tmp_header) - break; - } - efuse_OneByteWrite(pAdapter, efuse_addr + 1, 0xFF, bPseudoTest); - efuse_OneByteWrite(pAdapter, efuse_addr + 2, 0xFF, bPseudoTest); - efuse_addr += 2; - } - } - } - tmp_word_cnts = Efuse_CalculateWordCnts(tmp_pkt.word_en); - - /* RTW_INFO("section offset 0x%x worden 0x%x\n", tmp_pkt.offset, tmp_pkt.word_en); */ - - /* ************ so-1 ******************* */ - if (tmp_pkt.offset != target_pkt.offset) { - efuse_addr = efuse_addr + (tmp_word_cnts * 2) + 1; /* Next pg_packet */ -#if (EFUSE_ERROE_HANDLE == 1) - WriteState = PG_STATE_HEADER; -#endif - } else { /* write the same offset */ - /* RTW_INFO("hal_EfusePgPacketWrite_8812A section offset the same\n"); */ - /* ************ so-2 ******************* */ - for (tmpindex = 0 ; tmpindex < (tmp_word_cnts * 2) ; tmpindex++) { - if (efuse_OneByteRead(pAdapter, (efuse_addr + 1 + tmpindex) , &efuse_data, bPseudoTest) && (efuse_data != 0xFF)) - bDataEmpty = _FALSE; - } - /* ************ so-2-1 ******************* */ - if (bDataEmpty == _FALSE) { - /* RTW_INFO("hal_EfusePgPacketWrite_8812A section offset the same and data is NOT empty\n"); */ - - efuse_addr = efuse_addr + (tmp_word_cnts * 2) + 1; /* Next pg_packet */ -#if (EFUSE_ERROE_HANDLE == 1) - WriteState = PG_STATE_HEADER; -#endif - } else { - /* ************ so-2-2 ******************* */ - /* RTW_INFO("hal_EfusePgPacketWrite_8812A section data empty\n"); */ - match_word_en = 0x0F; /* same bit as original wren */ - if (!((target_pkt.word_en & BIT0) | (tmp_pkt.word_en & BIT0))) - match_word_en &= (~BIT0); - if (!((target_pkt.word_en & BIT1) | (tmp_pkt.word_en & BIT1))) - match_word_en &= (~BIT1); - if (!((target_pkt.word_en & BIT2) | (tmp_pkt.word_en & BIT2))) - match_word_en &= (~BIT2); - if (!((target_pkt.word_en & BIT3) | (tmp_pkt.word_en & BIT3))) - match_word_en &= (~BIT3); - - /* ************ so-2-2-A ******************* */ - if ((match_word_en & 0x0F) != 0x0F) { - badworden = Efuse_WordEnableDataWrite(pAdapter, efuse_addr + 1, tmp_pkt.word_en , target_pkt.data, bPseudoTest); - - /* ************ so-2-2-A-1 ******************* */ - /* ############################ */ - if (0x0F != (badworden & 0x0F)) { - u8 reorg_offset = offset; - u8 reorg_worden = badworden; - Efuse_PgPacketWrite(pAdapter, reorg_offset, reorg_worden, target_pkt.data, bPseudoTest); - } - /* ############################ */ - - tmp_word_en = 0x0F; /* not the same bit as original wren */ - if ((target_pkt.word_en & BIT0) ^ (match_word_en & BIT0)) - tmp_word_en &= (~BIT0); - if ((target_pkt.word_en & BIT1) ^ (match_word_en & BIT1)) - tmp_word_en &= (~BIT1); - if ((target_pkt.word_en & BIT2) ^ (match_word_en & BIT2)) - tmp_word_en &= (~BIT2); - if ((target_pkt.word_en & BIT3) ^ (match_word_en & BIT3)) - tmp_word_en &= (~BIT3); - - /* ************ so-2-2-A-2 ******************* */ - if ((tmp_word_en & 0x0F) != 0x0F) { - /* reorganize other pg packet - * efuse_addr = efuse_addr + (2*tmp_word_cnts) +1; */ /* next pg packet addr */ - efuse_addr = Efuse_GetCurrentSize(pAdapter, efuseType, bPseudoTest); - /* =========================== */ - target_pkt.offset = offset; - target_pkt.word_en = tmp_word_en; - /* =========================== */ - } else - bContinual = _FALSE; -#if (EFUSE_ERROE_HANDLE == 1) - WriteState = PG_STATE_HEADER; - repeat_times++; - if (repeat_times > EFUSE_REPEAT_THRESHOLD_) { - bContinual = _FALSE; - /* bResult = _FALSE; */ - } -#endif - } else { /* ************ so-2-2-B ******************* */ - /* reorganize other pg packet */ - efuse_addr = efuse_addr + (2 * tmp_word_cnts) + 1; /* next pg packet addr */ - /* =========================== */ - target_pkt.offset = offset; - /* target_pkt.word_en= target_pkt.word_en; */ - /* =========================== */ -#if (EFUSE_ERROE_HANDLE == 1) - WriteState = PG_STATE_HEADER; -#endif - } - } - } - RTW_INFO("EFUSE PG_STATE_HEADER-1\n"); - } else { /* ************ s1: header == oxff ******************* */ - bExtendedHeader = _FALSE; - - if (target_pkt.offset >= EFUSE_MAX_SECTION_BASE) { - pg_header = ((target_pkt.offset & 0x07) << 5) | 0x0F; - - /* RTW_INFO("hal_EfusePgPacketWrite_8812A extended pg_header[2:0] |0x0F 0x%x\n", pg_header); */ - - efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest); - efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest); - - while (tmp_header == 0xFF) { - /* RTW_INFO("hal_EfusePgPacketWrite_8812A extended pg_header[2:0] wirte fail\n"); */ - - repeat_times++; - - if (repeat_times > EFUSE_REPEAT_THRESHOLD_) { - bContinual = _FALSE; - /* bResult = _FALSE; */ - efuse_addr++; - break; - } - efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest); - efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest); - } - - if (!bContinual) - break; - - if (tmp_header == pg_header) { - efuse_addr++; - pg_header_temp = pg_header; - pg_header = ((target_pkt.offset & 0x78) << 1) | target_pkt.word_en; - - /* RTW_INFO("hal_EfusePgPacketWrite_8812A extended pg_header[6:3] | worden 0x%x word_en 0x%x\n", pg_header, target_pkt.word_en); */ - - efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest); - efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest); - - while (tmp_header == 0xFF) { - repeat_times++; - - if (repeat_times > EFUSE_REPEAT_THRESHOLD_) { - bContinual = _FALSE; - /* bResult = _FALSE; */ - break; - } - efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest); - efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest); - } - - if (!bContinual) - break; - - if ((tmp_header & 0x0F) == 0x0F) { /* wren PG fail */ - repeat_times++; - - if (repeat_times > EFUSE_REPEAT_THRESHOLD_) { - bContinual = _FALSE; - /* bResult = _FALSE; */ - break; - } else { - efuse_addr++; - continue; - } - } else if (pg_header != tmp_header) { /* offset PG fail */ - bExtendedHeader = _TRUE; - tmp_pkt.offset = ((pg_header_temp & 0xE0) >> 5) | ((tmp_header & 0xF0) >> 1); - tmp_pkt.word_en = tmp_header & 0x0F; - tmp_word_cnts = Efuse_CalculateWordCnts(tmp_pkt.word_en); - } - } else if ((tmp_header & 0x1F) == 0x0F) { /* wrong extended header */ - efuse_addr += 2; - continue; - } - } else { - pg_header = ((target_pkt.offset << 4) & 0xf0) | target_pkt.word_en; - efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest); - efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest); - } - - if (tmp_header == pg_header) { - /* ************ s1-1******************* */ - WriteState = PG_STATE_DATA; - } -#if (EFUSE_ERROE_HANDLE == 1) - else if (tmp_header == 0xFF) { /* ************ s1-3: if Write or read func doesn't work ******************* */ - /* efuse_addr doesn't change */ - WriteState = PG_STATE_HEADER; - repeat_times++; - if (repeat_times > EFUSE_REPEAT_THRESHOLD_) { - bContinual = _FALSE; - /* bResult = _FALSE; */ - } - } -#endif - else { - /* ************ s1-2 : fixed the header procedure ******************* */ - if (!bExtendedHeader) { - tmp_pkt.offset = (tmp_header >> 4) & 0x0F; - tmp_pkt.word_en = tmp_header & 0x0F; - tmp_word_cnts = Efuse_CalculateWordCnts(tmp_pkt.word_en); - } - - /* ************ s1-2-A :cover the exist data ******************* */ - _rtw_memset(originaldata, 0xff, sizeof(u8) * 8); - - if (Efuse_PgPacketRead(pAdapter, tmp_pkt.offset, originaldata, bPseudoTest)) { - /* check if data exist */ - /* efuse_reg_ctrl(pAdapter,_TRUE); */ /* power on */ - badworden = Efuse_WordEnableDataWrite(pAdapter, efuse_addr + 1, tmp_pkt.word_en, originaldata, bPseudoTest); - /* ############################ */ - if (0x0F != (badworden & 0x0F)) { - u8 reorg_offset = tmp_pkt.offset; - u8 reorg_worden = badworden; - Efuse_PgPacketWrite(pAdapter, reorg_offset, reorg_worden, originaldata, bPseudoTest); - efuse_addr = Efuse_GetCurrentSize(pAdapter, efuseType, bPseudoTest); - } - /* ############################ */ - else { - efuse_addr = efuse_addr + (tmp_word_cnts * 2) + 1; /* Next pg_packet */ - } - } - /* ************ s1-2-B: wrong address******************* */ - else { - efuse_addr = efuse_addr + (tmp_word_cnts * 2) + 1; /* Next pg_packet */ - } - -#if (EFUSE_ERROE_HANDLE == 1) - WriteState = PG_STATE_HEADER; - repeat_times++; - if (repeat_times > EFUSE_REPEAT_THRESHOLD_) { - bContinual = _FALSE; - /* bResult = _FALSE; */ - } -#endif - - /* RTW_INFO("EFUSE PG_STATE_HEADER-2\n"); */ - } + while (efuse_addr < efuse_max_available_len) { + pg_header = ((pTargetPkt->offset & 0x07) << 5) | 0x0F; + efuse_OneByteWrite(padapter, efuse_addr, pg_header, bPseudoTest); + efuse_OneByteRead(padapter, efuse_addr, &tmp_header, bPseudoTest); + while (tmp_header == 0xFF || pg_header != tmp_header) { + if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { + RTW_INFO("%s, Repeat over limit for pg_header!!\n", __FUNCTION__); + return _FALSE; } + efuse_OneByteWrite(padapter, efuse_addr, pg_header, bPseudoTest); + efuse_OneByteRead(padapter, efuse_addr, &tmp_header, bPseudoTest); } - /* write data state */ - else if (WriteState == PG_STATE_DATA) { - /* ************ s1-1 ******************* */ - /* RTW_INFO("EFUSE PG_STATE_DATA\n"); */ - badworden = 0x0f; - badworden = Efuse_WordEnableDataWrite(pAdapter, efuse_addr + 1, target_pkt.word_en, target_pkt.data, bPseudoTest); - if ((badworden & 0x0F) == 0x0F) { - /* ************ s1-1-A ******************* */ - bContinual = _FALSE; - } else { - /* reorganize other pg packet */ /* ************ s1-1-B ******************* */ - efuse_addr = efuse_addr + (2 * target_word_cnts) + 1; /* next pg packet addr */ - /* =========================== */ - target_pkt.offset = offset; - target_pkt.word_en = badworden; - target_word_cnts = Efuse_CalculateWordCnts(target_pkt.word_en); - /* =========================== */ -#if (EFUSE_ERROE_HANDLE == 1) - WriteState = PG_STATE_HEADER; - repeat_times++; - if (repeat_times > EFUSE_REPEAT_THRESHOLD_) { - bContinual = _FALSE; - /* bResult = _FALSE; */ + /*to write ext_header*/ + if (tmp_header == pg_header) { + efuse_addr++; + pg_header_temp = pg_header; + pg_header = ((pTargetPkt->offset & 0x78) << 1) | pTargetPkt->word_en; + + efuse_OneByteWrite(padapter, efuse_addr, pg_header, bPseudoTest); + efuse_OneByteRead(padapter, efuse_addr, &tmp_header, bPseudoTest); + + + while (tmp_header == 0xFF || pg_header != tmp_header) { + if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { + RTW_INFO("%s, Repeat over limit for ext_header!!\n", __FUNCTION__); + return _FALSE; } -#endif - /* RTW_INFO("EFUSE PG_STATE_HEADER-3\n"); */ + + efuse_OneByteWrite(padapter, efuse_addr, pg_header, bPseudoTest); + efuse_OneByteRead(padapter, efuse_addr, &tmp_header, bPseudoTest); } + + if ((tmp_header & 0x0F) == 0x0F) { + if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { + RTW_INFO("Repeat over limit for word_en!!\n"); + return _FALSE; + } else { + efuse_addr++; + continue; + } + } else if (pg_header != tmp_header) { + PGPKT_STRUCT fixPkt; + + RTW_ERR("Error, efuse_PgPacketWrite2ByteHeader(), offset PG fail, need to cover the existed data!!\n"); + RTW_ERR("Error condition for offset PG fail, need to cover the existed data\n"); + fixPkt.offset = ((pg_header_temp & 0xE0) >> 5) | ((tmp_header & 0xF0) >> 1); + fixPkt.word_en = tmp_header & 0x0F; + fixPkt.word_cnts = Efuse_CalculateWordCnts(fixPkt.word_en); + if (!hal_EfuseFixHeaderProcess(padapter, efuseType, &fixPkt, &efuse_addr, bPseudoTest)) + return _FALSE; + } else + break; + } else if ((tmp_header & 0x1F) == 0x0F) {/*wrong extended header*/ + efuse_addr += 2; + continue; } } - if (efuse_addr >= (EFUSE_REAL_CONTENT_LEN_JAGUAR - EFUSE_OOB_PROTECT_BYTES_JAGUAR)) - RTW_INFO("hal_EfusePgPacketWrite_8812A(): efuse_addr(%#x) Out of size!!\n", efuse_addr); - /* efuse_reg_ctrl(pAdapter,_FALSE); */ /* power off */ + *pAddr = efuse_addr; return _TRUE; } + +static u8 +hal_EfusePgPacketWrite1ByteHeader( + PADAPTER pAdapter, + u8 efuseType, + u16 *pAddr, + PPGPKT_STRUCT pTargetPkt, + u8 bPseudoTest) +{ + u8 bRet = _FALSE; + u8 pg_header = 0, tmp_header = 0; + u16 efuse_addr = *pAddr; + u8 repeatcnt = 0; + + RTW_INFO("%s\n", __func__); + pg_header = ((pTargetPkt->offset << 4) & 0xf0) | pTargetPkt->word_en; + + efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest); + + efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest); + + while (tmp_header == 0xFF || pg_header != tmp_header) { + if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { + RTW_INFO("retry %d times fail!!\n", repeatcnt); + return FALSE; + } + efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest); + efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest); + RTW_INFO("===> %s: Keep %d-th retrying, tmp_header = 0x%X\n", __func__, repeatcnt, tmp_header); + } + + if (tmp_header != pg_header) { + PGPKT_STRUCT fixPkt; + + RTW_INFO("Error, %s(), offset PG fail, need to cover the existed data!!\n", __func__); + RTW_INFO("pg_header(0x%X) != tmp_header(0x%X)\n", pg_header, tmp_header); + RTW_INFO("Error condition for fixed PG packet, need to cover the existed data: (Addr, Data) = (0x%X, 0x%X)\n", + efuse_addr, tmp_header); + fixPkt.offset = (tmp_header>>4) & 0x0F; + fixPkt.word_en = tmp_header & 0x0F; + fixPkt.word_cnts = Efuse_CalculateWordCnts(fixPkt.word_en); + if (!hal_EfuseFixHeaderProcess(pAdapter, efuseType, &fixPkt, &efuse_addr, bPseudoTest)) + return FALSE; + } + + *pAddr = efuse_addr; + + return _TRUE; +} + + +static u8 +hal_EfusePgPacketWriteData( + PADAPTER pAdapter, + u8 efuseType, + u16 *pAddr, + PPGPKT_STRUCT pTargetPkt, + u8 bPseudoTest) +{ + u16 efuse_addr; + u8 badworden; + + + efuse_addr = *pAddr; + badworden = rtl8812_Efuse_WordEnableDataWrite(pAdapter, efuse_addr + 1, pTargetPkt->word_en, pTargetPkt->data, bPseudoTest); + if (badworden != 0x0F) { + RTW_INFO("%s: Fail!!\n", __FUNCTION__); + return _FALSE; + } + + /* RTW_INFO("%s: ok\n", __FUNCTION__); */ + return _TRUE; +} + +BOOLEAN efuse_PgPacketCheck( + PADAPTER pAdapter, + u8 efuseType, + BOOLEAN bPseudoTest +) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + + if (Efuse_GetCurrentSize(pAdapter, efuseType, bPseudoTest) >= (EFUSE_REAL_CONTENT_LEN_JAGUAR - EFUSE_OOB_PROTECT_BYTES_JAGUAR)) { + RTW_INFO("%s()error: %x >= %x\n", __func__, Efuse_GetCurrentSize(pAdapter, efuseType, bPseudoTest), (EFUSE_REAL_CONTENT_LEN_JAGUAR - EFUSE_OOB_PROTECT_BYTES_JAGUAR)); + return _FALSE; + } + + return _TRUE; +} + + +VOID +efuse_PgPacketConstruct( + IN u8 offset, + IN u8 word_en, + IN u8 *pData, + IN OUT PPGPKT_STRUCT pTargetPkt +) +{ + _rtw_memset((PVOID)pTargetPkt->data, 0xFF, sizeof(u8) * 8); + pTargetPkt->offset = offset; + pTargetPkt->word_en = word_en; + efuse_WordEnableDataRead(word_en, pData, pTargetPkt->data); + pTargetPkt->word_cnts = Efuse_CalculateWordCnts(pTargetPkt->word_en); + + RTW_INFO("efuse_PgPacketConstruct(), targetPkt, offset=%d, word_en=0x%x, word_cnts=%d\n", pTargetPkt->offset, pTargetPkt->word_en, pTargetPkt->word_cnts); +} + +u2Byte +Hal_EfusePgPacketExceptionHandle_8812A( + PADAPTER pAdapter, + u2Byte ErrOffset + ) +{ + BOOLEAN bPseudoTest = FALSE; + u8 next = 0, next_next = 0, data = 0, i = 0, header = 0; + u8 s = 0; + u2Byte offset = ErrOffset; + + efuse_OneByteRead(pAdapter, offset, &header, bPseudoTest); + + if (EXT_HEADER(header)) { + s = ((header & 0xF0) >> 4); + + /* Skip bad word enable to look two bytes ahead and determine if recoverable.*/ + offset += 1; + efuse_OneByteRead(pAdapter, offset+1, &next, bPseudoTest); + efuse_OneByteRead(pAdapter, offset+2, &next_next, bPseudoTest); + if (next == 0xFF && next_next == 0xFF) {/* Have enough space to make fake data to recover bad header.*/ + switch (s) { + case 0x0: case 0x2: case 0x4: case 0x6: + case 0x8: case 0xA: case 0xC: + for (i = 0; i < 3; ++i) { + efuse_OneByteWrite(pAdapter, offset, 0x27, bPseudoTest); + efuse_OneByteRead(pAdapter, offset, &data, bPseudoTest); + if (data == 0x27) + break; + } + break; + case 0xE: + for (i = 0; i < 3; ++i) { + efuse_OneByteWrite(pAdapter, offset, 0x17, bPseudoTest); + efuse_OneByteRead(pAdapter, offset, &data, bPseudoTest); + if (data == 0x17) + break; + + break; + default: + break; + } + efuse_OneByteWrite(pAdapter, offset+1, 0xFF, bPseudoTest); + efuse_OneByteWrite(pAdapter, offset+2, 0xFF, bPseudoTest); + offset += 3; + ErrOffset = offset; + } + } else {/* 1-Byte header*/ + if (ALL_WORDS_DISABLED(header)) { + u8 next = 0; + + efuse_OneByteRead(pAdapter, offset+1, &next, bPseudoTest); + if (next == 0xFF) {/* Have enough space to make fake data to recover bad header.*/ + header = (header & 0xF0) | 0x7; + for (i = 0; i < 3; ++i) { + efuse_OneByteWrite(pAdapter, offset, header, bPseudoTest); + efuse_OneByteRead(pAdapter, offset, &data, bPseudoTest); + if (data == header) + break; + } + efuse_OneByteWrite(pAdapter, offset+1, 0xFF, bPseudoTest); + efuse_OneByteWrite(pAdapter, offset+2, 0xFF, bPseudoTest); + offset += 2; + ErrOffset = offset; + } + } + } + } + + return ErrOffset; +} + +BOOLEAN hal_EfuseCheckIfDatafollowed( + IN PADAPTER pAdapter, + IN u8 word_cnts, + IN u16 startAddr, + IN BOOLEAN bPseudoTest +) +{ + BOOLEAN bRet = FALSE; + u8 i, efuse_data; + + for (i = 0; i < (word_cnts * 2) ; i++) { + if (efuse_OneByteRead(pAdapter, (startAddr + i) , &efuse_data, bPseudoTest) && (efuse_data != 0xFF)) + bRet = TRUE; + } + + return bRet; +} + +BOOLEAN +hal_EfuseWordEnMatched( + IN PPGPKT_STRUCT pTargetPkt, + IN PPGPKT_STRUCT pCurPkt, + IN u8 *pWden +) +{ + u8 match_word_en = 0x0F; /* default all words are disabled */ + + /* check if the same words are enabled both target and current PG packet */ + if (((pTargetPkt->word_en & BIT0) == 0) && + ((pCurPkt->word_en & BIT0) == 0)) { + match_word_en &= ~BIT0; /* enable word 0 */ + } + if (((pTargetPkt->word_en & BIT1) == 0) && + ((pCurPkt->word_en & BIT1) == 0)) { + match_word_en &= ~BIT1; /* enable word 1 */ + } + if (((pTargetPkt->word_en & BIT2) == 0) && + ((pCurPkt->word_en & BIT2) == 0)) { + match_word_en &= ~BIT2; /* enable word 2 */ + } + if (((pTargetPkt->word_en & BIT3) == 0) && + ((pCurPkt->word_en & BIT3) == 0)) { + match_word_en &= ~BIT3; /* enable word 3 */ + } + + *pWden = match_word_en; + + if (match_word_en != 0xf) + return TRUE; + else + return FALSE; +} + + +BOOLEAN +efuse_PgPacketPartialWrite( + IN PADAPTER pAdapter, + IN u8 efuseType, + IN OUT u16 *pAddr, + IN PPGPKT_STRUCT pTargetPkt, + IN BOOLEAN bPseudoTest +) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + PEFUSE_HAL pEfuseHal = &(pHalData->EfuseHal); + BOOLEAN bRet = _FALSE; + u8 i, efuse_data = 0, cur_header = 0; + u8 matched_wden = 0, badworden = 0; + u16 startAddr = 0; + PGPKT_STRUCT curPkt; + u16 max_sec_num = (efuseType == EFUSE_WIFI) ? pEfuseHal->MaxSecNum_WiFi : pEfuseHal->MaxSecNum_BT; + u16 efuse_max = pEfuseHal->BankSize; + u16 efuse_max_available_len = + (efuseType == EFUSE_WIFI) ? pEfuseHal->TotalAvailBytes_WiFi : pEfuseHal->TotalAvailBytes_BT; + + RTW_INFO("efuse_PgPacketPartialWrite()\n"); + + if (bPseudoTest) { + pEfuseHal->fakeEfuseBank = (efuseType == EFUSE_WIFI) ? 0 : pEfuseHal->fakeEfuseBank; + Efuse_GetCurrentSize(pAdapter, efuseType, _TRUE); + } + + EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, &efuse_max_available_len, bPseudoTest); + EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_CONTENT_LEN_BANK, &efuse_max, bPseudoTest); + + if (efuseType == EFUSE_WIFI) { + if (bPseudoTest) { +#ifdef HAL_EFUSE_MEMORY + startAddr = (u16)pEfuseHal->fakeEfuseUsedBytes; +#else + startAddr = (u16)fakeEfuseUsedBytes; +#endif + + } else + rtw_hal_get_hwreg(pAdapter, HW_VAR_EFUSE_BYTES, (u8 *)&startAddr); + } else { + if (bPseudoTest) { +#ifdef HAL_EFUSE_MEMORY + startAddr = (u16)pEfuseHal->fakeBTEfuseUsedBytes; +#else + startAddr = (u16)fakeBTEfuseUsedBytes; +#endif + + } else + rtw_hal_get_hwreg(pAdapter, HW_VAR_EFUSE_BT_BYTES, (u8 *)&startAddr); + } + + startAddr %= efuse_max; + RTW_INFO("%s: startAddr=%#X\n", __FUNCTION__, startAddr); + RTW_INFO("efuse_PgPacketPartialWrite(), startAddr = 0x%X\n", startAddr); + + while (1) { + if (startAddr >= efuse_max_available_len) { + bRet = _FALSE; + RTW_INFO("startAddr(%d) >= efuse_max_available_len(%d)\n", + startAddr, efuse_max_available_len); + break; + } + + if (efuse_OneByteRead(pAdapter, startAddr, &efuse_data, bPseudoTest) && (efuse_data != 0xFF)) { + if (EXT_HEADER(efuse_data)) { + cur_header = efuse_data; + startAddr++; + efuse_OneByteRead(pAdapter, startAddr, &efuse_data, bPseudoTest); + if (ALL_WORDS_DISABLED(efuse_data)) { + u16 recoveredAddr = startAddr; + + recoveredAddr = Hal_EfusePgPacketExceptionHandle_8812A(pAdapter, startAddr - 1); + + if (recoveredAddr == (startAddr - 1)) { + RTW_INFO("Error! All words disabled and the recovery failed, (Addr, Data) = (0x%X, 0x%X)\n", + startAddr, efuse_data); + pAdapter->LastError = ERR_INVALID_DATA; + break; + + } else { + startAddr = recoveredAddr; + RTW_INFO("Bad extension header but recovered => Keep going.\n"); + continue; + } + } else { + curPkt.offset = ((cur_header & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1); + curPkt.word_en = efuse_data & 0x0F; + } + } else { + if (ALL_WORDS_DISABLED(efuse_data)) { + u16 recoveredAddr = startAddr; + + recoveredAddr = Hal_EfusePgPacketExceptionHandle_8812A(pAdapter, startAddr); + if (recoveredAddr != startAddr) { + efuse_OneByteRead(pAdapter, startAddr, &efuse_data, bPseudoTest); + RTW_INFO("Bad header but recovered => Read header again.\n"); + } + } + + cur_header = efuse_data; + curPkt.offset = (cur_header >> 4) & 0x0F; + curPkt.word_en = cur_header & 0x0F; + } + if (curPkt.offset > max_sec_num) { + pAdapter->LastError = ERR_OUT_OF_RANGE; + pEfuseHal->Status = ERR_OUT_OF_RANGE; + bRet = _FALSE; + break; + } + + curPkt.word_cnts = Efuse_CalculateWordCnts(curPkt.word_en); + /* if same header is found but no data followed */ + /* write some part of data followed by the header. */ + if ((curPkt.offset == pTargetPkt->offset) && + (!hal_EfuseCheckIfDatafollowed(pAdapter, curPkt.word_cnts, startAddr + 1, bPseudoTest)) && + hal_EfuseWordEnMatched(pTargetPkt, &curPkt, &matched_wden)) { + RTW_INFO("Need to partial write data by the previous wrote header\n"); + /* RT_ASSERT(_FALSE, ("Error, Need to partial write data by the previous wrote header!!\n")); */ + /* Here to write partial data */ + badworden = Efuse_WordEnableDataWrite(pAdapter, startAddr + 1, matched_wden, pTargetPkt->data, bPseudoTest); + if (badworden != 0x0F) { + u32 PgWriteSuccess = 0; + /* if write fail on some words, write these bad words again */ + + PgWriteSuccess = Efuse_PgPacketWrite(pAdapter, pTargetPkt->offset, badworden, pTargetPkt->data, bPseudoTest); + + if (!PgWriteSuccess) { + bRet = _FALSE; /* write fail, return */ + break; + } + } + /* partial write ok, update the target packet for later use */ + for (i = 0; i < 4; i++) { + if ((matched_wden & (0x1 << i)) == 0) { /* this word has been written */ + pTargetPkt->word_en |= (0x1 << i); /* disable the word */ + } + } + pTargetPkt->word_cnts = Efuse_CalculateWordCnts(pTargetPkt->word_en); + } + /* read from next header */ + startAddr = startAddr + (curPkt.word_cnts * 2) + 1; + } else { + /* not used header, 0xff */ + *pAddr = startAddr; + RTW_INFO("Started from unused header offset=%d\n", startAddr); + bRet = _TRUE; + break; + } + } + return bRet; +} + +BOOLEAN efuse_PgPacketWriteHeader( + PADAPTER pAdapter, + u8 efuseType, + u16 *pAddr, + PPGPKT_STRUCT pTargetPkt, + BOOLEAN bPseudoTest) +{ + BOOLEAN bRet = _FALSE; + + if (pTargetPkt->offset >= EFUSE_MAX_SECTION_BASE) + bRet = hal_EfusePgPacketWrite2ByteHeader(pAdapter, efuseType, pAddr, pTargetPkt, bPseudoTest); + else + bRet = hal_EfusePgPacketWrite1ByteHeader(pAdapter, efuseType, pAddr, pTargetPkt, bPseudoTest); + + return bRet; +} + +int +hal_EfusePgPacketWrite_8812A(IN PADAPTER pAdapter, + u8 offset, + u8 word_en, + u8 *pData, + BOOLEAN bPseudoTest) +{ + u8 efuseType = EFUSE_WIFI; + PGPKT_STRUCT targetPkt; + u16 startAddr = 0; + + RTW_INFO("===> efuse_PgPacketWrite[%s], offset: 0x%X\n", (efuseType == EFUSE_WIFI) ? "WIFI" : "BT", offset); + + /* 4 [1] Check if the remaining space is available to write. */ + if (!efuse_PgPacketCheck(pAdapter, efuseType, bPseudoTest)) { + pAdapter->LastError = ERR_WRITE_PROTECT; + RTW_INFO("efuse_PgPacketCheck(), fail!!\n"); + return _FALSE; + } + + /* 4 [2] Construct a packet to write: (Data, Offset, and WordEnable) */ + efuse_PgPacketConstruct(offset, word_en, pData, &targetPkt); + + /* 4 [3] Fix headers without data or fix bad headers, and then return the address where to get started. */ + if (!efuse_PgPacketPartialWrite(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest)) { + pAdapter->LastError = ERR_INVALID_DATA; + RTW_INFO("efuse_PgPacketPartialWrite(), fail!!\n"); + return _FALSE; + } + + /* 4 [4] Write the (extension) header. */ + if (!efuse_PgPacketWriteHeader(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest)) { + pAdapter->LastError = ERR_IO_FAILURE; + RTW_INFO("efuse_PgPacketWriteHeader(), fail!!\n"); + return _FALSE; + } + + /* 4 [5] Write the data. */ + if (!hal_EfusePgPacketWriteData(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest)) { + pAdapter->LastError = ERR_IO_FAILURE; + RTW_INFO("efuse_PgPacketWriteData(), fail!!\n"); + return _FALSE; + } + + RTW_INFO("<=== efuse_PgPacketWrite\n"); + return _TRUE; +} + +static VOID +rtl8812_EfusePowerSwitch( + IN PADAPTER pAdapter, + IN u8 bWrite, + IN u8 PwrState) +{ + + Hal_EfusePowerSwitch8812A(pAdapter, bWrite, PwrState); + +} + static int rtl8812_Efuse_PgPacketWrite(IN PADAPTER pAdapter, IN u8 offset, @@ -3136,7 +3303,7 @@ rtl8812_Efuse_PgPacketWrite(IN PADAPTER pAdapter, IN u8 *data, IN BOOLEAN bPseudoTest) { - int ret; + int ret; ret = hal_EfusePgPacketWrite_8812A(pAdapter, offset, word_en, data, bPseudoTest); @@ -3242,110 +3409,6 @@ hal_EfusePartialWriteCheck( return bRet; } -static u8 -hal_EfusePgPacketWrite2ByteHeader( - PADAPTER padapter, - u8 efuseType, - u16 *pAddr, - PPGPKT_STRUCT pTargetPkt, - u8 bPseudoTest) -{ - u16 efuse_addr, efuse_max_available_len = 0; - u8 pg_header = 0, tmp_header = 0; - u8 repeatcnt = 0; - - - /* RTW_INFO("%s\n", __FUNCTION__); */ - EFUSE_GetEfuseDefinition(padapter, efuseType, TYPE_AVAILABLE_EFUSE_BYTES_BANK, &efuse_max_available_len, bPseudoTest); - - efuse_addr = *pAddr; - if (efuse_addr >= efuse_max_available_len) { - RTW_INFO("%s: addr(%d) over available(%d)!!\n", __FUNCTION__, efuse_addr, efuse_max_available_len); - return _FALSE; - } - - pg_header = ((pTargetPkt->offset & 0x07) << 5) | 0x0F; - /* RTW_INFO("%s: pg_header=0x%x\n", __FUNCTION__, pg_header); */ - - do { - efuse_OneByteWrite(padapter, efuse_addr, pg_header, bPseudoTest); - efuse_OneByteRead(padapter, efuse_addr, &tmp_header, bPseudoTest); - if (tmp_header != 0xFF) - break; - if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { - RTW_INFO("%s: Repeat over limit for pg_header!!\n", __FUNCTION__); - return _FALSE; - } - } while (1); - - if (tmp_header != pg_header) { - RTW_INFO(KERN_ERR "%s: PG Header Fail!!(pg=0x%02X read=0x%02X)\n", __FUNCTION__, pg_header, tmp_header); - return _FALSE; - } - - /* to write ext_header */ - efuse_addr++; - pg_header = ((pTargetPkt->offset & 0x78) << 1) | pTargetPkt->word_en; - - do { - efuse_OneByteWrite(padapter, efuse_addr, pg_header, bPseudoTest); - efuse_OneByteRead(padapter, efuse_addr, &tmp_header, bPseudoTest); - if (tmp_header != 0xFF) - break; - if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { - RTW_INFO("%s: Repeat over limit for ext_header!!\n", __FUNCTION__); - return _FALSE; - } - } while (1); - - if (tmp_header != pg_header) { /* offset PG fail */ - RTW_INFO(KERN_ERR "%s: PG EXT Header Fail!!(pg=0x%02X read=0x%02X)\n", __FUNCTION__, pg_header, tmp_header); - return _FALSE; - } - - *pAddr = efuse_addr; - - return _TRUE; -} - -static u8 -hal_EfusePgPacketWrite1ByteHeader( - PADAPTER pAdapter, - u8 efuseType, - u16 *pAddr, - PPGPKT_STRUCT pTargetPkt, - u8 bPseudoTest) -{ - u8 bRet = _FALSE; - u8 pg_header = 0, tmp_header = 0; - u16 efuse_addr = *pAddr; - u8 repeatcnt = 0; - - - /* RTW_INFO("%s\n", __FUNCTION__); */ - pg_header = ((pTargetPkt->offset << 4) & 0xf0) | pTargetPkt->word_en; - - do { - efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest); - efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest); - if (tmp_header != 0xFF) - break; - if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { - RTW_INFO("%s: Repeat over limit for pg_header!!\n", __FUNCTION__); - return _FALSE; - } - } while (1); - - if (tmp_header != pg_header) { - RTW_INFO(KERN_ERR "%s: PG Header Fail!!(pg=0x%02X read=0x%02X)\n", __FUNCTION__, pg_header, tmp_header); - return _FALSE; - } - - *pAddr = efuse_addr; - - return _TRUE; -} - static u8 hal_EfusePgPacketWriteHeader( PADAPTER padapter, @@ -3364,30 +3427,6 @@ hal_EfusePgPacketWriteHeader( return bRet; } -static u8 -hal_EfusePgPacketWriteData( - PADAPTER pAdapter, - u8 efuseType, - u16 *pAddr, - PPGPKT_STRUCT pTargetPkt, - u8 bPseudoTest) -{ - u16 efuse_addr; - u8 badworden; - - - efuse_addr = *pAddr; - badworden = Efuse_WordEnableDataWrite(pAdapter, efuse_addr + 1, pTargetPkt->word_en, pTargetPkt->data, bPseudoTest); - if (badworden != 0x0F) { - RTW_INFO("%s: Fail!!\n", __FUNCTION__); - return _FALSE; - } - - /* RTW_INFO("%s: ok\n", __FUNCTION__); */ - return _TRUE; -} - - static u8 Hal_EfusePgPacketWrite_BT( PADAPTER pAdapter, From 14e32665291aa0eefb4ba014ad7337cc1999b87d Mon Sep 17 00:00:00 2001 From: Christian B Date: Sat, 16 Dec 2017 12:31:10 +0100 Subject: [PATCH 2/6] Use fixed mac address when one is not specified * Use fixed MAC instead of RANDOM. For changing MAC, use "macchanger" or related tools instead. This fix was presented in "goncalossilva" fork here: https://github.com/goncalossilva/rtl8812AU/commit/eaa89bf90cf30a1e6ed4e828417d52f4e9b97a9d --- core/rtw_ieee80211.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/rtw_ieee80211.c b/core/rtw_ieee80211.c index e443945..56a0096 100644 --- a/core/rtw_ieee80211.c +++ b/core/rtw_ieee80211.c @@ -1379,7 +1379,7 @@ extern char *rtw_initmac; */ void rtw_macaddr_cfg(u8 *out, const u8 *hw_mac_addr) { -#define DEFAULT_RANDOM_MACADDR 1 +#define DEFAULT_RANDOM_MACADDR 0 u8 mac[ETH_ALEN]; if (out == NULL) { @@ -1422,9 +1422,9 @@ err_chk: mac[0] = 0x00; mac[1] = 0xe0; mac[2] = 0x4c; - mac[3] = 0x87; - mac[4] = 0x00; - mac[5] = 0x00; + mac[3] = 0xe0; + mac[4] = 0x10; + mac[5] = 0x70; #endif } From 9102876a597873fea7cb3bfefbd3689a452d31c7 Mon Sep 17 00:00:00 2001 From: Christian B Date: Sat, 16 Dec 2017 12:40:58 +0100 Subject: [PATCH 3/6] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e20a412..456776f 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,8 @@ or ``` sudo iw wlan0 set txpower fixed 3000 ``` -For Ubuntu 17.04 add the following lines +Newer versions of NetworkManager switches to random MAC address +Some users would prefer to use a fixed address. Simply add these lines below ``` [device] wifi.scan-rand-mac-address=no From 6584437a9cbc6c88f61bcb1a528de836f9f7ef93 Mon Sep 17 00:00:00 2001 From: Christian B Date: Sat, 16 Dec 2017 14:15:42 +0100 Subject: [PATCH 4/6] Cleanup: Brackets & Indentation --- hal/rtl8814a/rtl8814a_hal_init.c | 1317 +++++++++++++----------------- 1 file changed, 579 insertions(+), 738 deletions(-) diff --git a/hal/rtl8814a/rtl8814a_hal_init.c b/hal/rtl8814a/rtl8814a_hal_init.c index 578addc..1135b1a 100644 --- a/hal/rtl8814a/rtl8814a_hal_init.c +++ b/hal/rtl8814a/rtl8814a_hal_init.c @@ -35,7 +35,7 @@ Hal_InitEfuseVars_8814A( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); PEFUSE_HAL pEfuseHal = &(pHalData->EfuseHal); pu2Byte ptr; - + #define INIT_EFUSE(var,value) ptr = (pu2Byte)&var; *ptr = value RTW_INFO("====> %s \n", __func__); @@ -59,16 +59,16 @@ Hal_InitEfuseVars_8814A( RTW_INFO("====>pEfuseHal->PhysicalLen_WiFi %d \n", pEfuseHal->PhysicalLen_WiFi); INIT_EFUSE(pEfuseHal->LogicalLen_WiFi , EFUSE_MAP_LEN_8814A); RTW_INFO("====>pEfuseHal->LogicalLen_WiFi %d \n", pEfuseHal->LogicalLen_WiFi); - INIT_EFUSE(pEfuseHal->BankNum_WiFi , pEfuseHal->PhysicalLen_WiFi/pEfuseHal->BankSize); - INIT_EFUSE(pEfuseHal->TotalAvailBytes_WiFi, (pEfuseHal->PhysicalLen_WiFi - (pEfuseHal->TotalBankNum * pEfuseHal->OOBProtectBytes))); + INIT_EFUSE(pEfuseHal->BankNum_WiFi , pEfuseHal->PhysicalLen_WiFi/pEfuseHal->BankSize); + INIT_EFUSE(pEfuseHal->TotalAvailBytes_WiFi, (pEfuseHal->PhysicalLen_WiFi - (pEfuseHal->TotalBankNum * pEfuseHal->OOBProtectBytes))); //2 BT - INIT_EFUSE(pEfuseHal->MaxSecNum_BT , 0); + INIT_EFUSE(pEfuseHal->MaxSecNum_BT , 0); INIT_EFUSE(pEfuseHal->PhysicalLen_BT , 0); INIT_EFUSE(pEfuseHal->LogicalLen_BT , 0); INIT_EFUSE(pEfuseHal->BankNum_BT , 0); - INIT_EFUSE(pEfuseHal->TotalAvailBytes_BT, 0); - + INIT_EFUSE(pEfuseHal->TotalAvailBytes_BT, 0); + RTW_INFO("%s <====\n", __func__); } @@ -93,9 +93,9 @@ s32 InitLLTTable8814A( { Status = _FAIL; break; - } + } } - return Status; + return Status; } #ifdef CONFIG_WOWLAN @@ -113,7 +113,7 @@ SetBcnCtrlReg( ) { HAL_DATA_TYPE* pHalData = GET_HAL_DATA(Adapter); - + pHalData->RegBcnCtrlVal |= SetBits; pHalData->RegBcnCtrlVal &= ~ClearBits; @@ -141,14 +141,12 @@ _FWDownloadEnable_8814A( u2Tmp &= (~BIT12); u2Tmp |= BIT13; u2Tmp |= BIT0; - rtw_write16(Adapter, REG_8051FW_CTRL_8814A, u2Tmp); + rtw_write16(Adapter, REG_8051FW_CTRL_8814A, u2Tmp); // Clear Rom DL enable // tmp = rtw_read8(Adapter, REG_8051FW_CTRL_8814A+2); //modify by gw 20130826(advice by hw) - // rtw_write8(Adapter, REG_8051FW_CTRL_8814A+2, tmp&0xf7);//clear bit3 - } - else - { + // rtw_write8(Adapter, REG_8051FW_CTRL_8814A+2, tmp&0xf7);//clear bit3 + } else { // MCU firmware download enable. tmp = rtw_read8(Adapter, REG_8051FW_CTRL_8814A); rtw_write8(Adapter, REG_8051FW_CTRL_8814A, tmp&0xfe); @@ -175,7 +173,7 @@ _BlockWrite_8814A( #ifdef CONFIG_USB_HCI blockSize_p1 = MAX_REG_BOLCK_SIZE; // Use 196-byte write to download FW // Small block size will increase USB init speed. But prevent FW download fail - // use 4-Byte instead of 196-Byte to write FW. + // use 4-Byte instead of 196-Byte to write FW. #endif //3 Phase #1 @@ -185,7 +183,7 @@ _BlockWrite_8814A( if(blockCount_p1) RT_TRACE(COMP_INIT,DBG_LOUD,("_BlockWrite_8814A[P1] ::buffSize( %d) blockSize_p1( %d) blockCount_p1( %d), remainSize_p1( %d)\n",buffSize ,blockSize_p1,blockCount_p1, remainSize_p1)); - for(i = 0 ; i < blockCount_p1 ; i++){ + for(i = 0 ; i < blockCount_p1 ; i++) { #if (DEV_BUS_TYPE == RT_USB_INTERFACE) rtw_writeN(Adapter, (FW_START_ADDRESS + i * blockSize_p1), blockSize_p1,(bufferPtr + i * blockSize_p1)); #else @@ -204,22 +202,21 @@ _BlockWrite_8814A( RT_TRACE(COMP_INIT,DBG_LOUD,("_BlockWrite_8814A[P2] ::buffSize_p2( %d) blockSize_p2( %d) blockCount_p2( %d) remainSize_p2( %d)\n",(buffSize-offset), blockSize_p2 ,blockCount_p2, remainSize_p2)); #if (DEV_BUS_TYPE == RT_USB_INTERFACE) - for(i = 0 ; i < blockCount_p2 ; i++){ + for(i = 0 ; i < blockCount_p2 ; i++){ rtw_writeN(Adapter, (FW_START_ADDRESS + offset+i*blockSize_p2), blockSize_p2,(bufferPtr + offset+i*blockSize_p2)); } #endif } - + //3 Phase #3 - if(remainSize_p2) - { - offset=(blockCount_p1 * blockSize_p1)+(blockCount_p2*blockSize_p2); + if(remainSize_p2) { + offset=(blockCount_p1 * blockSize_p1)+(blockCount_p2*blockSize_p2); blockCount_p3 = remainSize_p2 /blockSize_p3; RT_TRACE(COMP_INIT,DBG_LOUD,("_BlockWrite_8814A[P3] ::buffSize_p3( %d) blockSize_p3( %d) blockCount_p3( %d) \n",(buffSize-offset),blockSize_p3, blockCount_p3)); - - for(i = 0 ; i < blockCount_p3 ; i++){ + + for(i = 0 ; i < blockCount_p3 ; i++) { rtw_write8(Adapter, (FW_START_ADDRESS + offset + i), *(bufferPtr +offset+ i)); } } @@ -238,7 +235,7 @@ _PageWrite_8814A( value8 = (rtw_read8(Adapter, REG_8051FW_CTRL_8814A+2)& 0xF8 ) | u8Page ; rtw_write8(Adapter,REG_8051FW_CTRL_8814A+2,value8); - + _BlockWrite_8814A(Adapter,buffer,size); } @@ -274,27 +271,27 @@ _WriteFW_8814A( u8* bufferPtr = (u8*)buffer; #ifdef CONFIG_PCI_HCI - // 20100120 Joseph: Add for 88CE normal chip. + // 20100120 Joseph: Add for 88CE normal chip. // Fill in zero to make firmware image to dword alignment. _FillDummy_8814A(bufferPtr, &size); #endif //CONFIG_PCI_HCI - - pageNums = size / MAX_PAGE_SIZE ; - //RT_ASSERT((pageNums <= 8), ("Page numbers should not greater then 8 \n")); - - remainSize = size % MAX_PAGE_SIZE; - + pageNums = size / MAX_PAGE_SIZE ; + + //RT_ASSERT((pageNums <= 8), ("Page numbers should not greater then 8 \n")); + + remainSize = size % MAX_PAGE_SIZE; + for(page = 0; page < pageNums; page++){ offset = page *MAX_PAGE_SIZE; - _PageWrite_8814A(Adapter,page, (bufferPtr+offset),MAX_PAGE_SIZE); + _PageWrite_8814A(Adapter,page, (bufferPtr+offset),MAX_PAGE_SIZE); rtw_udelay_os(2); } if(remainSize){ offset = pageNums *MAX_PAGE_SIZE; page = pageNums; _PageWrite_8814A(Adapter,page, (bufferPtr+offset),remainSize); - } + } RT_TRACE(COMP_INIT, DBG_LOUD, ("_WriteFW_8814A Done- for Normal chip.\n")); } @@ -323,7 +320,7 @@ _3081Enable8814A( //add by ylb 20130814 for 3081 download FW static -BOOLEAN +BOOLEAN IDDMADownLoadFW_3081( IN PADAPTER Adapter, IN u32 source, @@ -343,17 +340,17 @@ IDDMADownLoadFW_3081( rtw_udelay_os(1000); cnt--; if(cnt==0) - { + { RTW_INFO("IDDMADownLoadFW_3081, line%d: CNT fail\n", __LINE__); return _FALSE; } } ch0ctrl |= length & DDMA_LEN_MASK; - + //check if chksum continuous if(fs == _FALSE){ ch0ctrl |= DDMA_CH_CHKSUM_CNT; - } + } rtw_write32(Adapter,REG_DDMA_CH0SA, source); rtw_write32(Adapter,REG_DDMA_CH0DA, dest); rtw_write32(Adapter,REG_DDMA_CH0CTRL, ch0ctrl); @@ -364,13 +361,13 @@ IDDMADownLoadFW_3081( rtw_udelay_os(1000); cnt--; if(cnt==0) - { + { RTW_INFO("IDDMADownLoadFW_3081, line%d: CNT fail\n", __LINE__); return _FALSE; } } - - //check checksum + + //check checksum if(ls == _TRUE) { tmp = rtw_read8(Adapter,REG_8051FW_CTRL_8814A); @@ -390,7 +387,7 @@ IDDMADownLoadFW_3081( tmp |= DMEM_DL_RDY; rtw_write8(Adapter,REG_8051FW_CTRL_8814A, tmp|DMEM_CHKSUM_OK); RTW_INFO("dmem check sum tmp %d\n",tmp); - } + } } else {//chksum fail @@ -419,7 +416,7 @@ IDDMADownLoadFW_3081( //add by ylb 20130814 for 3081 download FW static -BOOLEAN +BOOLEAN WaitDownLoadRSVDPageOK_3081( IN PADAPTER Adapter ) @@ -427,7 +424,7 @@ WaitDownLoadRSVDPageOK_3081( u8 BcnValidReg=0,TxBcReg=0; u8 count=0, DLBcnCount=0; BOOLEAN bRetValue = _FALSE; - + #if defined(CONFIG_PCI_HCI) //Polling Beacon Queue to send Beacon TxBcReg = rtw_read8(Adapter, REG_MGQ_TXBD_NUM_8814A+3); @@ -438,7 +435,7 @@ WaitDownLoadRSVDPageOK_3081( rtw_udelay_os(10); TxBcReg = rtw_read8(Adapter, REG_MGQ_TXBD_NUM_8814A+3); } - + rtw_write8(Adapter, REG_MGQ_TXBD_NUM_8814A+3, TxBcReg|BIT4); #endif //#if defined(CONFIG_PCI_HCI) // check rsvd page download OK. @@ -450,7 +447,7 @@ WaitDownLoadRSVDPageOK_3081( rtw_udelay_os(50); BcnValidReg = rtw_read8(Adapter, REG_FIFOPAGE_CTRL_2_8814A+1); } - + //Set 1 to Clear BIT7 by SW if(BcnValidReg & BIT7) { @@ -478,12 +475,12 @@ SetDownLoadFwRsvdPagePkt_8814A( struct xmit_frame *pcmdframe; struct xmit_priv *pxmitpriv; struct pkt_attrib *pattrib; - //The desc lengh in Tx packet buffer of 8814A is 40 bytes. + //The desc lengh in Tx packet buffer of 8814A is 40 bytes. u16 BufIndex=0, TxDescOffset = TXDESC_OFFSET; u32 TotalPacketLen = len; BOOLEAN bDLOK = FALSE; u8 *ReservedPagePacket; - + pHalData = GET_HAL_DATA(Adapter); pxmitpriv = &Adapter->xmitpriv; @@ -501,24 +498,23 @@ SetDownLoadFwRsvdPagePkt_8814A( BufIndex = TxDescOffset; TotalPacketLen = len + BufIndex; - + _rtw_memcpy(&ReservedPagePacket[BufIndex], buffer, len); //RTW_INFO("SetFwRsvdPagePkt_8814A(): HW_VAR_SET_TX_CMD: BCN, %p, %d\n", &ReservedPagePacket[BufIndex], len); - + //RTW_INFO("SetFwRsvdPagePkt(): TotalPacketLen=%d \n", TotalPacketLen); - + // update attribute pattrib = &pcmdframe->attrib; update_mgntframe_attrib(Adapter, pattrib); pattrib->qsel = QSLT_BEACON; pattrib->pktlen = pattrib->last_txcmdsz = TotalPacketLen - TxDescOffset; - + dump_mgntframe(Adapter, pcmdframe); //ReturnGenTempBuffer(pAdapter, pGenBufReservedPagePacket); } - VOID HalROMDownloadFWRSVDPage8814A( IN PADAPTER Adapter, @@ -526,15 +522,15 @@ HalROMDownloadFWRSVDPage8814A( IN u32 Len ) { - u8 u1bTmp=0, tmpReg422=0; + u8 u1bTmp=0, tmpReg422=0; u8 BcnValidReg=0,TxBcReg=0; BOOLEAN bSendBeacon=_FALSE, bDownLoadRSVDPageOK = _FALSE; u8* pbuffer = buffer; - + BOOLEAN fs = _TRUE, ls = _FALSE; u8 FWHeaderSize = 64, PageSize = 128 ; u16 RsvdPageNum = 0; - u32 dmem_pkt_size = 0, iram_pkt_size = 0 ,MaxRsvdPageBufSize = 0; + u32 dmem_pkt_size = 0, iram_pkt_size = 0 ,MaxRsvdPageBufSize = 0; u32 last_block_size = 0, filesize_ram_block = 0, pkt_offset = 0; u32 txpktbuf_bndy = 0; u32 BeaconHeaderInTxPacketBuf = 0, MEMOffsetInTxPacketBuf = 0; @@ -549,7 +545,7 @@ HalROMDownloadFWRSVDPage8814A( // 2010.05.11. Added by tynli. SetBcnCtrlReg(Adapter, 0, BIT3); SetBcnCtrlReg(Adapter, BIT4, 0); - + // Set FWHW_TXQ_CTRL 0x422[6]=0 to tell Hw the packet is not a real beacon frame. tmpReg422 = rtw_read8(Adapter, REG_FWHW_TXQ_CTRL_8814A+2); rtw_write8(Adapter, REG_FWHW_TXQ_CTRL_8814A+2, tmpReg422&(~BIT6)); @@ -563,21 +559,21 @@ HalROMDownloadFWRSVDPage8814A( //Set The head page of packet of Bcnq rtw_hal_get_def_var(Adapter, HAL_DEF_TX_PAGE_BOUNDARY, (u16*)&txpktbuf_bndy); rtw_write16(Adapter,REG_FIFOPAGE_CTRL_2_8814A, txpktbuf_bndy); - + /* RTW_INFO("HalROMDownloadFWRSVDPage8814A: txpktbuf_bndy=%d\n", txpktbuf_bndy); */ - + // Clear beacon valid check bit. BcnValidReg = rtw_read8(Adapter, REG_FIFOPAGE_CTRL_2_8814A+1); rtw_write8(Adapter, REG_FIFOPAGE_CTRL_2_8814A+1, (BcnValidReg|BIT7)); - + // Return Beacon TCB. //ReturnBeaconQueueTcb_8814A(Adapter); - + dmem_pkt_size = (u32)GET_FIRMWARE_HDR_TOTAL_DMEM_SZ_3081(pbuffer); - iram_pkt_size = (u32)GET_FIRMWARE_HDR_IRAM_SZ_3081(pbuffer); + iram_pkt_size = (u32)GET_FIRMWARE_HDR_IRAM_SZ_3081(pbuffer); dmem_pkt_size += (u32)FW_CHKSUM_DUMMY_SZ; iram_pkt_size += (u32)FW_CHKSUM_DUMMY_SZ; - + if(dmem_pkt_size + iram_pkt_size + FWHeaderSize != Len) { RTW_INFO("ERROR: Fw Hdr size do not match the real fw size!!\n"); @@ -585,8 +581,8 @@ HalROMDownloadFWRSVDPage8814A( return; } RTW_INFO("dmem_pkt_size = %d, iram_pkt_size = %d,FWHeaderSize = %d, Len = %d!!\n",dmem_pkt_size,iram_pkt_size,FWHeaderSize,Len); - - // download rsvd page. + + // download rsvd page. //RsvdPageNum = GetTxBufferRsvdPageNum8814A(Adapter, _FALSE); #ifdef CONFIG_BCN_IC /* TODO: check tx buffer and DMA size */ @@ -595,12 +591,12 @@ HalROMDownloadFWRSVDPage8814A( MaxRsvdPageBufSize = MAX_XMIT_EXTBUF_SZ-TXDESC_OFFSET;//RsvdPageNum*PageSize - 40 -16 /*modified for usb*/;//TX_INFO_SIZE_8814AE; #endif RTW_INFO("MaxRsvdPageBufSize %d, Total len %d\n",MaxRsvdPageBufSize,Len); - + BeaconHeaderInTxPacketBuf = txpktbuf_bndy * PageSize; - MEMOffsetInTxPacketBuf = OCPBASE_TXBUF_3081 + BeaconHeaderInTxPacketBuf + 40;//TX_INFO_SIZE_8814AE; + MEMOffsetInTxPacketBuf = OCPBASE_TXBUF_3081 + BeaconHeaderInTxPacketBuf + 40;//TX_INFO_SIZE_8814AE; //download DMEM while(dmem_pkt_size > 0) - { + { if(dmem_pkt_size > MaxRsvdPageBufSize) { filesize_ram_block = MaxRsvdPageBufSize; @@ -612,11 +608,9 @@ HalROMDownloadFWRSVDPage8814A( if(((last_block_size + 40) & 0x3F) == 0) // Multiples of 64 filesize_ram_block -=4; } - } - else - { + } else { filesize_ram_block = dmem_pkt_size; - ls = _TRUE; + ls = _TRUE; } fs = (pkt_offset == 0 ? _TRUE: _FALSE); // Return Beacon TCB. @@ -628,17 +622,17 @@ HalROMDownloadFWRSVDPage8814A( { RTW_INFO("ERROR: DMEM bDownLoadRSVDPageOK is false!!\n"); return; - } - - IDDMADownLoadFW_3081(Adapter,MEMOffsetInTxPacketBuf,OCPBASE_DMEM_3081+pkt_offset,filesize_ram_block,fs,ls); - dmem_pkt_size -= filesize_ram_block; + } + + IDDMADownLoadFW_3081(Adapter,MEMOffsetInTxPacketBuf,OCPBASE_DMEM_3081+pkt_offset,filesize_ram_block,fs,ls); + dmem_pkt_size -= filesize_ram_block; pkt_offset += filesize_ram_block; - } - + } + //download IRAM pkt_offset = 0; while(iram_pkt_size > 0) - { + { if(iram_pkt_size > MaxRsvdPageBufSize) { filesize_ram_block = MaxRsvdPageBufSize; @@ -650,39 +644,37 @@ HalROMDownloadFWRSVDPage8814A( if(((last_block_size + 40) & 0x3F) == 0) // Multiples of 64 filesize_ram_block -=4; } - } - else - { + } else { filesize_ram_block = iram_pkt_size; ls = _TRUE; } - + fs = (pkt_offset == 0 ? _TRUE: _FALSE); // Return Beacon TCB. //ReturnBeaconQueueTcb_8814A(Adapter); //RTW_INFO("%d packet offset %d iram_pkt_size %d\n", __LINE__,pkt_offset, iram_pkt_size); SetDownLoadFwRsvdPagePkt_8814A(Adapter, pbuffer+Len-iram_pkt_size, filesize_ram_block); - + bDownLoadRSVDPageOK = WaitDownLoadRSVDPageOK_3081(Adapter); if(!bDownLoadRSVDPageOK) { RTW_INFO("ERROR: IRAM bDownLoadRSVDPageOK is false!!\n"); return; } - - IDDMADownLoadFW_3081(Adapter,MEMOffsetInTxPacketBuf,OCPBASE_IMEM_3081+pkt_offset,filesize_ram_block,fs,ls); - - iram_pkt_size -= filesize_ram_block; + + IDDMADownLoadFW_3081(Adapter,MEMOffsetInTxPacketBuf,OCPBASE_IMEM_3081+pkt_offset,filesize_ram_block,fs,ls); + + iram_pkt_size -= filesize_ram_block; pkt_offset += filesize_ram_block; } - - // Enable Bcn + + // Enable Bcn SetBcnCtrlReg(Adapter, BIT3, 0); SetBcnCtrlReg(Adapter, 0, BIT4); // To make sure that if there exists an adapter which would like to send beacon. // If exists, the origianl value of 0x422[6] will be 1, we should check this to - // prevent from setting 0x422[6] to 0 after download reserved page, or it will cause + // prevent from setting 0x422[6] to 0 after download reserved page, or it will cause // the beacon cannot be sent by HW. // 2010.06.23. Added by tynli. if(bSendBeacon) @@ -719,23 +711,22 @@ _FWFreeToGo8814A( u32 value32; // polling CheckSum report - do{ + do { rtw_mdelay_os(50); value32 = rtw_read32(Adapter, REG_8051FW_CTRL_8814A); - + } while ((counter++ < 100) && (!(value32 & CPU_DL_READY))); if (counter >= 100) { - RT_TRACE(COMP_INIT, DBG_SERIOUS, ("_FWFreeToGo8814A:: FW init fail ! REG_8051FW_CTRL_8814A:0x%08x .\n", value32)); + RT_TRACE(COMP_INIT, DBG_SERIOUS, ("_FWFreeToGo8814A:: FW init fail ! REG_8051FW_CTRL_8814A:0x%08x .\n", value32)); return _FAIL; } RT_TRACE(COMP_INIT, DBG_LOUD, ("_FWFreeToGo8814A:: FW init ok ! REG_8051FW_CTRL_8814A:0x%08x .\n", value32)); - + return _SUCCESS; } - #ifdef CONFIG_FILE_FWIMG extern char *rtw_fw_file_path; u8 FwBuffer8814[FW_SIZE]; @@ -754,8 +745,8 @@ FirmwareDownload8814A( s32 rtStatus = _SUCCESS; u8 write_fw = 0; u32 fwdl_start_time; - PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); - + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); + u8 *pFwImageFileName; u8 *pucMappedFile = NULL; PRT_FIRMWARE_8814 pFirmware = NULL; @@ -763,7 +754,6 @@ FirmwareDownload8814A( u8 *pFirmwareBuf; u32 FirmwareLen; - RT_TRACE(_module_hal_init_c_, _drv_info_, ("+%s\n", __FUNCTION__)); pFirmware = (PRT_FIRMWARE_8814)rtw_zmalloc(sizeof(RT_FIRMWARE_8814)); if(!pFirmware) @@ -832,7 +822,7 @@ FirmwareDownload8814A( RTW_INFO ("%s: fw_ver=%d fw_subver=%d sig=0x%x\n", __FUNCTION__, pHalData->FirmwareVersion, pHalData->FirmwareSubVersion, pHalData->FirmwareSignature); fwdl_start_time = rtw_get_current_time(); - + _FWDownloadEnable_8814A(Adapter, _TRUE); _3081Disable8814A(Adapter);//add by gw 2013026 for disable mcu core @@ -842,8 +832,8 @@ FirmwareDownload8814A( _3081Enable8814A(Adapter);//add by gw 2013026 for Enable mcu core _FWDownloadEnable_8814A(Adapter, _FALSE); - - rtStatus = _FWFreeToGo8814A(Adapter); + + rtStatus = _FWFreeToGo8814A(Adapter); if (_SUCCESS != rtStatus) goto fwdl_stat; @@ -860,18 +850,16 @@ exit: #ifdef CONFIG_WOWLAN if (adapter_to_pwrctl(Adapter)->wowlan_mode) - InitializeFirmwareVars8814(Adapter); + InitializeFirmwareVars8814(Adapter); else - RTW_ERR("%s: wowland_mode:%d wowlan_wake_reason:%d\n", - __func__, adapter_to_pwrctl(Adapter)->wowlan_mode, + RTW_ERR("%s: wowland_mode:%d wowlan_wake_reason:%d\n", + __func__, adapter_to_pwrctl(Adapter)->wowlan_mode, adapter_to_pwrctl(Adapter)->wowlan_wake_reason); #endif return rtStatus; } - - void InitializeFirmwareVars8814(PADAPTER padapter) { PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); @@ -913,14 +901,13 @@ SetFwBTFwPatchCmd( FillH2CCmd_8812(Adapter, H2C_BT_FW_PATCH, 6 , u1BTFwPatchParm); } - int _CheckWLANFwPatchBTFwReady_8821A( PADAPTER Adapter ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); u32 count=0; u8 u1bTmp; int ret = _FAIL; - + #if (DEV_BUS_TYPE == RT_SDIO_INTERFACE) u32 txpktbuf_bndy; #endif @@ -931,7 +918,7 @@ int _CheckWLANFwPatchBTFwReady_8821A( PADAPTER Adapter ) do{ u1bTmp = rtw_read8(Adapter, REG_FW_DRV_MSG_8812); if((u1bTmp&BIT6) || (u1bTmp&BIT7)) - { + { ret = _SUCCESS; break; } @@ -964,29 +951,28 @@ int _CheckWLANFwPatchBTFwReady_8821A( PADAPTER Adapter ) {// for WMM txpktbuf_bndy = WMM_NORMAL_TX_PAGE_BOUNDARY_8821; } - + ret = InitLLTTable8812A(Adapter, txpktbuf_bndy); if(_SUCCESS != ret){ RTW_INFO("_CheckWLANFwPatchBTFwReady_8821A(): Failed to init LLT!\n"); } - + // Init Tx boundary. rtw_write8(Adapter, REG_TDECTRL+1, (u8)txpktbuf_bndy); #endif SetBcnCtrlReg(Adapter, BIT3, 0); SetBcnCtrlReg(Adapter, 0, BIT4); - + rtw_write8(Adapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl|BIT6)); pHalData->RegFwHwTxQCtrl |= BIT6; u1bTmp = rtw_read8(Adapter, REG_CR+1); rtw_write8(Adapter, REG_CR+1, (u1bTmp&(~BIT0))); - + return ret; } - int _WriteBTFWtoTxPktBuf8812( PADAPTER Adapter, PVOID buffer, @@ -1082,17 +1068,16 @@ int _WriteBTFWtoTxPktBuf8812( // 2. Adjust LLT table to an even boundary. //--------------------------------------------------------- #if 0//(DEV_BUS_TYPE == RT_SDIO_INTERFACE) - txpktbuf_bndy = 10; // rsvd page start address should be an even value. + txpktbuf_bndy = 10; // rsvd page start address should be an even value. rtStatus = InitLLTTable8723BS(Adapter, txpktbuf_bndy); if(_SUCCESS != rtStatus){ RTW_INFO("_CheckWLANFwPatchBTFwReady_8723B(): Failed to init LLT!\n"); return _FAIL; } - - // Init Tx boundary. - rtw_write8(Adapter, REG_DWBCN0_CTRL_8723B+1, (u8)txpktbuf_bndy); -#endif + // Init Tx boundary. + rtw_write8(Adapter, REG_DWBCN0_CTRL_8723B+1, (u8)txpktbuf_bndy); +#endif //--------------------------------------------------------- // 3. Write Fw to Tx packet buffer by reseverd page. @@ -1168,9 +1153,8 @@ int _WriteBTFWtoTxPktBuf8812( //RTW_INFO("##0x208:%08x,0x210=%08x\n",rtw_read32(Adapter, REG_TDECTRL),rtw_read32(Adapter, 0x210)); rtw_write8(Adapter, REG_TDECTRL+2,BcnValidReg); - - }while((!(BcnValidReg&BIT(0))) && DLBcnCount<5); + }while((!(BcnValidReg&BIT(0))) && DLBcnCount<5); #endif if(DLBcnCount >=5){ @@ -1218,23 +1202,22 @@ int ReservedPage_Compare(PADAPTER Adapter,PRT_MP_FIRMWARE pFirmware,u32 BTPatchS RTW_INFO("%s can't be executed due to the failed malloc.\n", __FUNCTION__); Adapter->mppriv.bTxBufCkFail=_TRUE; return _FALSE; - } - + } + temp=rtw_read8(Adapter,0x209); - + address_start=(temp*128)/8; - + rtw_write32(Adapter,0x140,0x00000000); rtw_write32(Adapter,0x144,0x00000000); rtw_write32(Adapter,0x148,0x00000000); rtw_write8(Adapter,0x106,0x69); - for(i=0;i<(BTPatchSize/8);i++) { - rtw_write32(Adapter,0x140,address_start+5+i) ; - + rtw_write32(Adapter,0x140,address_start+5+i) ; + //polling until reg 0x140[23]=1; do{ u1bTmp = rtw_read32(Adapter, 0x140); @@ -1247,21 +1230,21 @@ int ReservedPage_Compare(PADAPTER Adapter,PRT_MP_FIRMWARE pFirmware,u32 BTPatchS RTW_INFO("0x140=%x, wait for 10 ms (%d) times.\n",u1bTmp, count); rtw_msleep_os(10); // 10ms }while(!(u1bTmp&BIT(23)) && count < 50); - + myBTFwBuffer[i*8+0]=rtw_read8(Adapter, 0x144); myBTFwBuffer[i*8+1]=rtw_read8(Adapter, 0x145); - myBTFwBuffer[i*8+2]=rtw_read8(Adapter, 0x146); + myBTFwBuffer[i*8+2]=rtw_read8(Adapter, 0x146); myBTFwBuffer[i*8+3]=rtw_read8(Adapter, 0x147); myBTFwBuffer[i*8+4]=rtw_read8(Adapter, 0x148); myBTFwBuffer[i*8+5]=rtw_read8(Adapter, 0x149); myBTFwBuffer[i*8+6]=rtw_read8(Adapter, 0x14a); myBTFwBuffer[i*8+7]=rtw_read8(Adapter, 0x14b); } - - rtw_write32(Adapter,0x140,address_start+5+BTPatchSize/8) ; + + rtw_write32(Adapter,0x140,address_start+5+BTPatchSize/8) ; lastBTsz=BTPatchSize%8; - + //polling until reg 0x140[23]=1; u1bTmp=0; count=0; @@ -1297,7 +1280,7 @@ int ReservedPage_Compare(PADAPTER Adapter,PRT_MP_FIRMWARE pFirmware,u32 BTPatchS { rtw_mfree(myBTFwBuffer, BTPatchSize); } - + return _TRUE; } @@ -1425,7 +1408,7 @@ SetFwRelatedForWoWLAN8812( //=========================================================== // Efuse related code //=========================================================== -BOOLEAN +BOOLEAN hal_GetChnlGroup8814A( IN u8 Channel, OUT u8* pGroup @@ -1446,9 +1429,7 @@ hal_GetChnlGroup8814A( { RT_DISP(FPHY, PHY_TXPWR_EFUSE, ("==>hal_GetChnlGroupJaguar in 2.4 G, but Channel %d in Group not found \n", Channel)); } - } - else - { + } else { bIn24G=_FALSE; if (36 <= Channel && Channel <= 42) *pGroup = 0; // 36 38 40 @@ -1465,8 +1446,7 @@ hal_GetChnlGroup8814A( else if (157 <= Channel && Channel <= 161) *pGroup = 11; // 157 159 161 else if (165 <= Channel && Channel <= 171) *pGroup = 12; // 165 167 169 else if (173 <= Channel && Channel <= 177) *pGroup = 13; // 173 175 177 - else - { + else { RT_DISP(FPHY, PHY_TXPWR_EFUSE, ("==>hal_GetChnlGroupJaguar in 5G, but Channel %d in Group not found \n",Channel)); } @@ -1487,7 +1467,7 @@ hal_ReadPowerValueFromPROM8814A( { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); u32 rfPath, eeAddr=EEPROM_TX_PWR_INX_8814, group,TxCount=0; - + _rtw_memset(pwrInfo24G, 0, sizeof(TxPowerInfo24G)); _rtw_memset(pwrInfo5G, 0, sizeof(TxPowerInfo5G)); @@ -1512,33 +1492,28 @@ hal_ReadPowerValueFromPROM8814A( { pwrInfo24G->BW20_Diff[rfPath][0] = EEPROM_DEFAULT_24G_HT20_DIFF; pwrInfo24G->OFDM_Diff[rfPath][0] = EEPROM_DEFAULT_24G_OFDM_DIFF; - } - else - { + } else { pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; } - } + } // 5G default value for(group = 0 ; group < MAX_CHNL_GROUP_5G; group++) { pwrInfo5G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_5G_INDEX; } - + for(TxCount=0;TxCountOFDM_Diff[rfPath][0] = EEPROM_DEFAULT_5G_OFDM_DIFF; pwrInfo5G->BW20_Diff[rfPath][0] = EEPROM_DEFAULT_5G_HT20_DIFF; pwrInfo5G->BW80_Diff[rfPath][0] = EEPROM_DEFAULT_DIFF; pwrInfo5G->BW160_Diff[rfPath][0] = EEPROM_DEFAULT_DIFF; - } - else - { + } else { pwrInfo5G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; pwrInfo5G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; pwrInfo5G->BW40_Diff[rfPath][TxCount]= EEPROM_DEFAULT_DIFF; @@ -1546,11 +1521,9 @@ hal_ReadPowerValueFromPROM8814A( pwrInfo5G->BW160_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; } - } - + } } - - //pHalData->bNOPG = _TRUE; + //pHalData->bNOPG = _TRUE; return; } @@ -1564,7 +1537,7 @@ hal_ReadPowerValueFromPROM8814A( { pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; } - /* RTW_INFO("8814-2G RF-%d-G-%d CCK-Addr-%x BASE=%x\n", + /* RTW_INFO("8814-2G RF-%d-G-%d CCK-Addr-%x BASE=%x\n", rfPath, group, eeAddr-1, pwrInfo24G->IndexCCK_Base[rfPath][group]); */ } for(group = 0 ; group < MAX_CHNL_GROUP_24G-1; group++) @@ -1572,7 +1545,7 @@ hal_ReadPowerValueFromPROM8814A( pwrInfo24G->IndexBW40_Base[rfPath][group] = PROMContent[eeAddr++]; if(pwrInfo24G->IndexBW40_Base[rfPath][group] == 0xFF) pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; - /* RTW_INFO("8814-2G RF-%d-G-%d BW40-Addr-%x BASE=%x\n", + /* RTW_INFO("8814-2G RF-%d-G-%d BW40-Addr-%x BASE=%x\n", rfPath, group, eeAddr-1, pwrInfo24G->IndexBW40_Base[rfPath][group]); */ } for(TxCount=0;TxCountBW40_Diff[rfPath][TxCount] = 0; { - pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; + pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; if(pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0; } - /* RTW_INFO("8814-2G RF-%d-SS-%d BW20-Addr-%x DIFF=%d\n", + /* RTW_INFO("8814-2G RF-%d-SS-%d BW20-Addr-%x DIFF=%d\n", rfPath, TxCount, eeAddr, pwrInfo24G->BW20_Diff[rfPath][TxCount]); */ { - pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); + pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); if(pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0; } - /* RTW_INFO("8814-2G RF-%d-SS-%d LGOD-Addr-%x DIFF=%d\n", + /* RTW_INFO("8814-2G RF-%d-SS-%d LGOD-Addr-%x DIFF=%d\n", rfPath, TxCount, eeAddr, pwrInfo24G->OFDM_Diff[rfPath][TxCount]); */ pwrInfo24G->CCK_Diff[rfPath][TxCount] = 0; eeAddr++; - } - else - { + } else { { - pwrInfo24G->BW40_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; + pwrInfo24G->BW40_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; if(pwrInfo24G->BW40_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number pwrInfo24G->BW40_Diff[rfPath][TxCount] |= 0xF0; } - /* RTW_INFO("8814-2G RF-%d-SS-%d BW40-Addr-%x DIFF=%d\n", + /* RTW_INFO("8814-2G RF-%d-SS-%d BW40-Addr-%x DIFF=%d\n", rfPath, TxCount, eeAddr, pwrInfo24G->BW40_Diff[rfPath][TxCount]); */ { - pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); + pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); if(pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0; } - /* RTW_INFO("8814-2G RF-%d-SS-%d BW20-Addr-%x DIFF=%d\n", + /* RTW_INFO("8814-2G RF-%d-SS-%d BW20-Addr-%x DIFF=%d\n", rfPath, TxCount, eeAddr, pwrInfo24G->BW20_Diff[rfPath][TxCount]); */ eeAddr++; - { - pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; + pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; if(pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0; } - /* RTW_INFO("8814-2G RF-%d-SS-%d LGOD-Addr-%x DIFF=%d\n", + /* RTW_INFO("8814-2G RF-%d-SS-%d LGOD-Addr-%x DIFF=%d\n", rfPath, TxCount, eeAddr, pwrInfo24G->BW20_Diff[rfPath][TxCount]); */ { - pwrInfo24G->CCK_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); + pwrInfo24G->CCK_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); if(pwrInfo24G->CCK_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number pwrInfo24G->CCK_Diff[rfPath][TxCount] |= 0xF0; } - /* RTW_INFO("8814-2G RF-%d-SS-%d CCK-Addr-%x DIFF=%d\n", + /* RTW_INFO("8814-2G RF-%d-SS-%d CCK-Addr-%x DIFF=%d\n", rfPath, TxCount, eeAddr, pwrInfo24G->CCK_Diff[rfPath][TxCount]); */ eeAddr++; @@ -1649,105 +1619,103 @@ hal_ReadPowerValueFromPROM8814A( { pwrInfo5G->IndexBW40_Base[rfPath][group] = PROMContent[eeAddr++]; if(pwrInfo5G->IndexBW40_Base[rfPath][group] == 0xFF) - pwrInfo5G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_DIFF; + pwrInfo5G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_DIFF; - /* RTW_INFO("8814-5G RF-%d-G-%d BW40-Addr-%x BASE=%x\n", + /* RTW_INFO("8814-5G RF-%d-G-%d BW40-Addr-%x BASE=%x\n", rfPath, TxCount, eeAddr-1, pwrInfo5G->IndexBW40_Base[rfPath][group]); */ } - + for(TxCount=0;TxCountBW40_Diff[rfPath][TxCount]= 0; - + pwrInfo5G->BW40_Diff[rfPath][TxCount]= 0; + { - pwrInfo5G->BW20_Diff[rfPath][0] = (PROMContent[eeAddr]&0xf0)>>4; + pwrInfo5G->BW20_Diff[rfPath][0] = (PROMContent[eeAddr]&0xf0)>>4; if(pwrInfo5G->BW20_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number - pwrInfo5G->BW20_Diff[rfPath][TxCount] |= 0xF0; + pwrInfo5G->BW20_Diff[rfPath][TxCount] |= 0xF0; } - /* RTW_INFO("8814-5G RF-%d-SS-%d BW20-Addr-%x DIFF=%d\n", + /* RTW_INFO("8814-5G RF-%d-SS-%d BW20-Addr-%x DIFF=%d\n", rfPath, TxCount, eeAddr, pwrInfo5G->BW20_Diff[rfPath][TxCount]); */ { - pwrInfo5G->OFDM_Diff[rfPath][0] = (PROMContent[eeAddr]&0x0f); + pwrInfo5G->OFDM_Diff[rfPath][0] = (PROMContent[eeAddr]&0x0f); if(pwrInfo5G->OFDM_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number - pwrInfo5G->OFDM_Diff[rfPath][TxCount] |= 0xF0; + pwrInfo5G->OFDM_Diff[rfPath][TxCount] |= 0xF0; } - /* RTW_INFO("8814-5G RF-%d-SS-%d LGOD-Addr-%x DIFF=%d\n", + /* RTW_INFO("8814-5G RF-%d-SS-%d LGOD-Addr-%x DIFF=%d\n", rfPath, TxCount, eeAddr, pwrInfo5G->OFDM_Diff[rfPath][TxCount]); */ eeAddr++; - } - else - { + } else { { - pwrInfo5G->BW40_Diff[rfPath][TxCount]= (PROMContent[eeAddr]&0xf0)>>4; + pwrInfo5G->BW40_Diff[rfPath][TxCount]= (PROMContent[eeAddr]&0xf0)>>4; if(pwrInfo5G->BW40_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number - pwrInfo5G->BW40_Diff[rfPath][TxCount] |= 0xF0; + pwrInfo5G->BW40_Diff[rfPath][TxCount] |= 0xF0; } - /* RTW_INFO("8814-5G RF-%d-SS-%d BW40-Addr-%x DIFF=%d\n", + /* RTW_INFO("8814-5G RF-%d-SS-%d BW40-Addr-%x DIFF=%d\n", rfPath, TxCount, eeAddr, pwrInfo5G->BW40_Diff[rfPath][TxCount]); */ - + { - pwrInfo5G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); + pwrInfo5G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); if(pwrInfo5G->BW20_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number - pwrInfo5G->BW20_Diff[rfPath][TxCount] |= 0xF0; + pwrInfo5G->BW20_Diff[rfPath][TxCount] |= 0xF0; } - /* RTW_INFO("8814-5G RF-%d-SS-%d BW20-Addr-%x DIFF=%d\n", + /* RTW_INFO("8814-5G RF-%d-SS-%d BW20-Addr-%x DIFF=%d\n", rfPath, TxCount, eeAddr, pwrInfo5G->BW20_Diff[rfPath][TxCount]); */ - + eeAddr++; } - } + } { pwrInfo5G->OFDM_Diff[rfPath][1] = (PROMContent[eeAddr]&0xf0)>>4; pwrInfo5G->OFDM_Diff[rfPath][2] = (PROMContent[eeAddr]&0x0f); } - /* RTW_INFO("8814-5G RF-%d-SS-%d LGOD-Addr-%x DIFF=%d\n", + /* RTW_INFO("8814-5G RF-%d-SS-%d LGOD-Addr-%x DIFF=%d\n", rfPath, 2, eeAddr, pwrInfo5G->OFDM_Diff[rfPath][2]); */ - eeAddr++; + eeAddr++; pwrInfo5G->OFDM_Diff[rfPath][3] = (PROMContent[eeAddr]&0x0f); - /* RTW_INFO("8814-5G RF-%d-SS-%d LGOD-Addr-%x DIFF=%d\n", + /* RTW_INFO("8814-5G RF-%d-SS-%d LGOD-Addr-%x DIFF=%d\n", rfPath, 3, eeAddr, pwrInfo5G->OFDM_Diff[rfPath][3]); */ eeAddr++; - + for(TxCount=1;TxCountOFDM_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number - pwrInfo5G->OFDM_Diff[rfPath][TxCount] |= 0xF0; + pwrInfo5G->OFDM_Diff[rfPath][TxCount] |= 0xF0; - /* RTW_INFO("8814-5G RF-%d-SS-%d LGOD-Addr-%x DIFF=%d\n", + /* RTW_INFO("8814-5G RF-%d-SS-%d LGOD-Addr-%x DIFF=%d\n", rfPath, TxCount, eeAddr, pwrInfo5G->OFDM_Diff[rfPath][TxCount]); */ - } - + } + for(TxCount=0;TxCountBW80_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; + pwrInfo5G->BW80_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; if(pwrInfo5G->BW80_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number - pwrInfo5G->BW80_Diff[rfPath][TxCount] |= 0xF0; + pwrInfo5G->BW80_Diff[rfPath][TxCount] |= 0xF0; } - /* RTW_INFO("8814-5G RF-%d-SS-%d BW80-Addr-%x DIFF=%d\n", + /* RTW_INFO("8814-5G RF-%d-SS-%d BW80-Addr-%x DIFF=%d\n", rfPath, TxCount, eeAddr, pwrInfo5G->BW80_Diff[rfPath][TxCount]); */ - + { - pwrInfo5G->BW160_Diff[rfPath][TxCount]= (PROMContent[eeAddr]&0x0f); + pwrInfo5G->BW160_Diff[rfPath][TxCount]= (PROMContent[eeAddr]&0x0f); if(pwrInfo5G->BW160_Diff[rfPath][TxCount] & BIT3) //4bit sign number to 8 bit sign number - pwrInfo5G->BW160_Diff[rfPath][TxCount] |= 0xF0; + pwrInfo5G->BW160_Diff[rfPath][TxCount] |= 0xF0; } - /* RTW_INFO("8814-5G RF-%d-SS-%d BW160-Addr-%x DIFF=%d\n", + /* RTW_INFO("8814-5G RF-%d-SS-%d BW160-Addr-%x DIFF=%d\n", rfPath, TxCount, eeAddr, pwrInfo5G->BW160_Diff[rfPath][TxCount]); */ eeAddr++; } @@ -1772,8 +1740,7 @@ HALBT_InitHalVars( #endif //CONFIG_BT_COEXIST } - -VOID +VOID BT_InitHalVars( IN PADAPTER Adapter ) @@ -1794,7 +1761,6 @@ BT_InitHalVars( #endif } - VOID hal_EfuseParseBTCoexistInfo8814A( IN PADAPTER Adapter, @@ -1829,20 +1795,19 @@ hal_EfuseParseBTCoexistInfo8814A( VOID hal_ReadPROMVersion8814A( - IN PADAPTER Adapter, + IN PADAPTER Adapter, IN u8* PROMContent, IN BOOLEAN AutoloadFail ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - if(AutoloadFail){ - pHalData->EEPROMVersion = EEPROM_Default_Version; - } - else{ + if(AutoloadFail) { + pHalData->EEPROMVersion = EEPROM_Default_Version; + } else { pHalData->EEPROMVersion = *(u8 *)&PROMContent[EEPROM_VERSION_8814]; if(pHalData->EEPROMVersion == 0xFF) - pHalData->EEPROMVersion = EEPROM_Default_Version; + pHalData->EEPROMVersion = EEPROM_Default_Version; } } @@ -1852,7 +1817,7 @@ hal_ReadTxPowerInfo8814A( IN u8* PROMContent, IN BOOLEAN AutoLoadFail ) -{ +{ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); TxPowerInfo24G pwrInfo24G; TxPowerInfo5G pwrInfo5G; @@ -1861,45 +1826,43 @@ hal_ReadTxPowerInfo8814A( hal_ReadPowerValueFromPROM8814A(Adapter, &pwrInfo24G,&pwrInfo5G, PROMContent, AutoLoadFail); //if(!AutoLoadFail) - // pHalData->bTXPowerDataReadFromEEPORM = _TRUE; + // pHalData->bTXPowerDataReadFromEEPORM = _TRUE; for(rfPath = 0 ; rfPath < MAX_RF_PATH ; rfPath++) { for (ch = 0 ; ch < CENTER_CH_2G_NUM ; ch++) { hal_GetChnlGroup8814A(ch+1, &group); - if(ch == 14-1) + if(ch == 14-1) { pHalData->Index24G_CCK_Base[rfPath][ch] = pwrInfo24G.IndexCCK_Base[rfPath][5]; pHalData->Index24G_BW40_Base[rfPath][ch] = pwrInfo24G.IndexBW40_Base[rfPath][group]; - } - else - { + } else { pHalData->Index24G_CCK_Base[rfPath][ch] = pwrInfo24G.IndexCCK_Base[rfPath][group]; pHalData->Index24G_BW40_Base[rfPath][ch] = pwrInfo24G.IndexBW40_Base[rfPath][group]; } - //RTW_INFO("======= Path %d, ChannelIndex %d, Group %d=======\n",rfPath,ch, group); + //RTW_INFO("======= Path %d, ChannelIndex %d, Group %d=======\n",rfPath,ch, group); //RTW_INFO("Index24G_CCK_Base[%d][%d] = 0x%x\n",rfPath,ch ,pHalData->Index24G_CCK_Base[rfPath][ch]); //RTW_INFO("Index24G_BW40_Base[%d][%d] = 0x%x\n",rfPath,ch,pHalData->Index24G_BW40_Base[rfPath][ch]); - } + } for (ch = 0 ; ch < CENTER_CH_5G_ALL_NUM; ch++) { hal_GetChnlGroup8814A(center_ch_5g_all[ch], &group); - + pHalData->Index5G_BW40_Base[rfPath][ch] = pwrInfo5G.IndexBW40_Base[rfPath][group]; - //RTW_INFO("======= Path %d, ChannelIndex %d, Group %d=======\n",rfPath,ch, group); + //RTW_INFO("======= Path %d, ChannelIndex %d, Group %d=======\n",rfPath,ch, group); //RTW_INFO("Index5G_BW40_Base[%d][%d] = 0x%x\n",rfPath,ch,pHalData->Index5G_BW40_Base[rfPath][ch]); } for (ch = 0 ; ch < CENTER_CH_5G_80M_NUM; ch++) { u8 upper, lower; - + hal_GetChnlGroup8814A(center_ch_5g_80m[ch], &group); upper = pwrInfo5G.IndexBW40_Base[rfPath][group]; lower = pwrInfo5G.IndexBW40_Base[rfPath][group+1]; - + pHalData->Index5G_BW80_Base[rfPath][ch] = (upper + lower) / 2; - - //RTW_INFO("======= Path %d, ChannelIndex %d, Group %d=======\n",rfPath,ch, group); + + //RTW_INFO("======= Path %d, ChannelIndex %d, Group %d=======\n",rfPath,ch, group); //RTW_INFO("Index5G_BW80_Base[%d][%d] = 0x%x\n",rfPath,ch,pHalData->Index5G_BW80_Base[rfPath][ch]); } @@ -1909,7 +1872,7 @@ hal_ReadTxPowerInfo8814A( pHalData->OFDM_24G_Diff[rfPath][TxCount]=pwrInfo24G.OFDM_Diff[rfPath][TxCount]; pHalData->BW20_24G_Diff[rfPath][TxCount]=pwrInfo24G.BW20_Diff[rfPath][TxCount]; pHalData->BW40_24G_Diff[rfPath][TxCount]=pwrInfo24G.BW40_Diff[rfPath][TxCount]; - + pHalData->OFDM_5G_Diff[rfPath][TxCount]=pwrInfo5G.OFDM_Diff[rfPath][TxCount]; pHalData->BW20_5G_Diff[rfPath][TxCount]=pwrInfo5G.BW20_Diff[rfPath][TxCount]; pHalData->BW40_5G_Diff[rfPath][TxCount]=pwrInfo5G.BW40_Diff[rfPath][TxCount]; @@ -1926,22 +1889,20 @@ hal_ReadTxPowerInfo8814A( RTW_INFO("BW20_5G_Diff[%d][%d]= %d\n",rfPath,TxCount,pHalData->BW20_5G_Diff[rfPath][TxCount]); RTW_INFO("BW40_5G_Diff[%d][%d]= %d\n",rfPath,TxCount,pHalData->BW40_5G_Diff[rfPath][TxCount]); RTW_INFO("BW80_5G_Diff[%d][%d]= %d\n",rfPath,TxCount,pHalData->BW80_5G_Diff[rfPath][TxCount]); -#endif +#endif } } - + // 2010/10/19 MH Add Regulator recognize for CU. if(!AutoLoadFail) { struct registry_priv *registry_par = &Adapter->registrypriv; - + pHalData->EEPROMRegulatory = (PROMContent[EEPROM_RF_BOARD_OPTION_8814]&0x7); //bit0~2 if(PROMContent[EEPROM_RF_BOARD_OPTION_8814] == 0xFF) pHalData->EEPROMRegulatory = (EEPROM_DEFAULT_BOARD_OPTION&0x7); //bit0~2 - } - else - { + } else { pHalData->EEPROMRegulatory = 0; } @@ -1951,13 +1912,12 @@ hal_ReadTxPowerInfo8814A( VOID hal_ReadBoardType8814A( - IN PADAPTER Adapter, + IN PADAPTER Adapter, IN u8* PROMContent, IN BOOLEAN AutoloadFail ) { - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); if(!AutoloadFail) @@ -1965,9 +1925,7 @@ hal_ReadBoardType8814A( pHalData->InterfaceSel = (PROMContent[EEPROM_RF_BOARD_OPTION_8814]&0xE0)>>5; if(PROMContent[EEPROM_RF_BOARD_OPTION_8814] == 0xFF) pHalData->InterfaceSel = (EEPROM_DEFAULT_BOARD_OPTION&0xE0)>>5; - } - else - { + } else { pHalData->InterfaceSel = 0; } RT_TRACE(COMP_INIT, DBG_LOUD, ("Board Type: 0x%2x\n", pHalData->InterfaceSel)); @@ -1975,7 +1933,7 @@ hal_ReadBoardType8814A( VOID hal_Read_TRX_antenna_8814A( - IN PADAPTER Adapter, + IN PADAPTER Adapter, IN u8 *PROMContent, IN BOOLEAN AutoloadFail ) @@ -2006,7 +1964,7 @@ hal_Read_TRX_antenna_8814A( trx_antenna = RF_2T4R; RTW_INFO("AutoloadFail, default to 2T4R\n"); } - + /* if driver doesn't set rf_config, use the value of EEPROM */ if (Adapter->registrypriv.rf_config == RF_MAX_TYPE) { @@ -2028,14 +1986,14 @@ hal_Read_TRX_antenna_8814A( Adapter->registrypriv.rf_config = RF_2T4R; #endif /* CONFIG_USB_HCI */ } - + RTW_INFO("Final rf_config: %d\n", Adapter->registrypriv.rf_config); } VOID hal_ReadThermalMeter_8814A( - IN PADAPTER Adapter, + IN PADAPTER Adapter, IN u8* PROMContent, IN BOOLEAN AutoloadFail ) @@ -2043,8 +2001,8 @@ hal_ReadThermalMeter_8814A( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); pHalData->EEPROMThermalMeter = 0xff; - - if(!AutoloadFail) + + if(!AutoloadFail) pHalData->EEPROMThermalMeter = PROMContent[EEPROM_THERMAL_METER_8814]; #if 0 /* ToDo: check with RF */ @@ -2075,9 +2033,7 @@ void hal_ReadRemoteWakeup_8814A( if(AutoLoadFail){ pwrctl->bHWPowerdown = _FALSE; pwrctl->bSupportRemoteWakeup = _FALSE; - } - else - { + } else { // decide hw if support remote wakeup function // if hw supported, 8051 (SIE) will generate WeakUP signal( D+/D- toggle) when autoresume /* todo: wowlan should check the efuse again @@ -2134,7 +2090,7 @@ void hal_GetRxGainOffset_8814A( pHalData->RxGainOffset[2] = 0; pHalData->RxGainOffset[3] = 0; - if ((pregistrypriv->reg_rxgain_offset_2g != 0 && pregistrypriv->reg_rxgain_offset_5gl != 0) && + if ((pregistrypriv->reg_rxgain_offset_2g != 0 && pregistrypriv->reg_rxgain_offset_5gl != 0) && (pregistrypriv->reg_rxgain_offset_5gm != 0 && pregistrypriv->reg_rxgain_offset_5gh != 0)) { pHalData->RxGainOffset[0] = pregistrypriv->reg_rxgain_offset_2g; pHalData->RxGainOffset[1] = pregistrypriv->reg_rxgain_offset_5gl; @@ -2159,7 +2115,6 @@ void hal_GetRxGainOffset_8814A( RTW_INFO("hal_GetRxGainOffset_8814A(): RegRxGainOffset_5GH = 0x%x!!\n", pHalData->RxGainOffset[3]); } - void Hal_EfuseParseKFreeData_8814A( IN PADAPTER Adapter, IN u8 *PROMContent, @@ -2228,7 +2183,6 @@ void Hal_EfuseParseKFreeData_8814A( #endif /*CONFIG_RF_GAIN_OFFSET */ } - VOID hal_EfuseParseXtal_8814A( IN PADAPTER pAdapter, @@ -2243,9 +2197,7 @@ hal_EfuseParseXtal_8814A( pHalData->CrystalCap = hwinfo[EEPROM_XTAL_8814]; if(pHalData->CrystalCap == 0xFF) pHalData->CrystalCap = EEPROM_Default_CrystalCap_8814; /* what value should 8814 set? */ - } - else - { + } else { pHalData->CrystalCap = EEPROM_Default_CrystalCap_8814; } RTW_INFO("CrystalCap: 0x%2x\n", pHalData->CrystalCap); @@ -2259,11 +2211,11 @@ hal_ReadAntennaDiversity8814A( ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - - pHalData->TRxAntDivType = NO_ANTDIV; + + pHalData->TRxAntDivType = NO_ANTDIV; pHalData->AntDivCfg = 0; - - RTW_INFO("SWAS: bHwAntDiv = %x, TRxAntDivType = %x\n", + + RTW_INFO("SWAS: bHwAntDiv = %x, TRxAntDivType = %x\n", pHalData->AntDivCfg, pHalData->TRxAntDivType); } @@ -2272,7 +2224,7 @@ hal_ReadPAType_8814A( IN PADAPTER Adapter, IN u8* PROMContent, IN BOOLEAN AutoloadFail, - OUT u8* pPAType, + OUT u8* pPAType, OUT u8* pLNAType ) { @@ -2289,76 +2241,66 @@ hal_ReadPAType_8814A( LNAType_AB = EF1Byte( *(u8*)&PROMContent[EEPROM_LNA_TYPE_AB_2G_8814] ); LNAType_CD = EF1Byte( *(u8*)&PROMContent[EEPROM_LNA_TYPE_CD_2G_8814] ); - + if (*pPAType == 0xFF && RFEType == 0xFF) - pHalData->ExternalPA_2G = (GetRegAmplifierType2G(Adapter)&ODM_BOARD_EXT_PA) ? 1 : 0; - else + pHalData->ExternalPA_2G = (GetRegAmplifierType2G(Adapter)&ODM_BOARD_EXT_PA) ? 1 : 0; + else pHalData->ExternalPA_2G = (*pPAType & BIT4) ? 1 : 0; if (LNAType_AB == 0xFF) pHalData->ExternalLNA_2G = (GetRegAmplifierType2G(Adapter)&ODM_BOARD_EXT_LNA) ? 1 : 0; else - pHalData->ExternalLNA_2G = (LNAType_AB & BIT3) ? 1 : 0; + pHalData->ExternalLNA_2G = (LNAType_AB & BIT3) ? 1 : 0; *pLNAType = (LNAType_AB & BIT3) << 1 | (LNAType_AB & BIT7) >> 2 | (LNAType_CD & BIT3) << 3 | (LNAType_CD & BIT7); - } - else - { - pHalData->ExternalPA_2G = (GetRegAmplifierType2G(Adapter)&ODM_BOARD_EXT_PA) ? 1 : 0; - pHalData->ExternalLNA_2G = (GetRegAmplifierType2G(Adapter)&ODM_BOARD_EXT_LNA) ? 1 : 0; + } else { + pHalData->ExternalPA_2G = (GetRegAmplifierType2G(Adapter)&ODM_BOARD_EXT_PA) ? 1 : 0; + pHalData->ExternalLNA_2G = (GetRegAmplifierType2G(Adapter)&ODM_BOARD_EXT_LNA) ? 1 : 0; } if (GetRegAmplifierType5G(Adapter) == 0) // AUTO { LNAType_AB = EF1Byte( *(u8*)&PROMContent[EEPROM_LNA_TYPE_AB_5G_8814] ); LNAType_CD = EF1Byte( *(u8*)&PROMContent[EEPROM_LNA_TYPE_CD_5G_8814] ); - + if (*pPAType == 0xFF && RFEType == 0xFF) - pHalData->ExternalPA_5G = (GetRegAmplifierType5G(Adapter)&ODM_BOARD_EXT_PA) ? 1 : 0; - else - pHalData->ExternalPA_5G = (*pPAType & BIT0) ? 1 : 0; + pHalData->ExternalPA_5G = (GetRegAmplifierType5G(Adapter)&ODM_BOARD_EXT_PA) ? 1 : 0; + else + pHalData->ExternalPA_5G = (*pPAType & BIT0) ? 1 : 0; if (LNAType_AB == 0xFF) pHalData->ExternalLNA_5G = (GetRegAmplifierType5G(Adapter)&ODM_BOARD_EXT_LNA) ? 1 : 0; else - pHalData->ExternalLNA_5G = (LNAType_AB & BIT3) ? 1 : 0; + pHalData->ExternalLNA_5G = (LNAType_AB & BIT3) ? 1 : 0; (*pLNAType) |= ((LNAType_AB & BIT3) >> 3 | (LNAType_AB & BIT7) >> 6 | (LNAType_CD & BIT3) >> 1 | (LNAType_CD & BIT7) >> 4); + } else { + pHalData->ExternalPA_5G = (GetRegAmplifierType5G(Adapter)&ODM_BOARD_EXT_PA_5G) ? 1 : 0; + pHalData->ExternalLNA_5G = (GetRegAmplifierType5G(Adapter)&ODM_BOARD_EXT_LNA_5G) ? 1 : 0; } - else + } else { + pHalData->ExternalPA_2G = EEPROM_Default_PAType; + pHalData->ExternalPA_5G = 0xFF; + pHalData->ExternalLNA_2G = EEPROM_Default_LNAType; + pHalData->ExternalLNA_5G = 0xFF; + + if (GetRegAmplifierType2G(Adapter) == 0) { - pHalData->ExternalPA_5G = (GetRegAmplifierType5G(Adapter)&ODM_BOARD_EXT_PA_5G) ? 1 : 0; - pHalData->ExternalLNA_5G = (GetRegAmplifierType5G(Adapter)&ODM_BOARD_EXT_LNA_5G) ? 1 : 0; + pHalData->ExternalPA_2G = 0; + pHalData->ExternalLNA_2G = 0; + } else { + pHalData->ExternalPA_2G = (GetRegAmplifierType2G(Adapter)&ODM_BOARD_EXT_PA) ? 1 : 0; + pHalData->ExternalLNA_2G = (GetRegAmplifierType2G(Adapter)&ODM_BOARD_EXT_LNA) ? 1 : 0; } - } - else - { - pHalData->ExternalPA_2G = EEPROM_Default_PAType; - pHalData->ExternalPA_5G = 0xFF; - pHalData->ExternalLNA_2G = EEPROM_Default_LNAType; - pHalData->ExternalLNA_5G = 0xFF; - - if (GetRegAmplifierType2G(Adapter) == 0) - { - pHalData->ExternalPA_2G = 0; - pHalData->ExternalLNA_2G = 0; - } - else + if (GetRegAmplifierType5G(Adapter) == 0) { - pHalData->ExternalPA_2G = (GetRegAmplifierType2G(Adapter)&ODM_BOARD_EXT_PA) ? 1 : 0; - pHalData->ExternalLNA_2G = (GetRegAmplifierType2G(Adapter)&ODM_BOARD_EXT_LNA) ? 1 : 0; - } - if (GetRegAmplifierType5G(Adapter) == 0) - { - pHalData->ExternalPA_5G = 0; - pHalData->ExternalLNA_5G = 0; - } - else - { - pHalData->ExternalPA_5G = (GetRegAmplifierType5G(Adapter)&ODM_BOARD_EXT_PA_5G) ? 1 : 0; - pHalData->ExternalLNA_5G = (GetRegAmplifierType5G(Adapter)&ODM_BOARD_EXT_LNA_5G) ? 1 : 0; + pHalData->ExternalPA_5G = 0; + pHalData->ExternalLNA_5G = 0; + } else { + pHalData->ExternalPA_5G = (GetRegAmplifierType5G(Adapter)&ODM_BOARD_EXT_PA_5G) ? 1 : 0; + pHalData->ExternalLNA_5G = (GetRegAmplifierType5G(Adapter)&ODM_BOARD_EXT_LNA_5G) ? 1 : 0; } } RTW_INFO("PAType is 0x%x, LNAType is 0x%x\n", *pPAType, *pLNAType); @@ -2421,7 +2363,7 @@ VOID hal_ReadAmplifierType_8814A( VOID hal_ReadRFEType_8814A( - IN PADAPTER Adapter, + IN PADAPTER Adapter, IN u8* PROMContent, IN BOOLEAN AutoloadFail ) @@ -2438,15 +2380,13 @@ hal_ReadRFEType_8814A( else if(IS_HARDWARE_TYPE_8814AU(Adapter)) pHalData->RFEType = 1; hal_ReadAmplifierType_8814A(Adapter); - + } else { /* bit7==0 means RFE type defined by 0xCA[6:0] */ pHalData->RFEType = PROMContent[EEPROM_RFE_OPTION_8814] & 0x7F; hal_ReadAmplifierType_8814A(Adapter); } - } - else - { + } else { if(GetRegRFEType(Adapter) != 64) pHalData->RFEType = GetRegRFEType(Adapter); else if(IS_HARDWARE_TYPE_8814AE(Adapter)) @@ -2469,18 +2409,18 @@ hal_EfusePowerSwitch8814A( u16 tmpV16; u8 EFUSE_ACCESS_ON_8814A = 0x69; u8 EFUSE_ACCESS_OFF_8814A = 0x00; - + if (PwrState == _TRUE) { - rtw_write8(pAdapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_ON_8814A); - + rtw_write8(pAdapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_ON_8814A); + // Reset: 0x0000h[28], default valid tmpV16 = PlatformEFIORead2Byte(pAdapter,REG_SYS_FUNC_EN); if( !(tmpV16 & FEN_ELDR) ){ tmpV16 |= FEN_ELDR ; rtw_write16(pAdapter,REG_SYS_FUNC_EN,tmpV16); } - + // Clock: Gated(0x0008h[5]) 8M(0x0008h[1]) clock from ANA, default valid tmpV16 = PlatformEFIORead2Byte(pAdapter,REG_SYS_CLKR); if( (!(tmpV16 & LOADER_CLK_EN) ) ||(!(tmpV16 & ANA8M) ) ) @@ -2497,17 +2437,15 @@ hal_EfusePowerSwitch8814A( tempval |= (VOLTAGE_V25 << 4); rtw_write8(pAdapter, EFUSE_TEST+3, (tempval | 0x80)); } - } - else - { + } else { rtw_write8(pAdapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_OFF_8814A); - + if(bWrite == _TRUE){ // Disable LDO 2.5V after read/write action tempval = rtw_read8(pAdapter, EFUSE_TEST+3); rtw_write8(pAdapter, EFUSE_TEST+3, (tempval & 0x7F)); } - } + } } static VOID @@ -2516,7 +2454,7 @@ rtl8814_EfusePowerSwitch( IN u8 bWrite, IN u8 PwrState) { - hal_EfusePowerSwitch8814A(pAdapter, bWrite, PwrState); + hal_EfusePowerSwitch8814A(pAdapter, bWrite, PwrState); } static VOID @@ -2568,16 +2506,14 @@ hal_EfuseReadEFuse8814A( // // 1. Read the first byte to check if efuse is empty!!! - // // - efuse_OneByteRead(Adapter, eFuse_Addr++, &efuseHeader, bPseudoTest); + // + efuse_OneByteRead(Adapter, eFuse_Addr++, &efuseHeader, bPseudoTest); if(efuseHeader != 0xFF) { efuse_utilized++; - } - else - { + } else { RTW_INFO("EFUSE is empty\n"); efuse_utilized = 0; goto exit; @@ -2590,14 +2526,14 @@ hal_EfuseReadEFuse8814A( while((efuseHeader != 0xFF) && AVAILABLE_EFUSE_ADDR_8814A(eFuse_Addr)) { //RTPRINT(FEEPROM, EFUSE_READ_ALL, ("efuse_Addr-%d efuse_data=%x\n", eFuse_Addr-1, *rtemp8)); - + // Check PG header for section num. if(EXT_HEADER(efuseHeader)) //extended header { offset_2_0 = GET_HDR_OFFSET_2_0(efuseHeader); //RT_DISP(FEEPROM, EFUSE_READ_ALL, ("extended header offset_2_0=%X\n", offset_2_0)); - efuse_OneByteRead(Adapter, eFuse_Addr++, &efuseExtHdr, bPseudoTest); + efuse_OneByteRead(Adapter, eFuse_Addr++, &efuseExtHdr, bPseudoTest); //RT_DISP(FEEPROM, EFUSE_READ_ALL, ("efuse[%X]=%X\n", eFuse_Addr-1, efuseExtHdr)); @@ -2612,26 +2548,20 @@ hal_EfuseReadEFuse8814A( efuse_utilized++; } break; - } - else - { + } else { offset = ((efuseExtHdr & 0xF0) >> 1) | offset_2_0; wden = (efuseExtHdr & 0x0F); } - } - else - { + } else { RTW_INFO("Error condition, extended = 0xff\n"); // We should handle this condition. break; } - } - else - { + } else { offset = ((efuseHeader >> 4) & 0x0f); wden = (efuseHeader & 0x0f); } - + if(offset < EFUSE_MAX_SECTION_8814A) { // Get word enable value from PG header @@ -2639,7 +2569,7 @@ hal_EfuseReadEFuse8814A( for(i=0; iEfuseHal); @@ -2953,9 +2883,7 @@ static u16 hal_EfuseGetCurrentSize_8814A( PADAPTER pAdapter, BOOLEAN bPseudoTest if(bPseudoTest) { efuse_addr = (u16)(fakeEfuseUsedBytes); - } - else - { + } else { rtw_hal_get_hwreg(pAdapter, HW_VAR_EFUSE_BYTES, (u8 *)&efuse_addr); } //RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfuseGetCurrentSize_8723A(), start_efuse_addr = %d\n", efuse_addr)); @@ -2967,7 +2895,7 @@ static u16 hal_EfuseGetCurrentSize_8814A( PADAPTER pAdapter, BOOLEAN bPseudoTest if (efuse_data != 0xFF) { if ((efuse_data&0x1F) == 0x0F) //extended header - { + { hoffset = efuse_data; efuse_addr++; efuse_OneByteRead(pAdapter, efuse_addr, &efuse_data, bPseudoTest); @@ -2981,14 +2909,12 @@ static u16 hal_EfuseGetCurrentSize_8814A( PADAPTER pAdapter, BOOLEAN bPseudoTest } } else { hoffset = (efuse_data>>4) & 0x0F; - hworden = efuse_data & 0x0F; + hworden = efuse_data & 0x0F; } word_cnts = Efuse_CalculateWordCnts(hworden); //read next header efuse_addr = efuse_addr + (word_cnts*2)+1; - } - else - { + } else { bContinual = _FALSE ; } } @@ -2998,9 +2924,7 @@ static u16 hal_EfuseGetCurrentSize_8814A( PADAPTER pAdapter, BOOLEAN bPseudoTest fakeEfuseUsedBytes = efuse_addr; pEfuseHal->fakeEfuseUsedBytes = efuse_addr; RTW_INFO ("%s(), return %d \n", __func__, pEfuseHal->fakeEfuseUsedBytes ); - } - else - { + } else { pEfuseHal->EfuseUsedBytes = efuse_addr; pEfuseHal->EfuseUsedPercentage = (u1Byte)((pEfuseHal->EfuseUsedBytes*100)/pEfuseHal->PhysicalLen_WiFi); rtw_hal_set_hwreg(pAdapter, HW_VAR_EFUSE_BYTES, (u8 *)&efuse_addr); @@ -3009,7 +2933,7 @@ static u16 hal_EfuseGetCurrentSize_8814A( PADAPTER pAdapter, BOOLEAN bPseudoTest } return efuse_addr; - + } static u16 @@ -3025,41 +2949,40 @@ rtl8814_EfuseGetCurrentSize( return ret; } - static int hal_EfusePgPacketRead_8814A( IN PADAPTER pAdapter, IN u8 offset, IN u8 *data, IN BOOLEAN bPseudoTest) -{ +{ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); PEFUSE_HAL pEfuseHal = &(pHalData->EfuseHal); - u8 ReadState = PG_STATE_HEADER; - + u8 ReadState = PG_STATE_HEADER; + int bContinual = _TRUE; - int bDataEmpty = _TRUE ; + int bDataEmpty = _TRUE ; u8 efuse_data,word_cnts=0; u16 efuse_addr = 0; - u8 hoffset=0,hworden=0; + u8 hoffset=0,hworden=0; u8 tmpidx=0; u8 tmpdata[8]; u8 tmp_header = 0; - + if(data==NULL) return _FALSE; - if(offset>=EFUSE_MAX_SECTION_JAGUAR) return _FALSE; - + if(offset>=EFUSE_MAX_SECTION_JAGUAR) return _FALSE; + _rtw_memset((PVOID)data, 0xff, sizeof(u8)*PGPKT_DATA_SIZE); _rtw_memset((PVOID)tmpdata, 0xff, sizeof(u8)*PGPKT_DATA_SIZE); - + // // Efuse has been pre-programmed dummy 5Bytes at the end of Efuse by CP. // Skip dummy parts to prevent unexpected data read from Efuse. // By pass right now. 2009.02.19. // while(bContinual && (efuse_addr < pEfuseHal->PhysicalLen_WiFi) ) - { + { //------- Header Read ------------- if(ReadState & PG_STATE_HEADER) { @@ -3073,19 +2996,15 @@ hal_EfusePgPacketRead_8814A( if((efuse_data & 0x0F) != 0x0F) { hoffset = ((tmp_header & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1); - hworden = efuse_data & 0x0F; - } - else - { + hworden = efuse_data & 0x0F; + } else { efuse_addr++; break; } - - } - else - { + + } else { hoffset = (efuse_data>>4) & 0x0F; - hworden = efuse_data & 0x0F; + hworden = efuse_data & 0x0F; } word_cnts = Efuse_CalculateWordCnts(hworden); bDataEmpty = _TRUE ; @@ -3094,38 +3013,37 @@ hal_EfusePgPacketRead_8814A( for(tmpidx = 0;tmpidx< word_cnts*2 ;tmpidx++){ if(efuse_OneByteRead(pAdapter, efuse_addr+1+tmpidx ,&efuse_data, bPseudoTest) ){ tmpdata[tmpidx] = efuse_data; - if(efuse_data!=0xff){ + if(efuse_data!=0xff){ bDataEmpty = _FALSE; } - } + } } if(bDataEmpty==_FALSE){ - ReadState = PG_STATE_DATA; - }else{//read next header + ReadState = PG_STATE_DATA; + } else { //read next header efuse_addr = efuse_addr + (word_cnts*2)+1; - ReadState = PG_STATE_HEADER; + ReadState = PG_STATE_HEADER; } } - else{//read next header + else { //read next header efuse_addr = efuse_addr + (word_cnts*2)+1; - ReadState = PG_STATE_HEADER; + ReadState = PG_STATE_HEADER; } - - } - else{ + + } else { bContinual = _FALSE ; } - } + } //------- Data section Read ------------- else if(ReadState & PG_STATE_DATA) { efuse_WordEnableDataRead(hworden,tmpdata,data); efuse_addr = efuse_addr + (word_cnts*2)+1; - ReadState = PG_STATE_HEADER; + ReadState = PG_STATE_HEADER; } - - } - + + } + if( (data[0]==0xff) &&(data[1]==0xff) && (data[2]==0xff) && (data[3]==0xff) && (data[4]==0xff) &&(data[5]==0xff) && (data[6]==0xff) && (data[7]==0xff)) return _FALSE; @@ -3191,14 +3109,13 @@ efuse_PgPacketExceptionHandle( RTW_INFO("===> efuse_PgPacketExceptionHandle(), ErrOffset = 0x%X\n", ErrOffset); // ErrOffset is the offset of bad (extension) header. - //if (IS_HARDWARE_TYPE_8812AU(pAdapter)) + //if (IS_HARDWARE_TYPE_8812AU(pAdapter)) //ErrOffset = Hal_EfusePgPacketExceptionHandle_8812A(pAdapter, ErrOffset); RTW_INFO("<=== efuse_PgPacketExceptionHandle(), recovered! Jump to Offset = 0x%X\n", ErrOffset); - - return ErrOffset; -} + return ErrOffset; +} BOOLEAN hal_EfuseCheckIfDatafollowed( @@ -3210,7 +3127,7 @@ hal_EfuseCheckIfDatafollowed( { BOOLEAN bRet=FALSE; u8 i, efuse_data; - + for(i=0; i<(word_cnts*2) ; i++) { if(efuse_OneByteRead(pAdapter, (startAddr+i) ,&efuse_data, bPseudoTest)&&(efuse_data != 0xFF)) @@ -3259,7 +3176,6 @@ hal_EfuseWordEnMatched( return FALSE; } - BOOLEAN efuse_PgPacketPartialWrite( IN PADAPTER pAdapter, @@ -3278,7 +3194,7 @@ efuse_PgPacketPartialWrite( PGPKT_STRUCT curPkt; u16 max_sec_num = (efuseType == EFUSE_WIFI) ? pEfuseHal->MaxSecNum_WiFi : pEfuseHal->MaxSecNum_BT; u16 efuse_max = pEfuseHal->BankSize; - u16 efuse_max_available_len = + u16 efuse_max_available_len = (efuseType == EFUSE_WIFI) ? pEfuseHal->TotalAvailBytes_WiFi : pEfuseHal->TotalAvailBytes_BT; if (bPseudoTest) { @@ -3288,7 +3204,7 @@ efuse_PgPacketPartialWrite( //EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, &efuse_max_available_len, bPseudoTest); //EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_CONTENT_LEN_BANK, &efuse_max, bPseudoTest); - + if(efuseType == EFUSE_WIFI) { if(bPseudoTest) @@ -3299,14 +3215,10 @@ efuse_PgPacketPartialWrite( startAddr = (u16)fakeEfuseUsedBytes; #endif - } - else - { + } else { rtw_hal_get_hwreg(pAdapter, HW_VAR_EFUSE_BYTES, (u8*)&startAddr); } - } - else - { + } else { if(bPseudoTest) { #ifdef HAL_EFUSE_MEMORY @@ -3321,23 +3233,23 @@ efuse_PgPacketPartialWrite( rtw_hal_get_hwreg(pAdapter, HW_VAR_EFUSE_BT_BYTES, (u8*)&startAddr); } } - + startAddr %= efuse_max; RTW_INFO("%s: startAddr=%#X\n", __FUNCTION__, startAddr); RTW_INFO("efuse_PgPacketPartialWrite(), startAddr = 0x%X\n", startAddr); while(1) { - if(startAddr >= efuse_max_available_len) + if(startAddr >= efuse_max_available_len) { bRet = _FALSE; - RTW_INFO("startAddr(%d) >= efuse_max_available_len(%d)\n", + RTW_INFO("startAddr(%d) >= efuse_max_available_len(%d)\n", startAddr, efuse_max_available_len); break; } - + if (efuse_OneByteRead(pAdapter, startAddr, &efuse_data, bPseudoTest) && (efuse_data!=0xFF)) - { + { if(EXT_HEADER(efuse_data)) { cur_header = efuse_data; @@ -3345,11 +3257,11 @@ efuse_PgPacketPartialWrite( efuse_OneByteRead(pAdapter, startAddr, &efuse_data, bPseudoTest); if (ALL_WORDS_DISABLED(efuse_data)) { - u16 recoveredAddr = startAddr; + u16 recoveredAddr = startAddr; recoveredAddr = efuse_PgPacketExceptionHandle(pAdapter, startAddr-1); if (recoveredAddr == (startAddr-1)) { - RTW_INFO("Error! All words disabled and the recovery failed, (Addr, Data) = (0x%X, 0x%X)\n", + RTW_INFO("Error! All words disabled and the recovery failed, (Addr, Data) = (0x%X, 0x%X)\n", startAddr, efuse_data); pAdapter->LastError = ERR_INVALID_DATA; break; @@ -3358,15 +3270,11 @@ efuse_PgPacketPartialWrite( RTW_INFO("Bad extension header but recovered => Keep going.\n"); continue; } - } - else - { + } else { curPkt.offset = ((cur_header & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1); curPkt.word_en = efuse_data & 0x0F; } - } - else - { + } else { if (ALL_WORDS_DISABLED(efuse_data)) { u16 recoveredAddr = startAddr; recoveredAddr = efuse_PgPacketExceptionHandle(pAdapter, startAddr); @@ -3375,8 +3283,8 @@ efuse_PgPacketPartialWrite( RTW_INFO("Bad header but recovered => Read header again.\n"); } } - - cur_header = efuse_data; + + cur_header = efuse_data; curPkt.offset = (cur_header>>4) & 0x0F; curPkt.word_en = cur_header & 0x0F; } @@ -3384,14 +3292,14 @@ efuse_PgPacketPartialWrite( if (curPkt.offset > max_sec_num) { pAdapter->LastError = ERR_OUT_OF_RANGE; pEfuseHal->Status = ERR_OUT_OF_RANGE; - bRet = _FALSE; + bRet = _FALSE; break; } - + curPkt.word_cnts = Efuse_CalculateWordCnts(curPkt.word_en); // if same header is found but no data followed // write some part of data followed by the header. - if( (curPkt.offset == pTargetPkt->offset) && + if( (curPkt.offset == pTargetPkt->offset) && (!hal_EfuseCheckIfDatafollowed(pAdapter, curPkt.word_cnts, startAddr+1, bPseudoTest)) && hal_EfuseWordEnMatched(pTargetPkt, &curPkt, &matched_wden) ) { @@ -3405,14 +3313,14 @@ efuse_PgPacketPartialWrite( // if write fail on some words, write these bad words again PgWriteSuccess = Efuse_PgPacketWrite(pAdapter, pTargetPkt->offset, badworden, pTargetPkt->data, bPseudoTest); - + if(!PgWriteSuccess) { bRet = _FALSE; // write fail, return break; - } + } } - // partial write ok, update the target packet for later use + // partial write ok, update the target packet for later use for(i=0; i<4; i++) { if((matched_wden & (0x1<word_cnts = Efuse_CalculateWordCnts(pTargetPkt->word_en); } // read from next header - startAddr = startAddr + (curPkt.word_cnts*2) +1; - } - else - { + startAddr = startAddr + (curPkt.word_cnts*2) +1; + } else { // not used header, 0xff *pAddr = startAddr; RTW_INFO("Started from unused header offset=%d\n", startAddr); bRet = _TRUE; break; } - } + } return bRet; } - BOOLEAN hal_EfuseFixHeaderProcess( IN PADAPTER pAdapter, @@ -3450,9 +3355,9 @@ hal_EfuseFixHeaderProcess( u8 originaldata[8], badworden=0; u16 efuse_addr=*pAddr; u32 PgWriteSuccess=0; - + _rtw_memset((PVOID)originaldata, 0xff, 8); - + if(Efuse_PgPacketRead(pAdapter, pFixPkt->offset, originaldata, bPseudoTest)) { //check if data exist badworden = Efuse_WordEnableDataWrite(pAdapter, efuse_addr+1, pFixPkt->word_en, originaldata, bPseudoTest); @@ -3464,21 +3369,16 @@ hal_EfuseFixHeaderProcess( return _FALSE; else efuse_addr = Efuse_GetCurrentSize(pAdapter, efuseType, bPseudoTest); - } - else - { + } else { efuse_addr = efuse_addr + (pFixPkt->word_cnts*2) +1; } - } - else - { + } else { efuse_addr = efuse_addr + (pFixPkt->word_cnts*2) +1; } *pAddr = efuse_addr; return _TRUE; } - BOOLEAN efuse_PgPacketWrite2ByteHeader( IN PADAPTER pAdapter, @@ -3493,12 +3393,11 @@ efuse_PgPacketWrite2ByteHeader( u16 efuse_addr=*pAddr; u8 pg_header=0, tmp_header=0, pg_header_temp=0; u8 repeatcnt=0; - u16 efuse_max_available_len = + u16 efuse_max_available_len = (efuseType == EFUSE_WIFI) ? pEfuseHal->TotalAvailBytes_WiFi : pEfuseHal->TotalAvailBytes_BT; RTW_INFO("Wirte 2byte header\n"); - while(efuse_addr < efuse_max_available_len) { pg_header = ((pTargetPkt->offset & 0x07) << 5) | 0x0F; @@ -3517,7 +3416,7 @@ efuse_PgPacketWrite2ByteHeader( efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest); efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest); } - + //to write ext_header if(tmp_header == pg_header) { @@ -3529,12 +3428,12 @@ efuse_PgPacketWrite2ByteHeader( efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest); while(tmp_header == 0xFF || pg_header != tmp_header) - { + { if(repeatcnt++ > pEfuseHal->DataRetry) { RTW_INFO("Repeat over limit for ext_header!!\n"); return _FALSE; - } + } efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest); efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest); @@ -3546,26 +3445,22 @@ efuse_PgPacketWrite2ByteHeader( { RTW_INFO("Repeat over limit for word_en!!\n"); return _FALSE; - } - else - { + } else { efuse_addr++; continue; } } - else if(pg_header != tmp_header) //offset PG fail + else if(pg_header != tmp_header) //offset PG fail { PGPKT_STRUCT fixPkt; //RT_ASSERT(_FALSE, ("Error, efuse_PgPacketWrite2ByteHeader(), offset PG fail, need to cover the existed data!!\n")); RTW_INFO("Error condition for offset PG fail, need to cover the existed data\n"); fixPkt.offset = ((pg_header_temp & 0xE0) >> 5) | ((tmp_header & 0xF0) >> 1); - fixPkt.word_en = tmp_header & 0x0F; + fixPkt.word_en = tmp_header & 0x0F; fixPkt.word_cnts = Efuse_CalculateWordCnts(fixPkt.word_en); if(!hal_EfuseFixHeaderProcess(pAdapter, efuseType, &fixPkt, &efuse_addr, bPseudoTest)) return _FALSE; - } - else - { + } else { bRet = _TRUE; break; } @@ -3573,7 +3468,7 @@ efuse_PgPacketWrite2ByteHeader( else if ((tmp_header & 0x1F) == 0x0F) //wrong extended header { efuse_addr+=2; - continue; + continue; } } @@ -3584,7 +3479,7 @@ efuse_PgPacketWrite2ByteHeader( BOOLEAN efuse_PgPacketWrite1ByteHeader( - IN PADAPTER pAdapter, + IN PADAPTER pAdapter, IN u8 efuseType, IN OUT u16* pAddr, IN PPGPKT_STRUCT pTargetPkt, @@ -3602,8 +3497,7 @@ efuse_PgPacketWrite1ByteHeader( if (IS_HARDWARE_TYPE_8723BE(pAdapter)) efuse_OneByteWrite(pAdapter, 0x1FF, 00, _FALSE); // increase current - - + efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest); if (IS_HARDWARE_TYPE_8723B(pAdapter) || IS_HARDWARE_TYPE_8188E(pAdapter) || @@ -3616,7 +3510,6 @@ efuse_PgPacketWrite1ByteHeader( IS_HARDWARE_TYPE_8192E(pAdapter) || IS_HARDWARE_TYPE_8703B(pAdapter) || IS_HARDWARE_TYPE_8188F(pAdapter)) PHY_SetMacReg(pAdapter, EFUSE_TEST, BIT26, 1); // Restored to 1.5K Read, Suggested by Morris & Victor - while(tmp_header == 0xFF || pg_header != tmp_header) { if(repeatcnt++ > pEfuseHal->HeaderRetry) @@ -3628,34 +3521,30 @@ efuse_PgPacketWrite1ByteHeader( efuse_OneByteRead(pAdapter,efuse_addr, &tmp_header, bPseudoTest); RTW_INFO("===> efuse_PgPacketWrite1ByteHeader: Keep %d-th retrying, tmp_header = 0x%X\n", repeatcnt, tmp_header); } - + if(pg_header == tmp_header) { bRet = _TRUE; - } - else - { + } else { PGPKT_STRUCT fixPkt; //RT_ASSERT(_FALSE, ("Error, efuse_PgPacketWrite1ByteHeader(), offset PG fail, need to cover the existed data!!\n")); RTW_INFO(" pg_header(0x%X) != tmp_header(0x%X)\n", pg_header, tmp_header); RTW_INFO("Error condition for fixed PG packet, need to cover the existed data: (Addr, Data) = (0x%X, 0x%X)\n", efuse_addr, tmp_header); fixPkt.offset = (tmp_header>>4) & 0x0F; - fixPkt.word_en = tmp_header & 0x0F; + fixPkt.word_en = tmp_header & 0x0F; fixPkt.word_cnts = Efuse_CalculateWordCnts(fixPkt.word_en); if(!hal_EfuseFixHeaderProcess(pAdapter, efuseType, &fixPkt, &efuse_addr, bPseudoTest)) return _FALSE; } - + *pAddr = efuse_addr; return bRet; } - - BOOLEAN efuse_PgPacketWriteHeader( - IN PADAPTER pAdapter, + IN PADAPTER pAdapter, IN u8 efuseType, IN OUT u16* pAddr, IN PPGPKT_STRUCT pTargetPkt, @@ -3666,9 +3555,7 @@ efuse_PgPacketWriteHeader( if(pTargetPkt->offset >= EFUSE_MAX_SECTION_BASE) { bRet = efuse_PgPacketWrite2ByteHeader(pAdapter, efuseType, pAddr, pTargetPkt, bPseudoTest); - } - else - { + } else { bRet = efuse_PgPacketWrite1ByteHeader(pAdapter, efuseType, pAddr, pTargetPkt, bPseudoTest); } @@ -3677,7 +3564,7 @@ efuse_PgPacketWriteHeader( BOOLEAN efuse_PgPacketWriteData( - IN PADAPTER pAdapter, + IN PADAPTER pAdapter, IN u8 efuseType, IN u16* pAddr, IN PPGPKT_STRUCT pTargetPkt, @@ -3691,7 +3578,7 @@ efuse_PgPacketWriteData( badworden = 0x0f; badworden = Efuse_WordEnableDataWrite(pAdapter, efuse_addr+1, pTargetPkt->word_en, pTargetPkt->data, bPseudoTest); if(badworden == 0x0F) - { + { RTW_INFO("efuse_PgPacketWriteData ok!!\n"); return _TRUE; } @@ -3699,7 +3586,7 @@ efuse_PgPacketWriteData( { // Reorganize other pg packet //RT_ASSERT(_FALSE, ("Error, efuse_PgPacketWriteData(), wirte data fail!!\n")); RTW_INFO("efuse_PgPacketWriteData Fail!!\n"); - + PgWriteSuccess = Efuse_PgPacketWrite(pAdapter, pTargetPkt->offset, badworden, pTargetPkt->data, bPseudoTest); if(!PgWriteSuccess) return _FALSE; @@ -3721,10 +3608,10 @@ hal_EfusePgPacketWrite_8814A(IN PADAPTER pAdapter, u8 efuseType = EFUSE_WIFI; PGPKT_STRUCT targetPkt; u16 startAddr = 0; - + RTW_INFO("===> efuse_PgPacketWrite[%s], offset: 0x%X\n", (efuseType == EFUSE_WIFI) ? "WIFI" : "BT", offset); - //4 [1] Check if the remaining space is available to write. + //4 [1] Check if the remaining space is available to write. if(!efuse_PgPacketCheck(pAdapter, efuseType, bPseudoTest)) { pAdapter->LastError = ERR_WRITE_PROTECT; @@ -3802,7 +3689,7 @@ void ReadRFType8814A(PADAPTER padapter) // pHalData->bRFPathRxEnable[0] = pHalData->bRFPathRxEnable[1] = _TRUE; //} - if (IsSupported24G(padapter->registrypriv.wireless_mode) && + if (IsSupported24G(padapter->registrypriv.wireless_mode) && IsSupported5G(padapter->registrypriv.wireless_mode)) pHalData->BandSet = BAND_ON_BOTH; else if (IsSupported5G(padapter->registrypriv.wireless_mode)) @@ -3843,7 +3730,7 @@ GetEEPROMSize8814A( curRCR = rtw_read16(Adapter, REG_SYS_EEPROM_CTRL); size = (curRCR & EEPROMSEL) ? 6 : 4; // 6: EEPROM used is 93C46, 4: boot from E-Fuse. - + RTW_INFO("EEPROM type is %s\n", size==4 ? "E-FUSE" : "93C46"); //return size; return 4; // <20120713, Kordan> The default value of HW is 6 ?!! @@ -3886,15 +3773,11 @@ void InitPGData8814A(PADAPTER padapter) //val16 = EF2Byte(ReadEEprom(pAdapter, (u16) (i>>1))); //*((u16*)(&PROMContent[i])) = val16; } - } - else - { + } else { // Read EFUSE real map to shadow. EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI, _FALSE); } - } - else - { + } else { // update to default value 0xFF if (!is_boot_from_eeprom(padapter)) EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI, _FALSE); @@ -3927,21 +3810,21 @@ static void read_chip_version_8814a(PADAPTER Adapter) if(Adapter->registrypriv.special_rf_path == 1) pHalData->VersionID.RFType = RF_TYPE_1T1R; //RF_1T1R; - + vdr = (value32 & EXT_VENDOR_ID) >> EXT_VENDOR_ID_SHIFT; if(vdr == 0x00) pHalData->VersionID.VendorType = CHIP_VENDOR_TSMC; else if(vdr == 0x01) pHalData->VersionID.VendorType = CHIP_VENDOR_SMIC; else if(vdr == 0x02) - pHalData->VersionID.VendorType = CHIP_VENDOR_UMC; + pHalData->VersionID.VendorType = CHIP_VENDOR_UMC; pHalData->VersionID.CUTVersion = (value32 & CHIP_VER_RTL_MASK)>>CHIP_VER_RTL_SHIFT; // IC version (CUT) pHalData->MultiFunc = RT_MULTI_FUNC_NONE; rtw_hal_config_rftype(Adapter); - + #if 1 dump_chip_info(pHalData->VersionID); #endif @@ -3958,20 +3841,18 @@ hal_PatchwithJaguar_8814( struct mlme_ext_priv *pmlmeext = &(Adapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - if( (MediaStatus == RT_MEDIA_CONNECT) && + if( (MediaStatus == RT_MEDIA_CONNECT) && (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_REALTEK_JAGUAR_BCUTAP )) { rtw_write8(Adapter, rVhtlen_Use_Lsig_Jaguar, 0x1); rtw_write8(Adapter, REG_TCR+3, BIT2); - } - else - { + } else { rtw_write8(Adapter, rVhtlen_Use_Lsig_Jaguar, 0x3F); rtw_write8(Adapter, REG_TCR+3, BIT0|BIT1|BIT2); } - /*if( (MediaStatus == RT_MEDIA_CONNECT) && + /*if( (MediaStatus == RT_MEDIA_CONNECT) && ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_REALTEK_JAGUAR_BCUTAP) || (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_REALTEK_JAGUAR_CCUTAP))) { @@ -4063,9 +3944,9 @@ void InitDefaultValue8814A(PADAPTER padapter) pwrctrlpriv = adapter_to_pwrctl(padapter); // init default value - pHalData->fw_ractrl = _FALSE; + pHalData->fw_ractrl = _FALSE; if (!pwrctrlpriv->bkeepfwalive) - pHalData->LastHMEBoxNum = 0; + pHalData->LastHMEBoxNum = 0; init_hal_spec_8814a(padapter); @@ -4090,7 +3971,7 @@ _InitBeaconParameters_8814A( { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); u16 val16; - u8 val8; + u8 val8; val8 = DIS_TSF_UDT; val16 = val8 | (val8 << 8); // port0 and port1 @@ -4129,9 +4010,9 @@ _BeaconFunctionEnable( { rtw_write8(Adapter, REG_BCN_CTRL, (BIT4 | BIT3 | BIT1)); //SetBcnCtrlReg(Adapter, (BIT4 | BIT3 | BIT1), 0x00); - //RT_TRACE(COMP_BEACON, DBG_LOUD, ("_BeaconFunctionEnable 0x550 0x%x\n", rtw_read8(Adapter, 0x550))); + //RT_TRACE(COMP_BEACON, DBG_LOUD, ("_BeaconFunctionEnable 0x550 0x%x\n", rtw_read8(Adapter, 0x550))); - rtw_write8(Adapter, REG_RD_CTRL+1, 0x6F); + rtw_write8(Adapter, REG_RD_CTRL+1, 0x6F); } void SetBeaconRelatedRegisters8814A(PADAPTER padapter) @@ -4141,24 +4022,24 @@ void SetBeaconRelatedRegisters8814A(PADAPTER padapter) struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u32 bcn_ctrl_reg = REG_BCN_CTRL; - //reset TSF, enable update TSF, correcting TSF On Beacon - + //reset TSF, enable update TSF, correcting TSF On Beacon + //REG_BCN_INTERVAL //REG_BCNDMATIM //REG_ATIMWND //REG_TBTT_PROHIBIT //REG_DRVERLYINT - //REG_BCN_MAX_ERR + //REG_BCN_MAX_ERR //REG_BCNTCFG //(0x510) //REG_DUAL_TSF_RST - //REG_BCN_CTRL //(0x550) + //REG_BCN_CTRL //(0x550) //BCN interval #ifdef CONFIG_CONCURRENT_MODE if (padapter->iface_type == IFACE_PORT1){ bcn_ctrl_reg = REG_BCN_CTRL_1; } -#endif +#endif rtw_write16(padapter, REG_BCN_INTERVAL, pmlmeinfo->bcn_interval); rtw_write8(padapter, REG_ATIMWND, 0x02);// 2ms @@ -4166,12 +4047,12 @@ void SetBeaconRelatedRegisters8814A(PADAPTER padapter) rtw_write8(padapter, REG_SLOT, 0x09); - value32 =rtw_read32(padapter, REG_TCR); + value32 =rtw_read32(padapter, REG_TCR); value32 &= ~TSFRST; - rtw_write32(padapter, REG_TCR, value32); + rtw_write32(padapter, REG_TCR, value32); value32 |= TSFRST; - rtw_write32(padapter, REG_TCR, value32); + rtw_write32(padapter, REG_TCR, value32); // NOTE: Fix test chip's bug (about contention windows's randomness) rtw_write8(padapter, REG_RXTSF_OFFSET_CCK, 0x50); @@ -4182,7 +4063,7 @@ void SetBeaconRelatedRegisters8814A(PADAPTER padapter) ResumeTxBeacon(padapter); //rtw_write8(padapter, 0x422, rtw_read8(padapter, 0x422)|BIT(6)); - + //rtw_write8(padapter, 0x541, 0xff); //rtw_write8(padapter, 0x542, rtw_read8(padapter, 0x541)|BIT(0)); @@ -4212,8 +4093,8 @@ SetBeamformingCLK_8812( { RTW_INFO(" <==%s return by Scan\n", __FUNCTION__); return; - } - + } + // Stop Usb TxDMA rtw_write_port_cancel(Adapter); @@ -4246,12 +4127,12 @@ SetBeamformingCLK_8812( { if (rtw_read32(Adapter, REG_SCH_TXCMD_8812A) != 0) continue; - else + else break; } RTW_INFO(" Tx Status count %d\n", Count); - + // Stop RX DMA path u1btmp = rtw_read8(Adapter, REG_RXDMA_CONTROL_8812A); rtw_write8(Adapter, REG_RXDMA_CONTROL_8812A, u1btmp | BIT2); @@ -4266,7 +4147,7 @@ SetBeamformingCLK_8812( } RTW_INFO(" Rx Empty count %d \n", Count); - + // Disable clock rtw_write8(Adapter, REG_SYS_CLKR+1, 0xf0); // Disable 320M @@ -4304,7 +4185,7 @@ SetBeamformRfMode_8812( if(BeamformCap == pBeamInfo->beamforming_cap) return; - else + else pBeamInfo->beamforming_cap = BeamformCap; if(GET_RF_TYPE(Adapter) == RF_1T1R) @@ -4317,7 +4198,7 @@ SetBeamformRfMode_8812( PHY_SetRFReg(Adapter, ODM_RF_PATH_B, RF_WeLut_Jaguar, 0x80000,0x1); // RF Mode table write enable if(bSelfBeamformer) - { + { // Paath_A PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_ModeTableAddr, 0x78000,0x3); // Select RX mode PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_ModeTableData0, 0xfffff,0x3F7FF); // Set Table data @@ -4326,9 +4207,7 @@ SetBeamformRfMode_8812( PHY_SetRFReg(Adapter, ODM_RF_PATH_B, RF_ModeTableAddr, 0x78000, 0x3); // Select RX mode PHY_SetRFReg(Adapter, ODM_RF_PATH_B, RF_ModeTableData0, 0xfffff,0x3F7FF); // Set Table data PHY_SetRFReg(Adapter, ODM_RF_PATH_B, RF_ModeTableData1, 0xfffff,0xE26BF); // Enable TXIQGEN in RX mode - } - else - { + } else { // Paath_A PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_ModeTableAddr, 0x78000, 0x3); // Select RX mode PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_ModeTableData0, 0xfffff,0x3F7FF); // Set Table data @@ -4348,8 +4227,6 @@ SetBeamformRfMode_8812( PHY_SetBBReg(Adapter, rTxPath_Jaguar, bMaskByte1, 0x11); } - - VOID SetBeamformEnter_8812( IN PADAPTER Adapter, @@ -4368,7 +4245,7 @@ SetBeamformEnter_8812( if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) STAid = BeamformEntry.mac_id; - else + else STAid = BeamformEntry.p_aid; // Sounding protocol control @@ -4390,7 +4267,7 @@ SetBeamformEnter_8812( /*rtw_write16(Adapter, REG_BFMER1_INFO_8812A+6, BeamformEntry.P_AID);*/ } - // CSI report parameters of Beamformee + // CSI report parameters of Beamformee if( (BeamformEntry.beamforming_entry_cap & BEAMFORMEE_CAP_VHT_SU) || (BeamformEntry.beamforming_entry_cap & BEAMFORMER_CAP_VHT_SU) ) { @@ -4398,14 +4275,12 @@ SetBeamformEnter_8812( CSI_Param = 0x01090109; else CSI_Param = 0x01080108; - } - else - { + } else { if(pHalData->rf_type == RF_2T2R) CSI_Param = 0x03090309; else CSI_Param = 0x03080308; - } + } if(pHalData->rf_type == RF_2T2R) rtw_write32(Adapter, 0x9B4, 0x00000000); // Nc =2 @@ -4418,26 +4293,22 @@ SetBeamformEnter_8812( // P_AID of Beamformee & enable NDPA transmission & enable NDPA interrupt if(Idx == 0) - { - rtw_write16(Adapter, REG_TXBF_CTRL_8812A, STAid); - rtw_write8(Adapter, REG_TXBF_CTRL_8812A+3, rtw_read8(Adapter, REG_TXBF_CTRL_8812A+3)|BIT4|BIT6|BIT7); - } - else { + rtw_write16(Adapter, REG_TXBF_CTRL_8812A, STAid); + rtw_write8(Adapter, REG_TXBF_CTRL_8812A+3, rtw_read8(Adapter, REG_TXBF_CTRL_8812A+3)|BIT4|BIT6|BIT7); + } else { rtw_write16(Adapter, REG_TXBF_CTRL_8812A+2, STAid | BIT12 | BIT14 | BIT15); - } + } // CSI report parameters of Beamformee - if(Idx == 0) + if(Idx == 0) { // Get BIT24 & BIT25 u8 tmp = rtw_read8(Adapter, REG_BFMEE_SEL_8812A+3) & 0x3; - + rtw_write8(Adapter, REG_BFMEE_SEL_8812A+3, tmp | 0x60); rtw_write16(Adapter, REG_BFMEE_SEL_8812A, STAid | BIT9); - } - else - { + } else { // Set BIT25 rtw_write16(Adapter, REG_BFMEE_SEL_8812A+2, STAid | (0xE2 << 8)); } @@ -4448,7 +4319,6 @@ SetBeamformEnter_8812( beamforming_notify(Adapter); } - VOID SetBeamformLeave_8812( IN PADAPTER Adapter, @@ -4464,19 +4334,17 @@ SetBeamformLeave_8812( * Clear Associated Bfmee Sel */ if(pBeamInfo->beamforming_cap == BEAMFORMING_CAP_NONE) - rtw_write8(Adapter, REG_SND_PTCL_CTRL_8812A, 0xC8); + rtw_write8(Adapter, REG_SND_PTCL_CTRL_8812A, 0xC8); if(Idx == 0) - { - rtw_write16(Adapter, REG_TXBF_CTRL_8812A, 0); + { + rtw_write16(Adapter, REG_TXBF_CTRL_8812A, 0); rtw_write32(Adapter, REG_BFMER0_INFO_8812A, 0); rtw_write16(Adapter, REG_BFMER0_INFO_8812A+4, 0); rtw_write16(Adapter, REG_BFMEE_SEL_8812A, 0); - } - else - { + } else { rtw_write16(Adapter, REG_TXBF_CTRL_8812A+2, rtw_read16(Adapter, REG_TXBF_CTRL_8812A+2) & 0xF000); rtw_write32(Adapter, REG_BFMER1_INFO_8812A, 0); @@ -4486,7 +4354,6 @@ SetBeamformLeave_8812( } } - VOID SetBeamformStatus_8812( IN PADAPTER Adapter, @@ -4501,7 +4368,7 @@ SetBeamformStatus_8812( if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) BeamCtrlVal = BeamformEntry.mac_id; - else + else BeamCtrlVal = BeamformEntry.p_aid; if(Idx == 0) @@ -4520,9 +4387,7 @@ SetBeamformStatus_8812( BeamCtrlVal |= BIT10; else if(BeamformEntry.sound_bw == CHANNEL_WIDTH_80) BeamCtrlVal |= BIT11; - } - else - { + } else { BeamCtrlVal &= ~(BIT9|BIT10|BIT11); } @@ -4531,7 +4396,6 @@ SetBeamformStatus_8812( RTW_INFO("%s Idx %d BeamCtrlReg %x BeamCtrlVal %x\n", __FUNCTION__, Idx, BeamCtrlReg, BeamCtrlVal); } - VOID SetBeamformFwTxBFCmd_8812( IN PADAPTER Adapter @@ -4555,7 +4419,7 @@ SetBeamformFwTxBFCmd_8812( else PageNum0 = 0xFF; //stop sounding Period0 = (u8)(pBeamInfo->beamforming_entry[Idx].sound_period); - } + } else if(Idx == 1) { if(pBeamInfo->beamforming_entry[Idx].bSound) @@ -4563,7 +4427,7 @@ SetBeamformFwTxBFCmd_8812( else PageNum1 = 0xFF; //stop sounding Period1 = (u8)(pBeamInfo->beamforming_entry[Idx].sound_period); - } + } } } @@ -4571,19 +4435,18 @@ SetBeamformFwTxBFCmd_8812( u1TxBFParm[1] = PageNum1; u1TxBFParm[2] = (Period1 << 4) | Period0; FillH2CCmd_8812(Adapter, H2C_8812_TxBF, 3, u1TxBFParm); - + RTW_INFO("%s PageNum0 = %d Period0 = %d\n", __FUNCTION__, PageNum0, Period0); RTW_INFO("PageNum1 = %d Period1 %d\n", PageNum1, Period1); } - VOID SetBeamformDownloadNDPA_8812( IN PADAPTER Adapter, IN u8 Idx ) { - u8 u1bTmp=0, tmpReg422=0, Head_Page; + u8 u1bTmp=0, tmpReg422=0, Head_Page; u8 BcnValidReg=0, count=0, DLBcnCount=0; BOOLEAN bSendBeacon=_FALSE; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); @@ -4599,7 +4462,7 @@ SetBeamformDownloadNDPA_8812( Head_Page = 0xFE; rtw_hal_get_def_var(Adapter, HAL_DEF_TX_PAGE_BOUNDARY, (u16 *)&TxPageBndy); - + //Set REG_CR bit 8. DMA beacon by SW. u1bTmp = rtw_read8(Adapter, REG_CR+1); rtw_write8(Adapter, REG_CR+1, (u1bTmp|BIT0)); @@ -4619,17 +4482,17 @@ SetBeamformDownloadNDPA_8812( // TDECTRL[15:8] 0x209[7:0] = 0xF6 Beacon Head for TXDMA rtw_write8(Adapter,REG_TDECTRL+1, Head_Page); - + do - { + { // Clear beacon valid check bit. BcnValidReg = rtw_read8(Adapter, REG_TDECTRL+2); rtw_write8(Adapter, REG_TDECTRL+2, (BcnValidReg|BIT0)); - + // download NDPA rsvd page. if(pBeamEntry->beamforming_entry_cap & BEAMFORMER_CAP_VHT_SU) beamforming_send_vht_ndpa_packet(Adapter,pBeamEntry->mac_addr,pBeamEntry->aid,pBeamEntry->sound_bw, BCN_QUEUE_INX); - else + else beamforming_send_ht_ndpa_packet(Adapter,pBeamEntry->mac_addr,pBeamEntry->sound_bw, BCN_QUEUE_INX); // check rsvd page download OK. @@ -4642,8 +4505,8 @@ SetBeamformDownloadNDPA_8812( BcnValidReg = rtw_read8(Adapter, REG_TDECTRL+2); } DLBcnCount++; - }while(!(BcnValidReg&BIT0) && DLBcnCount<5); - + } while(!(BcnValidReg&BIT0) && DLBcnCount<5); + if(!(BcnValidReg&BIT0)) RTW_INFO("%s Download RSVD page failed!\n", __FUNCTION__); @@ -4652,7 +4515,7 @@ SetBeamformDownloadNDPA_8812( // To make sure that if there exists an adapter which would like to send beacon. // If exists, the origianl value of 0x422[6] will be 1, we should check this to - // prevent from setting 0x422[6] to 0 after download reserved page, or it will cause + // prevent from setting 0x422[6] to 0 after download reserved page, or it will cause // the beacon cannot be sent by HW. // 2010.06.23. Added by tynli. if(bSendBeacon) @@ -4685,7 +4548,6 @@ SetBeamformFwTxBF_8812( SetBeamformFwTxBFCmd_8812(Adapter); } - VOID SetBeamformPatch_8812( IN PADAPTER Adapter, @@ -4694,13 +4556,13 @@ SetBeamformPatch_8812( { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct beamforming_info *pBeamInfo = GET_BEAMFORM_INFO(&(Adapter->mlmepriv)); - + if(pBeamInfo->beamforming_cap == BEAMFORMING_CAP_NONE) return; - + /*if(Operation == SCAN_OPT_BACKUP_BAND0) { - rtw_write8(Adapter, REG_SND_PTCL_CTRL_8812A, 0xC8); + rtw_write8(Adapter, REG_SND_PTCL_CTRL_8812A, 0xC8); } else if(Operation == SCAN_OPT_RESTORE) { @@ -4731,7 +4593,7 @@ static void hw_var_set_monitor(PADAPTER Adapter, u8 variable, u8 *val) rcr_bits |= RCR_APPFCS; #if 0 - /* + /* CRC and ICV packet will drop in recvbuf2recvframe() We no turn on it. */ @@ -4758,7 +4620,7 @@ static void hw_var_set_monitor(PADAPTER Adapter, u8 variable, u8 *val) static void hw_var_set_opmode(PADAPTER Adapter, u8 variable, u8* val) { - u8 val8; + u8 val8; u8 mode = *((u8 *)val); u32 value_rcr; static u8 isMonitor = _FALSE; @@ -4785,12 +4647,12 @@ static void hw_var_set_opmode(PADAPTER Adapter, u8 variable, u8* val) { // disable Port1 TSF update rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|DIS_TSF_UDT); - + // set net_type val8 = rtw_read8(Adapter, MSR)&0x03; val8 |= (mode<<2); rtw_write8(Adapter, MSR, val8); - + RTW_INFO("%s()-%d mode = %d\n", __FUNCTION__, __LINE__, mode); if((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_)) @@ -4801,21 +4663,21 @@ static void hw_var_set_opmode(PADAPTER Adapter, u8 variable, u8* val) #ifdef CONFIG_PCI_HCI UpdateInterruptMask8814AE(Adapter, 0, 0, RT_BCN_INT_MASKS, 0); #else //CONFIG_PCI_HCI - #ifdef CONFIG_INTERRUPT_BASED_TXBCN + #ifdef CONFIG_INTERRUPT_BASED_TXBCN - #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT + #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT rtw_write8(Adapter, REG_DRVERLYINT, 0x05);//restore early int time to 5ms - UpdateInterruptMask8814AU(Adapter,_TRUE, 0, IMR_BCNDMAINT0_8812); + UpdateInterruptMask8814AU(Adapter,_TRUE, 0, IMR_BCNDMAINT0_8812); #endif // CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT - - #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR + + #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR UpdateInterruptMask8814AU(Adapter,_TRUE ,0, (IMR_TXBCN0ERR_8812|IMR_TXBCN0OK_8812)); #endif// CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR - + #endif //CONFIG_INTERRUPT_BASED_TXBCN #endif //CONFIG_PCI_HCI } - + rtw_write8(Adapter,REG_BCN_CTRL_1, 0x11);//disable atim wnd and disable beacon function //rtw_write8(Adapter,REG_BCN_CTRL_1, 0x18); } @@ -4834,12 +4696,12 @@ static void hw_var_set_opmode(PADAPTER Adapter, u8 variable, u8* val) #ifdef CONFIG_PCI_HCI UpdateInterruptMask8814AE(Adapter, RT_BCN_INT_MASKS, 0, 0, 0); #else - #ifdef CONFIG_INTERRUPT_BASED_TXBCN + #ifdef CONFIG_INTERRUPT_BASED_TXBCN #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT UpdateInterruptMask8814AU(Adapter,_TRUE ,IMR_BCNDMAINT0_8812, 0); #endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT - #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR + #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR UpdateInterruptMask8814AU(Adapter,_TRUE ,(IMR_TXBCN0ERR_8812|IMR_TXBCN0OK_8812), 0); #endif//CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR @@ -4847,7 +4709,7 @@ static void hw_var_set_opmode(PADAPTER Adapter, u8 variable, u8* val) #endif ResumeTxBeacon(Adapter); - + rtw_write8(Adapter, REG_BCN_CTRL_1, 0x12); #ifdef RTL8814AE_SW_BCN @@ -4865,16 +4727,16 @@ static void hw_var_set_opmode(PADAPTER Adapter, u8 variable, u8* val) //enable to rx data frame rtw_write16(Adapter, REG_RXFLTMAP2, 0xFFFF); - //Beacon Control related register for first time - rtw_write8(Adapter, REG_BCNDMATIM, 0x02); // 2ms + //Beacon Control related register for first time + rtw_write8(Adapter, REG_BCNDMATIM, 0x02); // 2ms //rtw_write8(Adapter, REG_BCN_MAX_ERR, 0xFF); rtw_write8(Adapter, REG_ATIMWND_1, 0x0a); // 10ms for port1 rtw_write16(Adapter, REG_BCNTCFG, 0x00); rtw_write16(Adapter, REG_TBTT_PROHIBIT, 0xff04); rtw_write16(Adapter, REG_TSFTR_SYN_OFFSET, 0x7fff);// +32767 (~32ms) - - //reset TSF2 + + //reset TSF2 rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)); //enable BCN1 Function for if2 @@ -4883,13 +4745,13 @@ static void hw_var_set_opmode(PADAPTER Adapter, u8 variable, u8* val) #ifdef CONFIG_CONCURRENT_MODE if(check_buddy_fwstate(Adapter, WIFI_FW_NULL_STATE)) - rtw_write8(Adapter, REG_BCN_CTRL, + rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL) & ~EN_BCN_FUNCTION); #endif //BCN1 TSF will sync to BCN0 TSF with offset(0x518) if if1_sta linked //rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(5)); //rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(3)); - + //dis BCN0 ATIM WND if if1 is station rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|DIS_ATIM); @@ -4908,18 +4770,18 @@ static void hw_var_set_opmode(PADAPTER Adapter, u8 variable, u8* val) { // disable Port0 TSF update rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|DIS_TSF_UDT); - + // set net_type val8 = rtw_read8(Adapter, MSR)&0x0c; val8 |= mode; rtw_write8(Adapter, MSR, val8); - + RTW_INFO("%s()-%d mode = %d\n", __FUNCTION__, __LINE__, mode); - + if((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_)) { #ifdef CONFIG_CONCURRENT_MODE - if(!check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE)) + if(!check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE)) #endif // CONFIG_CONCURRENT_MODE { StopTxBeacon(Adapter); @@ -4928,18 +4790,18 @@ static void hw_var_set_opmode(PADAPTER Adapter, u8 variable, u8* val) #else #ifdef CONFIG_INTERRUPT_BASED_TXBCN #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT - rtw_write8(Adapter, REG_DRVERLYINT, 0x05);//restore early int time to 5ms - UpdateInterruptMask8814AU(Adapter,_TRUE, 0, IMR_BCNDMAINT0_8812); + rtw_write8(Adapter, REG_DRVERLYINT, 0x05);//restore early int time to 5ms + UpdateInterruptMask8814AU(Adapter,_TRUE, 0, IMR_BCNDMAINT0_8812); #endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT - - #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR + + #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR UpdateInterruptMask8814AU(Adapter,_TRUE ,0, (IMR_TXBCN0ERR_8812|IMR_TXBCN0OK_8812)); #endif //CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR - + #endif //CONFIG_INTERRUPT_BASED_TXBCN #endif } - + rtw_write8(Adapter,REG_BCN_CTRL, 0x19);//disable atim wnd //rtw_write8(Adapter,REG_BCN_CTRL, 0x18); } @@ -4957,15 +4819,15 @@ static void hw_var_set_opmode(PADAPTER Adapter, u8 variable, u8* val) #ifdef CONFIG_PCI_HCI UpdateInterruptMask8814AE(Adapter, RT_BCN_INT_MASKS, 0, 0, 0); #else - #ifdef CONFIG_INTERRUPT_BASED_TXBCN + #ifdef CONFIG_INTERRUPT_BASED_TXBCN #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT UpdateInterruptMask8814AU(Adapter,_TRUE ,IMR_BCNDMAINT0_8812, 0); #endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT - #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR + #ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR UpdateInterruptMask8814AU(Adapter,_TRUE ,(IMR_TXBCN0ERR_8812|IMR_TXBCN0OK_8812), 0); #endif//CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR - + #endif //CONFIG_INTERRUPT_BASED_TXBCN #endif @@ -4990,8 +4852,8 @@ static void hw_var_set_opmode(PADAPTER Adapter, u8 variable, u8* val) rtw_write16(Adapter, REG_RXFLTMAP2, 0xFFFF); //Beacon Control related register for first time - rtw_write8(Adapter, REG_BCNDMATIM, 0x02); // 2ms - + rtw_write8(Adapter, REG_BCNDMATIM, 0x02); // 2ms + //rtw_write8(Adapter, REG_BCN_MAX_ERR, 0xFF); rtw_write8(Adapter, REG_ATIMWND, 0x0a); // 10ms rtw_write16(Adapter, REG_BCNTCFG, 0x00); @@ -5000,14 +4862,14 @@ static void hw_var_set_opmode(PADAPTER Adapter, u8 variable, u8* val) //reset TSF rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(0)); - + //enable BCN0 Function for if1 //don't enable update TSF0 for if1 (due to TSF update when beacon/probe rsp are received) rtw_write8(Adapter, REG_BCN_CTRL, (DIS_TSF_UDT|EN_BCN_FUNCTION | EN_TXBCN_RPT|DIS_BCNQ_SUB)); #ifdef CONFIG_CONCURRENT_MODE if(check_buddy_fwstate(Adapter, WIFI_FW_NULL_STATE)) - rtw_write8(Adapter, REG_BCN_CTRL_1, + rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1) & ~EN_BCN_FUNCTION); #endif @@ -5045,7 +4907,7 @@ static void hw_var_set_macaddr(PADAPTER Adapter, u8 variable, u8* val) { rtw_write8(GET_PRIMARY_ADAPTER(Adapter), (reg_macid+idx), val[idx]); } - + } static void hw_var_set_bssid(PADAPTER Adapter, u8 variable, u8* val) @@ -5079,24 +4941,22 @@ static void hw_var_set_bcn_func(PADAPTER Adapter, u8 variable, u8* val) if(Adapter->iface_type == IFACE_PORT1) { bcn_ctrl_reg = REG_BCN_CTRL_1; - } + } else -#endif - { +#endif + { bcn_ctrl_reg = REG_BCN_CTRL; } if(*((u8 *)val)) { rtw_write8(Adapter, bcn_ctrl_reg, (EN_BCN_FUNCTION | EN_TXBCN_RPT)); - } - else - { - + } else { + u8 val8; val8 = rtw_read8(Adapter, bcn_ctrl_reg); val8 &= ~(EN_BCN_FUNCTION | EN_TXBCN_RPT); - + #ifdef CONFIG_BT_COEXIST if (GET_HAL_DATA(Adapter)->EEPROMBluetoothCoexist == 1) { @@ -5108,7 +4968,7 @@ static void hw_var_set_bcn_func(PADAPTER Adapter, u8 variable, u8* val) rtw_write8(Adapter, bcn_ctrl_reg, val8); } - + } @@ -5124,7 +4984,7 @@ static void hw_var_set_correct_tsf(PADAPTER Adapter, u8 variable, u8* val) tsf = pmlmeext->TSFValue - rtw_modular64(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024)) -1024; //us if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) - { + { //pHalData->RegTxPause |= STOP_BCNQ;BIT(6) //rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)|BIT(6))); StopTxBeacon(Adapter); @@ -5134,18 +4994,18 @@ static void hw_var_set_correct_tsf(PADAPTER Adapter, u8 variable, u8* val) { //disable related TSF function rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(3))); - + rtw_write32(Adapter, REG_TSFTR1, tsf); rtw_write32(Adapter, REG_TSFTR1+4, tsf>>32); //enable related TSF function - rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(3)); + rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(3)); // Update buddy port's TSF if it is SoftAP for beacon TX issue! if ( (pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE && check_buddy_fwstate(Adapter, WIFI_AP_STATE) - ) { + ) { //disable related TSF function rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(3))); @@ -5160,26 +5020,23 @@ static void hw_var_set_correct_tsf(PADAPTER Adapter, u8 variable, u8* val) RTW_INFO("ERROR! %s()-%d: Reset port0 TSF fail\n", __FUNCTION__, __LINE__); -#endif // CONFIG_TSF_RESET_OFFLOAD - } +#endif // CONFIG_TSF_RESET_OFFLOAD + } - - } - else - { + } else { //disable related TSF function rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(3))); - + rtw_write32(Adapter, REG_TSFTR, tsf); rtw_write32(Adapter, REG_TSFTR+4, tsf>>32); //enable related TSF function rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(3)); - + // Update buddy port's TSF if it is SoftAP for beacon TX issue! if ( (pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE && check_buddy_fwstate(Adapter, WIFI_AP_STATE) - ) { + ) { //disable related TSF function rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(3))); @@ -5194,11 +5051,10 @@ static void hw_var_set_correct_tsf(PADAPTER Adapter, u8 variable, u8* val) RTW_INFO("ERROR! %s()-%d: Reset port1 TSF fail\n", __FUNCTION__, __LINE__); #endif // CONFIG_TSF_RESET_OFFLOAD - } + } } - - + if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) { //pHalData->RegTxPause &= (~STOP_BCNQ); @@ -5212,10 +5068,9 @@ static void hw_var_set_correct_tsf(PADAPTER Adapter, u8 variable, u8* val) static void hw_var_set_mlme_disconnect(PADAPTER Adapter, u8 variable, u8* val) { #ifdef CONFIG_CONCURRENT_MODE - - if(check_buddy_mlmeinfo_state(Adapter, _HW_STATE_NOLINK_)) + + if(check_buddy_mlmeinfo_state(Adapter, _HW_STATE_NOLINK_)) rtw_write16(Adapter, REG_RXFLTMAP2, 0x00); - if(Adapter->iface_type == IFACE_PORT1) { @@ -5227,9 +5082,7 @@ static void hw_var_set_mlme_disconnect(PADAPTER Adapter, u8 variable, u8* val) // disable Port1's beacon function rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(3))); - } - else - { + } else { //reset TSF rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(0)); @@ -5280,8 +5133,8 @@ static void hw_var_set_mlme_sitesurvey(PADAPTER Adapter, u8 variable, u8* val) || (check_buddy_fwstate(Adapter, WIFI_AP_STATE) == _TRUE) #endif ) - { - rcr_clear_bit = RCR_CBSSID_BCN; + { + rcr_clear_bit = RCR_CBSSID_BCN; } #ifdef CONFIG_TDLS // TDLS will clear RCR_CBSSID_DATA bit for connection. @@ -5313,7 +5166,7 @@ static void hw_var_set_mlme_sitesurvey(PADAPTER Adapter, u8 variable, u8* val) } else//sitesurvey done { - if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) + if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) #ifdef CONFIG_CONCURRENT_MODE || check_buddy_fwstate(Adapter, (_FW_LINKED|WIFI_AP_STATE)) #endif @@ -5352,11 +5205,11 @@ static void hw_var_set_mlme_sitesurvey(PADAPTER Adapter, u8 variable, u8* val) #if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) tx_beacon_hdl(iface, NULL); #endif - #endif + #endif } } } - } + } } static void hw_var_set_mlme_join(PADAPTER Adapter, u8 variable, u8* val) @@ -5368,25 +5221,23 @@ static void hw_var_set_mlme_join(PADAPTER Adapter, u8 variable, u8* val) struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; if(type == 0) // prepare to join - { + { if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) && - check_buddy_fwstate(Adapter, _FW_LINKED)) + check_buddy_fwstate(Adapter, _FW_LINKED)) { StopTxBeacon(Adapter); } - + //enable to rx data frame.Accept all data frame //rtw_write32(padapter, REG_RCR, rtw_read32(padapter, REG_RCR)|RCR_ADF); rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF); if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE)) { - rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_BCN); - } - else - { + rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_BCN); + } else { rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN); - } + } if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) { @@ -5398,30 +5249,29 @@ static void hw_var_set_mlme_join(PADAPTER Adapter, u8 variable, u8* val) } } else if(type == 1) //joinbss_event call back when join res < 0 - { - if(check_buddy_mlmeinfo_state(Adapter, _HW_STATE_NOLINK_)) + { + if(check_buddy_mlmeinfo_state(Adapter, _HW_STATE_NOLINK_)) rtw_write16(Adapter, REG_RXFLTMAP2,0x00); if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) && check_buddy_fwstate(Adapter, _FW_LINKED)) { - ResumeTxBeacon(Adapter); - + ResumeTxBeacon(Adapter); + //reset TSF 1/2 after ResumeTxBeacon - rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0)); - + rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0)); + } } else if(type == 2) //sta add event call back { - + //enable update TSF if(Adapter->iface_type == IFACE_PORT1) rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(4))); - else + else rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4))); - - + if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE)) { //fixed beacon issue for 8191su........... @@ -5433,16 +5283,16 @@ static void hw_var_set_mlme_join(PADAPTER Adapter, u8 variable, u8* val) if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) && check_buddy_fwstate(Adapter, _FW_LINKED)) { - ResumeTxBeacon(Adapter); - + ResumeTxBeacon(Adapter); + //reset TSF 1/2 after ResumeTxBeacon rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0)); } - + } rtw_write16(Adapter, REG_RL, RetryLimit << RETRY_LIMIT_SHORT_SHIFT | RetryLimit << RETRY_LIMIT_LONG_SHIFT); - + #endif //CONFIG_CONCURRENT_MODE } @@ -5457,7 +5307,7 @@ static void rtw_store_all_sta_hwseq(_adapter *padapter) struct sta_priv *pstapriv = &padapter->stapriv; struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj); - + /* save each HW sequence of mac id from report fifo */ for (index = 0; index < macid_ctl->num && index < NUM_STA; index++) { if (rtw_macid_is_used(macid_ctl, index)) { @@ -5468,14 +5318,14 @@ static void rtw_store_all_sta_hwseq(_adapter *padapter) /* RTW_INFO("mac_id:%d is used, hw_seq[index]=%d\n", index, hw_seq[index]); */ } } - + _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); for (index = 0; index < NUM_STA; index++) { psta = NULL; - + phead = &(pstapriv->sta_hash[index]); plist = get_next(phead); - + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); plist = get_next(plist); @@ -5486,7 +5336,7 @@ static void rtw_store_all_sta_hwseq(_adapter *padapter) } _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); - + } static void rtw_restore_all_sta_hwseq(_adapter *padapter) @@ -5500,25 +5350,25 @@ static void rtw_restore_all_sta_hwseq(_adapter *padapter) struct sta_priv *pstapriv = &padapter->stapriv; struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj); - + _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); for (index = 0; index < NUM_STA; index++) { psta = NULL; - + phead = &(pstapriv->sta_hash[index]); plist = get_next(phead); - + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); plist = get_next(plist); - + hw_seq[psta->mac_id] = psta->hwseq; /* RTW_INFO(" psta->mac_id=%d, psta->hwseq=%d\n", psta->mac_id, psta->hwseq); */ } } _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); - + /* restore each HW sequence of mac id to report fifo */ for (index = 0; index < macid_ctl->num && index < NUM_STA; index++) { if (rtw_macid_is_used(macid_ctl, index)) { @@ -5529,18 +5379,18 @@ static void rtw_restore_all_sta_hwseq(_adapter *padapter) /* RTW_INFO("mac_id:%d is used, hw_seq[index]=%d\n", index, hw_seq[index]); */ } } - + } void SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval) { - PHAL_DATA_TYPE pHalData; + PHAL_DATA_TYPE pHalData; PDM_ODM_T podmpriv; u8 val8; u16 val16; u32 val32; - pHalData = GET_HAL_DATA(padapter); + pHalData = GET_HAL_DATA(padapter); podmpriv = &pHalData->odmpriv; switch (variable) @@ -5627,7 +5477,7 @@ void SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval) tsf = pmlmeext->TSFValue - rtw_modular64(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024)) -1024; //us if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) - { + { //pHalData->RegTxPause |= STOP_BCNQ;BIT(6) //rtw_write8(padapter, REG_TXPAUSE, (rtw_read8(padapter, REG_TXPAUSE)|BIT(6))); StopTxBeacon(padapter); @@ -5642,8 +5492,7 @@ void SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval) //enable related TSF function rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)|BIT(3)); - - + if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) { //pHalData->RegTxPause &= (~STOP_BCNQ); @@ -5705,7 +5554,7 @@ void SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval) u8 RetryLimit = 0x30; u8 type = *(u8*)pval; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - + if (type == 0) // prepare to join { //enable to rx data frame.Accept all data frame @@ -5751,7 +5600,7 @@ void SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval) #endif // !CONFIG_CONCURRENT_MODE #ifdef CONFIG_BT_COEXIST - if (_TRUE == pHalData->EEPROMBluetoothCoexist) + if (_TRUE == pHalData->EEPROMBluetoothCoexist) { switch (*pval) { @@ -5767,7 +5616,7 @@ void SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval) // sta add event callback // rtw_btcoex_MediaStatusNotify(padapter, RT_MEDIA_CONNECT); break; - } + } } #endif break; @@ -5848,9 +5697,7 @@ void SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval) { ulContent |= (ucIndex & 0x03) | ((u16)(ulEncAlgo)<<2); //ulContent |= CAM_VALID; - } - else - { + } else { ulContent = 0; } // polling bit, and No Write enable, and address @@ -6010,7 +5857,7 @@ void SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval) case HW_VAR_FIFO_CLEARN_UP: { struct pwrctrl_priv *pwrpriv; - u8 trycnt = 100; + u8 trycnt = 100; pwrpriv = adapter_to_pwrctl(padapter); @@ -6044,7 +5891,7 @@ void SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval) } } break; - + case HW_VAR_RESTORE_HW_SEQ: rtw_restore_all_sta_hwseq(padapter); break; @@ -6195,7 +6042,7 @@ void SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval) rtw_write8(padapter, REG_SIFS_CTX+1, SIFS_Timer); // SIFS for OFDM consecutive tx like CTS data! rtw_write8(padapter, REG_SIFS_TRX+1, SIFS_Timer); - + rtw_write8(padapter,REG_SPEC_SIFS+1, SIFS_Timer); rtw_write8(padapter,REG_MAC_SPEC_SIFS+1, SIFS_Timer); @@ -6211,11 +6058,11 @@ void SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval) R2T_SIFS = 0xa; #ifdef CONFIG_80211AC_VHT if (wireless_mode & WIRELESS_11_5AC && - //MgntLinkStatusQuery(Adapter) && - TEST_FLAG(pmlmepriv->vhtpriv.ldpc_cap, LDPC_VHT_ENABLE_RX) && + //MgntLinkStatusQuery(Adapter) && + TEST_FLAG(pmlmepriv->vhtpriv.ldpc_cap, LDPC_VHT_ENABLE_RX) && TEST_FLAG(pmlmepriv->vhtpriv.stbc_cap, STBC_VHT_ENABLE_RX)) - { - if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_ATHEROS) + { + if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_ATHEROS) R2T_SIFS = 0x8; else R2T_SIFS = 0xa; @@ -6245,46 +6092,46 @@ void SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval) case HW_VAR_HW_REG_TIMER_INIT: { HAL_HW_TIMER_TYPE TimerType = (*(PHAL_HW_TIMER_TYPE)pval)>>16; - + rtw_write8(padapter, 0x164, 1); if (TimerType == HAL_TIMER_TXBF) rtw_write32(padapter, 0x15C, (*(pu2Byte)pval)); else if (TimerType == HAL_TIMER_EARLYMODE) - rtw_write32(padapter, 0x160, 0x05000190); + rtw_write32(padapter, 0x160, 0x05000190); break; - } + } case HW_VAR_HW_REG_TIMER_START: { HAL_HW_TIMER_TYPE TimerType = *(PHAL_HW_TIMER_TYPE)pval; - + if (TimerType == HAL_TIMER_TXBF) rtw_write8(padapter, 0x15F, 0x5); else if (TimerType == HAL_TIMER_EARLYMODE) - rtw_write8(padapter, 0x163, 0x5); - break; - } + rtw_write8(padapter, 0x163, 0x5); + break; + } case HW_VAR_HW_REG_TIMER_RESTART: { HAL_HW_TIMER_TYPE TimerType = *(PHAL_HW_TIMER_TYPE)pval; - + if (TimerType == HAL_TIMER_TXBF) { rtw_write8(padapter, 0x15F, 0x0); rtw_write8(padapter, 0x15F, 0x5); } else if (TimerType == HAL_TIMER_EARLYMODE) { rtw_write8(padapter, 0x163, 0x0); - rtw_write8(padapter, 0x163, 0x5); + rtw_write8(padapter, 0x163, 0x5); } break; - } + } case HW_VAR_HW_REG_TIMER_STOP: { HAL_HW_TIMER_TYPE TimerType = *(PHAL_HW_TIMER_TYPE)pval; - + if (TimerType == HAL_TIMER_TXBF) rtw_write8(padapter, 0x15F, 0); else if (TimerType == HAL_TIMER_EARLYMODE) - rtw_write8(padapter, 0x163, 0x0); + rtw_write8(padapter, 0x163, 0x0); break; } #endif/*#if (BEAMFORMING_SUPPORT == 1) - for PHYDM TxBF*/ @@ -6505,7 +6352,7 @@ void GetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval) else *pval = _TRUE; } - + break; #ifdef CONFIG_ANTENNA_DIVERSITY @@ -6515,7 +6362,7 @@ void GetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval) #endif //CONFIG_ANTENNA_DIVERSITY case HW_VAR_EFUSE_BYTES: // To get EFUE total used bytes, added by Roger, 2008.12.22. - *(u16*)pval = pHalData->EfuseUsedBytes; + *(u16*)pval = pHalData->EfuseUsedBytes; break; case HW_VAR_APFM_ON_MAC: @@ -6557,7 +6404,7 @@ u8 SetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval) pHalData->EfuseUsedBytes = *((u16*)pval); break; case HAL_DEF_EFUSE_USAGE: - pHalData->EfuseUsedPercentage = *((u8*)pval); + pHalData->EfuseUsedPercentage = *((u8*)pval); break; default: bResult = SetHalDefVar(padapter, variable, pval); @@ -6568,7 +6415,7 @@ u8 SetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval) } /* - * Description: + * Description: * Query setting of specified variable. */ u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval) @@ -6576,13 +6423,12 @@ u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval) PHAL_DATA_TYPE pHalData; u8 bResult; - pHalData = GET_HAL_DATA(padapter); bResult = _SUCCESS; switch (variable) { - + #ifdef CONFIG_ANTENNA_DIVERSITY case HAL_DEF_IS_SUPPORT_ANT_DIV: @@ -6640,7 +6486,7 @@ u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval) *((PBOOLEAN)pval) = _TRUE; else *((PBOOLEAN)pval) = _FALSE; - break; + break; case HAL_DEF_EXPLICIT_BEAMFORMEE: *((PBOOLEAN)pval) = _TRUE; break; @@ -6652,8 +6498,8 @@ u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval) u32 cmd ; u32 ra_info1, ra_info2; u32 rate_mask1, rate_mask2; - u8 curr_tx_rate,curr_tx_sgi,hight_rate,lowest_rate; - + u8 curr_tx_rate,curr_tx_sgi,hight_rate,lowest_rate; + RTW_INFO("============ RA status check Mac_id:%d ===================\n", mac_id); cmd = 0x40000100 |mac_id; @@ -6663,7 +6509,7 @@ u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval) curr_tx_rate = ra_info1&0x7F; curr_tx_sgi = (ra_info1>>7)&0x01; RTW_INFO("[ ra_info1:0x%08x ] =>cur_tx_rate= %s,cur_sgi:%d, PWRSTS = 0x%02x \n", - ra_info1, + ra_info1, HDATA_RATE(curr_tx_rate), curr_tx_sgi, (ra_info1>>8) & 0x07); @@ -6676,21 +6522,21 @@ u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval) rate_mask1 = rtw_read32(padapter,REG_RSVD7_8812); rate_mask2 = rtw_read32(padapter,REG_RSVD8_8812); hight_rate = ra_info2&0xFF; - lowest_rate = (ra_info2>>8) & 0xFF; + lowest_rate = (ra_info2>>8) & 0xFF; RTW_INFO("[ ra_info1:0x%08x ] =>RSSI=%d, BW_setting=0x%02x, DISRA=0x%02x, VHT_EN=0x%02x\n", ra_info1, ra_info1&0xFF, (ra_info1>>8) & 0xFF, (ra_info1>>16) & 0xFF, (ra_info1>>24) & 0xFF); - + RTW_INFO("[ ra_info2:0x%08x ] =>hight_rate=%s, lowest_rate=%s, SGI=0x%02x, RateID=%d\n", ra_info2, HDATA_RATE(hight_rate), HDATA_RATE(lowest_rate), (ra_info2>>16) & 0xFF, (ra_info2>>24) & 0xFF); - RTW_INFO("rate_mask2=0x%08x, rate_mask1=0x%08x\n", rate_mask2, rate_mask1); + RTW_INFO("rate_mask2=0x%08x, rate_mask1=0x%08x\n", rate_mask2, rate_mask1); } #else //0 RTW_INFO("%s,%d, 8814 need to fix \n", __FUNCTION__,__LINE__); @@ -6705,9 +6551,7 @@ u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval) if (!padapter->registrypriv.wifi_spec) { *(u16*)pval = TX_PAGE_BOUNDARY_8814A; - } - else - { + } else { *(u16*)pval = WMM_NORMAL_TX_PAGE_BOUNDARY_8814A; } break; @@ -6723,7 +6567,7 @@ u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval) *((u16*)(pval)) = pHalData->EfuseUsedBytes; break; case HAL_DEF_EFUSE_USAGE: - *((u32*)(pval)) = (pHalData->EfuseUsedPercentage<<16)|(pHalData->EfuseUsedBytes); + *((u32*)(pval)) = (pHalData->EfuseUsedPercentage<<16)|(pHalData->EfuseUsedBytes); break; case HAL_DEF_RX_DMA_SZ_WOW: *((u32 *)pval) = RX_DMA_BOUNDARY_8814A + 1; @@ -6748,7 +6592,7 @@ s32 c2h_id_filter_ccx_8814a(u8 *buf) s32 ret = _FALSE; if (c2h_evt->id == C2H_CCX_TX_RPT) ret = _TRUE; - + return ret; } @@ -6793,7 +6637,7 @@ void rtl8812a_combo_card_WifiOnlyHwInit(PADAPTER pdapter) // coex parameters //pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x3); rtw_write8(pdapter,0x778,0x3); - + // enable counter statistics //pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); rtw_write8(pdapter,0x76e,0xc); @@ -6819,7 +6663,7 @@ void rtl8812a_combo_card_WifiOnlyHwInit(PADAPTER pdapter) rtw_write8(pdapter,0x7, u1Tmp); } - + } #endif //CONFIG_BT_COEXIST @@ -6858,7 +6702,6 @@ void rtl8814_set_hal_ops(struct hal_ops *pHalFunc) pHalFunc->read_rfreg = &PHY_QueryRFReg8814A; pHalFunc->write_rfreg = &PHY_SetRFReg8814A; - // Efuse related function pHalFunc->EfusePowerSwitch = &rtl8814_EfusePowerSwitch; pHalFunc->ReadEFuse = &rtl8814_ReadEFuse; @@ -6893,5 +6736,3 @@ void rtl8814_set_hal_ops(struct hal_ops *pHalFunc) pHalFunc->fw_dl = &FirmwareDownload8814A; pHalFunc->hal_get_tx_buff_rsvd_page_num = &GetTxBufferRsvdPageNum8814; } - - From d5aa37ed12d05d42bc38b37dc7ba1e7bf7c48dd0 Mon Sep 17 00:00:00 2001 From: Christian B Date: Sat, 16 Dec 2017 14:19:00 +0100 Subject: [PATCH 5/6] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 456776f..bfcc428 100644 --- a/README.md +++ b/README.md @@ -69,8 +69,8 @@ or ``` sudo iw wlan0 set txpower fixed 3000 ``` -Newer versions of NetworkManager switches to random MAC address -Some users would prefer to use a fixed address. Simply add these lines below +Newer versions of NetworkManager switches to random MAC address. Some users would prefer to use a fixed address. +Simply add these lines below ``` [device] wifi.scan-rand-mac-address=no From 645274ec5670f60449132a9453bdef72e3795a3a Mon Sep 17 00:00:00 2001 From: Christian B Date: Sat, 16 Dec 2017 14:20:10 +0100 Subject: [PATCH 6/6] Update dkms.conf * Tag a new release date --- dkms.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dkms.conf b/dkms.conf index acadace..b220ea1 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME="realtek-rtl88xxau" -PACKAGE_VERSION="5.1.5~20171206" +PACKAGE_VERSION="5.1.5~20171216" CLEAN="make clean" BUILT_MODULE_NAME[0]=8812au DEST_MODULE_LOCATION[0]="/updates"