Deleted Added
full compact
if_iwn.c (287197) if_iwn.c (287312)
1/*-
2 * Copyright (c) 2007-2009 Damien Bergamini <damien.bergamini@free.fr>
3 * Copyright (c) 2008 Benjamin Close <benjsc@FreeBSD.org>
4 * Copyright (c) 2008 Sam Leffler, Errno Consulting
5 * Copyright (c) 2011 Intel Corporation
6 * Copyright (c) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
7 * Copyright (c) 2013 Adrian Chadd <adrian@FreeBSD.org>
8 *

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

20 */
21
22/*
23 * Driver for Intel WiFi Link 4965 and 1000/5000/6000 Series 802.11 network
24 * adapters.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2007-2009 Damien Bergamini <damien.bergamini@free.fr>
3 * Copyright (c) 2008 Benjamin Close <benjsc@FreeBSD.org>
4 * Copyright (c) 2008 Sam Leffler, Errno Consulting
5 * Copyright (c) 2011 Intel Corporation
6 * Copyright (c) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
7 * Copyright (c) 2013 Adrian Chadd <adrian@FreeBSD.org>
8 *

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

20 */
21
22/*
23 * Driver for Intel WiFi Link 4965 and 1000/5000/6000 Series 802.11 network
24 * adapters.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/iwn/if_iwn.c 287197 2015-08-27 08:56:39Z glebius $");
28__FBSDID("$FreeBSD: head/sys/dev/iwn/if_iwn.c 287312 2015-08-30 21:54:33Z adrian $");
29
30#include "opt_wlan.h"
31#include "opt_iwn.h"
32
33#include <sys/param.h>
34#include <sys/sockio.h>
35#include <sys/sysctl.h>
36#include <sys/mbuf.h>
37#include <sys/kernel.h>
38#include <sys/socket.h>
39#include <sys/systm.h>
40#include <sys/malloc.h>
41#include <sys/bus.h>
29
30#include "opt_wlan.h"
31#include "opt_iwn.h"
32
33#include <sys/param.h>
34#include <sys/sockio.h>
35#include <sys/sysctl.h>
36#include <sys/mbuf.h>
37#include <sys/kernel.h>
38#include <sys/socket.h>
39#include <sys/systm.h>
40#include <sys/malloc.h>
41#include <sys/bus.h>
42#include <sys/conf.h>
42#include <sys/rman.h>
43#include <sys/endian.h>
44#include <sys/firmware.h>
45#include <sys/limits.h>
46#include <sys/module.h>
43#include <sys/rman.h>
44#include <sys/endian.h>
45#include <sys/firmware.h>
46#include <sys/limits.h>
47#include <sys/module.h>
48#include <sys/priv.h>
47#include <sys/queue.h>
48#include <sys/taskqueue.h>
49
50#include <machine/bus.h>
51#include <machine/resource.h>
52#include <machine/clock.h>
53
54#include <dev/pci/pcireg.h>

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

373DRIVER_MODULE(iwn, pci, iwn_driver, iwn_devclass, NULL, NULL);
374
375MODULE_VERSION(iwn, 1);
376
377MODULE_DEPEND(iwn, firmware, 1, 1, 1);
378MODULE_DEPEND(iwn, pci, 1, 1, 1);
379MODULE_DEPEND(iwn, wlan, 1, 1, 1);
380
49#include <sys/queue.h>
50#include <sys/taskqueue.h>
51
52#include <machine/bus.h>
53#include <machine/resource.h>
54#include <machine/clock.h>
55
56#include <dev/pci/pcireg.h>

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

375DRIVER_MODULE(iwn, pci, iwn_driver, iwn_devclass, NULL, NULL);
376
377MODULE_VERSION(iwn, 1);
378
379MODULE_DEPEND(iwn, firmware, 1, 1, 1);
380MODULE_DEPEND(iwn, pci, 1, 1, 1);
381MODULE_DEPEND(iwn, wlan, 1, 1, 1);
382
383static d_ioctl_t iwn_cdev_ioctl;
384static d_open_t iwn_cdev_open;
385static d_close_t iwn_cdev_close;
386
387static struct cdevsw iwn_cdevsw = {
388 .d_version = D_VERSION,
389 .d_flags = 0,
390 .d_open = iwn_cdev_open,
391 .d_close = iwn_cdev_close,
392 .d_ioctl = iwn_cdev_ioctl,
393 .d_name = "iwn",
394};
395
381static int
382iwn_probe(device_t dev)
383{
384 const struct iwn_ident *ident;
385
386 for (ident = iwn_ident_table; ident->name != NULL; ident++) {
387 if (pci_get_vendor(dev) == ident->vendor &&
388 pci_get_device(dev) == ident->device) {

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

699 __func__,
700 sizeof(struct iwn_stats),
701 sizeof(struct iwn_stats_bt));
702#endif
703
704 if (bootverbose)
705 ieee80211_announce(ic);
706 DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
396static int
397iwn_probe(device_t dev)
398{
399 const struct iwn_ident *ident;
400
401 for (ident = iwn_ident_table; ident->name != NULL; ident++) {
402 if (pci_get_vendor(dev) == ident->vendor &&
403 pci_get_device(dev) == ident->device) {

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

714 __func__,
715 sizeof(struct iwn_stats),
716 sizeof(struct iwn_stats_bt));
717#endif
718
719 if (bootverbose)
720 ieee80211_announce(ic);
721 DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
722
723 /* Add debug ioctl right at the end */
724 sc->sc_cdev = make_dev(&iwn_cdevsw, device_get_unit(dev),
725 UID_ROOT, GID_WHEEL, 0600, "%s", device_get_nameunit(dev));
726 if (sc->sc_cdev == NULL) {
727 device_printf(dev, "failed to create debug character device\n");
728 } else {
729 sc->sc_cdev->si_drv1 = sc;
730 }
707 return 0;
708fail:
709 iwn_detach(dev);
710 DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end in error\n",__func__);
711 return error;
712}
713
714/*

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

1411 if (sc->ict != NULL)
1412 iwn_free_ict(sc);
1413 iwn_free_fwmem(sc);
1414
1415 if (sc->mem != NULL)
1416 bus_release_resource(dev, SYS_RES_MEMORY,
1417 rman_get_rid(sc->mem), sc->mem);
1418
731 return 0;
732fail:
733 iwn_detach(dev);
734 DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end in error\n",__func__);
735 return error;
736}
737
738/*

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

1435 if (sc->ict != NULL)
1436 iwn_free_ict(sc);
1437 iwn_free_fwmem(sc);
1438
1439 if (sc->mem != NULL)
1440 bus_release_resource(dev, SYS_RES_MEMORY,
1441 rman_get_rid(sc->mem), sc->mem);
1442
1443 if (sc->sc_cdev) {
1444 destroy_dev(sc->sc_cdev);
1445 sc->sc_cdev = NULL;
1446 }
1447
1419 DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n", __func__);
1420 IWN_LOCK_DESTROY(sc);
1421 return 0;
1422}
1423
1424static int
1425iwn_shutdown(device_t dev)
1426{

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

4994 ieee80211_runtask(ic, &sc->sc_reinit_task);
4995 return;
4996 }
4997 }
4998 callout_reset(&sc->watchdog_to, hz, iwn_watchdog, sc);
4999}
5000
5001static int
1448 DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n", __func__);
1449 IWN_LOCK_DESTROY(sc);
1450 return 0;
1451}
1452
1453static int
1454iwn_shutdown(device_t dev)
1455{

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

5023 ieee80211_runtask(ic, &sc->sc_reinit_task);
5024 return;
5025 }
5026 }
5027 callout_reset(&sc->watchdog_to, hz, iwn_watchdog, sc);
5028}
5029
5030static int
5002iwn_ioctl(struct ieee80211com *ic, u_long cmd, void *data)
5031iwn_cdev_open(struct cdev *dev, int flags, int type, struct thread *td)
5003{
5032{
5004 struct ifreq *ifr = data;
5005 struct iwn_softc *sc = ic->ic_softc;
5006 int error = 0;
5007
5033
5034 return (0);
5035}
5036
5037static int
5038iwn_cdev_close(struct cdev *dev, int flags, int type, struct thread *td)
5039{
5040
5041 return (0);
5042}
5043
5044static int
5045iwn_cdev_ioctl(struct cdev *dev, unsigned long cmd, caddr_t data, int fflag,
5046 struct thread *td)
5047{
5048 int rc;
5049 struct iwn_softc *sc = dev->si_drv1;
5050 struct iwn_ioctl_data *d;
5051
5052 rc = priv_check(td, PRIV_DRIVER);
5053 if (rc != 0)
5054 return (0);
5055
5008 switch (cmd) {
5009 case SIOCGIWNSTATS:
5056 switch (cmd) {
5057 case SIOCGIWNSTATS:
5058 d = (struct iwn_ioctl_data *) data;
5010 IWN_LOCK(sc);
5011 /* XXX validate permissions/memory/etc? */
5059 IWN_LOCK(sc);
5060 /* XXX validate permissions/memory/etc? */
5012 error = copyout(&sc->last_stat, ifr->ifr_data,
5013 sizeof(struct iwn_stats));
5061 rc = copyout(&sc->last_stat, d->dst_addr, sizeof(struct iwn_stats));
5014 IWN_UNLOCK(sc);
5015 break;
5016 case SIOCZIWNSTATS:
5017 IWN_LOCK(sc);
5018 memset(&sc->last_stat, 0, sizeof(struct iwn_stats));
5019 IWN_UNLOCK(sc);
5020 break;
5021 default:
5062 IWN_UNLOCK(sc);
5063 break;
5064 case SIOCZIWNSTATS:
5065 IWN_LOCK(sc);
5066 memset(&sc->last_stat, 0, sizeof(struct iwn_stats));
5067 IWN_UNLOCK(sc);
5068 break;
5069 default:
5022 error = ENOTTY;
5070 rc = EINVAL;
5023 break;
5024 }
5071 break;
5072 }
5025 return (error);
5073 return (rc);
5026}
5027
5074}
5075
5076static int
5077iwn_ioctl(struct ieee80211com *ic, u_long cmd, void *data)
5078{
5079
5080 return (ENOTTY);
5081}
5082
5028static void
5029iwn_parent(struct ieee80211com *ic)
5030{
5031 struct iwn_softc *sc = ic->ic_softc;
5032 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
5033 int startall = 0, stop = 0;
5034
5035 IWN_LOCK(sc);

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

8974 DPRINTF(sc, IWN_DEBUG_REGISTER," %10s: 0x%08x ",
8975 iwn_get_csr_string(csr_tbl[i]), IWN_READ(sc, csr_tbl[i]));
8976 if ((i+1) % 3 == 0)
8977 DPRINTF(sc, IWN_DEBUG_REGISTER,"%s","\n");
8978 }
8979 DPRINTF(sc, IWN_DEBUG_REGISTER,"%s","\n");
8980}
8981#endif
5083static void
5084iwn_parent(struct ieee80211com *ic)
5085{
5086 struct iwn_softc *sc = ic->ic_softc;
5087 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
5088 int startall = 0, stop = 0;
5089
5090 IWN_LOCK(sc);

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

9029 DPRINTF(sc, IWN_DEBUG_REGISTER," %10s: 0x%08x ",
9030 iwn_get_csr_string(csr_tbl[i]), IWN_READ(sc, csr_tbl[i]));
9031 if ((i+1) % 3 == 0)
9032 DPRINTF(sc, IWN_DEBUG_REGISTER,"%s","\n");
9033 }
9034 DPRINTF(sc, IWN_DEBUG_REGISTER,"%s","\n");
9035}
9036#endif
9037
9038