[Midnightbsd-cvs] src [10031] trunk/sys/dev/wpi: sync with freebsd 10 stable

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun May 27 18:22:26 EDT 2018


Revision: 10031
          http://svnweb.midnightbsd.org/src/?rev=10031
Author:   laffer1
Date:     2018-05-27 18:22:25 -0400 (Sun, 27 May 2018)
Log Message:
-----------
sync with freebsd 10 stable

Modified Paths:
--------------
    trunk/sys/dev/wpi/if_wpi.c
    trunk/sys/dev/wpi/if_wpireg.h
    trunk/sys/dev/wpi/if_wpivar.h

Modified: trunk/sys/dev/wpi/if_wpi.c
===================================================================
--- trunk/sys/dev/wpi/if_wpi.c	2018-05-27 22:22:10 UTC (rev 10030)
+++ trunk/sys/dev/wpi/if_wpi.c	2018-05-27 22:22:25 UTC (rev 10031)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006,2007
  *	Damien Bergamini <damien.bergamini at free.fr>
@@ -19,7 +20,7 @@
 #define VERSION "20071127"
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/wpi/if_wpi.c 264956 2014-04-25 22:23:38Z marius $");
 
 /*
  * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
@@ -59,6 +60,8 @@
  * via the firmware.
  */
 
+#include "opt_wlan.h"
+
 #include <sys/param.h>
 #include <sys/sysctl.h>
 #include <sys/sockio.h>
@@ -250,7 +253,6 @@
 static int wpi_suspend(device_t);
 static int wpi_resume(device_t);
 
-
 static device_method_t wpi_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe,		wpi_probe),
@@ -260,7 +262,7 @@
 	DEVMETHOD(device_suspend,	wpi_suspend),
 	DEVMETHOD(device_resume,	wpi_resume),
 
-	{ 0, 0 }
+	DEVMETHOD_END
 };
 
 static driver_t wpi_driver = {
@@ -271,7 +273,7 @@
 
 static devclass_t wpi_devclass;
 
-DRIVER_MODULE(wpi, pci, wpi_driver, wpi_devclass, 0, 0);
+DRIVER_MODULE(wpi, pci, wpi_driver, wpi_devclass, NULL, NULL);
 
 MODULE_VERSION(wpi, 1);
 
@@ -282,12 +284,12 @@
 	/* CCK: device-dependent */
 	10, 20, 55, 110
 };
+
 static const uint8_t wpi_ridx_to_rate[] = {
 	12, 18, 24, 36, 48, 72, 96, 108, /* OFDM */
 	2, 4, 11, 22 /*CCK */
 };
 
-
 static int
 wpi_probe(device_t dev)
 {
@@ -297,7 +299,7 @@
 		if (pci_get_vendor(dev) == ident->vendor &&
 		    pci_get_device(dev) == ident->device) {
 			device_set_desc(dev, ident->name);
-			return 0;
+			return (BUS_PROBE_DEFAULT);
 		}
 	}
 	return ENXIO;
@@ -490,7 +492,7 @@
 	struct wpi_softc *sc = device_get_softc(dev);
 	struct ifnet *ifp;
 	struct ieee80211com *ic;
-	int ac, error, supportsa = 1;
+	int ac, error, rid, supportsa = 1;
 	uint32_t tmp;
 	const struct wpi_ident *ident;
 	uint8_t macaddr[IEEE80211_ADDR_LEN];
@@ -522,12 +524,6 @@
 	callout_init_mtx(&sc->calib_to, &sc->sc_mtx, 0);
 	callout_init_mtx(&sc->watchdog_to, &sc->sc_mtx, 0);
 
-	if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
-		device_printf(dev, "chip is in D%d power mode "
-		    "-- setting to D0\n", pci_get_powerstate(dev));
-		pci_set_powerstate(dev, PCI_POWERSTATE_D0);
-	}
-
 	/* disable the retry timeout register */
 	pci_write_config(dev, 0x41, 0, 1);
 
@@ -534,8 +530,8 @@
 	/* enable bus-mastering */
 	pci_enable_busmaster(dev);
 
-	sc->mem_rid = PCIR_BAR(0);
-	sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid,
+	rid = PCIR_BAR(0);
+	sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
 	    RF_ACTIVE);
 	if (sc->mem == NULL) {
 		device_printf(dev, "could not allocate memory resource\n");
@@ -546,8 +542,8 @@
 	sc->sc_st = rman_get_bustag(sc->mem);
 	sc->sc_sh = rman_get_bushandle(sc->mem);
 
-	sc->irq_rid = 0;
-	sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid,
+	rid = 0;
+	sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
 	    RF_ACTIVE | RF_SHAREABLE);
 	if (sc->irq == NULL) {
 		device_printf(dev, "could not allocate interrupt resource\n");
@@ -714,6 +710,9 @@
 	struct ieee80211com *ic;
 	int ac;
 
+	if (sc->irq != NULL)
+		bus_teardown_intr(dev, sc->irq, sc->sc_ih);
+
 	if (ifp != NULL) {
 		ic = ifp->if_l2com;
 
@@ -743,13 +742,12 @@
 		wpi_free_fwmem(sc);
 	WPI_UNLOCK(sc);
 
-	if (sc->irq != NULL) {
-		bus_teardown_intr(dev, sc->irq, sc->sc_ih);
-		bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq);
-	}
-
+	if (sc->irq != NULL)
+		bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq),
+		    sc->irq);
 	if (sc->mem != NULL)
-		bus_release_resource(dev, SYS_RES_MEMORY, sc->mem_rid, sc->mem);
+		bus_release_resource(dev, SYS_RES_MEMORY,
+		    rman_get_rid(sc->mem), sc->mem);
 
 	if (ifp != NULL)
 		if_free(ifp);
@@ -1884,7 +1882,7 @@
 	hdrlen = ieee80211_hdrsize(wh);
 	ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
 
-	if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
+	if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) {
 		k = ieee80211_crypto_encap(ni, m0);
 		if (k == NULL) {
 			m_freem(m0);
@@ -1953,7 +1951,7 @@
 		tap->wt_flags = 0;
 		tap->wt_rate = rate;
 		tap->wt_hwqueue = ac;
-		if (wh->i_fc[1] & IEEE80211_FC1_WEP)
+		if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED)
 			tap->wt_flags |= IEEE80211_RADIOTAP_F_WEP;
 
 		ieee80211_radiotap_tx(vap, m0);
@@ -3189,7 +3187,6 @@
 	callout_stop(&sc->watchdog_to);
 	callout_stop(&sc->calib_to);
 
-
 	/* disable interrupts */
 	WPI_WRITE(sc, WPI_MASK, 0);
 	WPI_WRITE(sc, WPI_INTR, WPI_INTR_MASK);

Modified: trunk/sys/dev/wpi/if_wpireg.h
===================================================================
--- trunk/sys/dev/wpi/if_wpireg.h	2018-05-27 22:22:10 UTC (rev 10030)
+++ trunk/sys/dev/wpi/if_wpireg.h	2018-05-27 22:22:25 UTC (rev 10031)
@@ -1,4 +1,5 @@
-/*	$MidnightBSD$	*/
+/* $MidnightBSD$ */
+/*	$FreeBSD: stable/10/sys/dev/wpi/if_wpireg.h 261455 2014-02-04 03:36:42Z eadler $	*/
 
 /*-
  * Copyright (c) 2006,2007
@@ -143,7 +144,7 @@
 
 /* possible flags for register WPI_UC_CTL */
 #define WPI_UC_ENABLE	(1 << 30)
-#define WPI_UC_RUN	(1 << 31)
+#define WPI_UC_RUN	(1U << 31)
 
 /* possible flags for register WPI_INTR_CSR */
 #define WPI_ALIVE_INTR	(1 << 0)
@@ -151,7 +152,7 @@
 #define WPI_SW_ERROR	(1 << 25)
 #define WPI_TX_INTR	(1 << 27)
 #define WPI_HW_ERROR	(1 << 29)
-#define WPI_RX_INTR	(1 << 31)
+#define WPI_RX_INTR	(1U << 31)
 
 #define WPI_INTR_MASK							\
 	(WPI_SW_ERROR | WPI_HW_ERROR | WPI_TX_INTR | WPI_RX_INTR |	\

Modified: trunk/sys/dev/wpi/if_wpivar.h
===================================================================
--- trunk/sys/dev/wpi/if_wpivar.h	2018-05-27 22:22:10 UTC (rev 10030)
+++ trunk/sys/dev/wpi/if_wpivar.h	2018-05-27 22:22:25 UTC (rev 10031)
@@ -1,4 +1,5 @@
-/*	$MidnightBSD$	*/
+/* $MidnightBSD$ */
+/*	$FreeBSD: stable/10/sys/dev/wpi/if_wpivar.h 264956 2014-04-25 22:23:38Z marius $	*/
 
 /*-
  * Copyright (c) 2006,2007
@@ -162,8 +163,6 @@
 	bus_space_tag_t		sc_st;
 	bus_space_handle_t	sc_sh;
 	void			*sc_ih;
-	int			mem_rid;
-	int			irq_rid;
 
 	struct wpi_config	config;
 	int			temp;



More information about the Midnightbsd-cvs mailing list