Commit 3c67b8f9 authored by Larry Finger's avatar Larry Finger Committed by John W. Linville

rtlwifi: Modify cam.{c,h} and efuse.{c,h} for new drivers

Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 9afa2e44
...@@ -11,10 +11,6 @@ ...@@ -11,10 +11,6 @@
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details. * more details.
* *
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* The full GNU General Public License is included in this distribution in the * The full GNU General Public License is included in this distribution in the
* file called LICENSE. * file called LICENSE.
* *
...@@ -26,10 +22,9 @@ ...@@ -26,10 +22,9 @@
* Larry Finger <Larry.Finger@lwfinger.net> * Larry Finger <Larry.Finger@lwfinger.net>
* *
*****************************************************************************/ *****************************************************************************/
#include <linux/export.h>
#include "wifi.h" #include "wifi.h"
#include "cam.h" #include "cam.h"
#include <linux/export.h>
void rtl_cam_reset_sec_info(struct ieee80211_hw *hw) void rtl_cam_reset_sec_info(struct ieee80211_hw *hw)
{ {
...@@ -52,8 +47,8 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no, ...@@ -52,8 +47,8 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
u32 target_content = 0; u32 target_content = 0;
u8 entry_i; u8 entry_i;
RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "key_cont_128: %6phC\n", RT_PRINT_DATA(rtlpriv, COMP_SEC, DBG_DMESG, "Key content :",
key_cont_128); key_cont_128, 16);
for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) { for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
target_command = entry_i + CAM_CONTENT_COUNT * entry_no; target_command = entry_i + CAM_CONTENT_COUNT * entry_no;
...@@ -68,11 +63,13 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no, ...@@ -68,11 +63,13 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
target_command); target_command);
RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE %x: %x\n", RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
"WRITE %x: %x\n",
rtlpriv->cfg->maps[WCAMI], target_content); rtlpriv->cfg->maps[WCAMI], target_content);
RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
"The Key ID is %d\n", entry_no); "The Key ID is %d\n", entry_no);
RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE %x: %x\n", RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
"WRITE %x: %x\n",
rtlpriv->cfg->maps[RWCAM], target_command); rtlpriv->cfg->maps[RWCAM], target_command);
} else if (entry_i == 1) { } else if (entry_i == 1) {
...@@ -87,10 +84,10 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no, ...@@ -87,10 +84,10 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
target_command); target_command);
RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE A4: %x\n", RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
target_content); "WRITE A4: %x\n", target_content);
RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE A0: %x\n", RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
target_command); "WRITE A0: %x\n", target_command);
} else { } else {
...@@ -107,15 +104,15 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no, ...@@ -107,15 +104,15 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
target_command); target_command);
udelay(100); udelay(100);
RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE A4: %x\n", RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
target_content); "WRITE A4: %x\n", target_content);
RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE A0: %x\n", RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
target_command); "WRITE A0: %x\n", target_command);
} }
} }
RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "after set key, usconfig:%x\n", RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
us_config); "after set key, usconfig:%x\n", us_config);
} }
u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr,
...@@ -125,27 +122,26 @@ u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, ...@@ -125,27 +122,26 @@ u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr,
u32 us_config; u32 us_config;
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
"EntryNo:%x, ulKeyId=%x, ulEncAlg=%x, ulUseDK=%x MacAddr %pM\n", "EntryNo:%x, ulKeyId=%x, ulEncAlg=%x, ulUseDK=%x MacAddr %pM\n",
ul_entry_idx, ul_key_id, ul_enc_alg, ul_entry_idx, ul_key_id, ul_enc_alg,
ul_default_key, mac_addr); ul_default_key, mac_addr);
if (ul_key_id == TOTAL_CAM_ENTRY) { if (ul_key_id == TOTAL_CAM_ENTRY) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
"<=== ulKeyId exceed!\n"); "ulKeyId exceed!\n");
return 0; return 0;
} }
if (ul_default_key == 1) { if (ul_default_key == 1)
us_config = CFG_VALID | ((u16) (ul_enc_alg) << 2); us_config = CFG_VALID | ((u16) (ul_enc_alg) << 2);
} else { else
us_config = CFG_VALID | ((ul_enc_alg) << 2) | ul_key_id; us_config = CFG_VALID | ((ul_enc_alg) << 2) | ul_key_id;
}
rtl_cam_program_entry(hw, ul_entry_idx, mac_addr, rtl_cam_program_entry(hw, ul_entry_idx, mac_addr,
key_content, us_config); (u8 *)key_content, us_config);
RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "<===\n"); RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "end\n");
return 1; return 1;
...@@ -289,7 +285,8 @@ u8 rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr) ...@@ -289,7 +285,8 @@ u8 rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr)
u8 i, *addr; u8 i, *addr;
if (NULL == sta_addr) { if (NULL == sta_addr) {
RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG, "sta_addr is NULL\n"); RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG,
"sta_addr is NULL.\n");
return TOTAL_CAM_ENTRY; return TOTAL_CAM_ENTRY;
} }
/* Does STA already exist? */ /* Does STA already exist? */
...@@ -322,7 +319,9 @@ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr) ...@@ -322,7 +319,9 @@ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr)
u8 i, *addr; u8 i, *addr;
if (NULL == sta_addr) { if (NULL == sta_addr) {
RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG, "sta_addr is NULL\n"); RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG,
"sta_addr is NULL.\n");
return;
} }
if (is_zero_ether_addr(sta_addr)) { if (is_zero_ether_addr(sta_addr)) {
...@@ -339,8 +338,8 @@ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr) ...@@ -339,8 +338,8 @@ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr)
/* Remove from HW Security CAM */ /* Remove from HW Security CAM */
eth_zero_addr(rtlpriv->sec.hwsec_cam_sta_addr[i]); eth_zero_addr(rtlpriv->sec.hwsec_cam_sta_addr[i]);
rtlpriv->sec.hwsec_cam_bitmap &= ~(BIT(0) << i); rtlpriv->sec.hwsec_cam_bitmap &= ~(BIT(0) << i);
RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
"del CAM entry %d\n", i); "&&&&&&&&&del entry %d\n", i);
} }
} }
return; return;
......
...@@ -11,10 +11,6 @@ ...@@ -11,10 +11,6 @@
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details. * more details.
* *
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* The full GNU General Public License is included in this distribution in the * The full GNU General Public License is included in this distribution in the
* file called LICENSE. * file called LICENSE.
* *
...@@ -36,15 +32,15 @@ ...@@ -36,15 +32,15 @@
#define CFG_VALID BIT(15) #define CFG_VALID BIT(15)
#define PAIRWISE_KEYIDX 0 #define PAIRWISE_KEYIDX 0
#define CAM_PAIRWISE_KEY_POSITION 4 #define CAM_PAIRWISE_KEY_POSITION 4
#define CAM_CONFIG_USEDK 1 #define CAM_CONFIG_USEDK 1
#define CAM_CONFIG_NO_USEDK 0 #define CAM_CONFIG_NO_USEDK 0
void rtl_cam_reset_all_entry(struct ieee80211_hw *hw); void rtl_cam_reset_all_entry(struct ieee80211_hw *hw);
u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr,
u32 ul_key_id, u32 ul_entry_idx, u32 ul_enc_alg, u32 ul_key_id, u32 ul_entry_idx, u32 ul_enc_alg,
u32 ul_default_key, u8 *key_content); u32 ul_default_key, u8 *key_content);
int rtl_cam_delete_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, int rtl_cam_delete_one_entry(struct ieee80211_hw *hw, u8 *mac_addr,
u32 ul_key_id); u32 ul_key_id);
void rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index); void rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index);
......
This diff is collapsed.
...@@ -11,10 +11,6 @@ ...@@ -11,10 +11,6 @@
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details. * more details.
* *
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* The full GNU General Public License is included in this distribution in the * The full GNU General Public License is included in this distribution in the
* file called LICENSE. * file called LICENSE.
* *
...@@ -32,7 +28,6 @@ ...@@ -32,7 +28,6 @@
#define EFUSE_IC_ID_OFFSET 506 #define EFUSE_IC_ID_OFFSET 506
#define EFUSE_MAP_LEN 128
#define EFUSE_MAX_WORD_UNIT 4 #define EFUSE_MAX_WORD_UNIT 4
#define EFUSE_INIT_MAP 0 #define EFUSE_INIT_MAP 0
...@@ -107,12 +102,14 @@ struct efuse_priv { ...@@ -107,12 +102,14 @@ struct efuse_priv {
void read_efuse_byte(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf); void read_efuse_byte(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf);
void efuse_initialize(struct ieee80211_hw *hw); void efuse_initialize(struct ieee80211_hw *hw);
u8 efuse_read_1byte(struct ieee80211_hw *hw, u16 address); u8 efuse_read_1byte(struct ieee80211_hw *hw, u16 address);
int efuse_one_byte_read(struct ieee80211_hw *hw, u16 addr, u8 *data);
void efuse_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value); void efuse_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value);
void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf); void read_efuse(struct ieee80211_hw *hw, u16 _offset,
void efuse_shadow_read(struct ieee80211_hw *hw, u8 type, u16 offset, u16 _size_byte, u8 *pbuf);
u32 *value); void efuse_shadow_read(struct ieee80211_hw *hw, u8 type,
void efuse_shadow_write(struct ieee80211_hw *hw, u8 type, u16 offset, u16 offset, u32 *value);
u32 value); void efuse_shadow_write(struct ieee80211_hw *hw, u8 type,
u16 offset, u32 value);
bool efuse_shadow_update(struct ieee80211_hw *hw); bool efuse_shadow_update(struct ieee80211_hw *hw);
bool efuse_shadow_update_chk(struct ieee80211_hw *hw); bool efuse_shadow_update_chk(struct ieee80211_hw *hw);
void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw); void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment