Deleted Added
full compact
if_iwn.c (220867) if_iwn.c (220891)
1/*-
2 * Copyright (c) 2007-2009
3 * Damien Bergamini <damien.bergamini@free.fr>
4 * Copyright (c) 2008
5 * Benjamin Close <benjsc@FreeBSD.org>
6 * Copyright (c) 2008 Sam Leffler, Errno Consulting
7 *
8 * Permission to use, copy, modify, and distribute this software for any

--- 10 unchanged lines hidden (view full) ---

19 */
20
21/*
22 * Driver for Intel WiFi Link 4965 and 1000/5000/6000 Series 802.11 network
23 * adapters.
24 */
25
26#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2007-2009
3 * Damien Bergamini <damien.bergamini@free.fr>
4 * Copyright (c) 2008
5 * Benjamin Close <benjsc@FreeBSD.org>
6 * Copyright (c) 2008 Sam Leffler, Errno Consulting
7 *
8 * Permission to use, copy, modify, and distribute this software for any

--- 10 unchanged lines hidden (view full) ---

19 */
20
21/*
22 * Driver for Intel WiFi Link 4965 and 1000/5000/6000 Series 802.11 network
23 * adapters.
24 */
25
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: head/sys/dev/iwn/if_iwn.c 220867 2011-04-19 19:51:35Z bschmidt $");
27__FBSDID("$FreeBSD: head/sys/dev/iwn/if_iwn.c 220891 2011-04-20 16:59:27Z bschmidt $");
28
29#include <sys/param.h>
30#include <sys/sockio.h>
31#include <sys/sysctl.h>
32#include <sys/mbuf.h>
33#include <sys/kernel.h>
34#include <sys/socket.h>
35#include <sys/systm.h>

--- 212 unchanged lines hidden (view full) ---

248static int iwn5000_init_gains(struct iwn_softc *);
249static int iwn4965_set_gains(struct iwn_softc *);
250static int iwn5000_set_gains(struct iwn_softc *);
251static void iwn_tune_sensitivity(struct iwn_softc *,
252 const struct iwn_rx_stats *);
253static int iwn_send_sensitivity(struct iwn_softc *);
254static int iwn_set_pslevel(struct iwn_softc *, int, int, int);
255static int iwn_send_btcoex(struct iwn_softc *);
28
29#include <sys/param.h>
30#include <sys/sockio.h>
31#include <sys/sysctl.h>
32#include <sys/mbuf.h>
33#include <sys/kernel.h>
34#include <sys/socket.h>
35#include <sys/systm.h>

--- 212 unchanged lines hidden (view full) ---

248static int iwn5000_init_gains(struct iwn_softc *);
249static int iwn4965_set_gains(struct iwn_softc *);
250static int iwn5000_set_gains(struct iwn_softc *);
251static void iwn_tune_sensitivity(struct iwn_softc *,
252 const struct iwn_rx_stats *);
253static int iwn_send_sensitivity(struct iwn_softc *);
254static int iwn_set_pslevel(struct iwn_softc *, int, int, int);
255static int iwn_send_btcoex(struct iwn_softc *);
256static int iwn_send_advanced_btcoex(struct iwn_softc *);
256static int iwn_config(struct iwn_softc *);
257static uint8_t *ieee80211_add_ssid(uint8_t *, const uint8_t *, u_int);
258static int iwn_scan(struct iwn_softc *);
259static int iwn_auth(struct iwn_softc *, struct ieee80211vap *vap);
260static int iwn_run(struct iwn_softc *, struct ieee80211vap *vap);
261#if 0 /* HT */
262static int iwn_ampdu_rx_start(struct ieee80211com *,
263 struct ieee80211_node *, uint8_t);

--- 547 unchanged lines hidden (view full) ---

811 sc->fwname = "iwn6050fw";
812 /* Override chains masks, ROM is known to be broken. */
813 sc->txchainmask = IWN_ANT_AB;
814 sc->rxchainmask = IWN_ANT_AB;
815 break;
816 case IWN_HW_REV_TYPE_6005:
817 sc->limits = &iwn6000_sensitivity_limits;
818 sc->fwname = "iwn6005fw";
257static int iwn_config(struct iwn_softc *);
258static uint8_t *ieee80211_add_ssid(uint8_t *, const uint8_t *, u_int);
259static int iwn_scan(struct iwn_softc *);
260static int iwn_auth(struct iwn_softc *, struct ieee80211vap *vap);
261static int iwn_run(struct iwn_softc *, struct ieee80211vap *vap);
262#if 0 /* HT */
263static int iwn_ampdu_rx_start(struct ieee80211com *,
264 struct ieee80211_node *, uint8_t);

--- 547 unchanged lines hidden (view full) ---

812 sc->fwname = "iwn6050fw";
813 /* Override chains masks, ROM is known to be broken. */
814 sc->txchainmask = IWN_ANT_AB;
815 sc->rxchainmask = IWN_ANT_AB;
816 break;
817 case IWN_HW_REV_TYPE_6005:
818 sc->limits = &iwn6000_sensitivity_limits;
819 sc->fwname = "iwn6005fw";
820 if (pid != 0x0082 && pid != 0x0085)
821 sc->sc_flags |= IWN_FLAG_ADV_BTCOEX;
819 break;
820 default:
821 device_printf(sc->sc_dev, "adapter type %d not supported\n",
822 sc->hw_type);
823 return ENOTSUP;
824 }
825 return 0;
826}

--- 3889 unchanged lines hidden (view full) ---

4716 cmd.lead_time = IWN_BT_LEAD_TIME_DEF;
4717 cmd.max_kill = IWN_BT_MAX_KILL_DEF;
4718 DPRINTF(sc, IWN_DEBUG_RESET, "%s: configuring bluetooth coexistence\n",
4719 __func__);
4720 return iwn_cmd(sc, IWN_CMD_BT_COEX, &cmd, sizeof(cmd), 0);
4721}
4722
4723static int
822 break;
823 default:
824 device_printf(sc->sc_dev, "adapter type %d not supported\n",
825 sc->hw_type);
826 return ENOTSUP;
827 }
828 return 0;
829}

--- 3889 unchanged lines hidden (view full) ---

4719 cmd.lead_time = IWN_BT_LEAD_TIME_DEF;
4720 cmd.max_kill = IWN_BT_MAX_KILL_DEF;
4721 DPRINTF(sc, IWN_DEBUG_RESET, "%s: configuring bluetooth coexistence\n",
4722 __func__);
4723 return iwn_cmd(sc, IWN_CMD_BT_COEX, &cmd, sizeof(cmd), 0);
4724}
4725
4726static int
4727iwn_send_advanced_btcoex(struct iwn_softc *sc)
4728{
4729 static const uint32_t btcoex_3wire[12] = {
4730 0xaaaaaaaa, 0xaaaaaaaa, 0xaeaaaaaa, 0xaaaaaaaa,
4731 0xcc00ff28, 0x0000aaaa, 0xcc00aaaa, 0x0000aaaa,
4732 0xc0004000, 0x00004000, 0xf0005000, 0xf0005000,
4733 };
4734 struct iwn6000_btcoex_config btconfig;
4735 struct iwn_btcoex_priotable btprio;
4736 struct iwn_btcoex_prot btprot;
4737 int error, i;
4738
4739 memset(&btconfig, 0, sizeof btconfig);
4740 btconfig.flags = 145;
4741 btconfig.max_kill = 5;
4742 btconfig.bt3_t7_timer = 1;
4743 btconfig.kill_ack = htole32(0xffff0000);
4744 btconfig.kill_cts = htole32(0xffff0000);
4745 btconfig.sample_time = 2;
4746 btconfig.bt3_t2_timer = 0xc;
4747 for (i = 0; i < 12; i++)
4748 btconfig.lookup_table[i] = htole32(btcoex_3wire[i]);
4749 btconfig.valid = htole16(0xff);
4750 btconfig.prio_boost = 0xf0;
4751 DPRINTF(sc, IWN_DEBUG_RESET,
4752 "%s: configuring advanced bluetooth coexistence\n", __func__);
4753 error = iwn_cmd(sc, IWN_CMD_BT_COEX, &btconfig, sizeof(btconfig), 1);
4754 if (error != 0)
4755 return error;
4756
4757 memset(&btprio, 0, sizeof btprio);
4758 btprio.calib_init1 = 0x6;
4759 btprio.calib_init2 = 0x7;
4760 btprio.calib_periodic_low1 = 0x2;
4761 btprio.calib_periodic_low2 = 0x3;
4762 btprio.calib_periodic_high1 = 0x4;
4763 btprio.calib_periodic_high2 = 0x5;
4764 btprio.dtim = 0x6;
4765 btprio.scan52 = 0x8;
4766 btprio.scan24 = 0xa;
4767 error = iwn_cmd(sc, IWN_CMD_BT_COEX_PRIOTABLE, &btprio, sizeof(btprio),
4768 1);
4769 if (error != 0)
4770 return error;
4771
4772 /* Force BT state machine change. */
4773 memset(&btprot, 0, sizeof btprio);
4774 btprot.open = 1;
4775 btprot.type = 1;
4776 error = iwn_cmd(sc, IWN_CMD_BT_COEX_PROT, &btprot, sizeof(btprot), 1);
4777 if (error != 0)
4778 return error;
4779 btprot.open = 0;
4780 return iwn_cmd(sc, IWN_CMD_BT_COEX_PROT, &btprot, sizeof(btprot), 1);
4781}
4782
4783static int
4724iwn_config(struct iwn_softc *sc)
4725{
4726 struct iwn_ops *ops = &sc->ops;
4727 struct ifnet *ifp = sc->sc_ifp;
4728 struct ieee80211com *ic = ifp->if_l2com;
4729 uint32_t txmask;
4730 uint16_t rxchain;
4731 int error;

--- 19 unchanged lines hidden (view full) ---

4751 device_printf(sc->sc_dev,
4752 "%s: could not configure valid TX chains, "
4753 "error %d\n", __func__, error);
4754 return error;
4755 }
4756 }
4757
4758 /* Configure bluetooth coexistence. */
4784iwn_config(struct iwn_softc *sc)
4785{
4786 struct iwn_ops *ops = &sc->ops;
4787 struct ifnet *ifp = sc->sc_ifp;
4788 struct ieee80211com *ic = ifp->if_l2com;
4789 uint32_t txmask;
4790 uint16_t rxchain;
4791 int error;

--- 19 unchanged lines hidden (view full) ---

4811 device_printf(sc->sc_dev,
4812 "%s: could not configure valid TX chains, "
4813 "error %d\n", __func__, error);
4814 return error;
4815 }
4816 }
4817
4818 /* Configure bluetooth coexistence. */
4759 error = iwn_send_btcoex(sc);
4819 if (sc->sc_flags & IWN_FLAG_ADV_BTCOEX)
4820 error = iwn_send_advanced_btcoex(sc);
4821 else
4822 error = iwn_send_btcoex(sc);
4760 if (error != 0) {
4761 device_printf(sc->sc_dev,
4762 "%s: could not configure bluetooth coexistence, error %d\n",
4763 __func__, error);
4764 return error;
4765 }
4766
4767 /* Set mode, channel, RX filter and enable RX. */

--- 1878 unchanged lines hidden ---
4823 if (error != 0) {
4824 device_printf(sc->sc_dev,
4825 "%s: could not configure bluetooth coexistence, error %d\n",
4826 __func__, error);
4827 return error;
4828 }
4829
4830 /* Set mode, channel, RX filter and enable RX. */

--- 1878 unchanged lines hidden ---