1 /******************************************************************************
2  *
3  * This file is provided under a dual BSD/GPLv2 license.  When using or
4  * redistributing this file, you may do so under either license.
5  *
6  * GPL LICENSE SUMMARY
7  *
8  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
9  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
10  * Copyright(c) 2012 - 2014, 2018, 2020 Intel Corporation
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of version 2 of the GNU General Public License as
14  * published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * General Public License for more details.
20  *
21  * The full GNU General Public License is included in this distribution
22  * in the file called COPYING.
23  *
24  * Contact Information:
25  *  Intel Linux Wireless <linuxwifi@intel.com>
26  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27  *
28  * BSD LICENSE
29  *
30  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
31  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
32  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
33  * Copyright(c) 2012 - 2014, 2018, 2020 Intel Corporation
34  * All rights reserved.
35  *
36  * Redistribution and use in source and binary forms, with or without
37  * modification, are permitted provided that the following conditions
38  * are met:
39  *
40  *  * Redistributions of source code must retain the above copyright
41  *    notice, this list of conditions and the following disclaimer.
42  *  * Redistributions in binary form must reproduce the above copyright
43  *    notice, this list of conditions and the following disclaimer in
44  *    the documentation and/or other materials provided with the
45  *    distribution.
46  *  * Neither the name Intel Corporation nor the names of its
47  *    contributors may be used to endorse or promote products derived
48  *    from this software without specific prior written permission.
49  *
50  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61  *
62  *****************************************************************************/
63 
64 #ifndef __iwl_fw_api_alive_h__
65 #define __iwl_fw_api_alive_h__
66 
67 /* alive response is_valid values */
68 #define ALIVE_RESP_UCODE_OK	BIT(0)
69 #define ALIVE_RESP_RFKILL	BIT(1)
70 
71 /* alive response ver_type values */
72 enum {
73 	FW_TYPE_HW = 0,
74 	FW_TYPE_PROT = 1,
75 	FW_TYPE_AP = 2,
76 	FW_TYPE_WOWLAN = 3,
77 	FW_TYPE_TIMING = 4,
78 	FW_TYPE_WIPAN = 5
79 };
80 
81 /* alive response ver_subtype values */
82 enum {
83 	FW_SUBTYPE_FULL_FEATURE = 0,
84 	FW_SUBTYPE_BOOTSRAP = 1, /* Not valid */
85 	FW_SUBTYPE_REDUCED = 2,
86 	FW_SUBTYPE_ALIVE_ONLY = 3,
87 	FW_SUBTYPE_WOWLAN = 4,
88 	FW_SUBTYPE_AP_SUBTYPE = 5,
89 	FW_SUBTYPE_WIPAN = 6,
90 	FW_SUBTYPE_INITIALIZE = 9
91 };
92 
93 #define IWL_ALIVE_STATUS_ERR 0xDEAD
94 #define IWL_ALIVE_STATUS_OK 0xCAFE
95 
96 #define IWL_ALIVE_FLG_RFKILL	BIT(0)
97 
98 struct iwl_lmac_debug_addrs {
99 	__le32 error_event_table_ptr;	/* SRAM address for error log */
100 	__le32 log_event_table_ptr;	/* SRAM address for LMAC event log */
101 	__le32 cpu_register_ptr;
102 	__le32 dbgm_config_ptr;
103 	__le32 alive_counter_ptr;
104 	__le32 scd_base_ptr;		/* SRAM address for SCD */
105 	__le32 st_fwrd_addr;		/* pointer to Store and forward */
106 	__le32 st_fwrd_size;
107 } __packed; /* UCODE_DEBUG_ADDRS_API_S_VER_2 */
108 
109 struct iwl_lmac_alive {
110 	__le32 ucode_major;
111 	__le32 ucode_minor;
112 	u8 ver_subtype;
113 	u8 ver_type;
114 	u8 mac;
115 	u8 opt;
116 	__le32 timestamp;
117 	struct iwl_lmac_debug_addrs dbg_ptrs;
118 } __packed; /* UCODE_ALIVE_NTFY_API_S_VER_3 */
119 
120 struct iwl_umac_debug_addrs {
121 	__le32 error_info_addr;		/* SRAM address for UMAC error log */
122 	__le32 dbg_print_buff_addr;
123 } __packed; /* UMAC_DEBUG_ADDRS_API_S_VER_1 */
124 
125 struct iwl_umac_alive {
126 	__le32 umac_major;		/* UMAC version: major */
127 	__le32 umac_minor;		/* UMAC version: minor */
128 	struct iwl_umac_debug_addrs dbg_ptrs;
129 } __packed; /* UMAC_ALIVE_DATA_API_S_VER_2 */
130 
131 struct iwl_sku_id {
132 	__le32 data[3];
133 } __packed; /* SKU_ID_API_S_VER_1 */
134 
135 struct iwl_alive_ntf_v3 {
136 	__le16 status;
137 	__le16 flags;
138 	struct iwl_lmac_alive lmac_data;
139 	struct iwl_umac_alive umac_data;
140 } __packed; /* UCODE_ALIVE_NTFY_API_S_VER_3 */
141 
142 struct iwl_alive_ntf_v4 {
143 	__le16 status;
144 	__le16 flags;
145 	struct iwl_lmac_alive lmac_data[2];
146 	struct iwl_umac_alive umac_data;
147 } __packed; /* UCODE_ALIVE_NTFY_API_S_VER_4 */
148 
149 struct iwl_alive_ntf_v5 {
150 	__le16 status;
151 	__le16 flags;
152 	struct iwl_lmac_alive lmac_data[2];
153 	struct iwl_umac_alive umac_data;
154 	struct iwl_sku_id sku_id;
155 } __packed; /* UCODE_ALIVE_NTFY_API_S_VER_5 */
156 
157 /**
158  * enum iwl_extended_cfg_flag - commands driver may send before
159  *	finishing init flow
160  * @IWL_INIT_DEBUG_CFG: driver is going to send debug config command
161  * @IWL_INIT_NVM: driver is going to send NVM_ACCESS commands
162  * @IWL_INIT_PHY: driver is going to send PHY_DB commands
163  */
164 enum iwl_extended_cfg_flags {
165 	IWL_INIT_DEBUG_CFG,
166 	IWL_INIT_NVM,
167 	IWL_INIT_PHY,
168 };
169 
170 /**
171  * struct iwl_extended_cfg_cmd - mark what commands ucode should wait for
172  * before finishing init flows
173  * @init_flags: values from iwl_extended_cfg_flags
174  */
175 struct iwl_init_extended_cfg_cmd {
176 	__le32 init_flags;
177 } __packed; /* INIT_EXTENDED_CFG_CMD_API_S_VER_1 */
178 
179 /**
180  * struct iwl_radio_version_notif - information on the radio version
181  * ( RADIO_VERSION_NOTIFICATION = 0x68 )
182  * @radio_flavor: radio flavor
183  * @radio_step: radio version step
184  * @radio_dash: radio version dash
185  */
186 struct iwl_radio_version_notif {
187 	__le32 radio_flavor;
188 	__le32 radio_step;
189 	__le32 radio_dash;
190 } __packed; /* RADIO_VERSION_NOTOFICATION_S_VER_1 */
191 
192 enum iwl_card_state_flags {
193 	CARD_ENABLED		= 0x00,
194 	HW_CARD_DISABLED	= 0x01,
195 	SW_CARD_DISABLED	= 0x02,
196 	CT_KILL_CARD_DISABLED	= 0x04,
197 	HALT_CARD_DISABLED	= 0x08,
198 	CARD_DISABLED_MSK	= 0x0f,
199 	CARD_IS_RX_ON		= 0x10,
200 };
201 
202 /**
203  * struct iwl_radio_version_notif - information on the card state
204  * ( CARD_STATE_NOTIFICATION = 0xa1 )
205  * @flags: &enum iwl_card_state_flags
206  */
207 struct iwl_card_state_notif {
208 	__le32 flags;
209 } __packed; /* CARD_STATE_NTFY_API_S_VER_1 */
210 
211 /**
212  * enum iwl_error_recovery_flags - flags for error recovery cmd
213  * @ERROR_RECOVERY_UPDATE_DB: update db from blob sent
214  * @ERROR_RECOVERY_END_OF_RECOVERY: end of recovery
215  */
216 enum iwl_error_recovery_flags {
217 	ERROR_RECOVERY_UPDATE_DB = BIT(0),
218 	ERROR_RECOVERY_END_OF_RECOVERY = BIT(1),
219 };
220 
221 /**
222  * struct iwl_fw_error_recovery_cmd - recovery cmd sent upon assert
223  * @flags: &enum iwl_error_recovery_flags
224  * @buf_size: db buffer size in bytes
225  */
226 struct iwl_fw_error_recovery_cmd {
227 	__le32 flags;
228 	__le32 buf_size;
229 } __packed; /* ERROR_RECOVERY_CMD_HDR_API_S_VER_1 */
230 
231 #endif /* __iwl_fw_api_alive_h__ */
232