Deleted Added
full compact
if_bwi.c (289165) if_bwi.c (293339)
1/*
2 * Copyright (c) 2007 The DragonFly Project. All rights reserved.
3 *
4 * This code is derived from software contributed to The DragonFly Project
5 * by Sepherosa Ziehau <sepherosa@gmail.com>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * $DragonFly: src/sys/dev/netif/bwi/if_bwi.c,v 1.19 2008/02/15 11:15:38 sephe Exp $
35 */
36
37#include <sys/cdefs.h>
1/*
2 * Copyright (c) 2007 The DragonFly Project. All rights reserved.
3 *
4 * This code is derived from software contributed to The DragonFly Project
5 * by Sepherosa Ziehau <sepherosa@gmail.com>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * $DragonFly: src/sys/dev/netif/bwi/if_bwi.c,v 1.19 2008/02/15 11:15:38 sephe Exp $
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/dev/bwi/if_bwi.c 289165 2015-10-12 04:55:20Z adrian $");
38__FBSDID("$FreeBSD: head/sys/dev/bwi/if_bwi.c 293339 2016-01-07 18:41:03Z avos $");
39
40#include "opt_inet.h"
41#include "opt_bwi.h"
42#include "opt_wlan.h"
43
44#include <sys/param.h>
45#include <sys/endian.h>
46#include <sys/kernel.h>

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

351
352int
353bwi_attach(struct bwi_softc *sc)
354{
355 struct ieee80211com *ic = &sc->sc_ic;
356 device_t dev = sc->sc_dev;
357 struct bwi_mac *mac;
358 struct bwi_phy *phy;
39
40#include "opt_inet.h"
41#include "opt_bwi.h"
42#include "opt_wlan.h"
43
44#include <sys/param.h>
45#include <sys/endian.h>
46#include <sys/kernel.h>

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

351
352int
353bwi_attach(struct bwi_softc *sc)
354{
355 struct ieee80211com *ic = &sc->sc_ic;
356 device_t dev = sc->sc_dev;
357 struct bwi_mac *mac;
358 struct bwi_phy *phy;
359 uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
359 int i, error;
360 int i, error;
360 uint8_t bands;
361
362 BWI_LOCK_INIT(sc);
363
364 /*
365 * Initialize taskq and various tasks
366 */
367 sc->sc_tq = taskqueue_create("bwi_taskq", M_NOWAIT | M_ZERO,
368 taskqueue_thread_enqueue, &sc->sc_tq);

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

448 if (error)
449 goto fail;
450
451 callout_init_mtx(&sc->sc_watchdog_timer, &sc->sc_mtx, 0);
452
453 /*
454 * Setup ratesets, phytype, channels and get MAC address
455 */
361
362 BWI_LOCK_INIT(sc);
363
364 /*
365 * Initialize taskq and various tasks
366 */
367 sc->sc_tq = taskqueue_create("bwi_taskq", M_NOWAIT | M_ZERO,
368 taskqueue_thread_enqueue, &sc->sc_tq);

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

448 if (error)
449 goto fail;
450
451 callout_init_mtx(&sc->sc_watchdog_timer, &sc->sc_mtx, 0);
452
453 /*
454 * Setup ratesets, phytype, channels and get MAC address
455 */
456 bands = 0;
456 memset(bands, 0, sizeof(bands));
457 if (phy->phy_mode == IEEE80211_MODE_11B ||
458 phy->phy_mode == IEEE80211_MODE_11G) {
457 if (phy->phy_mode == IEEE80211_MODE_11B ||
458 phy->phy_mode == IEEE80211_MODE_11G) {
459 setbit(&bands, IEEE80211_MODE_11B);
459 setbit(bands, IEEE80211_MODE_11B);
460 if (phy->phy_mode == IEEE80211_MODE_11B) {
461 ic->ic_phytype = IEEE80211_T_DS;
462 } else {
463 ic->ic_phytype = IEEE80211_T_OFDM;
460 if (phy->phy_mode == IEEE80211_MODE_11B) {
461 ic->ic_phytype = IEEE80211_T_DS;
462 } else {
463 ic->ic_phytype = IEEE80211_T_OFDM;
464 setbit(&bands, IEEE80211_MODE_11G);
464 setbit(bands, IEEE80211_MODE_11G);
465 }
466
467 bwi_get_eaddr(sc, BWI_SPROM_11BG_EADDR, ic->ic_macaddr);
468 if (IEEE80211_IS_MULTICAST(ic->ic_macaddr)) {
469 bwi_get_eaddr(sc, BWI_SPROM_11A_EADDR, ic->ic_macaddr);
470 if (IEEE80211_IS_MULTICAST(ic->ic_macaddr)) {
471 device_printf(dev,
472 "invalid MAC address: %6D\n",
473 ic->ic_macaddr, ":");
474 }
475 }
476 } else if (phy->phy_mode == IEEE80211_MODE_11A) {
477 /* TODO:11A */
465 }
466
467 bwi_get_eaddr(sc, BWI_SPROM_11BG_EADDR, ic->ic_macaddr);
468 if (IEEE80211_IS_MULTICAST(ic->ic_macaddr)) {
469 bwi_get_eaddr(sc, BWI_SPROM_11A_EADDR, ic->ic_macaddr);
470 if (IEEE80211_IS_MULTICAST(ic->ic_macaddr)) {
471 device_printf(dev,
472 "invalid MAC address: %6D\n",
473 ic->ic_macaddr, ":");
474 }
475 }
476 } else if (phy->phy_mode == IEEE80211_MODE_11A) {
477 /* TODO:11A */
478 setbit(&bands, IEEE80211_MODE_11A);
478 setbit(bands, IEEE80211_MODE_11A);
479 error = ENXIO;
480 goto fail;
481 } else {
482 panic("unknown phymode %d\n", phy->phy_mode);
483 }
484
485 /* Get locale */
486 sc->sc_locale = __SHIFTOUT(bwi_read_sprom(sc, BWI_SPROM_CARD_INFO),
487 BWI_SPROM_CARD_INFO_LOCALE);
488 DPRINTF(sc, BWI_DBG_ATTACH, "locale: %d\n", sc->sc_locale);
489 /* XXX use locale */
479 error = ENXIO;
480 goto fail;
481 } else {
482 panic("unknown phymode %d\n", phy->phy_mode);
483 }
484
485 /* Get locale */
486 sc->sc_locale = __SHIFTOUT(bwi_read_sprom(sc, BWI_SPROM_CARD_INFO),
487 BWI_SPROM_CARD_INFO_LOCALE);
488 DPRINTF(sc, BWI_DBG_ATTACH, "locale: %d\n", sc->sc_locale);
489 /* XXX use locale */
490 ieee80211_init_channels(ic, NULL, &bands);
490 ieee80211_init_channels(ic, NULL, bands);
491
492 ic->ic_softc = sc;
493 ic->ic_name = device_get_nameunit(dev);
494 ic->ic_caps = IEEE80211_C_STA |
495 IEEE80211_C_SHSLOT |
496 IEEE80211_C_SHPREAMBLE |
497 IEEE80211_C_WPA |
498 IEEE80211_C_BGSCAN |

--- 3477 unchanged lines hidden ---
491
492 ic->ic_softc = sc;
493 ic->ic_name = device_get_nameunit(dev);
494 ic->ic_caps = IEEE80211_C_STA |
495 IEEE80211_C_SHSLOT |
496 IEEE80211_C_SHPREAMBLE |
497 IEEE80211_C_WPA |
498 IEEE80211_C_BGSCAN |

--- 3477 unchanged lines hidden ---