linux/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
<<
>>
Prefs
   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_nvm_reg_h__
  64#define __iwl_fw_api_nvm_reg_h__
  65
  66/**
  67 * enum iwl_regulatory_and_nvm_subcmd_ids - regulatory/NVM commands
  68 */
  69enum iwl_regulatory_and_nvm_subcmd_ids {
  70        /**
  71         * @NVM_ACCESS_COMPLETE: &struct iwl_nvm_access_complete_cmd
  72         */
  73        NVM_ACCESS_COMPLETE = 0x0,
  74
  75        /**
  76         * @NVM_GET_INFO:
  77         * Command is &struct iwl_nvm_get_info,
  78         * response is &struct iwl_nvm_get_info_rsp
  79         */
  80        NVM_GET_INFO = 0x2,
  81};
  82
  83/**
  84 * enum iwl_nvm_access_op - NVM access opcode
  85 * @IWL_NVM_READ: read NVM
  86 * @IWL_NVM_WRITE: write NVM
  87 */
  88enum iwl_nvm_access_op {
  89        IWL_NVM_READ    = 0,
  90        IWL_NVM_WRITE   = 1,
  91};
  92
  93/**
  94 * enum iwl_nvm_access_target - target of the NVM_ACCESS_CMD
  95 * @NVM_ACCESS_TARGET_CACHE: access the cache
  96 * @NVM_ACCESS_TARGET_OTP: access the OTP
  97 * @NVM_ACCESS_TARGET_EEPROM: access the EEPROM
  98 */
  99enum iwl_nvm_access_target {
 100        NVM_ACCESS_TARGET_CACHE = 0,
 101        NVM_ACCESS_TARGET_OTP = 1,
 102        NVM_ACCESS_TARGET_EEPROM = 2,
 103};
 104
 105/**
 106 * enum iwl_nvm_section_type - section types for NVM_ACCESS_CMD
 107 * @NVM_SECTION_TYPE_SW: software section
 108 * @NVM_SECTION_TYPE_REGULATORY: regulatory section
 109 * @NVM_SECTION_TYPE_CALIBRATION: calibration section
 110 * @NVM_SECTION_TYPE_PRODUCTION: production section
 111 * @NVM_SECTION_TYPE_REGULATORY_SDP: regulatory section used by 3168 series
 112 * @NVM_SECTION_TYPE_MAC_OVERRIDE: MAC override section
 113 * @NVM_SECTION_TYPE_PHY_SKU: PHY SKU section
 114 * @NVM_MAX_NUM_SECTIONS: number of sections
 115 */
 116enum iwl_nvm_section_type {
 117        NVM_SECTION_TYPE_SW = 1,
 118        NVM_SECTION_TYPE_REGULATORY = 3,
 119        NVM_SECTION_TYPE_CALIBRATION = 4,
 120        NVM_SECTION_TYPE_PRODUCTION = 5,
 121        NVM_SECTION_TYPE_REGULATORY_SDP = 8,
 122        NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
 123        NVM_SECTION_TYPE_PHY_SKU = 12,
 124        NVM_MAX_NUM_SECTIONS = 13,
 125};
 126
 127/**
 128 * struct iwl_nvm_access_cmd - Request the device to send an NVM section
 129 * @op_code: &enum iwl_nvm_access_op
 130 * @target: &enum iwl_nvm_access_target
 131 * @type: &enum iwl_nvm_section_type
 132 * @offset: offset in bytes into the section
 133 * @length: in bytes, to read/write
 134 * @data: if write operation, the data to write. On read its empty
 135 */
 136struct iwl_nvm_access_cmd {
 137        u8 op_code;
 138        u8 target;
 139        __le16 type;
 140        __le16 offset;
 141        __le16 length;
 142        u8 data[];
 143} __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */
 144
 145/**
 146 * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD
 147 * @offset: offset in bytes into the section
 148 * @length: in bytes, either how much was written or read
 149 * @type: NVM_SECTION_TYPE_*
 150 * @status: 0 for success, fail otherwise
 151 * @data: if read operation, the data returned. Empty on write.
 152 */
 153struct iwl_nvm_access_resp {
 154        __le16 offset;
 155        __le16 length;
 156        __le16 type;
 157        __le16 status;
 158        u8 data[];
 159} __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */
 160
 161/*
 162 * struct iwl_nvm_get_info - request to get NVM data
 163 */
 164struct iwl_nvm_get_info {
 165        __le32 reserved;
 166} __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_S_VER_1 */
 167
 168/**
 169 * enum iwl_nvm_info_general_flags - flags in NVM_GET_INFO resp
 170 * @NVM_GENERAL_FLAGS_EMPTY_OTP: 1 if OTP is empty
 171 */
 172enum iwl_nvm_info_general_flags {
 173        NVM_GENERAL_FLAGS_EMPTY_OTP     = BIT(0),
 174};
 175
 176/**
 177 * struct iwl_nvm_get_info_general - general NVM data
 178 * @flags: bit 0: 1 - empty, 0 - non-empty
 179 * @nvm_version: nvm version
 180 * @board_type: board type
 181 * @reserved: reserved
 182 */
 183struct iwl_nvm_get_info_general {
 184        __le32 flags;
 185        __le16 nvm_version;
 186        u8 board_type;
 187        u8 reserved;
 188} __packed; /* GRP_REGULATORY_NVM_GET_INFO_GENERAL_S_VER_1 */
 189
 190/**
 191 * struct iwl_nvm_get_info_sku - mac information
 192 * @enable_24g: band 2.4G enabled
 193 * @enable_5g: band 5G enabled
 194 * @enable_11n: 11n enabled
 195 * @enable_11ac: 11ac enabled
 196 * @mimo_disable: MIMO enabled
 197 * @ext_crypto: Extended crypto enabled
 198 */
 199struct iwl_nvm_get_info_sku {
 200        __le32 enable_24g;
 201        __le32 enable_5g;
 202        __le32 enable_11n;
 203        __le32 enable_11ac;
 204        __le32 mimo_disable;
 205        __le32 ext_crypto;
 206} __packed; /* GRP_REGULATORY_NVM_GET_INFO_MAC_SKU_SECTION_S_VER_1 */
 207
 208/**
 209 * struct iwl_nvm_get_info_phy - phy information
 210 * @tx_chains: BIT 0 chain A, BIT 1 chain B
 211 * @rx_chains: BIT 0 chain A, BIT 1 chain B
 212 */
 213struct iwl_nvm_get_info_phy {
 214        __le32 tx_chains;
 215        __le32 rx_chains;
 216} __packed; /* GRP_REGULATORY_NVM_GET_INFO_PHY_SKU_SECTION_S_VER_1 */
 217
 218#define IWL_NUM_CHANNELS (51)
 219
 220/**
 221 * struct iwl_nvm_get_info_regulatory - regulatory information
 222 * @lar_enabled: is LAR enabled
 223 * @channel_profile: regulatory data of this channel
 224 * @reserved: reserved
 225 */
 226struct iwl_nvm_get_info_regulatory {
 227        __le32 lar_enabled;
 228        __le16 channel_profile[IWL_NUM_CHANNELS];
 229        __le16 reserved;
 230} __packed; /* GRP_REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */
 231
 232/**
 233 * struct iwl_nvm_get_info_rsp - response to get NVM data
 234 * @general: general NVM data
 235 * @mac_sku: data relating to MAC sku
 236 * @phy_sku: data relating to PHY sku
 237 * @regulatory: regulatory data
 238 */
 239struct iwl_nvm_get_info_rsp {
 240        struct iwl_nvm_get_info_general general;
 241        struct iwl_nvm_get_info_sku mac_sku;
 242        struct iwl_nvm_get_info_phy phy_sku;
 243        struct iwl_nvm_get_info_regulatory regulatory;
 244} __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_RSP_S_VER_1 */
 245
 246/**
 247 * struct iwl_nvm_access_complete_cmd - NVM_ACCESS commands are completed
 248 * @reserved: reserved
 249 */
 250struct iwl_nvm_access_complete_cmd {
 251        __le32 reserved;
 252} __packed; /* NVM_ACCESS_COMPLETE_CMD_API_S_VER_1 */
 253
 254/**
 255 * struct iwl_mcc_update_cmd_v1 - Request the device to update geographic
 256 * regulatory profile according to the given MCC (Mobile Country Code).
 257 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
 258 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
 259 * MCC in the cmd response will be the relevant MCC in the NVM.
 260 * @mcc: given mobile country code
 261 * @source_id: the source from where we got the MCC, see iwl_mcc_source
 262 * @reserved: reserved for alignment
 263 */
 264struct iwl_mcc_update_cmd_v1 {
 265        __le16 mcc;
 266        u8 source_id;
 267        u8 reserved;
 268} __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_1 */
 269
 270/**
 271 * struct iwl_mcc_update_cmd - Request the device to update geographic
 272 * regulatory profile according to the given MCC (Mobile Country Code).
 273 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
 274 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
 275 * MCC in the cmd response will be the relevant MCC in the NVM.
 276 * @mcc: given mobile country code
 277 * @source_id: the source from where we got the MCC, see iwl_mcc_source
 278 * @reserved: reserved for alignment
 279 * @key: integrity key for MCC API OEM testing
 280 * @reserved2: reserved
 281 */
 282struct iwl_mcc_update_cmd {
 283        __le16 mcc;
 284        u8 source_id;
 285        u8 reserved;
 286        __le32 key;
 287        u8 reserved2[20];
 288} __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_2 */
 289
 290/**
 291 * struct iwl_mcc_update_resp_v1  - response to MCC_UPDATE_CMD.
 292 * Contains the new channel control profile map, if changed, and the new MCC
 293 * (mobile country code).
 294 * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
 295 * @status: see &enum iwl_mcc_update_status
 296 * @mcc: the new applied MCC
 297 * @cap: capabilities for all channels which matches the MCC
 298 * @source_id: the MCC source, see iwl_mcc_source
 299 * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
 300 *              channels, depending on platform)
 301 * @channels: channel control data map, DWORD for each channel. Only the first
 302 *      16bits are used.
 303 */
 304struct iwl_mcc_update_resp_v1  {
 305        __le32 status;
 306        __le16 mcc;
 307        u8 cap;
 308        u8 source_id;
 309        __le32 n_channels;
 310        __le32 channels[0];
 311} __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_1 */
 312
 313/**
 314 * struct iwl_mcc_update_resp - response to MCC_UPDATE_CMD.
 315 * Contains the new channel control profile map, if changed, and the new MCC
 316 * (mobile country code).
 317 * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
 318 * @status: see &enum iwl_mcc_update_status
 319 * @mcc: the new applied MCC
 320 * @cap: capabilities for all channels which matches the MCC
 321 * @source_id: the MCC source, see iwl_mcc_source
 322 * @time: time elapsed from the MCC test start (in 30 seconds TU)
 323 * @reserved: reserved.
 324 * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
 325 *              channels, depending on platform)
 326 * @channels: channel control data map, DWORD for each channel. Only the first
 327 *      16bits are used.
 328 */
 329struct iwl_mcc_update_resp {
 330        __le32 status;
 331        __le16 mcc;
 332        u8 cap;
 333        u8 source_id;
 334        __le16 time;
 335        __le16 reserved;
 336        __le32 n_channels;
 337        __le32 channels[0];
 338} __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_2 */
 339
 340/**
 341 * struct iwl_mcc_chub_notif - chub notifies of mcc change
 342 * (MCC_CHUB_UPDATE_CMD = 0xc9)
 343 * The Chub (Communication Hub, CommsHUB) is a HW component that connects to
 344 * the cellular and connectivity cores that gets updates of the mcc, and
 345 * notifies the ucode directly of any mcc change.
 346 * The ucode requests the driver to request the device to update geographic
 347 * regulatory  profile according to the given MCC (Mobile Country Code).
 348 * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
 349 * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
 350 * MCC in the cmd response will be the relevant MCC in the NVM.
 351 * @mcc: given mobile country code
 352 * @source_id: identity of the change originator, see iwl_mcc_source
 353 * @reserved1: reserved for alignment
 354 */
 355struct iwl_mcc_chub_notif {
 356        __le16 mcc;
 357        u8 source_id;
 358        u8 reserved1;
 359} __packed; /* LAR_MCC_NOTIFY_S */
 360
 361enum iwl_mcc_update_status {
 362        MCC_RESP_NEW_CHAN_PROFILE,
 363        MCC_RESP_SAME_CHAN_PROFILE,
 364        MCC_RESP_INVALID,
 365        MCC_RESP_NVM_DISABLED,
 366        MCC_RESP_ILLEGAL,
 367        MCC_RESP_LOW_PRIORITY,
 368        MCC_RESP_TEST_MODE_ACTIVE,
 369        MCC_RESP_TEST_MODE_NOT_ACTIVE,
 370        MCC_RESP_TEST_MODE_DENIAL_OF_SERVICE,
 371};
 372
 373enum iwl_mcc_source {
 374        MCC_SOURCE_OLD_FW = 0,
 375        MCC_SOURCE_ME = 1,
 376        MCC_SOURCE_BIOS = 2,
 377        MCC_SOURCE_3G_LTE_HOST = 3,
 378        MCC_SOURCE_3G_LTE_DEVICE = 4,
 379        MCC_SOURCE_WIFI = 5,
 380        MCC_SOURCE_RESERVED = 6,
 381        MCC_SOURCE_DEFAULT = 7,
 382        MCC_SOURCE_UNINITIALIZED = 8,
 383        MCC_SOURCE_MCC_API = 9,
 384        MCC_SOURCE_GET_CURRENT = 0x10,
 385        MCC_SOURCE_GETTING_MCC_TEST_MODE = 0x11,
 386};
 387
 388#endif /* __iwl_fw_api_nvm_reg_h__ */
 389