View | Details | Raw Unified | Return to bug 216923
Collapse All | Expand All

(-)sys/dev/iwi/if_iwi.c (-5 / +51 lines)
Lines 130-135 Link Here
130
	{ 0, 0, NULL }
130
	{ 0, 0, NULL }
131
};
131
};
132
132
133
static const uint8_t def_chan_2ghz[] =
134
	{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
135
static const uint8_t def_chan_5ghz_band1[] =
136
	{ 36, 40, 44, 48, 52, 56, 60, 64 };
137
static const uint8_t def_chan_5ghz_band2[] =
138
	{ 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 };
139
static const uint8_t def_chan_5ghz_band3[] =
140
	{ 149, 153, 157, 161, 165 };
141
133
static struct ieee80211vap *iwi_vap_create(struct ieee80211com *,
142
static struct ieee80211vap *iwi_vap_create(struct ieee80211com *,
134
		    const char [IFNAMSIZ], int, enum ieee80211_opmode, int,
143
		    const char [IFNAMSIZ], int, enum ieee80211_opmode, int,
135
		    const uint8_t [IEEE80211_ADDR_LEN],
144
		    const uint8_t [IEEE80211_ADDR_LEN],
Lines 204-209 Link Here
204
static void	iwi_sysctlattach(struct iwi_softc *);
213
static void	iwi_sysctlattach(struct iwi_softc *);
205
static void	iwi_led_event(struct iwi_softc *, int);
214
static void	iwi_led_event(struct iwi_softc *, int);
206
static void	iwi_ledattach(struct iwi_softc *);
215
static void	iwi_ledattach(struct iwi_softc *);
216
static void	iwi_collect_bands(struct ieee80211com *, uint8_t [], size_t);
217
static void	iwi_getradiocaps(struct ieee80211com *, int, int *,
218
		    struct ieee80211_channel []);
207
219
208
static int iwi_probe(device_t);
220
static int iwi_probe(device_t);
209
static int iwi_attach(device_t);
221
static int iwi_attach(device_t);
Lines 374-384 Link Here
374
	ic->ic_macaddr[4] = val & 0xff;
386
	ic->ic_macaddr[4] = val & 0xff;
375
	ic->ic_macaddr[5] = val >> 8;
387
	ic->ic_macaddr[5] = val >> 8;
376
388
377
	memset(bands, 0, sizeof(bands));
389
	iwi_collect_bands(ic, bands, sizeof(bands));
378
	setbit(bands, IEEE80211_MODE_11B);
379
	setbit(bands, IEEE80211_MODE_11G);
380
	if (pci_get_device(dev) >= 0x4223) 
381
		setbit(bands, IEEE80211_MODE_11A);
382
	ieee80211_init_channels(ic, NULL, bands);
390
	ieee80211_init_channels(ic, NULL, bands);
383
391
384
	ieee80211_ifattach(ic);
392
	ieee80211_ifattach(ic);
Lines 399-404 Link Here
399
	ic->ic_ioctl = iwi_ioctl;
407
	ic->ic_ioctl = iwi_ioctl;
400
	ic->ic_transmit = iwi_transmit;
408
	ic->ic_transmit = iwi_transmit;
401
	ic->ic_parent = iwi_parent;
409
	ic->ic_parent = iwi_parent;
410
	ic->ic_getradiocaps = iwi_getradiocaps;
402
411
403
	ieee80211_radiotap_attach(ic,
412
	ieee80211_radiotap_attach(ic,
404
	    &sc->sc_txtap.wt_ihdr, sizeof(sc->sc_txtap),
413
	    &sc->sc_txtap.wt_ihdr, sizeof(sc->sc_txtap),
Lines 3569-3571 Link Here
3569
		iwi_cmd(sc, IWI_CMD_ABORT_SCAN, NULL, 0);
3578
		iwi_cmd(sc, IWI_CMD_ABORT_SCAN, NULL, 0);
3570
	IWI_UNLOCK(sc);
3579
	IWI_UNLOCK(sc);
3571
}
3580
}
3581
3582
static void
3583
iwi_collect_bands(struct ieee80211com *ic, uint8_t bands[], size_t bands_sz)
3584
{
3585
	struct iwi_softc *sc = ic->ic_softc;
3586
	device_t dev = sc->sc_dev;
3587
3588
	memset(bands, 0, bands_sz);
3589
	setbit(bands, IEEE80211_MODE_11B);
3590
	setbit(bands, IEEE80211_MODE_11G);
3591
	if (pci_get_device(dev) >= 0x4223)
3592
		setbit(bands, IEEE80211_MODE_11A);
3593
}
3594
3595
static void
3596
iwi_getradiocaps(struct ieee80211com *ic,
3597
    int maxchans, int *nchans, struct ieee80211_channel chans[])
3598
{
3599
	uint8_t bands[IEEE80211_MODE_BYTES];
3600
3601
	iwi_collect_bands(ic, bands, sizeof(bands));
3602
	*nchans = 0;
3603
	if (isset(bands, IEEE80211_MODE_11B) || isset(bands, IEEE80211_MODE_11G))
3604
		ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
3605
		    def_chan_2ghz, nitems(def_chan_2ghz), bands, 0);
3606
	if (isset(bands, IEEE80211_MODE_11A)) {
3607
		ieee80211_add_channel_list_5ghz(chans, maxchans, nchans,
3608
		    def_chan_5ghz_band1, nitems(def_chan_5ghz_band1),
3609
		    bands, 0);
3610
		ieee80211_add_channel_list_5ghz(chans, maxchans, nchans,
3611
		    def_chan_5ghz_band2, nitems(def_chan_5ghz_band2),
3612
		    bands, 0);
3613
		ieee80211_add_channel_list_5ghz(chans, maxchans, nchans,
3614
		    def_chan_5ghz_band3, nitems(def_chan_5ghz_band3),
3615
		    bands, 0);
3616
	}
3617
}

Return to bug 216923