blob: d5194879988a05c89d5ea884fbf64528813e7755 [file] [log] [blame]
Emmanuel Grumbach48f20d32011-08-25 23:10:36 -07001/******************************************************************************
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 *
Wey-Yi Guy4e318262011-12-27 11:21:32 -08008 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
Emmanuel Grumbach48f20d32011-08-25 23:10:36 -07009 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
22 * USA
23 *
24 * The full GNU General Public License is included in this distribution
25 * in the file called LICENSE.GPL.
26 *
27 * Contact Information:
28 * Intel Linux Wireless <ilw@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30 *
31 * BSD LICENSE
32 *
Wey-Yi Guy4e318262011-12-27 11:21:32 -080033 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
Emmanuel Grumbach48f20d32011-08-25 23:10:36 -070034 * All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 *
40 * * Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * * Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in
44 * the documentation and/or other materials provided with the
45 * distribution.
46 * * Neither the name Intel Corporation nor the names of its
47 * contributors may be used to endorse or promote products derived
48 * from this software without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *
62 *****************************************************************************/
63#ifndef __iwl_shared_h__
64#define __iwl_shared_h__
65
Emmanuel Grumbacha72b8b02011-08-25 23:11:13 -070066#include <linux/types.h>
67#include <linux/spinlock.h>
Emmanuel Grumbacha72b8b02011-08-25 23:11:13 -070068#include <linux/gfp.h>
Emmanuel Grumbachba562f72011-08-25 23:11:22 -070069#include <net/mac80211.h>
Emmanuel Grumbacha72b8b02011-08-25 23:11:13 -070070
Emmanuel Grumbach5f85a782011-08-25 23:11:18 -070071#include "iwl-commands.h"
Johannes Berg0692fe42012-03-06 13:30:37 -080072#include "iwl-fw.h"
Johannes Berg2aac73f2012-04-09 17:46:59 -070073#include "iwl-config.h"
Emmanuel Grumbach5f85a782011-08-25 23:11:18 -070074
Emmanuel Grumbach21023e22011-09-15 11:46:34 -070075/**
76 * DOC: shared area - role and goal
77 *
78 * The shared area contains all the data exported by the upper layer to the
79 * other layers. Since the bus and transport layer shouldn't dereference
80 * iwl_priv, all the data needed by the upper layer and the transport / bus
81 * layer must be here.
82 * The shared area also holds pointer to all the other layers. This allows a
83 * layer to call a function from another layer.
84 *
85 * NOTE: All the layers hold a pointer to the shared area which must be shrd.
86 * A few macros assume that (_m)->shrd points to the shared area no matter
87 * what _m is.
88 *
89 * gets notifications about enumeration, suspend, resume.
90 * For the moment, the bus layer is not a linux kernel module as itself, and
91 * the module_init function of the driver must call the bus specific
92 * registration functions. These functions are listed at the end of this file.
93 * For the moment, there is only one implementation of this interface: PCI-e.
94 * This implementation is iwl-pci.c
95 */
Emmanuel Grumbache6bb4c92011-08-25 23:10:48 -070096
Emmanuel Grumbach48f20d32011-08-25 23:10:36 -070097struct iwl_priv;
Don Fryae6130f2011-11-30 16:12:59 -080098struct iwl_trans;
Emmanuel Grumbache6bb4c92011-08-25 23:10:48 -070099struct iwl_trans_ops;
Emmanuel Grumbach48f20d32011-08-25 23:10:36 -0700100
Don Fry3c607d22011-09-30 11:40:20 -0700101#define DRV_NAME "iwlwifi"
Emmanuel Grumbach332a4ba2011-08-25 23:11:16 -0700102#define IWLWIFI_VERSION "in-tree:"
Wey-Yi Guy4e318262011-12-27 11:21:32 -0800103#define DRV_COPYRIGHT "Copyright(c) 2003-2012 Intel Corporation"
Emmanuel Grumbach332a4ba2011-08-25 23:11:16 -0700104#define DRV_AUTHOR "<ilw@linux.intel.com>"
105
Emmanuel Grumbach48f20d32011-08-25 23:10:36 -0700106extern struct iwl_mod_params iwlagn_mod_params;
107
Johannes Berg74289942011-12-13 00:07:40 -0800108#define IWL_DISABLE_HT_ALL BIT(0)
109#define IWL_DISABLE_HT_TXAGG BIT(1)
110#define IWL_DISABLE_HT_RXAGG BIT(2)
111
Wey-Yi Guye4ef84d2011-08-25 23:10:58 -0700112/**
113 * struct iwl_mod_params
Emmanuel Grumbach21023e22011-09-15 11:46:34 -0700114 *
115 * Holds the module parameters
116 *
Wey-Yi Guye4ef84d2011-08-25 23:10:58 -0700117 * @sw_crypto: using hardware encryption, default = 0
Johannes Berg74289942011-12-13 00:07:40 -0800118 * @disable_11n: disable 11n capabilities, default = 0,
119 * use IWL_DISABLE_HT_* constants
Wey-Yi Guye4ef84d2011-08-25 23:10:58 -0700120 * @amsdu_size_8K: enable 8K amsdu size, default = 1
Wey-Yi Guye4ef84d2011-08-25 23:10:58 -0700121 * @restart_fw: restart firmware, default = 1
122 * @plcp_check: enable plcp health check, default = true
Wey-Yi Guy9995ffe2011-12-02 08:19:19 -0800123 * @wd_disable: enable stuck queue check, default = 0
Wey-Yi Guye4ef84d2011-08-25 23:10:58 -0700124 * @bt_coex_active: enable bt coex, default = true
125 * @led_mode: system default, default = 0
Wey-Yi Guye4ef84d2011-08-25 23:10:58 -0700126 * @power_save: disable power save, default = false
127 * @power_level: power level, default = 1
128 * @debug_level: levels are IWL_DL_*
129 * @ant_coupling: antenna coupling in dB, default = 0
130 * @bt_ch_announce: BT channel inhibition, default = enable
Wey-Yi Guye4ef84d2011-08-25 23:10:58 -0700131 * @auto_agg: enable agg. without check, default = true
132 */
Emmanuel Grumbach48f20d32011-08-25 23:10:36 -0700133struct iwl_mod_params {
Wey-Yi Guye4ef84d2011-08-25 23:10:58 -0700134 int sw_crypto;
Johannes Berg74289942011-12-13 00:07:40 -0800135 unsigned int disable_11n;
Wey-Yi Guye4ef84d2011-08-25 23:10:58 -0700136 int amsdu_size_8K;
Wey-Yi Guye4ef84d2011-08-25 23:10:58 -0700137 int restart_fw;
138 bool plcp_check;
Wey-Yi Guy9995ffe2011-12-02 08:19:19 -0800139 int wd_disable;
Wey-Yi Guye4ef84d2011-08-25 23:10:58 -0700140 bool bt_coex_active;
141 int led_mode;
Wey-Yi Guye4ef84d2011-08-25 23:10:58 -0700142 bool power_save;
143 int power_level;
144 u32 debug_level;
Emmanuel Grumbach48f20d32011-08-25 23:10:36 -0700145 int ant_coupling;
Wey-Yi Guye4ef84d2011-08-25 23:10:58 -0700146 bool bt_ch_announce;
Wey-Yi Guye4ef84d2011-08-25 23:10:58 -0700147 bool auto_agg;
Emmanuel Grumbach48f20d32011-08-25 23:10:36 -0700148};
149
Don Fry38622412011-12-16 07:07:36 -0800150/**
Emmanuel Grumbachcac988a2011-08-25 23:10:37 -0700151 * struct iwl_shared - shared fields for all the layers of the driver
152 *
Don Fry38622412011-12-16 07:07:36 -0800153 * @cfg: see struct iwl_cfg
Emmanuel Grumbach23fd7b02011-12-07 14:46:24 +0200154 * @trans: pointer to the transport layer data
Emmanuel Grumbachcac988a2011-08-25 23:10:37 -0700155 */
156struct iwl_shared {
Johannes Berg706c4ff2012-03-05 11:24:33 -0800157 const struct iwl_cfg *cfg;
Emmanuel Grumbache6bb4c92011-08-25 23:10:48 -0700158 struct iwl_trans *trans;
Emmanuel Grumbachcac988a2011-08-25 23:10:37 -0700159};
160
Emmanuel Grumbach36a79222012-02-27 13:53:32 -0800161/*Whatever _m is (iwl_trans, iwl_priv, these macros will work */
Don Fry38622412011-12-16 07:07:36 -0800162#define cfg(_m) ((_m)->shrd->cfg)
Emmanuel Grumbache6bb4c92011-08-25 23:10:48 -0700163#define trans(_m) ((_m)->shrd->trans)
Emmanuel Grumbachcac988a2011-08-25 23:10:37 -0700164
Johannes Berga8bceb32012-03-05 11:24:30 -0800165static inline bool iwl_have_debug_level(u32 level)
Emmanuel Grumbach8f470ce2011-08-25 23:10:38 -0700166{
Johannes Berga8bceb32012-03-05 11:24:30 -0800167 return iwlagn_mod_params.debug_level & level;
Emmanuel Grumbach8f470ce2011-08-25 23:10:38 -0700168}
Emmanuel Grumbach8f470ce2011-08-25 23:10:38 -0700169
Emmanuel Grumbachba562f72011-08-25 23:11:22 -0700170enum iwl_rxon_context_id {
171 IWL_RXON_CTX_BSS,
172 IWL_RXON_CTX_PAN,
173
174 NUM_IWL_RXON_CTX
175};
176
Emmanuel Grumbach48f20d32011-08-25 23:10:36 -0700177#endif /* #__iwl_shared_h__ */