M7350/wlan/host/wmi/wmi_parser.c
2024-09-09 08:52:07 +00:00

258 lines
9.5 KiB
C

//------------------------------------------------------------------------------
// ISC License (ISC)
//
// Copyright (c) 2004-2010, The Linux Foundation
// All rights reserved.
// Software was previously licensed under ISC license by Qualcomm Atheros, Inc.
//
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
//
//------------------------------------------------------------------------------
//==============================================================================
// This module implements the hardware independent layer of the
// Wireless Module Interface (WMI) protocol.
//
// Author(s): ="Atheros"
//==============================================================================
#include <a_config.h>
#include <athdefs.h>
#include <a_types.h>
#include <a_osapi.h>
//#include "ntddk.h"
#include "wmi.h"
#include "wmi_parser.h"
#define TABLE_ENTRY(id) {id, #id}
typedef struct
{
WMI_COMMAND_ID cmdId;
A_INT8* cmdIdStr;
} WMI_CMD_TABLE;
WMI_CMD_TABLE wmiCmdTbl[] =
{
TABLE_ENTRY(WMI_CONNECT_CMDID ),
TABLE_ENTRY(WMI_RECONNECT_CMDID),
TABLE_ENTRY(WMI_DISCONNECT_CMDID),
TABLE_ENTRY(WMI_SYNCHRONIZE_CMDID),
TABLE_ENTRY(WMI_CREATE_PSTREAM_CMDID),
TABLE_ENTRY(WMI_DELETE_PSTREAM_CMDID),
TABLE_ENTRY(WMI_START_SCAN_CMDID),
TABLE_ENTRY(WMI_SET_SCAN_PARAMS_CMDID),
TABLE_ENTRY(WMI_SET_BSS_FILTER_CMDID),
TABLE_ENTRY(WMI_SET_PROBED_SSID_CMDID), /* 10 */
TABLE_ENTRY(WMI_SET_LISTEN_INT_CMDID),
TABLE_ENTRY(WMI_SET_BMISS_TIME_CMDID),
TABLE_ENTRY(WMI_SET_DISC_TIMEOUT_CMDID),
TABLE_ENTRY(WMI_GET_CHANNEL_LIST_CMDID),
TABLE_ENTRY(WMI_SET_BEACON_INT_CMDID),
TABLE_ENTRY(WMI_GET_STATISTICS_CMDID),
TABLE_ENTRY(WMI_SET_CHANNEL_PARAMS_CMDID),
TABLE_ENTRY(WMI_SET_POWER_MODE_CMDID),
TABLE_ENTRY(WMI_SET_IBSS_PM_CAPS_CMDID),
TABLE_ENTRY(WMI_SET_POWER_PARAMS_CMDID), /* 20 */
TABLE_ENTRY(WMI_SET_POWERSAVE_TIMERS_POLICY_CMDID),
TABLE_ENTRY(WMI_ADD_CIPHER_KEY_CMDID),
TABLE_ENTRY(WMI_DELETE_CIPHER_KEY_CMDID),
TABLE_ENTRY(WMI_ADD_KRK_CMDID),
TABLE_ENTRY(WMI_DELETE_KRK_CMDID),
TABLE_ENTRY(WMI_SET_PMKID_CMDID),
TABLE_ENTRY(WMI_SET_TX_PWR_CMDID),
TABLE_ENTRY(WMI_GET_TX_PWR_CMDID),
TABLE_ENTRY(WMI_SET_ASSOC_INFO_CMDID),
TABLE_ENTRY(WMI_ADD_BAD_AP_CMDID), /* 30 */
TABLE_ENTRY(WMI_DELETE_BAD_AP_CMDID),
TABLE_ENTRY(WMI_SET_TKIP_COUNTERMEASURES_CMDID),
TABLE_ENTRY(WMI_RSSI_THRESHOLD_PARAMS_CMDID),
TABLE_ENTRY(WMI_TARGET_ERROR_REPORT_BITMASK_CMDID),
TABLE_ENTRY(WMI_SET_ACCESS_PARAMS_CMDID),
TABLE_ENTRY(WMI_SET_RETRY_LIMITS_CMDID),
//TABLE_ENTRY(WMI_SET_OPT_MODE_CMDID),
//TABLE_ENTRY(WMI_OPT_TX_FRAME_CMDID),
TABLE_ENTRY(WMI_SET_VOICE_PKT_SIZE_CMDID),
TABLE_ENTRY(WMI_SET_MAX_SP_LEN_CMDID), /* 40 */
TABLE_ENTRY(WMI_SET_ROAM_CTRL_CMDID),
TABLE_ENTRY(WMI_GET_ROAM_TBL_CMDID),
TABLE_ENTRY(WMI_GET_ROAM_DATA_CMDID),
TABLE_ENTRY(WMI_ENABLE_RM_CMDID),
TABLE_ENTRY(WMI_SET_MAX_OFFHOME_DURATION_CMDID),
TABLE_ENTRY(WMI_EXTENSION_CMDID), /* Non-wireless extensions */
TABLE_ENTRY(WMI_SNR_THRESHOLD_PARAMS_CMDID),
TABLE_ENTRY(WMI_LQ_THRESHOLD_PARAMS_CMDID),
TABLE_ENTRY(WMI_SET_LPREAMBLE_CMDID),
TABLE_ENTRY(WMI_SET_RTS_CMDID), /* 50 */
TABLE_ENTRY(WMI_CLR_RSSI_SNR_CMDID),
TABLE_ENTRY(WMI_SET_FIXRATES_CMDID),
TABLE_ENTRY(WMI_GET_FIXRATES_CMDID),
TABLE_ENTRY(WMI_SET_AUTH_MODE_CMDID),
TABLE_ENTRY(WMI_SET_REASSOC_MODE_CMDID),
TABLE_ENTRY(WMI_SET_WMM_CMDID),
TABLE_ENTRY(WMI_SET_WMM_TXOP_CMDID),
TABLE_ENTRY(WMI_TEST_CMDID),
/* COEX AR6002 only*/
TABLE_ENTRY(WMI_SET_BT_STATUS_CMDID),
TABLE_ENTRY(WMI_SET_BT_PARAMS_CMDID), /* 60 */
TABLE_ENTRY(WMI_SET_KEEPALIVE_CMDID),
TABLE_ENTRY(WMI_GET_KEEPALIVE_CMDID),
TABLE_ENTRY(WMI_SET_APPIE_CMDID),
TABLE_ENTRY(WMI_GET_APPIE_CMDID),
TABLE_ENTRY(WMI_SET_WSC_STATUS_CMDID),
/* Wake on Wireless */
TABLE_ENTRY(WMI_SET_HOST_SLEEP_MODE_CMDID),
TABLE_ENTRY(WMI_SET_WOW_MODE_CMDID),
TABLE_ENTRY(WMI_GET_WOW_LIST_CMDID),
TABLE_ENTRY(WMI_ADD_WOW_PATTERN_CMDID),
TABLE_ENTRY(WMI_DEL_WOW_PATTERN_CMDID), /* 70 */
TABLE_ENTRY(WMI_SET_FRAMERATES_CMDID),
TABLE_ENTRY(WMI_SET_AP_PS_CMDID),
TABLE_ENTRY(WMI_SET_QOS_SUPP_CMDID),
/* WMI_THIN_RESERVED_... mark the start and end
* values for WMI_THIN_RESERVED command IDs. These
* command IDs can be found in wmi_thin.h */
TABLE_ENTRY(WMI_THIN_RESERVED_START),
TABLE_ENTRY(WMI_THIN_RESERVED_END),
/*
* Developer commands starts at 0xF000
*/
TABLE_ENTRY(WMI_SET_BITRATE_CMDID),
TABLE_ENTRY(WMI_GET_BITRATE_CMDID),
TABLE_ENTRY(WMI_SET_WHALPARAM_CMDID),
/*Should add the new command to the tail for compatible with
* etna.
*/
TABLE_ENTRY(WMI_SET_MAC_ADDRESS_CMDID),
TABLE_ENTRY(WMI_SET_AKMP_PARAMS_CMDID),
TABLE_ENTRY(WMI_SET_PMKID_LIST_CMDID),
TABLE_ENTRY(WMI_GET_PMKID_LIST_CMDID),
TABLE_ENTRY(WMI_ABORT_SCAN_CMDID),
TABLE_ENTRY(WMI_SET_TARGET_EVENT_REPORT_CMDID),
// Unused
TABLE_ENTRY(WMI_UNUSED1),
TABLE_ENTRY(WMI_UNUSED2),
/*
* AP mode commands
*/
TABLE_ENTRY(WMI_AP_HIDDEN_SSID_CMDID), /* F00B */
TABLE_ENTRY(WMI_AP_SET_NUM_STA_CMDID),
TABLE_ENTRY(WMI_AP_ACL_POLICY_CMDID),
TABLE_ENTRY(WMI_AP_ACL_MAC_LIST_CMDID),
TABLE_ENTRY(WMI_AP_CONFIG_COMMIT_CMDID),
TABLE_ENTRY(WMI_AP_SET_MLME_CMDID), /* F010 */
TABLE_ENTRY(WMI_AP_SET_PVB_CMDID),
TABLE_ENTRY(WMI_AP_CONN_INACT_CMDID),
TABLE_ENTRY(WMI_AP_PROT_SCAN_TIME_CMDID),
TABLE_ENTRY(WMI_AP_SET_COUNTRY_CMDID),
TABLE_ENTRY(WMI_AP_SET_DTIM_CMDID),
TABLE_ENTRY(WMI_AP_MODE_STAT_CMDID),
TABLE_ENTRY(WMI_SET_IP_CMDID), /* F017 */
TABLE_ENTRY(WMI_SET_PARAMS_CMDID),
TABLE_ENTRY(WMI_SET_MCAST_FILTER_CMDID),
TABLE_ENTRY(WMI_DEL_MCAST_FILTER_CMDID),
TABLE_ENTRY(WMI_ALLOW_AGGR_CMDID), /* F01B */
TABLE_ENTRY(WMI_ADDBA_REQ_CMDID),
TABLE_ENTRY(WMI_DELBA_REQ_CMDID),
TABLE_ENTRY(WMI_SET_HT_CAP_CMDID),
TABLE_ENTRY(WMI_SET_HT_OP_CMDID),
TABLE_ENTRY(WMI_SET_TX_SELECT_RATES_CMDID),
TABLE_ENTRY(WMI_SET_TX_SGI_PARAM_CMDID),
TABLE_ENTRY(WMI_SET_RATE_POLICY_CMDID),
TABLE_ENTRY(WMI_HCI_CMD_CMDID), /* F023 */
TABLE_ENTRY(WMI_RX_FRAME_FORMAT_CMDID),
TABLE_ENTRY(WMI_SET_THIN_MODE_CMDID),
TABLE_ENTRY(WMI_SET_BT_WLAN_CONN_PRECEDENCE_CMDID),
TABLE_ENTRY(WMI_AP_SET_11BG_RATESET_CMDID), /* F027 */
TABLE_ENTRY(WMI_SET_PMK_CMDID),
TABLE_ENTRY(WMI_MCAST_FILTER_CMDID),
/* COEX CMDID AR6003*/
TABLE_ENTRY( WMI_SET_BTCOEX_FE_ANT_CMDID), /* F02A */
TABLE_ENTRY( WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMDID),
TABLE_ENTRY( WMI_SET_BTCOEX_SCO_CONFIG_CMDID),
TABLE_ENTRY( WMI_SET_BTCOEX_A2DP_CONFIG_CMDID),
TABLE_ENTRY( WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMDID),
TABLE_ENTRY( WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMDID),
TABLE_ENTRY(WMI_SET_BTCOEX_DEBUG_CMDID),
TABLE_ENTRY(WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID),
TABLE_ENTRY(WMI_GET_BTCOEX_STATS_CMDID),
TABLE_ENTRY(WMI_GET_BTCOEX_CONFIG_CMDID),
TABLE_ENTRY(WMI_SET_DFS_ENABLE_CMDID), /* F034 */
TABLE_ENTRY(WMI_SET_DFS_MINRSSITHRESH_CMDID),
TABLE_ENTRY(WMI_SET_DFS_MAXPULSEDUR_CMDID),
TABLE_ENTRY(WMI_DFS_RADAR_DETECTED_CMDID),
/* P2P CMDS */
TABLE_ENTRY(WMI_P2P_SET_CONFIG_CMDID), /* F038 */
TABLE_ENTRY(WMI_WPS_SET_CONFIG_CMDID),
TABLE_ENTRY(WMI_SET_REQ_DEV_ATTR_CMDID),
TABLE_ENTRY(WMI_P2P_FIND_CMDID),
TABLE_ENTRY(WMI_P2P_STOP_FIND_CMDID),
TABLE_ENTRY(WMI_P2P_GO_NEG_START_CMDID),
TABLE_ENTRY(WMI_P2P_LISTEN_CMDID),
TABLE_ENTRY(WMI_CONFIG_TX_MAC_RULES_CMDID), /* F040 */
TABLE_ENTRY(WMI_SET_PROMISCUOUS_MODE_CMDID),
TABLE_ENTRY(WMI_RX_FRAME_FILTER_CMDID),
TABLE_ENTRY(WMI_SET_CHANNEL_CMDID),
/* WAC commands */
TABLE_ENTRY(WMI_ENABLE_WAC_CMDID),
TABLE_ENTRY(WMI_WAC_SCAN_REPLY_CMDID),
TABLE_ENTRY(WMI_WAC_CTRL_REQ_CMDID),
TABLE_ENTRY(WMI_SET_DIV_PARAMS_CMDID),
TABLE_ENTRY(WMI_GET_PMK_CMDID),
TABLE_ENTRY(WMI_SET_PASSPHRASE_CMDID),
TABLE_ENTRY(WMI_SEND_ASSOC_RES_CMDID),
TABLE_ENTRY(WMI_SET_ASSOC_REQ_RELAY_CMDID),
TABLE_ENTRY(WMI_GET_RFKILL_MODE_CMDID),
//TABLE_ENTRY(WMI_AP_JOIN_BSS_CMDID),
};
//#define PRINT_CMD_ID(id) KdPrintEx((0x50, 0, "Send WMI Cmd(%d: %s)\n"), id, #id)
void wmi_cmd_decode(WMI_COMMAND_ID cmdId)
{
A_UINT32 i = 0;
for (i=0; i<(sizeof(wmiCmdTbl)/sizeof(WMI_CMD_TABLE)); i++)
{
if (cmdId == wmiCmdTbl[i].cmdId )
{
#ifdef WIN_NWF
KdPrintEx((0x50, 0, "WMI Cmd(index=%d 0x%04x: %s)\n", i, wmiCmdTbl[i].cmdId, wmiCmdTbl[i].cmdIdStr));
#endif
return;
}
}
#ifdef WIN_NWF
KdPrintEx((0x50, 0, "Unkown WMI CMD(0x%04x)\n", cmdId));
#endif
}