xref: /linux/drivers/net/wireless/ath/ath10k/testmode_i.h (revision 8f7aa3d3c7323f4ca2768a9e74ebbe359c4f8f88)
1 /* SPDX-License-Identifier: ISC */
2 /*
3  * Copyright (c) 2014,2017 Qualcomm Atheros, Inc.
4  * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
5  */
6 
7 /* "API" level of the ath10k testmode interface. Bump it after every
8  * incompatible interface change.
9  */
10 #define ATH10K_TESTMODE_VERSION_MAJOR 1
11 
12 /* Bump this after every _compatible_ interface change, for example
13  * addition of a new command or an attribute.
14  */
15 #define ATH10K_TESTMODE_VERSION_MINOR 0
16 
17 #define ATH10K_TM_DATA_MAX_LEN		5000
18 #define ATH_FTM_EVENT_MAX_BUF_LENGTH	2048
19 
20 enum ath10k_tm_attr {
21 	__ATH10K_TM_ATTR_INVALID	= 0,
22 	ATH10K_TM_ATTR_CMD		= 1,
23 	ATH10K_TM_ATTR_DATA		= 2,
24 	ATH10K_TM_ATTR_WMI_CMDID	= 3,
25 	ATH10K_TM_ATTR_VERSION_MAJOR	= 4,
26 	ATH10K_TM_ATTR_VERSION_MINOR	= 5,
27 	ATH10K_TM_ATTR_WMI_OP_VERSION	= 6,
28 
29 	/* keep last */
30 	__ATH10K_TM_ATTR_AFTER_LAST,
31 	ATH10K_TM_ATTR_MAX		= __ATH10K_TM_ATTR_AFTER_LAST - 1,
32 };
33 
34 /* All ath10k testmode interface commands specified in
35  * ATH10K_TM_ATTR_CMD
36  */
37 enum ath10k_tm_cmd {
38 	/* Returns the supported ath10k testmode interface version in
39 	 * ATH10K_TM_ATTR_VERSION. Always guaranteed to work. User space
40 	 * uses this to verify it's using the correct version of the
41 	 * testmode interface
42 	 */
43 	ATH10K_TM_CMD_GET_VERSION = 0,
44 
45 	/* Boots the UTF firmware, the netdev interface must be down at the
46 	 * time.
47 	 */
48 	ATH10K_TM_CMD_UTF_START = 1,
49 
50 	/* Shuts down the UTF firmware and puts the driver back into OFF
51 	 * state.
52 	 */
53 	ATH10K_TM_CMD_UTF_STOP = 2,
54 
55 	/* The command used to transmit a WMI command to the firmware and
56 	 * the event to receive WMI events from the firmware. Without
57 	 * struct wmi_cmd_hdr header, only the WMI payload. Command id is
58 	 * provided with ATH10K_TM_ATTR_WMI_CMDID and payload in
59 	 * ATH10K_TM_ATTR_DATA.
60 	 */
61 	ATH10K_TM_CMD_WMI = 3,
62 
63 	/* The command used to transmit a test command to the firmware
64 	 * and the event to receive test events from the firmware. The data
65 	 * received only contain the TLV payload, need to add the tlv header
66 	 * and send the cmd to firmware with command id WMI_PDEV_UTF_CMDID.
67 	 * The data payload size could be large and the driver needs to
68 	 * send segmented data to firmware.
69 	 *
70 	 * This legacy testmode command shares the same value as the get-version
71 	 * command. To distinguish between them, we check whether the data attribute
72 	 * is present.
73 	 */
74 	ATH10K_TM_CMD_TLV = ATH10K_TM_CMD_GET_VERSION,
75 };
76