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_alive {
100 	__le32 ucode_major;
101 	__le32 ucode_minor;
102 	u8 ver_subtype;
103 	u8 ver_type;
104 	u8 mac;
105 	u8 opt;
106 	__le32 timestamp;
107 	__le32 error_event_table_ptr;	/* SRAM address for error log */
108 	__le32 log_event_table_ptr;	/* SRAM address for LMAC event log */
109 	__le32 cpu_register_ptr;
110 	__le32 dbgm_config_ptr;
111 	__le32 alive_counter_ptr;
112 	__le32 scd_base_ptr;		/* SRAM address for SCD */
113 	__le32 st_fwrd_addr;		/* pointer to Store and forward */
114 	__le32 st_fwrd_size;
115 } __packed; /* UCODE_ALIVE_NTFY_API_S_VER_3 */
116 
117 struct iwl_umac_alive {
118 	__le32 umac_major;		/* UMAC version: major */
119 	__le32 umac_minor;		/* UMAC version: minor */
120 	__le32 error_info_addr;		/* SRAM address for UMAC error log */
121 	__le32 dbg_print_buff_addr;
122 } __packed; /* UMAC_ALIVE_DATA_API_S_VER_2 */
123 
124 struct mvm_alive_resp_v3 {
125 	__le16 status;
126 	__le16 flags;
127 	struct iwl_lmac_alive lmac_data;
128 	struct iwl_umac_alive umac_data;
129 } __packed; /* ALIVE_RES_API_S_VER_3 */
130 
131 struct mvm_alive_resp {
132 	__le16 status;
133 	__le16 flags;
134 	struct iwl_lmac_alive lmac_data[2];
135 	struct iwl_umac_alive umac_data;
136 } __packed; /* ALIVE_RES_API_S_VER_4 */
137 
138 /**
139  * enum iwl_extended_cfg_flag - commands driver may send before
140  *	finishing init flow
141  * @IWL_INIT_DEBUG_CFG: driver is going to send debug config command
142  * @IWL_INIT_NVM: driver is going to send NVM_ACCESS commands
143  * @IWL_INIT_PHY: driver is going to send PHY_DB commands
144  */
145 enum iwl_extended_cfg_flags {
146 	IWL_INIT_DEBUG_CFG,
147 	IWL_INIT_NVM,
148 	IWL_INIT_PHY,
149 };
150 
151 /**
152  * struct iwl_extended_cfg_cmd - mark what commands ucode should wait for
153  * before finishing init flows
154  * @init_flags: values from iwl_extended_cfg_flags
155  */
156 struct iwl_init_extended_cfg_cmd {
157 	__le32 init_flags;
158 } __packed; /* INIT_EXTENDED_CFG_CMD_API_S_VER_1 */
159 
160 /**
161  * struct iwl_radio_version_notif - information on the radio version
162  * ( RADIO_VERSION_NOTIFICATION = 0x68 )
163  * @radio_flavor: radio flavor
164  * @radio_step: radio version step
165  * @radio_dash: radio version dash
166  */
167 struct iwl_radio_version_notif {
168 	__le32 radio_flavor;
169 	__le32 radio_step;
170 	__le32 radio_dash;
171 } __packed; /* RADIO_VERSION_NOTOFICATION_S_VER_1 */
172 
173 enum iwl_card_state_flags {
174 	CARD_ENABLED		= 0x00,
175 	HW_CARD_DISABLED	= 0x01,
176 	SW_CARD_DISABLED	= 0x02,
177 	CT_KILL_CARD_DISABLED	= 0x04,
178 	HALT_CARD_DISABLED	= 0x08,
179 	CARD_DISABLED_MSK	= 0x0f,
180 	CARD_IS_RX_ON		= 0x10,
181 };
182 
183 /**
184  * struct iwl_radio_version_notif - information on the card state
185  * ( CARD_STATE_NOTIFICATION = 0xa1 )
186  * @flags: &enum iwl_card_state_flags
187  */
188 struct iwl_card_state_notif {
189 	__le32 flags;
190 } __packed; /* CARD_STATE_NTFY_API_S_VER_1 */
191 
192 #endif /* __iwl_fw_api_alive_h__ */
193