forked from Minki/linux
0692fe41b3
Through the driver, struct iwl_fw will store the firmware. Split this out into a separate file, iwl-fw.h, and make all other code use it. To do this, also move the log pointers into it, and remove the knowledge of "nic" from everything. Now the op_mode has a fw pointer, and (unfortunately) for now the shared data also needs to keep one for the transport to access dump the error log -- I think that will move later. Since I wanted to constify the firmware pointers, some more changes were needed. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
147 lines
5.5 KiB
C
147 lines
5.5 KiB
C
/******************************************************************************
|
|
*
|
|
* This file is provided under a dual BSD/GPLv2 license. When using or
|
|
* redistributing this file, you may do so under either license.
|
|
*
|
|
* GPL LICENSE SUMMARY
|
|
*
|
|
* Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of version 2 of the GNU General Public License as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
|
|
* USA
|
|
*
|
|
* The full GNU General Public License is included in this distribution
|
|
* in the file called LICENSE.GPL.
|
|
*
|
|
* Contact Information:
|
|
* Intel Linux Wireless <ilw@linux.intel.com>
|
|
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
|
*
|
|
* BSD LICENSE
|
|
*
|
|
* Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
*
|
|
* * Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in
|
|
* the documentation and/or other materials provided with the
|
|
* distribution.
|
|
* * Neither the name Intel Corporation nor the names of its
|
|
* contributors may be used to endorse or promote products derived
|
|
* from this software without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*****************************************************************************/
|
|
|
|
#ifndef __iwl_fw_h__
|
|
#define __iwl_fw_h__
|
|
#include <linux/types.h>
|
|
|
|
/**
|
|
* enum iwl_ucode_tlv_flag - ucode API flags
|
|
* @IWL_UCODE_TLV_FLAGS_PAN: This is PAN capable microcode; this previously
|
|
* was a separate TLV but moved here to save space.
|
|
* @IWL_UCODE_TLV_FLAGS_NEWSCAN: new uCode scan behaviour on hidden SSID,
|
|
* treats good CRC threshold as a boolean
|
|
* @IWL_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w).
|
|
* @IWL_UCODE_TLV_FLAGS_P2P: This uCode image supports P2P.
|
|
*/
|
|
enum iwl_ucode_tlv_flag {
|
|
IWL_UCODE_TLV_FLAGS_PAN = BIT(0),
|
|
IWL_UCODE_TLV_FLAGS_NEWSCAN = BIT(1),
|
|
IWL_UCODE_TLV_FLAGS_MFP = BIT(2),
|
|
IWL_UCODE_TLV_FLAGS_P2P = BIT(3),
|
|
};
|
|
|
|
/* The default calibrate table size if not specified by firmware file */
|
|
#define IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18
|
|
#define IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE 19
|
|
#define IWL_MAX_PHY_CALIBRATE_TBL_SIZE 253
|
|
|
|
struct iwl_ucode_capabilities {
|
|
u32 max_probe_length;
|
|
u32 standard_phy_calibration_size;
|
|
u32 flags;
|
|
};
|
|
|
|
/* one for each uCode image (inst/data, boot/init/runtime) */
|
|
struct fw_desc {
|
|
dma_addr_t p_addr; /* hardware address */
|
|
void *v_addr; /* software address */
|
|
u32 len; /* size in bytes */
|
|
};
|
|
|
|
struct fw_img {
|
|
struct fw_desc code; /* firmware code image */
|
|
struct fw_desc data; /* firmware data image */
|
|
};
|
|
|
|
/* uCode version contains 4 values: Major/Minor/API/Serial */
|
|
#define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24)
|
|
#define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16)
|
|
#define IWL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8)
|
|
#define IWL_UCODE_SERIAL(ver) ((ver) & 0x000000FF)
|
|
|
|
/**
|
|
* struct iwl_fw - variables associated with the firmware
|
|
*
|
|
* @ucode_ver: ucode version from the ucode file
|
|
* @fw_version: firmware version string
|
|
* @ucode_rt: run time ucode image
|
|
* @ucode_init: init ucode image
|
|
* @ucode_wowlan: wake on wireless ucode image (optional)
|
|
* @ucode_capa: capabilities parsed from the ucode file.
|
|
* @enhance_sensitivity_table: device can do enhanced sensitivity.
|
|
* @init_evtlog_ptr: event log offset for init ucode.
|
|
* @init_evtlog_size: event log size for init ucode.
|
|
* @init_errlog_ptr: error log offfset for init ucode.
|
|
* @inst_evtlog_ptr: event log offset for runtime ucode.
|
|
* @inst_evtlog_size: event log size for runtime ucode.
|
|
* @inst_errlog_ptr: error log offfset for runtime ucode.
|
|
*/
|
|
struct iwl_fw {
|
|
u32 ucode_ver;
|
|
|
|
char fw_version[ETHTOOL_BUSINFO_LEN];
|
|
|
|
/* ucode images */
|
|
struct fw_img ucode_rt;
|
|
struct fw_img ucode_init;
|
|
struct fw_img ucode_wowlan;
|
|
|
|
struct iwl_ucode_capabilities ucode_capa;
|
|
bool enhance_sensitivity_table;
|
|
|
|
u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr;
|
|
u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr;
|
|
};
|
|
|
|
#endif /* __iwl_fw_h__ */
|