1 /*
2  * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
3  *
4  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5  *
6  *
7  * Permission to use, copy, modify, and/or distribute this software for
8  * any purpose with or without fee is hereby granted, provided that the
9  * above copyright notice and this permission notice appear in all
10  * copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19  * PERFORMANCE OF THIS SOFTWARE.
20  */
21 
22 /*
23  * This file was originally distributed by Qualcomm Atheros, Inc.
24  * under proprietary terms before Copyright ownership was assigned
25  * to the Linux Foundation.
26  */
27 
28 /*
29  * This file contains extensions of the WMI protocol specified in the
30  * Wireless Module Interface (WMI).  It includes definitions of all
31  * extended commands and events.  Extensions include useful commands
32  * that are not directly related to wireless activities.  They may
33  * be hardware-specific, and they might not be supported on all
34  * implementations.
35  *
36  * Extended WMIX commands are encapsulated in a WMI message with
37  * cmd=WMI_EXTENSION_CMD.
38  */
39 
40 #ifndef _WMIX_H_
41 #define _WMIX_H_
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /*
48  * Extended WMI commands are those that are needed during wireless
49  * operation, but which are not really wireless commands.  This allows,
50  * for instance, platform-specific commands.  Extended WMI commands are
51  * embedded in a WMI command message with WMI_COMMAND_ID=WMI_EXTENSION_CMDID.
52  * Extended WMI events are similarly embedded in a WMI event message with
53  * WMI_EVENT_ID=WMI_EXTENSION_EVENTID.
54  */
55 typedef struct {
56     A_UINT32    commandId;
57 } POSTPACK WMIX_CMD_HDR;
58 
59 typedef enum {
60     WMIX_DSETOPEN_REPLY_CMDID           = 0x2001,
61     WMIX_DSETDATA_REPLY_CMDID,
62     WMIX_HB_CHALLENGE_RESP_CMDID,
63     WMIX_DBGLOG_CFG_MODULE_CMDID,
64     WMIX_PROF_CFG_CMDID,                 /* 0x200a */
65     WMIX_PROF_ADDR_SET_CMDID,
66     WMIX_PROF_START_CMDID,
67     WMIX_PROF_STOP_CMDID,
68     WMIX_PROF_COUNT_GET_CMDID,
69 } WMIX_COMMAND_ID;
70 
71 typedef enum {
72     WMIX_DSETOPENREQ_EVENTID            = 0x3001,
73     WMIX_DSETCLOSE_EVENTID,
74     WMIX_DSETDATAREQ_EVENTID,
75     WMIX_HB_CHALLENGE_RESP_EVENTID,
76     WMIX_DBGLOG_EVENTID,
77     WMIX_PROF_COUNT_EVENTID,
78     WMIX_PKTLOG_EVENTID,
79 } WMIX_EVENT_ID;
80 
81 /*
82  * =============DataSet support=================
83  */
84 
85 /*
86  * WMIX_DSETOPENREQ_EVENTID
87  * DataSet Open Request Event
88  */
89 typedef struct {
90     A_UINT32 dset_id;
91     A_UINT32 targ_dset_handle;  /* echo'ed, not used by Host, */
92     A_UINT32 targ_reply_fn;     /* echo'ed, not used by Host, */
93     A_UINT32 targ_reply_arg;    /* echo'ed, not used by Host, */
94 } POSTPACK WMIX_DSETOPENREQ_EVENT;
95 
96 /*
97  * WMIX_DSETCLOSE_EVENTID
98  * DataSet Close Event
99  */
100 typedef struct {
101     A_UINT32 access_cookie;
102 } POSTPACK WMIX_DSETCLOSE_EVENT;
103 
104 /*
105  * WMIX_DSETDATAREQ_EVENTID
106  * DataSet Data Request Event
107  */
108 typedef struct {
109     A_UINT32 access_cookie;
110     A_UINT32 offset;
111     A_UINT32 length;
112     A_UINT32 targ_buf;         /* echo'ed, not used by Host, */
113     A_UINT32 targ_reply_fn;    /* echo'ed, not used by Host, */
114     A_UINT32 targ_reply_arg;   /* echo'ed, not used by Host, */
115 } WMIX_DSETDATAREQ_EVENT;
116 
117 typedef struct {
118     A_UINT32              status;
119     A_UINT32              targ_dset_handle;
120     A_UINT32              targ_reply_fn;
121     A_UINT32              targ_reply_arg;
122     A_UINT32              access_cookie;
123     A_UINT32              size;
124     A_UINT32              version;
125 }  WMIX_DSETOPEN_REPLY_CMD;
126 
127 typedef struct {
128     A_UINT32              status;
129     A_UINT32              targ_buf;
130     A_UINT32              targ_reply_fn;
131     A_UINT32              targ_reply_arg;
132     A_UINT32              length;
133     A_UINT8               buf[1];
134 }  WMIX_DSETDATA_REPLY_CMD;
135 
136 
137 /*
138  * =============Error Detection support=================
139  */
140 
141 /*
142  * WMIX_HB_CHALLENGE_RESP_CMDID
143  * Heartbeat Challenge Response command
144  */
145 typedef struct {
146     A_UINT32              cookie;
147     A_UINT32              source;
148 }  WMIX_HB_CHALLENGE_RESP_CMD;
149 
150 /*
151  * WMIX_HB_CHALLENGE_RESP_EVENTID
152  * Heartbeat Challenge Response Event
153  */
154 #define WMIX_HB_CHALLENGE_RESP_EVENT WMIX_HB_CHALLENGE_RESP_CMD
155 
156 /*
157  * =============Target Profiling support=================
158  */
159 
160 typedef struct {
161     A_UINT32 period; /* Time (in 30.5us ticks) between samples */
162     A_UINT32 nbins;
163 }  WMIX_PROF_CFG_CMD;
164 
165 typedef struct {
166     A_UINT32 addr;
167 }  WMIX_PROF_ADDR_SET_CMD;
168 
169 /*
170  * Target responds to Hosts's earlier WMIX_PROF_COUNT_GET_CMDID request
171  * using a WMIX_PROF_COUNT_EVENT with
172  *   addr set to the next address
173  *   count set to the corresponding count
174  */
175 typedef struct {
176     A_UINT32              addr;
177     A_UINT32              count;
178 }  WMIX_PROF_COUNT_EVENT;
179 
180 
181 #ifdef __cplusplus
182 }
183 #endif
184 
185 #endif /* _WMIX_H_ */
186