diff --git a/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/Jamfile b/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/Jamfile index 26158e37cf..cd7c13138e 100644 --- a/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/Jamfile +++ b/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/Jamfile @@ -15,8 +15,9 @@ UseHeaders [ FDirName $(SUBDIR) ] : true ; SEARCH_SOURCE += [ FDirName $(SUBDIR) dev wi ] ; KernelAddon wavelanwifi : - if_wi.c - if_wi_pci.c + if_wi.c + if_wi_pci.c + glue.c : libfreebsd_wlan.a libfreebsd_network.a diff --git a/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/dev/wi/if_wi.c b/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/dev/wi/if_wi.c index 616c5d7b33..6daa6be296 100644 --- a/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/dev/wi/if_wi.c +++ b/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/dev/wi/if_wi.c @@ -589,16 +589,6 @@ wi_intr(void *arg) WI_LOCK(sc); - if (sc->wi_gone || !sc->sc_enabled || (ifp->if_flags & IFF_UP) == 0) { - CSR_WRITE_2(sc, WI_INT_EN, 0); - CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF); - WI_UNLOCK(sc); - return; - } - - /* Disable interrupts. */ - CSR_WRITE_2(sc, WI_INT_EN, 0); - status = CSR_READ_2(sc, WI_EVENT_STAT); if (status & WI_EV_RX) wi_rx_intr(sc); diff --git a/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/glue.c b/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/glue.c new file mode 100644 index 0000000000..66f8468b34 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/glue.c @@ -0,0 +1,45 @@ +/* + * Copyright 2009, Colin Günther, coling@gmx.de. + * All Rights Reserved. Distributed under the terms of the MIT License. + */ + + +#include +#include + +#include +#include +#include + +#include + +#include + +#include +#include +#include + + +HAIKU_FBSD_WLAN_DRIVER_GLUE(wavelanwifi, wi, pci) +NO_HAIKU_FBSD_MII_DRIVER(); +NO_HAIKU_REENABLE_INTERRUPTS(); +HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES|FBSD_WLAN); + + +int +HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) +{ + struct wi_softc* sc = (struct wi_softc*)device_get_softc(dev); + struct ifnet* ifp = sc->sc_ifp; + + if (sc->wi_gone || !sc->sc_enabled || (ifp->if_flags & IFF_UP) == 0) { + CSR_WRITE_2(sc, WI_INT_EN, 0); + CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF); + return 0; + } + + /* Disable interrupts. */ + CSR_WRITE_2(sc, WI_INT_EN, 0); + + return 1; +} diff --git a/src/libs/compat/freebsd_network/compat/sys/rman.h b/src/libs/compat/freebsd_network/compat/sys/rman.h index 585dc3f88d..a537e2b154 100644 --- a/src/libs/compat/freebsd_network/compat/sys/rman.h +++ b/src/libs/compat/freebsd_network/compat/sys/rman.h @@ -2,6 +2,38 @@ * Copyright 2007, Hugo Santos. All Rights Reserved. * Distributed under the terms of the MIT License. */ + + +/*- + * Copyright 1998 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * supporting documentation, and that the name of M.I.T. not be used + * in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. M.I.T. makes + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ #ifndef _FBSD_COMPAT_SYS_RMAN_H_ #define _FBSD_COMPAT_SYS_RMAN_H_ @@ -12,8 +44,10 @@ #define RF_ACTIVE 0x0002 #define RF_SHAREABLE 0x0004 -#define RF_OPTIONAL 0x0080 +#define RF_OPTIONAL 0x0080 +#define RF_ALIGNMENT_SHIFT 10 /* alignment size bit starts bit 10 */ +#define RF_ALIGNMENT_LOG2(x) ((x) << RF_ALIGNMENT_SHIFT) struct resource { int r_type; @@ -25,7 +59,30 @@ struct resource { bus_space_handle_t rman_get_bushandle(struct resource *); bus_space_tag_t rman_get_bustag(struct resource *); -uint32_t rman_make_alignment_flags(uint32_t); -u_long rman_get_start(struct resource *); -#endif /* _FBSD_COMPAT_SYS_RMAN_H_ */ + +static inline u_long +rman_get_start(struct resource *resourcePointer) +{ + return resourcePointer->r_bushandle; +} + + +static inline uint32_t +rman_make_alignment_flags(uint32_t size) +{ + int i; + + /* + * Find the hightest bit set, and add one if more than one bit + * set. We're effectively computing the ceil(log2(size)) here. + */ + for (i = 31; i > 0; i--) + if ((1 << i) & size) + break; + if (~(1 << i) & size) + i++; + + return RF_ALIGNMENT_LOG2(i); +} +#endif /* _FBSD_COMPAT_SYS_RMAN_H_ */