[haiku-commits] r34626 - in haiku/trunk/src: add-ons/kernel/drivers/network/wlan/wavelanwifi add-ons/kernel/drivers/network/wlan/wavelanwifi/dev/wi libs/compat/freebsd_network/compat/sys

  • From: coling@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 10 Dec 2009 23:04:51 +0100 (CET)

Author: colin
Date: 2009-12-10 23:04:51 +0100 (Thu, 10 Dec 2009)
New Revision: 34626
Changeset: http://dev.haiku-os.org/changeset/34626/haiku

Added:
   haiku/trunk/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/glue.c
Modified:
   haiku/trunk/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/Jamfile
   
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/dev/wi/if_wi.c
   haiku/trunk/src/libs/compat/freebsd_network/compat/sys/rman.h
Log:
* 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.


Modified: 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/Jamfile
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/Jamfile     
2009-12-10 20:51:26 UTC (rev 34625)
+++ haiku/trunk/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/Jamfile     
2009-12-10 22:04:51 UTC (rev 34626)
@@ -15,8 +15,9 @@
 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

Modified: 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/dev/wi/if_wi.c
===================================================================
--- 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/dev/wi/if_wi.c  
    2009-12-10 20:51:26 UTC (rev 34625)
+++ 
haiku/trunk/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/dev/wi/if_wi.c  
    2009-12-10 22:04:51 UTC (rev 34626)
@@ -589,16 +589,6 @@
 
        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);

Added: haiku/trunk/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/glue.c
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/glue.c      
                        (rev 0)
+++ haiku/trunk/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/glue.c      
2009-12-10 22:04:51 UTC (rev 34626)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2009, Colin Günther, coling@xxxxxxx
+ * 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;
+}

Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/sys/rman.h
===================================================================
--- haiku/trunk/src/libs/compat/freebsd_network/compat/sys/rman.h       
2009-12-10 20:51:26 UTC (rev 34625)
+++ haiku/trunk/src/libs/compat/freebsd_network/compat/sys/rman.h       
2009-12-10 22:04:51 UTC (rev 34626)
@@ -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 @@
 
 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_ */


Other related posts:

  • » [haiku-commits] r34626 - in haiku/trunk/src: add-ons/kernel/drivers/network/wlan/wavelanwifi add-ons/kernel/drivers/network/wlan/wavelanwifi/dev/wi libs/compat/freebsd_network/compat/sys - coling