qcacmn: support of common wmi rx event handling for common wmi layer

Remove hard-coded rx execution context of wmi event callbacks.
UMAC layer needs to register execution context while registering
events with wmi layer.

Execute wmi rx event callbacks in following context-
1) work queue context provided by wmi layer.
2) umac provided context, umac can choose to
   execute in thread context or default tasklet context
   based on umac implementation.

CRs-Fixed: 978619
Change-Id: Id9b1f1e5157e8a203f93a62791f85a8145cc1599
diff --git a/wmi_unified_api.h b/wmi_unified_api.h
index c1d6e0f..7e86d2c 100644
--- a/wmi_unified_api.h
+++ b/wmi_unified_api.h
@@ -51,11 +51,9 @@
  * @wma_process_fw_event_handler_cbk: generic event handler callback
  */
 struct wmi_rx_ops {
-	void (*service_ready_cbk)(void *ctx, void *ev);
-	void (*service_ready_ext_cbk)(void *ctx, void *ev);
-	void (*ready_cbk)(void *ctx, void *ev);
+
 	int (*wma_process_fw_event_handler_cbk)(void *ctx,
-				  void *ev);
+				  void *ev, uint8_t rx_ctx);
 };
 
 /**
@@ -70,6 +68,17 @@
 };
 
 /**
+ * enum wmi_rx_exec_ctx - wmi rx execution context
+ * @WMI_RX_WORK_CTX: work queue context execution provided by WMI layer
+ * @WMI_RX_UMAC_CTX: execution context provided by umac layer
+ *
+ */
+enum wmi_rx_exec_ctx {
+	WMI_RX_WORK_CTX,
+	WMI_RX_UMAC_CTX
+};
+
+/**
  * attach for unified WMI
  *
  *  @param scn_handle      : handle to SCN.
@@ -126,17 +135,21 @@
 		     WMI_CMD_ID cmd_id);
 
 /**
- * WMI event handler register function
+ * wmi_unified_register_event_handler() - WMI event handler
+ * registration function
  *
- *  @param wmi_handle      : handle to WMI.
- *  @param event_id        : WMI event ID
- *  @param handler_func    : Event handler call back function
+ * @wmi_handle:   handle to WMI.
+ * @event_id:     WMI event ID
+ * @handler_func: Event handler call back function
+ * @rx_ctx: rx event processing context
+ *
  *  @return 0  on success and -ve on failure.
  */
 int
 wmi_unified_register_event_handler(wmi_unified_t wmi_handle,
 				   WMI_EVT_ID event_id,
-				   wmi_unified_event_handler handler_func);
+				   wmi_unified_event_handler handler_func,
+				   uint8_t rx_ctx);
 
 /**
  * WMI event handler unregister function
@@ -179,7 +192,6 @@
 /**
    WMI API to set target suspend state
  */
-
 void wmi_set_target_suspend(wmi_unified_t wmi_handle, bool val);
 
 #ifdef FEATURE_RUNTIME_PM
@@ -198,6 +210,7 @@
 }
 #endif
 
+
 /**
  * WMA Callback to process fw event.
  */
diff --git a/wmi_unified_priv.h b/wmi_unified_priv.h
index c530f1c..ec7b378 100644
--- a/wmi_unified_priv.h
+++ b/wmi_unified_priv.h
@@ -48,13 +48,13 @@
 
 struct wmi_command_debug {
 	uint32_t command;
-	uint32_t data[4];       /*16 bytes of WMI cmd excluding TLV and WMI headers */
+	uint32_t data[4]; /*16 bytes of WMI cmd excluding TLV and WMI headers */
 	uint64_t time;
 };
 
 struct wmi_event_debug {
 	uint32_t event;
-	uint32_t data[4];       /*16 bytes of WMI event data excluding TLV header */
+	uint32_t data[4]; /*16 bytes of WMI event data excluding TLV header */
 	uint64_t time;
 };
 
@@ -179,6 +179,7 @@
 	uint16_t max_msg_len;
 	WMI_EVT_ID event_id[WMI_UNIFIED_MAX_EVENT];
 	wmi_unified_event_handler event_handler[WMI_UNIFIED_MAX_EVENT];
+	enum wmi_rx_exec_ctx ctx[WMI_UNIFIED_MAX_EVENT];
 	uint32_t max_event_idx;
 	void *htc_handle;
 	cdf_spinlock_t eventq_lock;
diff --git a/wmi_version_whitelist.h b/wmi_version_whitelist.h
new file mode 100644
index 0000000..6ec33d4
--- /dev/null
+++ b/wmi_version_whitelist.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * Every Product Line or chipset or team can have its own Whitelist table.
+ * The following is a list of versions that the present software can support
+ * even though its versions are incompatible. Any entry here means that the
+ * indicated version does not break WMI compatibility even though it has
+ * a minor version change.
+ */
+wmi_whitelist_version_info version_whitelist[] = {
+	{0, 0, 0x5F414351, 0x00004C4D, 0, 0}
+	/* Placeholder: Major=0, Minor=0, Namespace="QCA_ML" (Dummy entry) */
+};