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) 2008 - 2014 Intel Corporation. All rights reserved. 9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of version 2 of the GNU General Public License as 13 * published by the Free Software Foundation. 14 * 15 * This program is distributed in the hope that it will be useful, but 16 * WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program; if not, write to the Free Software 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, 23 * USA 24 * 25 * The full GNU General Public License is included in this distribution 26 * in the file called COPYING. 27 * 28 * Contact Information: 29 * Intel Linux Wireless <ilw@linux.intel.com> 30 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 31 * 32 * BSD LICENSE 33 * 34 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 35 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 36 * All rights reserved. 37 * 38 * Redistribution and use in source and binary forms, with or without 39 * modification, are permitted provided that the following conditions 40 * are met: 41 * 42 * * Redistributions of source code must retain the above copyright 43 * notice, this list of conditions and the following disclaimer. 44 * * Redistributions in binary form must reproduce the above copyright 45 * notice, this list of conditions and the following disclaimer in 46 * the documentation and/or other materials provided with the 47 * distribution. 48 * * Neither the name Intel Corporation nor the names of its 49 * contributors may be used to endorse or promote products derived 50 * from this software without specific prior written permission. 51 * 52 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 53 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 54 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 55 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 56 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 57 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 58 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 59 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 60 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 61 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 62 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 63 *****************************************************************************/ 64 65 #ifndef __iwl_fw_file_h__ 66 #define __iwl_fw_file_h__ 67 68 #include <linux/netdevice.h> 69 70 /* v1/v2 uCode file layout */ 71 struct iwl_ucode_header { 72 __le32 ver; /* major/minor/API/serial */ 73 union { 74 struct { 75 __le32 inst_size; /* bytes of runtime code */ 76 __le32 data_size; /* bytes of runtime data */ 77 __le32 init_size; /* bytes of init code */ 78 __le32 init_data_size; /* bytes of init data */ 79 __le32 boot_size; /* bytes of bootstrap code */ 80 u8 data[0]; /* in same order as sizes */ 81 } v1; 82 struct { 83 __le32 build; /* build number */ 84 __le32 inst_size; /* bytes of runtime code */ 85 __le32 data_size; /* bytes of runtime data */ 86 __le32 init_size; /* bytes of init code */ 87 __le32 init_data_size; /* bytes of init data */ 88 __le32 boot_size; /* bytes of bootstrap code */ 89 u8 data[0]; /* in same order as sizes */ 90 } v2; 91 } u; 92 }; 93 94 /* 95 * new TLV uCode file layout 96 * 97 * The new TLV file format contains TLVs, that each specify 98 * some piece of data. 99 */ 100 101 enum iwl_ucode_tlv_type { 102 IWL_UCODE_TLV_INVALID = 0, /* unused */ 103 IWL_UCODE_TLV_INST = 1, 104 IWL_UCODE_TLV_DATA = 2, 105 IWL_UCODE_TLV_INIT = 3, 106 IWL_UCODE_TLV_INIT_DATA = 4, 107 IWL_UCODE_TLV_BOOT = 5, 108 IWL_UCODE_TLV_PROBE_MAX_LEN = 6, /* a u32 value */ 109 IWL_UCODE_TLV_PAN = 7, 110 IWL_UCODE_TLV_RUNT_EVTLOG_PTR = 8, 111 IWL_UCODE_TLV_RUNT_EVTLOG_SIZE = 9, 112 IWL_UCODE_TLV_RUNT_ERRLOG_PTR = 10, 113 IWL_UCODE_TLV_INIT_EVTLOG_PTR = 11, 114 IWL_UCODE_TLV_INIT_EVTLOG_SIZE = 12, 115 IWL_UCODE_TLV_INIT_ERRLOG_PTR = 13, 116 IWL_UCODE_TLV_ENHANCE_SENS_TBL = 14, 117 IWL_UCODE_TLV_PHY_CALIBRATION_SIZE = 15, 118 IWL_UCODE_TLV_WOWLAN_INST = 16, 119 IWL_UCODE_TLV_WOWLAN_DATA = 17, 120 IWL_UCODE_TLV_FLAGS = 18, 121 IWL_UCODE_TLV_SEC_RT = 19, 122 IWL_UCODE_TLV_SEC_INIT = 20, 123 IWL_UCODE_TLV_SEC_WOWLAN = 21, 124 IWL_UCODE_TLV_DEF_CALIB = 22, 125 IWL_UCODE_TLV_PHY_SKU = 23, 126 IWL_UCODE_TLV_SECURE_SEC_RT = 24, 127 IWL_UCODE_TLV_SECURE_SEC_INIT = 25, 128 IWL_UCODE_TLV_SECURE_SEC_WOWLAN = 26, 129 IWL_UCODE_TLV_NUM_OF_CPU = 27, 130 IWL_UCODE_TLV_CSCHEME = 28, 131 IWL_UCODE_TLV_API_CHANGES_SET = 29, 132 IWL_UCODE_TLV_ENABLED_CAPABILITIES = 30, 133 IWL_UCODE_TLV_N_SCAN_CHANNELS = 31, 134 }; 135 136 struct iwl_ucode_tlv { 137 __le32 type; /* see above */ 138 __le32 length; /* not including type/length fields */ 139 u8 data[0]; 140 }; 141 142 #define IWL_TLV_UCODE_MAGIC 0x0a4c5749 143 #define FW_VER_HUMAN_READABLE_SZ 64 144 145 struct iwl_tlv_ucode_header { 146 /* 147 * The TLV style ucode header is distinguished from 148 * the v1/v2 style header by first four bytes being 149 * zero, as such is an invalid combination of 150 * major/minor/API/serial versions. 151 */ 152 __le32 zero; 153 __le32 magic; 154 u8 human_readable[FW_VER_HUMAN_READABLE_SZ]; 155 __le32 ver; /* major/minor/API/serial */ 156 __le32 build; 157 __le64 ignore; 158 /* 159 * The data contained herein has a TLV layout, 160 * see above for the TLV header and types. 161 * Note that each TLV is padded to a length 162 * that is a multiple of 4 for alignment. 163 */ 164 u8 data[0]; 165 }; 166 167 /* 168 * ucode TLVs 169 * 170 * ability to get extension for: flags & capabilities from ucode binaries files 171 */ 172 struct iwl_ucode_api { 173 __le32 api_index; 174 __le32 api_flags; 175 } __packed; 176 177 struct iwl_ucode_capa { 178 __le32 api_index; 179 __le32 api_capa; 180 } __packed; 181 182 #endif /* __iwl_fw_file_h__ */ 183