* Implementing rman_get_start and copying rman_make_alignment_flags from

FreeBSD 8 (r199625) and thus adding the FreeBSD license header.
* Implementing the glue code to make the wavelanwifi driver linking.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34626 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Colin Günther 2009-12-10 22:04:51 +00:00
parent 281f1ab86c
commit 2b03fdfe35
4 changed files with 109 additions and 16 deletions

View File

@ -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

View File

@ -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);

View File

@ -0,0 +1,45 @@
/*
* Copyright 2009, Colin Günther, coling@gmx.de.
* All Rights Reserved. Distributed under the terms of the MIT License.
*/
#include <sys/bus.h>
#include <sys/kernel.h>
#include <net/if.h>
#include <net/ethernet.h>
#include <net/if_media.h>
#include <net80211/ieee80211_var.h>
#include <machine/bus.h>
#include <dev/wi/if_wavelan_ieee.h>
#include <dev/wi/if_wireg.h>
#include <dev/wi/if_wivar.h>
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;
}

View File

@ -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_ */