xref: /wlan-driver/fw-api/fw/htc_services.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2012, 2014-2017, 2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
6  *
7  *
8  * Permission to use, copy, modify, and/or distribute this software for
9  * any purpose with or without fee is hereby granted, provided that the
10  * above copyright notice and this permission notice appear in all
11  * copies.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
14  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
16  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
17  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
18  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20  * PERFORMANCE OF THIS SOFTWARE.
21  */
22 
23 /*
24  * This file was originally distributed by Qualcomm Atheros, Inc.
25  * under proprietary terms before Copyright ownership was assigned
26  * to the Linux Foundation.
27  */
28 
29 #ifndef __HTC_SERVICES_H__
30 #define __HTC_SERVICES_H__
31 
32 /* Current service IDs */
33 
34 typedef enum {
35     RSVD_SERVICE_GROUP       = 0,
36     WMI_SERVICE_GROUP        = 1,
37     NMI_SERVICE_GROUP        = 2,
38     HTT_SERVICE_GROUP        = 3,
39     CFG_NV_SERVICE_GROUP     = 4,
40     WDI_IPA_SERVICE_GROUP    = 5,
41     PACKET_LOG_SERVICE_GROUP = 6,
42     LPASS_SERVICE_GROUP      = 7,
43 
44     HTC_TEST_GROUP           = 254,
45     HTC_SERVICE_GROUP_LAST   = 255
46 }HTC_SERVICE_GROUP_IDS;
47 
48 #define MAKE_SERVICE_ID(group,index) \
49             (int)(((int)group << 8) | (int)(index))
50 
51 /* NOTE: service ID of 0x0000 is reserved and should never be used */
52 #define HTC_CTRL_RSVD_SVC MAKE_SERVICE_ID(RSVD_SERVICE_GROUP,1)
53 /* WMI_CONTROL_SVC: WMI service for MAC 0 */
54 #define WMI_CONTROL_SVC        MAKE_SERVICE_ID(WMI_SERVICE_GROUP,0)
55 #define WMI_DATA_BE_SVC        MAKE_SERVICE_ID(WMI_SERVICE_GROUP,1)
56 #define WMI_DATA_BK_SVC        MAKE_SERVICE_ID(WMI_SERVICE_GROUP,2)
57 #define WMI_DATA_VI_SVC        MAKE_SERVICE_ID(WMI_SERVICE_GROUP,3)
58 #define WMI_DATA_VO_SVC        MAKE_SERVICE_ID(WMI_SERVICE_GROUP,4)
59 /* WMI_CONTROL_SVC_WMAC1,2: WMI service for MACs 1 and 2 (where applicable) */
60 #define WMI_CONTROL_SVC_WMAC1  MAKE_SERVICE_ID(WMI_SERVICE_GROUP,5)
61 #define WMI_CONTROL_SVC_WMAC2  MAKE_SERVICE_ID(WMI_SERVICE_GROUP,6)
62 #define WMI_CONTROL_DIAG_SVC   MAKE_SERVICE_ID(WMI_SERVICE_GROUP,7)
63 #define WMI_CONTROL_DBR_SVC    MAKE_SERVICE_ID(WMI_SERVICE_GROUP,8)
64 /* WMI_CONTROL_SVC_WMAC3,4: WMI service for MACs 3 and 4 (where applicable) */
65 #define WMI_CONTROL_SVC_WMAC3  MAKE_SERVICE_ID(WMI_SERVICE_GROUP,9)
66 #define WMI_CONTROL_SVC_WMAC4  MAKE_SERVICE_ID(WMI_SERVICE_GROUP,10)
67 #define WMI_MAX_SERVICES  11
68 
69 #define NMI_CONTROL_SVC   MAKE_SERVICE_ID(NMI_SERVICE_GROUP,0)
70 #define NMI_DATA_SVC      MAKE_SERVICE_ID(NMI_SERVICE_GROUP,1)
71 
72 /* HTT_DATA_MSG_SVC
73  * This service is the regular (mandatory) HTT service
74  * used for transferring data-path messages betwween host and target.
75  */
76 #define HTT_DATA_MSG_SVC  MAKE_SERVICE_ID(HTT_SERVICE_GROUP,0)
77 
78 /* HTT_DATA2_MSG_SVG
79  * This is an optional service, used for downloading short tx frames
80  * over a communication channel parallel to the regular HTT comm channel.
81  * This can only be used for protocols where frame reordering is permitted (TCP).
82  * This is helpful for minimizing latency and maximizing efficiency of TCP acks.
83  * This service is also for sending Rx In-order indication packets over copy engine 9 for
84  * for dual-band systems with multi-core hosts.
85  */
86 #define HTT_DATA2_MSG_SVC MAKE_SERVICE_ID(HTT_SERVICE_GROUP,1)
87 
88 /* This service is only for sending Rx In-order indication packets over copy engine 10
89  * for dual-band systems with multi-core hosts, in which rx indications from one pdev/MAC
90  * can be routed to one host processor core in parallel with rx indications from another
91  * pdev/MAC being routed to another host core over another copy engine, such that these
92  * rx indications can be processed in parallel.
93  */
94 #define HTT_DATA3_MSG_SVC MAKE_SERVICE_ID(HTT_SERVICE_GROUP,2)
95 
96 /* raw stream service (i.e. flash, tcmd, calibration apps) */
97 #define HTC_RAW_STREAMS_SVC MAKE_SERVICE_ID(HTC_TEST_GROUP,0)
98 
99 #define CFG_NV_SVC  MAKE_SERVICE_ID(CFG_NV_SERVICE_GROUP,0)
100 
101 #define WDI_IPA_TX_SVC MAKE_SERVICE_ID(WDI_IPA_SERVICE_GROUP,0)
102 
103 #define PACKET_LOG_SVC MAKE_SERVICE_ID(PACKET_LOG_SERVICE_GROUP,0)
104 
105 #define LPASS_DATA_MSG_SVC MAKE_SERVICE_ID(LPASS_SERVICE_GROUP,0)
106 
107 /*
108  * Directions for interconnect pipe configuration.
109  * These definitions may be used during configuration and are shared
110  * between Host and Target.
111  *
112  * Pipe Directions are relative to the Host, so PIPEDIR_IN means
113  * "coming IN over air through Target to Host" as with a WiFi Rx operation.
114  * Conversely, PIPEDIR_OUT means "going OUT from Host through Target over air"
115  * as with a WiFi Tx operation. This is somewhat awkward for the "middle-man"
116  * Target since things that are "PIPEDIR_OUT" are coming IN to the Target
117  * over the interconnect.
118  */
119 typedef A_UINT32 PIPEDIR;
120 #define PIPEDIR_NONE      0
121 #define PIPEDIR_IN        1  /* Target-->Host, WiFi Rx direction */
122 #define PIPEDIR_OUT       2  /* Host->Target, WiFi Tx direction */
123 #define PIPEDIR_INOUT     3  /* bidirectional, target to target */
124 #define PIPEDIR_INOUT_T2T PIPEDIR_INOUT
125 #define PIPEDIR_INOUT_H2H 4  /* bidirectional, host to host */
126 #define PIPEDIR_MATCH(d1, d2) (((PIPEDIR)(d1) & (PIPEDIR)(d2)) != 0)
127 #define INVALID_PIPE_NO (-1)
128 
129 /* Establish a mapping between a service/direction and a pipe. */
130 struct service_to_pipe {
131     A_UINT32 service_id;
132     A_UINT32 pipedir;
133     A_UINT32 pipenum;
134 };
135 
136 
137 #endif /*HTC_SERVICES_H_*/
138