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