qcacmn: Add tlv implementation of common unified API

Add common unified API and tlv/non-tlv callback wrappers.
Add tlv implementation of common MCL/WIN API.

CRs-Fixed: 978603
Change-Id: I7e70b48ef5e1df0c0f81c639579e6eb1a6685dc3
diff --git a/wmi_unified_param.h b/wmi_unified_param.h
new file mode 100644
index 0000000..4f5bb92
--- /dev/null
+++ b/wmi_unified_param.h
@@ -0,0 +1,532 @@
+/*
+ * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ *
+ * Previously licensed under the 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 file was originally distributed by Qualcomm Atheros, Inc.
+ * under proprietary terms before Copyright ownership was assigned
+ * to the Linux Foundation.
+ */
+
+/*
+ * This file contains the API definitions for the Unified Wireless Module
+ * Interface (WMI).
+ */
+
+#ifndef _WMI_UNIFIED_PARAM_H_
+#define _WMI_UNIFIED_PARAM_H_
+#include "wmi_unified.h"
+#define IEEE80211_ADDR_LEN  6  /* size of 802.11 address */
+#define MAX_UTF_EVENT_LENGTH    2048
+#define WMI_MAC_MAX_SSID_LENGTH              32
+#define WMI_SCAN_MAX_NUM_SSID                0x0A
+#define mgmt_tx_dl_frm_len 64
+#define WMI_SMPS_MASK_LOWER_16BITS 0xFF
+#define WMI_SMPS_MASK_UPPER_3BITS 0x7
+#define WMI_SMPS_PARAM_VALUE_S 29
+#define MAX_WMI_UTF_LEN         252
+/**
+ * struct vdev_create_params - vdev create cmd parameter
+ * @if_id: interface id
+ * @type: interface type
+ * @subtype: interface subtype
+ */
+struct vdev_create_params {
+	uint8_t if_id;
+	uint32_t type;
+	uint32_t subtype;
+};
+
+/**
+ * struct vdev_delete_params - vdev delete cmd parameter
+ * @if_id: interface id
+ */
+struct vdev_delete_params {
+	uint8_t if_id;
+};
+
+/**
+ * struct vdev_start_params - vdev start cmd parameter
+ * @beacon_intval: beacon intval
+ * @dtim_period: dtim period
+ * @max_txpow: max tx power
+ * @phy_ch_width chan_width: channel width
+ * @is_dfs: flag to check if dfs enabled
+ * @vdev_id: vdev id
+ * @chan: channel no
+ * @oper_mode: operating mode
+ * @length: length
+ * @ssId[32]: ssid
+ * @hidden_ssid: hidden ssid
+ * @pmf_enabled: is pmf enabled
+ * @vht_capable: is vht capable
+ * @ch_center_freq_seg0: center freq seq 0
+ * @ch_center_freq_seg1: center freq seq 1
+ * @ht_capable: is ht capable
+ * @dfs_pri_multiplier: DFS multiplier
+ * @dot11_mode: dot11 mode
+ * @is_half_rate: Indicates half rate channel
+ * @is_quarter_rate: Indicates quarter rate channel
+ * @preferred_tx_streams: preferred tx streams
+ * @preferred_rx_streams: preferred rx streams
+ */
+struct vdev_start_params {
+	uint32_t beacon_intval;
+	uint32_t dtim_period;
+	int32_t max_txpow;
+	bool is_dfs;
+	uint8_t vdev_id;
+	uint8_t chan;
+	uint8_t oper_mode;
+	uint8_t length;
+	uint8_t ssId[32];
+	uint8_t hidden_ssid;
+	uint8_t pmf_enabled;
+	uint8_t vht_capable;
+	uint8_t ch_center_freq_seg0;
+	uint8_t ch_center_freq_seg1;
+	uint8_t ht_capable;
+	int32_t dfs_pri_multiplier;
+	uint8_t dot11_mode;
+	bool is_half_rate;
+	bool is_quarter_rate;
+	uint32_t preferred_tx_streams;
+	uint32_t preferred_rx_streams;
+};
+
+/**
+ * struct vdev_stop_params - vdev stop cmd parameter
+ * @vdev_id: vdev id
+ */
+struct vdev_stop_params {
+	uint8_t vdev_id;
+};
+
+/**
+ * struct vdev_up_params - vdev up cmd parameter
+ * @vdev_id: vdev id
+ * @assoc_id: association id
+ */
+struct vdev_up_params {
+	uint8_t vdev_id;
+	uint16_t assoc_id;
+};
+
+/**
+ * struct vdev_down_params - vdev down cmd parameter
+ * @vdev_id: vdev id
+ */
+struct vdev_down_params {
+	uint8_t vdev_id;
+};
+
+/**
+ * struct vdev_set_params - vdev set cmd parameter
+ * @if_id: vdev id
+ * @param_id: parameter id
+ * @param_value: parameter value
+ */
+struct vdev_set_params {
+	uint32_t if_id;
+	uint32_t param_id;
+	uint32_t param_value;
+};
+
+/**
+ * struct peer_delete_params - peer delete cmd parameter
+ * @vdev_id: vdev id
+ */
+struct peer_delete_params {
+	uint8_t vdev_id;
+};
+
+/**
+ * struct peer_flush_params - peer flush cmd parameter
+ * @peer_tid_bitmap: peer tid bitmap
+ * @vdev_id: vdev id
+ */
+struct peer_flush_params {
+	uint32_t peer_tid_bitmap;
+	uint8_t vdev_id;
+};
+
+/**
+ * struct peer_set_params - peer set cmd parameter
+ * @param_id: parameter id
+ * @param_value: parameter value
+ * @vdev_id: vdev id
+ */
+struct peer_set_params {
+	uint32_t param_id;
+	uint32_t param_value;
+	uint32_t vdev_id;
+};
+
+/**
+ * struct peer_create_params - peer create cmd parameter
+ * @peer_addr: peer mac addr
+ * @peer_type: peer type
+ * @vdev_id: vdev id
+ */
+struct peer_create_params {
+	const uint8_t *peer_addr;
+	uint32_t peer_type;
+	uint32_t vdev_id;
+};
+
+/**
+ * struct peer_remove_params - peer remove cmd parameter
+ * @bssid: bss id
+ * @vdev_id: vdev id
+ * @roam_synch_in_progress: flag to indicate if roaming is in progress
+ */
+struct peer_remove_params {
+	uint8_t *bssid;
+	uint8_t vdev_id;
+	bool roam_synch_in_progress;
+};
+
+/**
+ * struct stats_request_params - stats_request cmd parameter
+ * @stats_id: statistics id
+ * @vdev_id: vdev id
+ */
+struct stats_request_params {
+	uint32_t stats_id;
+	uint32_t vdev_id;
+};
+
+/**
+ * struct green_ap_ps_params - green ap ps cmd parameter
+ * @value: parameter value
+ */
+struct green_ap_ps_params {
+	uint32_t value;
+};
+
+/**
+ * struct wow_cmd_params - wow cmd parameter
+ * @enable: wow enable or disable flag
+ * @can_suspend_link: flag to indicate if link can be suspended
+ * @pause_iface_config: interface config
+ */
+struct wow_cmd_params {
+	bool enable;
+	bool can_suspend_link;
+	uint8_t pause_iface_config;
+};
+
+/**
+ * struct packet_enable_params - packet enable cmd parameter
+ * @vdev_id: vdev id
+ * @enable: flag to indicate if parameter can be enabled or disabled
+ */
+struct packet_enable_params {
+	uint8_t vdev_id;
+	bool enable;
+};
+
+/**
+ * struct suspend_params - suspend cmd parameter
+ * @disable_target_intr: disable target interrupt
+ */
+struct suspend_params {
+	uint8_t disable_target_intr;
+};
+
+/**
+ * struct pdev_params - pdev set cmd parameter
+ * @param_id: parameter id
+ * @param_value: parameter value
+ */
+struct pdev_params {
+	uint32_t param_id;
+	uint32_t param_value;
+};
+
+/**
+ * struct beacon_params - beacon template cmd parameter
+ * @vdev_id: vdev id
+ * @tim_ie_offset: tim ie offset
+ * @tmpl_len: beacon template length
+ * @tmpl_len_aligned: beacon template alignment
+ * @frm: beacon template parameter
+ */
+struct beacon_params {
+	uint8_t vdev_id;
+	uint32_t tim_ie_offset;
+	uint32_t tmpl_len;
+	uint32_t tmpl_len_aligned;
+	uint8_t *frm;
+};
+
+/**
+ * struct peer_assoc_params - peer assoc cmd parameter
+ * @peer_macaddr: peer mac address
+ * @vdev_id: vdev id
+ * @peer_new_assoc: peer association type
+ * @peer_associd: peer association id
+ * @peer_flags: peer flags
+ * @peer_caps: peer capabalities
+ * @peer_listen_intval: peer listen interval
+ * @peer_ht_caps: HT capabalities
+ * @peer_max_mpdu: 0 : 8k , 1 : 16k, 2 : 32k, 3 : 64k
+ * @peer_mpdu_density: 3 : 0~7 : 2^(11nAMPDUdensity -4)
+ * @peer_rate_caps: peer rate capabalities
+ * @peer_nss: peer nss
+ * @peer_phymode: peer phymode
+ * @peer_ht_info: peer HT info
+ * @peer_legacy_rates: peer legacy rates
+ * @peer_ht_rates: peer ht rates
+ * @num_peer_legacy_rates: no of peer legacy rates
+ * @num_peer_ht_rates: no of peer ht rates
+ * @rx_max_rate: max rx rates
+ * @rx_mcs_set: rx mcs
+ * @tx_max_rate: max tx rates
+ * @tx_mcs_set: tx mcs
+ * @vht_capable: VHT capabalities
+ */
+struct peer_assoc_params {
+	wmi_mac_addr peer_macaddr;
+	uint32_t vdev_id;
+	uint32_t peer_new_assoc;
+	uint32_t peer_associd;
+	uint32_t peer_flags;
+	uint32_t peer_caps;
+	uint32_t peer_listen_intval;
+	uint32_t peer_ht_caps;
+	uint32_t peer_max_mpdu;
+	uint32_t peer_mpdu_density;
+	uint32_t peer_rate_caps;
+	uint32_t peer_nss;
+	uint32_t peer_vht_caps;
+	uint32_t peer_phymode;
+	uint32_t peer_ht_info[2];
+	wmi_rate_set peer_legacy_rates;
+	wmi_rate_set peer_ht_rates;
+	uint32_t num_peer_legacy_rates;
+	uint32_t num_peer_ht_rates;
+	uint32_t rx_max_rate;
+	uint32_t rx_mcs_set;
+	uint32_t tx_max_rate;
+	uint32_t tx_mcs_set;
+	uint8_t vht_capable;
+};
+
+/**
+ * struct sta_ps_params - sta ps cmd parameter
+ * @vdev_id: vdev id
+ * @param: sta ps paramter
+ * @value: sta ps parameter value
+ */
+struct sta_ps_params {
+	uint32_t vdev_id;
+	uint32_t param;
+	uint32_t value;
+};
+
+/**
+ * struct ap_ps_params - ap ps cmd parameter
+ * @vdev_id: vdev id
+ * @param: ap ps paramter
+ * @value: ap ps paramter value
+ */
+struct ap_ps_params {
+	uint32_t vdev_id;
+	uint32_t param;
+	uint32_t value;
+};
+
+/**
+ * struct mac_ssid - mac ssid structure
+ * @length:
+ * @mac_ssid[WMI_MAC_MAX_SSID_LENGTH]:
+ */
+struct mac_ssid {
+	uint8_t length;
+	uint8_t mac_ssid[WMI_MAC_MAX_SSID_LENGTH];
+} cdf_packed;
+
+/**
+ * struct scan_start_params - start scan cmd parameter
+ * @scan_id: scan id
+ * @scan_req_id: requeted scan id
+ * @vdev_id: vdev id
+ * @scan_priority: scan priority
+ * @notify_scan_events: flag to indicate if scan to be notified
+ * @dwell_time_active: active dwell time
+ * @dwell_time_passive: passive dwell time
+ * @min_rest_time: min rest time
+ * @max_rest_time: max rest time
+ * @repeat_probe_time: repeat probe time
+ * @probe_spacing_time: probe spacing time
+ * @idle_time: idle time
+ * @max_scan_time: max scan time
+ * @probe_delay: probe delay
+ * @scan_ctrl_flags: scan control flag
+ * @burst_duration: burst duration
+ * @num_chan: no of channel
+ * @num_bssid: no of bssid
+ * @num_ssids: no of ssid
+ * @ie_len: ie length
+ * @n_probes: no of probe
+ * @chan_list: channel list
+ * @ie_len_with_pad: ie length with padding
+ * @num_ssid: no of ssid
+ * @sid: pointer to mac_ssid structure
+ * @uie_fieldOffset: ie field offset
+ * @mac_add_bytes: mac address bytes
+ */
+struct scan_start_params {
+	uint32_t scan_id;
+	uint32_t scan_req_id;
+	uint32_t vdev_id;
+	uint32_t scan_priority;
+	uint32_t notify_scan_events;
+	uint32_t dwell_time_active;
+	uint32_t dwell_time_passive;
+	uint32_t min_rest_time;
+	uint32_t max_rest_time;
+	uint32_t repeat_probe_time;
+	uint32_t probe_spacing_time;
+	uint32_t idle_time;
+	uint32_t max_scan_time;
+	uint32_t probe_delay;
+	uint32_t scan_ctrl_flags;
+	uint32_t burst_duration;
+	uint32_t num_chan;
+	uint32_t num_bssid;
+	uint32_t num_ssids;
+	uint32_t ie_len;
+	uint32_t n_probes;
+	uint32_t *chan_list;
+	uint32_t ie_len_with_pad;
+	struct mac_ssid ssid[WMI_SCAN_MAX_NUM_SSID];
+	uint8_t  *ie_base;
+	uint16_t uie_fieldOffset;
+	uint8_t  mac_add_bytes[IEEE80211_ADDR_LEN];
+};
+
+/**
+ * struct scan_stop_params - stop scan cmd parameter
+ * @requestor: scan requestor
+ * @scan_id: scan id
+ * @req_type: scan request type
+ * @vdev_id: vdev id
+ */
+struct scan_stop_params {
+	uint32_t requestor;
+	uint32_t scan_id;
+	uint32_t req_type;
+	uint32_t vdev_id;
+};
+
+/**
+ * struct scan_chan_list_params  - scan channel list cmd parameter
+ * @num_scan_chans: no of scan channels
+ * @chan_info: pointer to wmi channel info
+ */
+struct scan_chan_list_params {
+	uint8_t num_scan_chans;
+	wmi_channel *chan_info;
+};
+
+/**
+ * struct fw_hang_params - fw hang command parameters
+ * @type: 0:unused 1: ASSERT, 2:not respond detect command, 3:simulate ep-full
+ * @delay_time_ms: 0xffffffff means the simulate will delay for random time (0 ~0xffffffff ms)
+ */
+struct fw_hang_params {
+	uint32_t type;
+	uint32_t delay_time_ms;
+};
+
+/**
+ * struct pdev_utf_params - pdev utf command parameters
+ * @utf_payload:
+ * @len:
+ */
+struct pdev_utf_params {
+	uint8_t *utf_payload;
+	uint32_t len;
+};
+
+/**
+ * struct crash_inject - crash inject command parameters
+ * @type: crash inject type
+ * @delay_time_ms: time in milliseconds for FW to delay the crash
+ */
+struct crash_inject {
+	uint32_t type;
+	uint32_t delay_time_ms;
+};
+
+/**
+ * struct dbglog_params - fw deboglog command parameters
+ * @param: command parameter
+ * @val: parameter value
+ * @module_id_bitmap: fixed length module id bitmap
+ * @bitmap_len: module id bitmap length
+ */
+struct dbglog_params {
+	uint32_t param;
+	uint32_t val;
+	uint32_t *module_id_bitmap;
+	uint32_t bitmap_len;
+};
+
+/**
+ * struct seg_hdr_info - header info
+ * @len: length
+ * @msgref: message refrence
+ * @segmentInfo: segment info
+ * @pad: padding
+ */
+struct seg_hdr_info {
+	uint32_t len;
+	uint32_t msgref;
+	uint32_t segmentInfo;
+	uint32_t pad;
+};
+
+/**
+ * struct wmi_mgmt_params - wmi mgmt cmd paramters
+ * @tx_frame: management tx frame
+ * @frmLen: frame length
+ * @vdev_id: vdev id
+ * @tx_complete_cb: tx download callback handler
+ * @tx_ota_post_proc_cb: OTA complition handler
+ * @chanfreq: channel frequency
+ * @pdata: frame data
+ * @wmi_desc: command descriptor
+ */
+struct wmi_mgmt_params {
+	void *tx_frame;
+	uint16_t frm_len;
+	uint8_t vdev_id;
+	void *tx_complete_cb;
+	void  *tx_ota_post_proc_cb;
+	uint16_t chanfreq;
+	void *pdata;
+	struct wmi_desc_t *wmi_desc;
+	void *cdf_ctx;
+};
+#endif /* _WMI_UNIFIED_PARAM_H_ */
+