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  *
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  * All rights reserved.
34  *
35  * Redistribution and use in source and binary forms, with or without
36  * modification, are permitted provided that the following conditions
37  * are met:
38  *
39  *  * Redistributions of source code must retain the above copyright
40  *    notice, this list of conditions and the following disclaimer.
41  *  * Redistributions in binary form must reproduce the above copyright
42  *    notice, this list of conditions and the following disclaimer in
43  *    the documentation and/or other materials provided with the
44  *    distribution.
45  *  * Neither the name Intel Corporation nor the names of its
46  *    contributors may be used to endorse or promote products derived
47  *    from this software without specific prior written permission.
48  *
49  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
52  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
53  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
54  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
55  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
57  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
59  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60  *
61  *****************************************************************************/
62 
63 #ifndef __iwl_fw_api_alive_h__
64 #define __iwl_fw_api_alive_h__
65 
66 /* alive response is_valid values */
67 #define ALIVE_RESP_UCODE_OK	BIT(0)
68 #define ALIVE_RESP_RFKILL	BIT(1)
69 
70 /* alive response ver_type values */
71 enum {
72 	FW_TYPE_HW = 0,
73 	FW_TYPE_PROT = 1,
74 	FW_TYPE_AP = 2,
75 	FW_TYPE_WOWLAN = 3,
76 	FW_TYPE_TIMING = 4,
77 	FW_TYPE_WIPAN = 5
78 };
79 
80 /* alive response ver_subtype values */
81 enum {
82 	FW_SUBTYPE_FULL_FEATURE = 0,
83 	FW_SUBTYPE_BOOTSRAP = 1, /* Not valid */
84 	FW_SUBTYPE_REDUCED = 2,
85 	FW_SUBTYPE_ALIVE_ONLY = 3,
86 	FW_SUBTYPE_WOWLAN = 4,
87 	FW_SUBTYPE_AP_SUBTYPE = 5,
88 	FW_SUBTYPE_WIPAN = 6,
89 	FW_SUBTYPE_INITIALIZE = 9
90 };
91 
92 #define IWL_ALIVE_STATUS_ERR 0xDEAD
93 #define IWL_ALIVE_STATUS_OK 0xCAFE
94 
95 #define IWL_ALIVE_FLG_RFKILL	BIT(0)
96 
97 struct iwl_lmac_alive {
98 	__le32 ucode_major;
99 	__le32 ucode_minor;
100 	u8 ver_subtype;
101 	u8 ver_type;
102 	u8 mac;
103 	u8 opt;
104 	__le32 timestamp;
105 	__le32 error_event_table_ptr;	/* SRAM address for error log */
106 	__le32 log_event_table_ptr;	/* SRAM address for LMAC event log */
107 	__le32 cpu_register_ptr;
108 	__le32 dbgm_config_ptr;
109 	__le32 alive_counter_ptr;
110 	__le32 scd_base_ptr;		/* SRAM address for SCD */
111 	__le32 st_fwrd_addr;		/* pointer to Store and forward */
112 	__le32 st_fwrd_size;
113 } __packed; /* UCODE_ALIVE_NTFY_API_S_VER_3 */
114 
115 struct iwl_umac_alive {
116 	__le32 umac_major;		/* UMAC version: major */
117 	__le32 umac_minor;		/* UMAC version: minor */
118 	__le32 error_info_addr;		/* SRAM address for UMAC error log */
119 	__le32 dbg_print_buff_addr;
120 } __packed; /* UMAC_ALIVE_DATA_API_S_VER_2 */
121 
122 struct mvm_alive_resp_v3 {
123 	__le16 status;
124 	__le16 flags;
125 	struct iwl_lmac_alive lmac_data;
126 	struct iwl_umac_alive umac_data;
127 } __packed; /* ALIVE_RES_API_S_VER_3 */
128 
129 struct mvm_alive_resp {
130 	__le16 status;
131 	__le16 flags;
132 	struct iwl_lmac_alive lmac_data[2];
133 	struct iwl_umac_alive umac_data;
134 } __packed; /* ALIVE_RES_API_S_VER_4 */
135 
136 /**
137  * enum iwl_extended_cfg_flag - commands driver may send before
138  *	finishing init flow
139  * @IWL_INIT_DEBUG_CFG: driver is going to send debug config command
140  * @IWL_INIT_NVM: driver is going to send NVM_ACCESS commands
141  * @IWL_INIT_PHY: driver is going to send PHY_DB commands
142  */
143 enum iwl_extended_cfg_flags {
144 	IWL_INIT_DEBUG_CFG,
145 	IWL_INIT_NVM,
146 	IWL_INIT_PHY,
147 };
148 
149 /**
150  * struct iwl_extended_cfg_cmd - mark what commands ucode should wait for
151  * before finishing init flows
152  * @init_flags: values from iwl_extended_cfg_flags
153  */
154 struct iwl_init_extended_cfg_cmd {
155 	__le32 init_flags;
156 } __packed; /* INIT_EXTENDED_CFG_CMD_API_S_VER_1 */
157 
158 /**
159  * struct iwl_radio_version_notif - information on the radio version
160  * ( RADIO_VERSION_NOTIFICATION = 0x68 )
161  * @radio_flavor: radio flavor
162  * @radio_step: radio version step
163  * @radio_dash: radio version dash
164  */
165 struct iwl_radio_version_notif {
166 	__le32 radio_flavor;
167 	__le32 radio_step;
168 	__le32 radio_dash;
169 } __packed; /* RADIO_VERSION_NOTOFICATION_S_VER_1 */
170 
171 enum iwl_card_state_flags {
172 	CARD_ENABLED		= 0x00,
173 	HW_CARD_DISABLED	= 0x01,
174 	SW_CARD_DISABLED	= 0x02,
175 	CT_KILL_CARD_DISABLED	= 0x04,
176 	HALT_CARD_DISABLED	= 0x08,
177 	CARD_DISABLED_MSK	= 0x0f,
178 	CARD_IS_RX_ON		= 0x10,
179 };
180 
181 /**
182  * struct iwl_radio_version_notif - information on the card state
183  * ( CARD_STATE_NOTIFICATION = 0xa1 )
184  * @flags: &enum iwl_card_state_flags
185  */
186 struct iwl_card_state_notif {
187 	__le32 flags;
188 } __packed; /* CARD_STATE_NTFY_API_S_VER_1 */
189 
190 /**
191  * struct iwl_fseq_ver_mismatch_nty - Notification about version
192  *
193  * This notification does not have a direct impact on the init flow.
194  * It means that another core (not WiFi) has initiated the FSEQ flow
195  * and updated the FSEQ version.  The driver only prints an error when
196  * this occurs.
197  *
198  * @aux_read_fseq_ver: auxiliary read FSEQ version
199  * @wifi_fseq_ver: FSEQ version (embedded in WiFi)
200  */
201 struct iwl_fseq_ver_mismatch_ntf {
202 	__le32 aux_read_fseq_ver;
203 	__le32 wifi_fseq_ver;
204 } __packed; /* FSEQ_VER_MISMATCH_NTFY_API_S_VER_1 */
205 
206 #endif /* __iwl_fw_api_alive_h__ */
207