Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add malo(4)@pci driver for Marvell Libertas wireless adaptor



details:   https://anonhg.NetBSD.org/src/rev/bc2689ba35b8
branches:  trunk
changeset: 780594:bc2689ba35b8
user:      degroote <degroote%NetBSD.org@localhost>
date:      Mon Jul 30 18:57:17 2012 +0000

description:
Add malo(4)@pci driver for Marvell Libertas wireless adaptor

Ported from OpenBSD
Known issues :
  - contrary to OpenBSD one, only support pci at the moment, because I don't
    have the necessary hardware to test PCMCIA / CARDUS Marvell Card
  - not connected to pmf(9) (unable to test it)

diffstat:

 distrib/sets/lists/man/mi |     5 +-
 share/man/man4/Makefile   |     4 +-
 share/man/man4/malo.4     |   180 +++
 sys/conf/files            |     6 +-
 sys/dev/ic/malo.c         |  2240 +++++++++++++++++++++++++++++++++++++++++++++
 sys/dev/ic/maloreg.h      |   119 ++
 sys/dev/ic/malovar.h      |   131 ++
 sys/dev/pci/files.pci     |     6 +-
 sys/dev/pci/if_malo_pci.c |   179 +++
 9 files changed, 2865 insertions(+), 5 deletions(-)

diffs (truncated from 2960 to 300 lines):

diff -r 9b3cc5bd9da7 -r bc2689ba35b8 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Mon Jul 30 18:40:36 2012 +0000
+++ b/distrib/sets/lists/man/mi Mon Jul 30 18:57:17 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1399 2012/07/19 09:06:33 rkujawa Exp $
+# $NetBSD: mi,v 1.1400 2012/07/30 18:57:17 degroote Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1290,6 +1290,7 @@
 ./usr/share/man/cat4/macppc/snapper.0          man-sys-catman          .cat
 ./usr/share/man/cat4/mainbus.0                 man-sys-catman          .cat
 ./usr/share/man/cat4/makphy.0                  man-sys-catman          .cat
+./usr/share/man/cat4/malo.0                    man-sys-catman          .cat
 ./usr/share/man/cat4/mbe.0                     man-sys-catman          .cat
 ./usr/share/man/cat4/mc.0                      man-sys-catman          .cat
 ./usr/share/man/cat4/mca.0                     man-sys-catman          .cat
@@ -4133,6 +4134,7 @@
 ./usr/share/man/html4/macppc/snapper.html      man-sys-htmlman         html
 ./usr/share/man/html4/mainbus.html             man-sys-htmlman         html
 ./usr/share/man/html4/makphy.html              man-sys-htmlman         html
+./usr/share/man/html4/malo.html                        man-sys-htmlman         html
 ./usr/share/man/html4/mbe.html                 man-sys-htmlman         html
 ./usr/share/man/html4/mc.html                  man-sys-htmlman         html
 ./usr/share/man/html4/mca.html                 man-sys-htmlman         html
@@ -6829,6 +6831,7 @@
 ./usr/share/man/man4/macppc/snapper.4          man-sys-man             .man
 ./usr/share/man/man4/mainbus.4                 man-sys-man             .man
 ./usr/share/man/man4/makphy.4                  man-sys-man             .man
+./usr/share/man/man4/malo.4                            man-sys-man             .man
 ./usr/share/man/man4/mbe.4                     man-sys-man             .man
 ./usr/share/man/man4/mc.4                      man-sys-man             .man
 ./usr/share/man/man4/mca.4                     man-sys-man             .man
diff -r 9b3cc5bd9da7 -r bc2689ba35b8 share/man/man4/Makefile
--- a/share/man/man4/Makefile   Mon Jul 30 18:40:36 2012 +0000
+++ b/share/man/man4/Makefile   Mon Jul 30 18:57:17 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.589 2012/07/19 08:57:09 rkujawa Exp $
+#      $NetBSD: Makefile,v 1.590 2012/07/30 18:57:18 degroote Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/18/93
 
 MAN=   aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -37,7 +37,7 @@
        jme.4 jmide.4 joy.4 \
        kloader.4 kse.4 ksyms.4 kttcp.4 \
        lc.4 ld.4 lii.4 lo.4 lxtphy.4 \
-       mainbus.4 makphy.4 mbe.4 mca.4 mcclock.4 md.4 mfb.4 mfi.4 mhzc.4 \
+       mainbus.4 makphy.4 malo.4 mbe.4 mca.4 mcclock.4 md.4 mfb.4 mfi.4 mhzc.4 \
        midi.4 mii.4 mk48txx.4 mlx.4 mly.4 mpls.4 mpii.4 mpt.4 mpu.4 mtd.4 \
        mtio.4 multicast.4 mvsata.4 \
        nadb.4 ne.4 neo.4 netintro.4 nfe.4 nfsmb.4 njata.4 njs.4 \
diff -r 9b3cc5bd9da7 -r bc2689ba35b8 share/man/man4/malo.4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/malo.4     Mon Jul 30 18:57:17 2012 +0000
@@ -0,0 +1,180 @@
+.\" $NetBSD: malo.4,v 1.1 2012/07/30 18:57:18 degroote Exp $
+.\"    $OpenBSD: malo.4,v 1.35 2010/11/01 17:59:09 jmc Exp $
+.\"
+.\" Copyright (c) 2006 Theo de Raadt.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in
+.\"    the documentation and/or other materials provided with the
+.\"    distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
+.\" COPYRIGHT HOLDERS OR CONTRIBUTORS 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.
+.\"
+.Dd November 1, 2010 $
+.Dt MALO 4
+.Os
+.Sh NAME
+.Nm malo
+.Nd Marvell Libertas IEEE 802.11b/g wireless network device
+.Sh SYNOPSIS
+.Cd "malo* at pci?"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Marvell Libertas 88W8335/88W8310/88W8385 based
+PCI network adapters.
+The second generation 88W8335/88W8310 chipsets support 802.11b/g.
+.Pp
+These are the modes the
+.Nm
+driver can operate in:
+.Bl -tag -width "IBSS-masterXX"
+.It BSS mode
+Also known as
+.Em infrastructure
+mode, this is used when associating with an access point, through
+which all traffic passes.
+This mode is the default.
+.\" .It IBSS mode
+.\" Also known as
+.\" .Em IEEE ad-hoc
+.\" mode or
+.\" .Em peer-to-peer
+.\" mode.
+.\" This is the standardized method of operating without an access point.
+.\" Stations associate with a service set.
+.\" However, actual connections between stations are peer-to-peer.
+.\" .It Host AP
+.\" In this mode the driver acts as an access point (base station)
+.\" for other cards.
+.It monitor mode
+In this mode the driver is able to receive packets without
+associating with an access point.
+This disables the internal receive filter and enables the card to
+capture packets from networks which it wouldn't normally have access to,
+or to scan for access points.
+.El
+.Pp
+The
+.Nm
+driver can be configured to use
+Wired Equivalent Privacy (WEP) or
+Wi-Fi Protected Access (WPA-PSK and WPA2-PSK).
+WPA is the de facto encryption standard for wireless networks.
+It is strongly recommended that WEP
+not be used as the sole mechanism
+to secure wireless communication,
+due to serious weaknesses in it.
+The
+.Nm
+driver relies on the software 802.11 stack for both encryption and decryption
+of data frames.
+.Pp
+The
+.Nm
+driver can be configured at runtime with
+.Xr ifconfig 8
+or on boot with
+.Xr ifconfig.if 5 .
+.Sh FILES
+The driver needs a set of firmware files which are loaded when
+an interface is brought up:
+.Pp
+.Bl -tag -width Ds -offset indent -compact
+.It Pa /libdata/firmware/malo/malo8335-h
+.It Pa /libdata/firmware/malo/malo8335-m
+.It Pa /libdata/firmware/malo/malo8338
+.It Pa /libdata/firmware/malo/malo8385-h
+.It Pa /libdata/firmware/malo/malo8385-m
+.El
+.Pp
+These firmware files are not free because Marvell refuses
+to grant distribution rights.
+As a result, even though
+.Ox
+includes the driver, the firmware files cannot be included and
+users have to download these files on their own.
+.Pp
+A prepackaged version of the firmware, designed to be used with
+.Xr pkg_add 1 ,
+can be found at:
+.Bd -literal -offset 3n
+http://www.nazgul.ch/malo/malo-firmware-1.4.tgz
+.Ed
+.Sh HARDWARE
+The following cards are among those supported by the
+.Nm
+driver:
+.Pp
+.Bl -column -compact "Microcom Travelcard" "MALO111" "CardBus" "a/b/g" -offset 6n
+.It Em "Card   Chip    Bus     Standard"
+.It Netgear WG311v3    88W8335 PCI     b/g
+.It Tenda TWL542P      88W8335 PCI     b/g
+.El
+.Sh EXAMPLES
+The following
+.Xr ifconfig.if 5
+example configures malo0 to join whatever network is available on boot,
+using WEP key
+.Dq 0x1deadbeef1 ,
+channel 11, obtaining an IP address using DHCP:
+.Bd -literal -offset indent
+dhcp NONE NONE NONE nwkey 0x1deadbeef1 chan 11
+.Ed
+.Pp
+.\"The following
+.\".Xr ifconfig.if 5
+.\"example creates a host-based access point on boot:
+.\".Bd -literal -offset indent
+.\"inet 192.168.1.1 255.255.255.0 NONE media autoselect \e
+.\"    mediaopt hostap nwid my_net chan 11
+.\".Ed
+.\".Pp
+Join an existing BSS network,
+.Dq my_net :
+.Bd -literal -offset indent
+# ifconfig malo0 192.168.1.1 netmask 0xffffff00 nwid my_net
+.Ed
+.Sh NOTES
+Contrary to the driver on
+.Ox
+, this driver currently does not work on PCMCIA/CARDBUS.
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr ifmedia 4 ,
+.Xr intro 4 ,
+.Xr netintro 4 ,
+.Xr pci 4 ,
+.Xr ifconfig.if 5 ,
+.Xr hostapd 8 ,
+.Xr ifconfig 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was first written by
+.An Claudio Jeker Aq claudio%openbsd.org@localhost
+and
+.An Marcus Glocker Aq mglocker%openbsd.org@localhost
+and apparead first in
+.Ox 4.1 .
+.Nx
+porting was done by
+.An Arnaud Degroote Aq degroote%NetBSD.org@localhost
diff -r 9b3cc5bd9da7 -r bc2689ba35b8 sys/conf/files
--- a/sys/conf/files    Mon Jul 30 18:40:36 2012 +0000
+++ b/sys/conf/files    Mon Jul 30 18:57:17 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files,v 1.1052 2012/07/26 20:49:47 jakllsch Exp $
+#      $NetBSD: files,v 1.1053 2012/07/30 18:57:18 degroote Exp $
 #      @(#)files.newconf       7.5 (Berkeley) 5/10/93
 
 version        20100430
@@ -649,6 +649,10 @@
 file   dev/ic/rt2560.c                 ral
 file   dev/ic/rt2661.c                 ral
 
+# Marvell Libertas Open
+device  malo: arp, ether, ifnet, wlan, firmload
+file    dev/ic/malo.c           malo
+
 # 3Com Etherlink-III Ethernet controller
 #
 device ep: arp, ether, ifnet, mii, mii_bitbang
diff -r 9b3cc5bd9da7 -r bc2689ba35b8 sys/dev/ic/malo.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/ic/malo.c Mon Jul 30 18:57:17 2012 +0000
@@ -0,0 +1,2240 @@
+/*     $OpenBSD: malo.c,v 1.92 2010/08/27 17:08:00 jsg Exp $ */
+
+/*
+ * Copyright (c) 2006 Claudio Jeker <claudio%openbsd.org@localhost>
+ * Copyright (c) 2006 Marcus Glocker <mglocker%openbsd.org@localhost>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/param.h>
+#include <sys/types.h>
+
+#include <sys/device.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/proc.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+
+#include <machine/endian.h>
+#include <machine/intr.h>
+
+#include <net/if.h>
+#include <net/if_media.h>
+#include <net/if_ether.h>
+
+#include <net/bpf.h>



Home | Main Index | Thread Index | Old Index