18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com> 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any 58c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above 68c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 98c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 108c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 118c2ecf20Sopenharmony_ci * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 128c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 138c2ecf20Sopenharmony_ci * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 148c2ecf20Sopenharmony_ci * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 158c2ecf20Sopenharmony_ci */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#ifndef _SMD_H_ 188c2ecf20Sopenharmony_ci#define _SMD_H_ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#include "wcn36xx.h" 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* Max shared size is 4k but we take less.*/ 238c2ecf20Sopenharmony_ci#define WCN36XX_NV_FRAGMENT_SIZE 3072 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define WCN36XX_HAL_BUF_SIZE 4096 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#define HAL_MSG_TIMEOUT 10000 288c2ecf20Sopenharmony_ci#define WCN36XX_SMSM_WLAN_TX_ENABLE 0x00000400 298c2ecf20Sopenharmony_ci#define WCN36XX_SMSM_WLAN_TX_RINGS_EMPTY 0x00000200 308c2ecf20Sopenharmony_ci/* The PNO version info be contained in the rsp msg */ 318c2ecf20Sopenharmony_ci#define WCN36XX_FW_MSG_PNO_VERSION_MASK 0x8000 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_cienum wcn36xx_fw_msg_result { 348c2ecf20Sopenharmony_ci WCN36XX_FW_MSG_RESULT_SUCCESS = 0, 358c2ecf20Sopenharmony_ci WCN36XX_FW_MSG_RESULT_SUCCESS_SYNC = 1, 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci WCN36XX_FW_MSG_RESULT_MEM_FAIL = 5, 388c2ecf20Sopenharmony_ci}; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci/******************************/ 418c2ecf20Sopenharmony_ci/* SMD requests and responses */ 428c2ecf20Sopenharmony_ci/******************************/ 438c2ecf20Sopenharmony_cistruct wcn36xx_fw_msg_status_rsp { 448c2ecf20Sopenharmony_ci u32 status; 458c2ecf20Sopenharmony_ci} __packed; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_cistruct wcn36xx_hal_ind_msg { 488c2ecf20Sopenharmony_ci struct list_head list; 498c2ecf20Sopenharmony_ci size_t msg_len; 508c2ecf20Sopenharmony_ci u8 msg[]; 518c2ecf20Sopenharmony_ci}; 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_cistruct wcn36xx; 548c2ecf20Sopenharmony_cistruct rpmsg_device; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ciint wcn36xx_smd_open(struct wcn36xx *wcn); 578c2ecf20Sopenharmony_civoid wcn36xx_smd_close(struct wcn36xx *wcn); 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ciint wcn36xx_smd_load_nv(struct wcn36xx *wcn); 608c2ecf20Sopenharmony_ciint wcn36xx_smd_start(struct wcn36xx *wcn); 618c2ecf20Sopenharmony_ciint wcn36xx_smd_stop(struct wcn36xx *wcn); 628c2ecf20Sopenharmony_ciint wcn36xx_smd_start_scan(struct wcn36xx *wcn, u8 scan_channel); 638c2ecf20Sopenharmony_ciint wcn36xx_smd_end_scan(struct wcn36xx *wcn, u8 scan_channel); 648c2ecf20Sopenharmony_ciint wcn36xx_smd_finish_scan(struct wcn36xx *wcn, enum wcn36xx_hal_sys_mode mode, 658c2ecf20Sopenharmony_ci struct ieee80211_vif *vif); 668c2ecf20Sopenharmony_ciint wcn36xx_smd_init_scan(struct wcn36xx *wcn, enum wcn36xx_hal_sys_mode mode, 678c2ecf20Sopenharmony_ci struct ieee80211_vif *vif); 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ciint wcn36xx_smd_update_scan_params(struct wcn36xx *wcn, u8 *channels, size_t channel_count); 708c2ecf20Sopenharmony_ciint wcn36xx_smd_start_hw_scan(struct wcn36xx *wcn, struct ieee80211_vif *vif, 718c2ecf20Sopenharmony_ci struct cfg80211_scan_request *req); 728c2ecf20Sopenharmony_ciint wcn36xx_smd_stop_hw_scan(struct wcn36xx *wcn); 738c2ecf20Sopenharmony_ciint wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, struct ieee80211_vif *vif); 748c2ecf20Sopenharmony_ciint wcn36xx_smd_delete_sta_self(struct wcn36xx *wcn, u8 *addr); 758c2ecf20Sopenharmony_ciint wcn36xx_smd_delete_sta(struct wcn36xx *wcn, u8 sta_index); 768c2ecf20Sopenharmony_ciint wcn36xx_smd_join(struct wcn36xx *wcn, const u8 *bssid, u8 *vif, u8 ch); 778c2ecf20Sopenharmony_ciint wcn36xx_smd_set_link_st(struct wcn36xx *wcn, const u8 *bssid, 788c2ecf20Sopenharmony_ci const u8 *sta_mac, 798c2ecf20Sopenharmony_ci enum wcn36xx_hal_link_state state); 808c2ecf20Sopenharmony_ciint wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, 818c2ecf20Sopenharmony_ci struct ieee80211_sta *sta, const u8 *bssid, 828c2ecf20Sopenharmony_ci bool update); 838c2ecf20Sopenharmony_ciint wcn36xx_smd_delete_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif); 848c2ecf20Sopenharmony_ciint wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif, 858c2ecf20Sopenharmony_ci struct ieee80211_sta *sta); 868c2ecf20Sopenharmony_ciint wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif, 878c2ecf20Sopenharmony_ci struct sk_buff *skb_beacon, u16 tim_off, 888c2ecf20Sopenharmony_ci u16 p2p_off); 898c2ecf20Sopenharmony_ciint wcn36xx_smd_switch_channel(struct wcn36xx *wcn, 908c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, int ch); 918c2ecf20Sopenharmony_ciint wcn36xx_smd_process_ptt_msg(struct wcn36xx *wcn, 928c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 938c2ecf20Sopenharmony_ci void *ptt_msg, size_t len, 948c2ecf20Sopenharmony_ci void **ptt_rsp_msg); 958c2ecf20Sopenharmony_ciint wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn, 968c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 978c2ecf20Sopenharmony_ci struct sk_buff *skb); 988c2ecf20Sopenharmony_ciint wcn36xx_smd_set_stakey(struct wcn36xx *wcn, 998c2ecf20Sopenharmony_ci enum ani_ed_type enc_type, 1008c2ecf20Sopenharmony_ci u8 keyidx, 1018c2ecf20Sopenharmony_ci u8 keylen, 1028c2ecf20Sopenharmony_ci u8 *key, 1038c2ecf20Sopenharmony_ci u8 sta_index); 1048c2ecf20Sopenharmony_ciint wcn36xx_smd_set_bsskey(struct wcn36xx *wcn, 1058c2ecf20Sopenharmony_ci enum ani_ed_type enc_type, 1068c2ecf20Sopenharmony_ci u8 bssidx, 1078c2ecf20Sopenharmony_ci u8 keyidx, 1088c2ecf20Sopenharmony_ci u8 keylen, 1098c2ecf20Sopenharmony_ci u8 *key); 1108c2ecf20Sopenharmony_ciint wcn36xx_smd_remove_stakey(struct wcn36xx *wcn, 1118c2ecf20Sopenharmony_ci enum ani_ed_type enc_type, 1128c2ecf20Sopenharmony_ci u8 keyidx, 1138c2ecf20Sopenharmony_ci u8 sta_index); 1148c2ecf20Sopenharmony_ciint wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn, 1158c2ecf20Sopenharmony_ci enum ani_ed_type enc_type, 1168c2ecf20Sopenharmony_ci u8 bssidx, 1178c2ecf20Sopenharmony_ci u8 keyidx); 1188c2ecf20Sopenharmony_ciint wcn36xx_smd_enter_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif); 1198c2ecf20Sopenharmony_ciint wcn36xx_smd_exit_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif); 1208c2ecf20Sopenharmony_ciint wcn36xx_smd_set_power_params(struct wcn36xx *wcn, bool ignore_dtim); 1218c2ecf20Sopenharmony_ciint wcn36xx_smd_keep_alive_req(struct wcn36xx *wcn, 1228c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 1238c2ecf20Sopenharmony_ci int packet_type); 1248c2ecf20Sopenharmony_ciint wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2, 1258c2ecf20Sopenharmony_ci u32 arg3, u32 arg4, u32 arg5); 1268c2ecf20Sopenharmony_ciint wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn); 1278c2ecf20Sopenharmony_civoid set_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap); 1288c2ecf20Sopenharmony_ciint get_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap); 1298c2ecf20Sopenharmony_civoid clear_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap); 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ciint wcn36xx_smd_add_ba_session(struct wcn36xx *wcn, 1328c2ecf20Sopenharmony_ci struct ieee80211_sta *sta, 1338c2ecf20Sopenharmony_ci u16 tid, 1348c2ecf20Sopenharmony_ci u16 *ssn, 1358c2ecf20Sopenharmony_ci u8 direction, 1368c2ecf20Sopenharmony_ci u8 sta_index); 1378c2ecf20Sopenharmony_ciint wcn36xx_smd_add_ba(struct wcn36xx *wcn, u8 session_id); 1388c2ecf20Sopenharmony_ciint wcn36xx_smd_del_ba(struct wcn36xx *wcn, u16 tid, u8 sta_index); 1398c2ecf20Sopenharmony_ciint wcn36xx_smd_trigger_ba(struct wcn36xx *wcn, u8 sta_index, u16 tid, u8 session_id); 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ciint wcn36xx_smd_update_cfg(struct wcn36xx *wcn, u32 cfg_id, u32 value); 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ciint wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, 1448c2ecf20Sopenharmony_ci void *buf, int len, void *priv, u32 addr); 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ciint wcn36xx_smd_set_mc_list(struct wcn36xx *wcn, 1478c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 1488c2ecf20Sopenharmony_ci struct wcn36xx_hal_rcv_flt_mc_addr_list_type *fp); 1498c2ecf20Sopenharmony_ci#endif /* _SMD_H_ */ 150