xref: /freebsd/sys/contrib/dev/iwlwifi/fw/api/binding.h (revision a4128aad8503277614f2d214011ef60a19447b83)
1bfcc09ddSBjoern A. Zeeb /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2bfcc09ddSBjoern A. Zeeb /*
3*a4128aadSBjoern A. Zeeb  * Copyright (C) 2012-2014, 2020, 2022, 2024 Intel Corporation
4bfcc09ddSBjoern A. Zeeb  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5bfcc09ddSBjoern A. Zeeb  * Copyright (C) 2016-2017 Intel Deutschland GmbH
6bfcc09ddSBjoern A. Zeeb  */
7bfcc09ddSBjoern A. Zeeb #ifndef __iwl_fw_api_binding_h__
8bfcc09ddSBjoern A. Zeeb #define __iwl_fw_api_binding_h__
9bfcc09ddSBjoern A. Zeeb 
10bfcc09ddSBjoern A. Zeeb #include <fw/file.h>
11bfcc09ddSBjoern A. Zeeb #include <fw/img.h>
12bfcc09ddSBjoern A. Zeeb 
13bfcc09ddSBjoern A. Zeeb #define MAX_MACS_IN_BINDING	(3)
14bfcc09ddSBjoern A. Zeeb #define MAX_BINDINGS		(4)
15bfcc09ddSBjoern A. Zeeb 
16bfcc09ddSBjoern A. Zeeb /**
17bfcc09ddSBjoern A. Zeeb  * struct iwl_binding_cmd_v1 - configuring bindings
18bfcc09ddSBjoern A. Zeeb  * ( BINDING_CONTEXT_CMD = 0x2b )
19bfcc09ddSBjoern A. Zeeb  * @id_and_color: ID and color of the relevant Binding,
20bfcc09ddSBjoern A. Zeeb  *	&enum iwl_ctxt_id_and_color
219af1bba4SBjoern A. Zeeb  * @action: action to perform, see &enum iwl_ctxt_action
22bfcc09ddSBjoern A. Zeeb  * @macs: array of MAC id and colors which belong to the binding,
23bfcc09ddSBjoern A. Zeeb  *	&enum iwl_ctxt_id_and_color
24bfcc09ddSBjoern A. Zeeb  * @phy: PHY id and color which belongs to the binding,
25bfcc09ddSBjoern A. Zeeb  *	&enum iwl_ctxt_id_and_color
26bfcc09ddSBjoern A. Zeeb  */
27bfcc09ddSBjoern A. Zeeb struct iwl_binding_cmd_v1 {
28bfcc09ddSBjoern A. Zeeb 	/* COMMON_INDEX_HDR_API_S_VER_1 */
29bfcc09ddSBjoern A. Zeeb 	__le32 id_and_color;
30bfcc09ddSBjoern A. Zeeb 	__le32 action;
31bfcc09ddSBjoern A. Zeeb 	/* BINDING_DATA_API_S_VER_1 */
32bfcc09ddSBjoern A. Zeeb 	__le32 macs[MAX_MACS_IN_BINDING];
33bfcc09ddSBjoern A. Zeeb 	__le32 phy;
34bfcc09ddSBjoern A. Zeeb } __packed; /* BINDING_CMD_API_S_VER_1 */
35bfcc09ddSBjoern A. Zeeb 
36bfcc09ddSBjoern A. Zeeb /**
37bfcc09ddSBjoern A. Zeeb  * struct iwl_binding_cmd - configuring bindings
38bfcc09ddSBjoern A. Zeeb  * ( BINDING_CONTEXT_CMD = 0x2b )
39bfcc09ddSBjoern A. Zeeb  * @id_and_color: ID and color of the relevant Binding,
40bfcc09ddSBjoern A. Zeeb  *	&enum iwl_ctxt_id_and_color
419af1bba4SBjoern A. Zeeb  * @action: action to perform, see &enum iwl_ctxt_action
42bfcc09ddSBjoern A. Zeeb  * @macs: array of MAC id and colors which belong to the binding
43bfcc09ddSBjoern A. Zeeb  *	&enum iwl_ctxt_id_and_color
44bfcc09ddSBjoern A. Zeeb  * @phy: PHY id and color which belongs to the binding
45bfcc09ddSBjoern A. Zeeb  *	&enum iwl_ctxt_id_and_color
46bfcc09ddSBjoern A. Zeeb  * @lmac_id: the lmac id the binding belongs to
47bfcc09ddSBjoern A. Zeeb  */
48bfcc09ddSBjoern A. Zeeb struct iwl_binding_cmd {
49bfcc09ddSBjoern A. Zeeb 	/* COMMON_INDEX_HDR_API_S_VER_1 */
50bfcc09ddSBjoern A. Zeeb 	__le32 id_and_color;
51bfcc09ddSBjoern A. Zeeb 	__le32 action;
52bfcc09ddSBjoern A. Zeeb 	/* BINDING_DATA_API_S_VER_1 */
53bfcc09ddSBjoern A. Zeeb 	__le32 macs[MAX_MACS_IN_BINDING];
54bfcc09ddSBjoern A. Zeeb 	__le32 phy;
55bfcc09ddSBjoern A. Zeeb 	__le32 lmac_id;
56bfcc09ddSBjoern A. Zeeb } __packed; /* BINDING_CMD_API_S_VER_2 */
57bfcc09ddSBjoern A. Zeeb 
58bfcc09ddSBjoern A. Zeeb #define IWL_BINDING_CMD_SIZE_V1	sizeof(struct iwl_binding_cmd_v1)
59bfcc09ddSBjoern A. Zeeb #define IWL_LMAC_24G_INDEX		0
60bfcc09ddSBjoern A. Zeeb #define IWL_LMAC_5G_INDEX		1
61bfcc09ddSBjoern A. Zeeb 
62bfcc09ddSBjoern A. Zeeb /* The maximal number of fragments in the FW's schedule session */
63bfcc09ddSBjoern A. Zeeb #define IWL_MVM_MAX_QUOTA 128
64bfcc09ddSBjoern A. Zeeb 
65bfcc09ddSBjoern A. Zeeb /**
66bfcc09ddSBjoern A. Zeeb  * struct iwl_time_quota_data_v1 - configuration of time quota per binding
67bfcc09ddSBjoern A. Zeeb  * @id_and_color: ID and color of the relevant Binding,
68bfcc09ddSBjoern A. Zeeb  *	&enum iwl_ctxt_id_and_color
69bfcc09ddSBjoern A. Zeeb  * @quota: absolute time quota in TU. The scheduler will try to divide the
70bfcc09ddSBjoern A. Zeeb  *	remainig quota (after Time Events) according to this quota.
71bfcc09ddSBjoern A. Zeeb  * @max_duration: max uninterrupted context duration in TU
72bfcc09ddSBjoern A. Zeeb  */
73bfcc09ddSBjoern A. Zeeb struct iwl_time_quota_data_v1 {
74bfcc09ddSBjoern A. Zeeb 	__le32 id_and_color;
75bfcc09ddSBjoern A. Zeeb 	__le32 quota;
76bfcc09ddSBjoern A. Zeeb 	__le32 max_duration;
77bfcc09ddSBjoern A. Zeeb } __packed; /* TIME_QUOTA_DATA_API_S_VER_1 */
78bfcc09ddSBjoern A. Zeeb 
79bfcc09ddSBjoern A. Zeeb /**
80*a4128aadSBjoern A. Zeeb  * struct iwl_time_quota_cmd_v1 - configuration of time quota between bindings
81bfcc09ddSBjoern A. Zeeb  * ( TIME_QUOTA_CMD = 0x2c )
82bfcc09ddSBjoern A. Zeeb  * @quotas: allocations per binding
83bfcc09ddSBjoern A. Zeeb  * Note: on non-CDB the fourth one is the auxilary mac and is
84bfcc09ddSBjoern A. Zeeb  *	essentially zero.
85bfcc09ddSBjoern A. Zeeb  *	On CDB the fourth one is a regular binding.
86bfcc09ddSBjoern A. Zeeb  */
87bfcc09ddSBjoern A. Zeeb struct iwl_time_quota_cmd_v1 {
88bfcc09ddSBjoern A. Zeeb 	struct iwl_time_quota_data_v1 quotas[MAX_BINDINGS];
89bfcc09ddSBjoern A. Zeeb } __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_1 */
90bfcc09ddSBjoern A. Zeeb 
91bfcc09ddSBjoern A. Zeeb enum iwl_quota_low_latency {
92bfcc09ddSBjoern A. Zeeb 	IWL_QUOTA_LOW_LATENCY_NONE = 0,
93bfcc09ddSBjoern A. Zeeb 	IWL_QUOTA_LOW_LATENCY_TX = BIT(0),
94bfcc09ddSBjoern A. Zeeb 	IWL_QUOTA_LOW_LATENCY_RX = BIT(1),
95bfcc09ddSBjoern A. Zeeb 	IWL_QUOTA_LOW_LATENCY_TX_RX =
96bfcc09ddSBjoern A. Zeeb 		IWL_QUOTA_LOW_LATENCY_TX | IWL_QUOTA_LOW_LATENCY_RX,
97bfcc09ddSBjoern A. Zeeb };
98bfcc09ddSBjoern A. Zeeb 
99bfcc09ddSBjoern A. Zeeb /**
100bfcc09ddSBjoern A. Zeeb  * struct iwl_time_quota_data - configuration of time quota per binding
101bfcc09ddSBjoern A. Zeeb  * @id_and_color: ID and color of the relevant Binding.
102bfcc09ddSBjoern A. Zeeb  * @quota: absolute time quota in TU. The scheduler will try to divide the
103bfcc09ddSBjoern A. Zeeb  *	remainig quota (after Time Events) according to this quota.
104bfcc09ddSBjoern A. Zeeb  * @max_duration: max uninterrupted context duration in TU
105bfcc09ddSBjoern A. Zeeb  * @low_latency: low latency status, &enum iwl_quota_low_latency
106bfcc09ddSBjoern A. Zeeb  */
107bfcc09ddSBjoern A. Zeeb struct iwl_time_quota_data {
108bfcc09ddSBjoern A. Zeeb 	__le32 id_and_color;
109bfcc09ddSBjoern A. Zeeb 	__le32 quota;
110bfcc09ddSBjoern A. Zeeb 	__le32 max_duration;
111bfcc09ddSBjoern A. Zeeb 	__le32 low_latency;
112bfcc09ddSBjoern A. Zeeb } __packed; /* TIME_QUOTA_DATA_API_S_VER_2 */
113bfcc09ddSBjoern A. Zeeb 
114bfcc09ddSBjoern A. Zeeb /**
115bfcc09ddSBjoern A. Zeeb  * struct iwl_time_quota_cmd - configuration of time quota between bindings
116bfcc09ddSBjoern A. Zeeb  * ( TIME_QUOTA_CMD = 0x2c )
117bfcc09ddSBjoern A. Zeeb  * Note: on non-CDB the fourth one is the auxilary mac and is essentially zero.
118bfcc09ddSBjoern A. Zeeb  * On CDB the fourth one is a regular binding.
119bfcc09ddSBjoern A. Zeeb  *
120bfcc09ddSBjoern A. Zeeb  * @quotas: allocations per binding
121bfcc09ddSBjoern A. Zeeb  */
122bfcc09ddSBjoern A. Zeeb struct iwl_time_quota_cmd {
123bfcc09ddSBjoern A. Zeeb 	struct iwl_time_quota_data quotas[MAX_BINDINGS];
124bfcc09ddSBjoern A. Zeeb } __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_2 */
125bfcc09ddSBjoern A. Zeeb 
126bfcc09ddSBjoern A. Zeeb #endif /* __iwl_fw_api_binding_h__ */
127