if_run.c (257435) | if_run.c (257712) |
---|---|
1/*- 2 * Copyright (c) 2008,2010 Damien Bergamini <damien.bergamini@free.fr> 3 * ported to FreeBSD by Akinori Furukoshi <moonlightakkiy@yahoo.ca> 4 * USB Consulting, Hans Petter Selasky <hselasky@freebsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2008,2010 Damien Bergamini <damien.bergamini@free.fr> 3 * ported to FreeBSD by Akinori Furukoshi <moonlightakkiy@yahoo.ca> 4 * USB Consulting, Hans Petter Selasky <hselasky@freebsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19#include <sys/cdefs.h> |
20__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_run.c 257435 2013-10-31 11:03:36Z hselasky $"); | 20__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_run.c 257712 2013-11-05 18:27:25Z hselasky $"); |
21 22/*- 23 * Ralink Technology RT2700U/RT2800U/RT3000U chipset driver. 24 * http://www.ralinktech.com/ 25 */ 26 27#include <sys/param.h> 28#include <sys/sockio.h> --- 666 unchanged lines hidden (view full) --- 695 ieee80211_radiotap_attach(ic, 696 &sc->sc_txtap.wt_ihdr, sizeof(sc->sc_txtap), 697 RUN_TX_RADIOTAP_PRESENT, 698 &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap), 699 RUN_RX_RADIOTAP_PRESENT); 700 701 TASK_INIT(&sc->cmdq_task, 0, run_cmdq_cb, sc); 702 TASK_INIT(&sc->ratectl_task, 0, run_ratectl_cb, sc); | 21 22/*- 23 * Ralink Technology RT2700U/RT2800U/RT3000U chipset driver. 24 * http://www.ralinktech.com/ 25 */ 26 27#include <sys/param.h> 28#include <sys/sockio.h> --- 666 unchanged lines hidden (view full) --- 695 ieee80211_radiotap_attach(ic, 696 &sc->sc_txtap.wt_ihdr, sizeof(sc->sc_txtap), 697 RUN_TX_RADIOTAP_PRESENT, 698 &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap), 699 RUN_RX_RADIOTAP_PRESENT); 700 701 TASK_INIT(&sc->cmdq_task, 0, run_cmdq_cb, sc); 702 TASK_INIT(&sc->ratectl_task, 0, run_ratectl_cb, sc); |
703 callout_init((struct callout *)&sc->ratectl_ch, 1); | 703 usb_callout_init_mtx(&sc->ratectl_ch, &sc->sc_mtx, 0); |
704 705 if (bootverbose) 706 ieee80211_announce(ic); 707 708 return (0); 709 710detach: 711 run_detach(self); --- 293 unchanged lines hidden (view full) --- 1005 (sc->mac_ver) != 0x2872 && 1006 (sc->mac_ver) != 0x3070) { 1007 base += 4096; 1008 } 1009 1010 /* cheap sanity check */ 1011 temp = fw->data; 1012 bytes = *temp; | 704 705 if (bootverbose) 706 ieee80211_announce(ic); 707 708 return (0); 709 710detach: 711 run_detach(self); --- 293 unchanged lines hidden (view full) --- 1005 (sc->mac_ver) != 0x2872 && 1006 (sc->mac_ver) != 0x3070) { 1007 base += 4096; 1008 } 1009 1010 /* cheap sanity check */ 1011 temp = fw->data; 1012 bytes = *temp; |
1013 if (bytes != be64toh(0xffffff0210280210)) { | 1013 if (bytes != be64toh(0xffffff0210280210ULL)) { |
1014 device_printf(sc->sc_dev, "firmware checksum failed\n"); 1015 error = EINVAL; 1016 goto fail; 1017 } 1018 1019 run_read(sc, RT2860_ASIC_VER_ID, &tmp); 1020 /* write microcode image */ 1021 run_write_region_1(sc, RT2870_FW_BASE, base, 4096); --- 1210 unchanged lines hidden (view full) --- 2232 RUN_LOCK(sc); 2233 run_reset_livelock(sc); 2234 /* just in case, there are some stats to drain */ 2235 run_drain_fifo(sc); 2236 RUN_UNLOCK(sc); 2237 ieee80211_iterate_nodes(&ic->ic_sta, run_iter_func, sc); 2238 } 2239 | 1014 device_printf(sc->sc_dev, "firmware checksum failed\n"); 1015 error = EINVAL; 1016 goto fail; 1017 } 1018 1019 run_read(sc, RT2860_ASIC_VER_ID, &tmp); 1020 /* write microcode image */ 1021 run_write_region_1(sc, RT2870_FW_BASE, base, 4096); --- 1210 unchanged lines hidden (view full) --- 2232 RUN_LOCK(sc); 2233 run_reset_livelock(sc); 2234 /* just in case, there are some stats to drain */ 2235 run_drain_fifo(sc); 2236 RUN_UNLOCK(sc); 2237 ieee80211_iterate_nodes(&ic->ic_sta, run_iter_func, sc); 2238 } 2239 |
2240 RUN_LOCK(sc); |
|
2240 if(sc->ratectl_run != RUN_RATECTL_OFF) 2241 usb_callout_reset(&sc->ratectl_ch, hz, run_ratectl_to, sc); | 2241 if(sc->ratectl_run != RUN_RATECTL_OFF) 2242 usb_callout_reset(&sc->ratectl_ch, hz, run_ratectl_to, sc); |
2243 RUN_UNLOCK(sc); |
|
2242} 2243 2244static void 2245run_drain_fifo(void *arg) 2246{ 2247 struct run_softc *sc = arg; 2248 struct ifnet *ifp = sc->sc_ifp; 2249 uint32_t stat; --- 2758 unchanged lines hidden --- | 2244} 2245 2246static void 2247run_drain_fifo(void *arg) 2248{ 2249 struct run_softc *sc = arg; 2250 struct ifnet *ifp = sc->sc_ifp; 2251 uint32_t stat; --- 2758 unchanged lines hidden --- |