summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/defaults/pccard.conf29
-rw-r--r--etc/pccard.conf.sample29
-rw-r--r--release/texts/HARDWARE.TXT2
-rw-r--r--release/texts/RELNOTES.TXT4
-rw-r--r--release/texts/i386/HARDWARE.TXT2
-rw-r--r--release/texts/i386/RELNOTES.TXT4
-rw-r--r--share/man/man4/man4.i386/Makefile5
-rw-r--r--share/man/man4/man4.i386/pn.46
-rw-r--r--share/man/man4/man4.i386/wi.4102
-rw-r--r--share/man/man4/pn.46
-rw-r--r--share/man/man4/wi.4102
-rw-r--r--sys/conf/NOTES6
-rw-r--r--sys/conf/files.i3863
-rw-r--r--sys/dev/wi/if_wavelan_ieee.h281
-rw-r--r--sys/dev/wi/if_wi.c8
-rw-r--r--sys/dev/wi/if_wireg.h580
-rw-r--r--sys/i386/conf/LINT6
-rw-r--r--sys/i386/conf/NOTES6
-rw-r--r--sys/i386/conf/files.i3863
-rw-r--r--sys/i386/include/if_wavelan_ieee.h281
-rw-r--r--sys/i386/isa/if_wi.c8
-rw-r--r--sys/i386/isa/if_wireg.h580
-rw-r--r--usr.sbin/Makefile3
-rw-r--r--usr.sbin/wicontrol/Makefile9
-rw-r--r--usr.sbin/wicontrol/wicontrol.8187
-rw-r--r--usr.sbin/wicontrol/wicontrol.c499
26 files changed, 2725 insertions, 26 deletions
diff --git a/etc/defaults/pccard.conf b/etc/defaults/pccard.conf
index eff9532..ce22c6c 100644
--- a/etc/defaults/pccard.conf
+++ b/etc/defaults/pccard.conf
@@ -8,7 +8,7 @@
# IRQ == 0 means "allocate free IRQ from IRQ pool"
# IRQ == 16 means "do not use IRQ (e.g. PIO mode)"
#
-# $Id: pccard.conf.sample,v 1.33 1999/05/03 19:08:43 brian Exp $
+# $Id: pccard.conf.sample,v 1.34 1999/05/04 08:39:11 brian Exp $
# Generally available IO ports
io 0x240-0x360
@@ -17,7 +17,32 @@ irq 3 5 10 11 13 15
# Available memory slots
memory 0xd4000 96k
-#IBM PCMCIA Ethernet I/II
+
+# Lucent WaveLAN/IEEE
+card "Lucent Technologies" "WaveLAN/IEEE"
+ config 0x1 "wi0" 11
+ insert echo WaveLAN/IEEE inserted
+ insert /etc/pccard_ether wi0
+ remove echo WaveLAN/IEEE removed
+ remove /sbin/ifconfig wi0 delete
+
+# NCR WaveLAN/IEEE
+card "NCR" "WaveLAN/IEEE"
+ config 0x1 "wi0" 11
+ insert echo WaveLAN/IEEE inserted
+ insert /etc/pccard_ether wi0
+ remove echo WaveLAN/IEEE removed
+ remove /sbin/ifconfig wi0 delete
+
+# Cabletron RoamAbout, WaveLAN/IEEE clone
+card "Cabletron" "RoamAbout 802.11 DS"
+ config 0x1 "wi0" 11
+ insert echo WaveLAN/IEEE inserted
+ insert /etc/pccard_ether wi0
+ remove echo WaveLAN/IEEE removed
+ remove /sbin/ifconfig wi0 delete
+
+# IBM PCMCIA Ethernet I/II
card "IBM Corp." "Ethernet"
config 0x1 "ed0" 11
ether 0xff0
diff --git a/etc/pccard.conf.sample b/etc/pccard.conf.sample
index eff9532..ce22c6c 100644
--- a/etc/pccard.conf.sample
+++ b/etc/pccard.conf.sample
@@ -8,7 +8,7 @@
# IRQ == 0 means "allocate free IRQ from IRQ pool"
# IRQ == 16 means "do not use IRQ (e.g. PIO mode)"
#
-# $Id: pccard.conf.sample,v 1.33 1999/05/03 19:08:43 brian Exp $
+# $Id: pccard.conf.sample,v 1.34 1999/05/04 08:39:11 brian Exp $
# Generally available IO ports
io 0x240-0x360
@@ -17,7 +17,32 @@ irq 3 5 10 11 13 15
# Available memory slots
memory 0xd4000 96k
-#IBM PCMCIA Ethernet I/II
+
+# Lucent WaveLAN/IEEE
+card "Lucent Technologies" "WaveLAN/IEEE"
+ config 0x1 "wi0" 11
+ insert echo WaveLAN/IEEE inserted
+ insert /etc/pccard_ether wi0
+ remove echo WaveLAN/IEEE removed
+ remove /sbin/ifconfig wi0 delete
+
+# NCR WaveLAN/IEEE
+card "NCR" "WaveLAN/IEEE"
+ config 0x1 "wi0" 11
+ insert echo WaveLAN/IEEE inserted
+ insert /etc/pccard_ether wi0
+ remove echo WaveLAN/IEEE removed
+ remove /sbin/ifconfig wi0 delete
+
+# Cabletron RoamAbout, WaveLAN/IEEE clone
+card "Cabletron" "RoamAbout 802.11 DS"
+ config 0x1 "wi0" 11
+ insert echo WaveLAN/IEEE inserted
+ insert /etc/pccard_ether wi0
+ remove echo WaveLAN/IEEE removed
+ remove /sbin/ifconfig wi0 delete
+
+# IBM PCMCIA Ethernet I/II
card "IBM Corp." "Ethernet"
config 0x1 "ed0" 11
ether 0xff0
diff --git a/release/texts/HARDWARE.TXT b/release/texts/HARDWARE.TXT
index 5c68aef..07ccdfe 100644
--- a/release/texts/HARDWARE.TXT
+++ b/release/texts/HARDWARE.TXT
@@ -694,5 +694,7 @@ Genius and Mustek hand scanners.
Floppy tape drives (some rather old models only, driver rather stale)
+Lucent Technologies WaveLAN/IEEE 802.11 PCMCIA network adapters and
+workalikes (NCR WaveLAN/IEEE 802.11, Cabletron RoamAbout)
FreeBSD currently does NOT support IBM's microchannel (MCA) bus.
diff --git a/release/texts/RELNOTES.TXT b/release/texts/RELNOTES.TXT
index 9b75120..7da280a 100644
--- a/release/texts/RELNOTES.TXT
+++ b/release/texts/RELNOTES.TXT
@@ -64,6 +64,10 @@ Driver support has been added for PCI gigabit ethernet adapters
based on the Alteon Networks Tigon 1 and Tigon 2 chipsets, including
the Alteon AceNIC, 3Com 3c985 and Netgear GA620.
+Driver support has been added for IEEE 802.11 PCMCIA wireless network
+adapters based on the Lucent Hermes chipset, including the Lucent
+WaveLAN/IEEE 802.11 and the Cabletron RoamAbout.
+
1.2. SECURITY FIXES
-------------------
diff --git a/release/texts/i386/HARDWARE.TXT b/release/texts/i386/HARDWARE.TXT
index 5c68aef..07ccdfe 100644
--- a/release/texts/i386/HARDWARE.TXT
+++ b/release/texts/i386/HARDWARE.TXT
@@ -694,5 +694,7 @@ Genius and Mustek hand scanners.
Floppy tape drives (some rather old models only, driver rather stale)
+Lucent Technologies WaveLAN/IEEE 802.11 PCMCIA network adapters and
+workalikes (NCR WaveLAN/IEEE 802.11, Cabletron RoamAbout)
FreeBSD currently does NOT support IBM's microchannel (MCA) bus.
diff --git a/release/texts/i386/RELNOTES.TXT b/release/texts/i386/RELNOTES.TXT
index 9b75120..7da280a 100644
--- a/release/texts/i386/RELNOTES.TXT
+++ b/release/texts/i386/RELNOTES.TXT
@@ -64,6 +64,10 @@ Driver support has been added for PCI gigabit ethernet adapters
based on the Alteon Networks Tigon 1 and Tigon 2 chipsets, including
the Alteon AceNIC, 3Com 3c985 and Netgear GA620.
+Driver support has been added for IEEE 802.11 PCMCIA wireless network
+adapters based on the Lucent Hermes chipset, including the Lucent
+WaveLAN/IEEE 802.11 and the Cabletron RoamAbout.
+
1.2. SECURITY FIXES
-------------------
diff --git a/share/man/man4/man4.i386/Makefile b/share/man/man4/man4.i386/Makefile
index d8b39a0..0f76efe 100644
--- a/share/man/man4/man4.i386/Makefile
+++ b/share/man/man4/man4.i386/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.102 1999/04/07 14:42:55 wpaul Exp $
+# $Id: Makefile,v 1.103 1999/04/11 00:15:40 n_hibma Exp $
MAN4= adv.4 adw.4 aha.4 ahb.4 ahc.4 aic.4 alpm.4 apm.4 ar.4 asc.4 atkbd.4 \
atkbdc.4 ax.4 bktr.4 bt.4 cs.4 cx.4 cy.4 de.4 \
@@ -9,7 +9,7 @@ MAN4= adv.4 adw.4 aha.4 ahb.4 ahc.4 aic.4 alpm.4 apm.4 ar.4 asc.4 atkbd.4 \
rdp.4 rl.4 sb.4 scd.4 screen.4 si.4 sio.4 \
spkr.4 splash.4 sr.4 syscons.4 sysmouse.4 ti.4 tl.4 tw.4 tx.4 uhci.4 \
ukbd.4 ums.4 usb.4 vga.4 vr.4 vx.4 \
- wb.4 wd.4 wfd.4 wl.4 wt.4 xl.4 ze.4 zp.4
+ wb.4 wd.4 wfd.4 wi. wl.4 wt.4 xl.4 ze.4 zp.4
MLINKS= adv.4 ../adv.4
MLINKS+= adw.4 ../adw.4
@@ -92,6 +92,7 @@ MLINKS+= vx.4 ../vx.4
MLINKS+= wb.4 ../wb.4
MLINKS+= wd.4 ../wd.4
MLINKS+= wfd.4 ../wfd.4
+MLINKS+= wi.4 ../wi.4
MLINKS+= wl.4 ../wl.4
MLINKS+= wt.4 ../wt.4
MLINKS+= xl.4 ../xl.4
diff --git a/share/man/man4/man4.i386/pn.4 b/share/man/man4/man4.i386/pn.4
index acdb26a..16a4b4c 100644
--- a/share/man/man4/man4.i386/pn.4
+++ b/share/man/man4/man4.i386/pn.4
@@ -28,7 +28,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
.\" THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $Id: pn.4,v 1.4 1999/04/14 19:02:39 wpaul Exp $
+.\" $Id: pn.4,v 1.4 1999/04/14 19:40:08 wpaul Exp $
.\"
.Dd November 7, 1998
.Dt PN 4 i386
@@ -46,8 +46,8 @@ driver provides support for PCI ethernet adapters and embedded
controllers based on the Lite-On 82c168 and 82c169 fast ethernet
controller chips. This includes the LinkSys LNE100TX, the
Bay Networks Netgear FA310TX revision D1, the Matrox Networks
-FastNIC 10/100, certain adapters manufactured by D-Link and
-Trendware, and various other commodity fast ethernet cards.
+FastNIC 10/100, the Kingston KNE110TX (EtherRx VP),
+and various other commodity fast ethernet cards.
.Pp
The Lite-On chips use bus master DMA and are designed to be
DEC 'tulip' workalikes. Many vendors that formerly based their
diff --git a/share/man/man4/man4.i386/wi.4 b/share/man/man4/man4.i386/wi.4
new file mode 100644
index 0000000..d41343c
--- /dev/null
+++ b/share/man/man4/man4.i386/wi.4
@@ -0,0 +1,102 @@
+.\" Copyright (c) 1997, 1998, 1999
+.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+.\"
+.\" 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.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD
+.\" 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.
+.\"
+.\" $Id$
+.\"
+.Dd April 21, 1999
+.Dt WI 4 i386
+.Os FreeBSD
+.Sh NAME
+.Nm wi
+.Nd
+Lucent Technologies WaveLAN/IEEE 802.11 PCMCIA driver
+.Sh SYNOPSIS
+.Cd "device wi0 at isa? port? net irq?"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for WaveLAN/IEEE PCCARD adapters (also known
+as WaveLAN II cards). Note that while Lucent sells both ISA and PCMCIA
+WaveLAN/IEEE devices, the ISA product is actually a PCMCIA card in an
+ISA to PCMCIA bridge adapter. The
+.Nm
+driver supports both the ISA and PCMCIA devices.
+.Pp
+The core of the WaveLAN/IEEE is the Lucent Hermes controller. All
+host/device interaction is via programmed I/O with the Hermes. The
+Hermes supports 802.11 and 802.3 frames, power management, BSS, WDS
+and ad-hoc operation modes. The
+.Nm
+driver encapsulates all IP and ARP traffic as 802.11 frames, however
+it can receive either 802.11 or 802.3 frames. Transmit speed is
+selectable between 1Mbps fixed, 2Mbps fixed or 2Mbps with auto fallback.
+.Pp
+By default, the
+.Nm
+driver configures the WaveLAN card for ad-hoc operation. In this mode,
+stations can communicate among each other without the aid of an access
+point. To join a service set, the driver must be set for BSS mode using
+the
+.Xr wicontrol 8
+utility.
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "wi%d: init failed"
+The WaveLAN failed to come ready after an initialization command was
+issued.
+.It "wi%d: failed to allocate %d bytes on NIC"
+The driver was unable to allocate memory for transmit frames in the
+NIC's on-board RAM.
+.It "wd%d: device timeout"
+The WaveLAN failed to generate an interrupt to acknowledge a transmit
+command.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ifconfig 8 ,
+.Xr wicontrol 8
+.Rs
+.%T HCF Light programming specification
+.%O http://www.wavelan.com
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 3.0 .
+.Sh AUTHOR
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ctr.columbia.edu .
diff --git a/share/man/man4/pn.4 b/share/man/man4/pn.4
index acdb26a..16a4b4c 100644
--- a/share/man/man4/pn.4
+++ b/share/man/man4/pn.4
@@ -28,7 +28,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
.\" THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $Id: pn.4,v 1.4 1999/04/14 19:02:39 wpaul Exp $
+.\" $Id: pn.4,v 1.4 1999/04/14 19:40:08 wpaul Exp $
.\"
.Dd November 7, 1998
.Dt PN 4 i386
@@ -46,8 +46,8 @@ driver provides support for PCI ethernet adapters and embedded
controllers based on the Lite-On 82c168 and 82c169 fast ethernet
controller chips. This includes the LinkSys LNE100TX, the
Bay Networks Netgear FA310TX revision D1, the Matrox Networks
-FastNIC 10/100, certain adapters manufactured by D-Link and
-Trendware, and various other commodity fast ethernet cards.
+FastNIC 10/100, the Kingston KNE110TX (EtherRx VP),
+and various other commodity fast ethernet cards.
.Pp
The Lite-On chips use bus master DMA and are designed to be
DEC 'tulip' workalikes. Many vendors that formerly based their
diff --git a/share/man/man4/wi.4 b/share/man/man4/wi.4
new file mode 100644
index 0000000..d41343c
--- /dev/null
+++ b/share/man/man4/wi.4
@@ -0,0 +1,102 @@
+.\" Copyright (c) 1997, 1998, 1999
+.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+.\"
+.\" 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.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD
+.\" 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.
+.\"
+.\" $Id$
+.\"
+.Dd April 21, 1999
+.Dt WI 4 i386
+.Os FreeBSD
+.Sh NAME
+.Nm wi
+.Nd
+Lucent Technologies WaveLAN/IEEE 802.11 PCMCIA driver
+.Sh SYNOPSIS
+.Cd "device wi0 at isa? port? net irq?"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for WaveLAN/IEEE PCCARD adapters (also known
+as WaveLAN II cards). Note that while Lucent sells both ISA and PCMCIA
+WaveLAN/IEEE devices, the ISA product is actually a PCMCIA card in an
+ISA to PCMCIA bridge adapter. The
+.Nm
+driver supports both the ISA and PCMCIA devices.
+.Pp
+The core of the WaveLAN/IEEE is the Lucent Hermes controller. All
+host/device interaction is via programmed I/O with the Hermes. The
+Hermes supports 802.11 and 802.3 frames, power management, BSS, WDS
+and ad-hoc operation modes. The
+.Nm
+driver encapsulates all IP and ARP traffic as 802.11 frames, however
+it can receive either 802.11 or 802.3 frames. Transmit speed is
+selectable between 1Mbps fixed, 2Mbps fixed or 2Mbps with auto fallback.
+.Pp
+By default, the
+.Nm
+driver configures the WaveLAN card for ad-hoc operation. In this mode,
+stations can communicate among each other without the aid of an access
+point. To join a service set, the driver must be set for BSS mode using
+the
+.Xr wicontrol 8
+utility.
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "wi%d: init failed"
+The WaveLAN failed to come ready after an initialization command was
+issued.
+.It "wi%d: failed to allocate %d bytes on NIC"
+The driver was unable to allocate memory for transmit frames in the
+NIC's on-board RAM.
+.It "wd%d: device timeout"
+The WaveLAN failed to generate an interrupt to acknowledge a transmit
+command.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ifconfig 8 ,
+.Xr wicontrol 8
+.Rs
+.%T HCF Light programming specification
+.%O http://www.wavelan.com
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 3.0 .
+.Sh AUTHOR
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ctr.columbia.edu .
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 4258e80..99edebc 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can.
#
-# $Id: LINT,v 1.590 1999/05/02 20:34:06 peter Exp $
+# $Id: LINT,v 1.591 1999/05/02 21:54:03 n_hibma Exp $
#
# NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from
@@ -1198,6 +1198,9 @@ options EXTRA_SIO=2 #number of extra sio ports to allocate
# rdp: RealTek RTL 8002-based pocket ethernet adapters
# sr: RISCom/N2 hdlc sync 1/2 port V.35/X.21 serial driver (requires sppp)
# wl: Lucent Wavelan (ISA card only).
+# wi: Lucent WaveLAN/IEEE 802.11 PCMCIA adapters. Note: this supports both
+ the PCMCIA and ISA cards: the ISA card is really a PCMCIA to ISA
+ bridge with a PCMCIA adapter plugged into it.
# ze: IBM/National Semiconductor PCMCIA ethernet controller.
# zp: 3Com PCMCIA Etherlink III (It does not require shared memory for
# send/receive operation, but it needs 'iomem' to read/write the
@@ -1219,6 +1222,7 @@ device le0 at isa? port 0x300 irq 5 iomem 0xd0000
device lnc0 at isa? port 0x280 irq 10 drq 0
device rdp0 at isa? port 0x378 irq 7 flags 2
device sr0 at isa? port 0x300 irq 5 iomem 0xd0000
+device wi0 at isa? port? irq?
options WLCACHE # enables the signal-strength cache
options WLDEBUG # enables verbose debugging output
device wl0 at isa? port 0x300 irq ?
diff --git a/sys/conf/files.i386 b/sys/conf/files.i386
index ba0dba1..53dc919 100644
--- a/sys/conf/files.i386
+++ b/sys/conf/files.i386
@@ -1,7 +1,7 @@
# This file tells config what files go into building a kernel,
# files marked standard are always included.
#
-# $Id: files.i386,v 1.235 1999/04/15 14:52:23 bde Exp $
+# $Id: files.i386,v 1.236 1999/04/16 21:22:10 peter Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -154,6 +154,7 @@ i386/isa/if_le.c optional le device-driver
i386/isa/if_lnc.c optional lnc device-driver
i386/isa/if_rdp.c optional rdp device-driver
i386/isa/if_sr.c optional sr device-driver
+i386/isa/if_wi.c optional wi device-driver
i386/isa/if_wl.c optional wl device-driver
i386/isa/if_ze.c optional ze device-driver
i386/isa/if_zp.c optional zp device-driver
diff --git a/sys/dev/wi/if_wavelan_ieee.h b/sys/dev/wi/if_wavelan_ieee.h
new file mode 100644
index 0000000..f002933
--- /dev/null
+++ b/sys/dev/wi/if_wavelan_ieee.h
@@ -0,0 +1,281 @@
+/*
+ * Copyright (c) 1997, 1998, 1999
+ * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Bill Paul.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD
+ * 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.
+ *
+ * $Id: if_wavelan_ieee.h,v 1.4 1999/04/27 02:02:41 wpaul Exp $
+ */
+
+#ifndef _IF_WAVELAN_IEEE_H
+#define _IF_WAVELAN_IEEE_H
+
+/*
+ * This header defines a simple command interface to the FreeBSD
+ * WaveLAN/IEEE driver (wi) driver, which is used to set certain
+ * device-specific parameters which can't be easily managed through
+ * ifconfig(8). No, sysctl(2) is not the answer. I said a _simple_
+ * interface, didn't I.
+ */
+
+#ifndef SIOCSWAVELAN
+#define SIOCSWAVELAN SIOCSIFGENERIC
+#endif
+
+#ifndef SIOCGWAVELAN
+#define SIOCGWAVELAN SIOCGIFGENERIC
+#endif
+
+/*
+ * Technically I don't think there's a limit to a record
+ * length. The largest record is the one that contains the CIS
+ * data, which is 240 words long, so 256 should be a safe
+ * value.
+ */
+#define WI_MAX_DATALEN 512
+
+struct wi_req {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_val[WI_MAX_DATALEN];
+};
+
+/*
+ * Private LTV records (interpreted only by the driver). This is
+ * a minor kludge to allow reading the interface statistics from
+ * the driver.
+ */
+#define WI_RID_IFACE_STATS 0x0100
+#define WI_RID_MGMT_XMIT 0x0200
+
+struct wi_80211_hdr {
+ u_int16_t frame_ctl;
+ u_int16_t dur_id;
+ u_int8_t addr1[6];
+ u_int8_t addr2[6];
+ u_int8_t addr3[6];
+ u_int16_t seq_ctl;
+ u_int8_t addr4[6];
+};
+
+#define WI_FCTL_VERS 0x0002
+#define WI_FCTL_FTYPE 0x000C
+#define WI_FCTL_STYPE 0x00F0
+#define WI_FCTL_TODS 0x0100
+#define WI_FCTL_FROMDS 0x0200
+#define WI_FCTL_MOREFRAGS 0x0400
+#define WI_FCTL_RETRY 0x0800
+#define WI_FCTL_PM 0x1000
+#define WI_FCTL_MOREDATA 0x2000
+#define WI_FCTL_WEP 0x4000
+#define WI_FCTL_ORDER 0x8000
+
+#define WI_FTYPE_MGMT 0x0000
+#define WI_FTYPE_CTL 0x0004
+#define WI_FTYPE_DATA 0x0008
+
+#define WI_STYPE_MGMT_ASREQ 0x0000 /* association request */
+#define WI_STYPE_MGMT_ASRESP 0x0010 /* association response */
+#define WI_STYPE_MGMT_REASREQ 0x0020 /* reassociation request */
+#define WI_STYPE_MGMT_REASRESP 0x0030 /* reassociation response */
+#define WI_STYPE_MGMT_PROBEREQ 0x0040 /* probe request */
+#define WI_STYPE_MGMT_PROBERESP 0x0050 /* probe response */
+#define WI_STYPE_MGMT_BEACON 0x0080 /* beacon */
+#define WI_STYPE_MGMT_ATIM 0x0090 /* announcement traffic ind msg */
+#define WI_STYPE_MGMT_DISAS 0x00A0 /* disassociation */
+#define WI_STYPE_MGMT_AUTH 0x00B0 /* authentication */
+#define WI_STYPE_MGMT_DEAUTH 0x00C0 /* deauthentication */
+
+struct wi_mgmt_hdr {
+ u_int16_t frame_ctl;
+ u_int16_t duration;
+ u_int8_t dst_addr[6];
+ u_int8_t src_addr[6];
+ u_int8_t bssid[6];
+ u_int16_t seq_ctl;
+};
+
+#ifndef KERNEL
+struct wi_counters {
+ u_int32_t wi_tx_unicast_frames;
+ u_int32_t wi_tx_multicast_frames;
+ u_int32_t wi_tx_fragments;
+ u_int32_t wi_tx_unicast_octets;
+ u_int32_t wi_tx_multicast_octets;
+ u_int32_t wi_tx_deferred_xmits;
+ u_int32_t wi_tx_single_retries;
+ u_int32_t wi_tx_multi_retries;
+ u_int32_t wi_tx_retry_limit;
+ u_int32_t wi_tx_discards;
+ u_int32_t wi_rx_unicast_frames;
+ u_int32_t wi_rx_multicast_frames;
+ u_int32_t wi_rx_fragments;
+ u_int32_t wi_rx_unicast_octets;
+ u_int32_t wi_rx_multicast_octets;
+ u_int32_t wi_rx_fcs_errors;
+ u_int32_t wi_rx_discards_nobuf;
+ u_int32_t wi_tx_discards_wrong_sa;
+ u_int32_t wi_rx_WEP_cant_decrypt;
+ u_int32_t wi_rx_msg_in_msg_frags;
+ u_int32_t wi_rx_msg_in_bad_msg_frags;
+};
+
+/*
+ * These are all the LTV record types that we can read or write
+ * from the WaveLAN. Not all of them are temendously useful, but I
+ * list as many as I know about here for completeness.
+ */
+
+#define WI_RID_DNLD_BUF 0xFD01
+#define WI_RID_MEMSZ 0xFD02
+#define WI_RID_DOMAINS 0xFD11
+#define WI_RID_CIS 0xFD13
+#define WI_RID_COMMQUAL 0xFD43
+#define WI_RID_SCALETHRESH 0xFD46
+#define WI_RID_PCF 0xFD87
+
+/*
+ * Network parameters, static configuration entities.
+ */
+#define WI_RID_PORTTYPE 0xFC00 /* Connection control characteristics */
+#define WI_RID_MAC_NODE 0xFC01 /* MAC address of this station */
+#define WI_RID_DESIRED_SSID 0xFC02 /* Service Set ID for connection */
+#define WI_RID_OWN_CHNL 0xFC03 /* Comm channel for BSS creation */
+#define WI_RID_OWN_SSID 0xFC04 /* IBSS creation ID */
+#define WI_RID_OWN_ATIM_WIN 0xFC05 /* ATIM window time for IBSS creation */
+#define WI_RID_SYSTEM_SCALE 0xFC06 /* scale that specifies AP density */
+#define WI_RID_MAX_DATALEN 0xFC07 /* Max len of MAC frame body data */
+#define WI_RID_MAC_WDS 0xFC08 /* MAC addr of corresponding WDS node */
+#define WI_RID_PM_ENABLED 0xFC09 /* ESS power management enable */
+#define WI_RID_PM_EPS 0xFC0A /* PM EPS/PS mode */
+#define WI_RID_MCAST_RX 0xFC0B /* ESS PM mcast reception */
+#define WI_RID_MAX_SLEEP 0xFC0C /* max sleep time for ESS PM */
+#define WI_RID_HOLDOVER 0xFC0D /* holdover time for ESS PM */
+#define WI_RID_NODENAME 0xFC0E /* ID name of this node for diag */
+#define WI_RID_DTIM_PERIOD 0xFC10 /* beacon interval between DTIMs */
+#define WI_RID_WDS_ADDR1 0xFC11 /* port 1 MAC of WDS link node */
+#define WI_RID_WDS_ADDR2 0xFC12 /* port 1 MAC of WDS link node */
+#define WI_RID_WDS_ADDR3 0xFC13 /* port 1 MAC of WDS link node */
+#define WI_RID_WDS_ADDR4 0xFC14 /* port 1 MAC of WDS link node */
+#define WI_RID_WDS_ADDR5 0xFC15 /* port 1 MAC of WDS link node */
+#define WI_RID_WDS_ADDR6 0xFC16 /* port 1 MAC of WDS link node */
+#define WI_RID_MCAST_PM_BUF 0xFC17 /* PM buffering of mcast */
+
+/*
+ * Network parameters, dynamic configuration entities
+ */
+#define WI_RID_MCAST_LIST 0xFC80 /* list of multicast addrs */
+#define WI_RID_CREATE_IBSS 0xFC81 /* create IBSS */
+#define WI_RID_FRAG_THRESH 0xFC82 /* frag len, unicast msg xmit */
+#define WI_RID_RTS_THRESH 0xFC83 /* frame len for RTS/CTS handshake */
+#define WI_RID_TX_RATE 0xFC84 /* data rate for message xmit */
+#define WI_RID_PROMISC 0xFC85 /* enable promisc mode */
+#define WI_RID_FRAG_THRESH0 0xFC90
+#define WI_RID_FRAG_THRESH1 0xFC91
+#define WI_RID_FRAG_THRESH2 0xFC92
+#define WI_RID_FRAG_THRESH3 0xFC93
+#define WI_RID_FRAG_THRESH4 0xFC94
+#define WI_RID_FRAG_THRESH5 0xFC95
+#define WI_RID_FRAG_THRESH6 0xFC96
+#define WI_RID_RTS_THRESH0 0xFC97
+#define WI_RID_RTS_THRESH1 0xFC98
+#define WI_RID_RTS_THRESH2 0xFC99
+#define WI_RID_RTS_THRESH3 0xFC9A
+#define WI_RID_RTS_THRESH4 0xFC9B
+#define WI_RID_RTS_THRESH5 0xFC9C
+#define WI_RID_RTS_THRESH6 0xFC9D
+#define WI_RID_TX_RATE0 0xFC9E
+#define WI_RID_TX_RATE1 0xFC9F
+#define WI_RID_TX_RATE2 0xFCA0
+#define WI_RID_TX_RATE3 0xFCA1
+#define WI_RID_TX_RATE4 0xFCA2
+#define WI_RID_TX_RATE5 0xFCA3
+#define WI_RID_TX_RATE6 0xFCA4
+#define WI_RID_TICK_TIME 0xFCE0
+
+/*
+ * NIC information
+ */
+#define WI_RID_FIRM_ID 0xFD02 /* Primary func firmware ID. */
+#define WI_RID_PRI_SUP_RANGE 0xFD03 /* primary supplier compatibility */
+#define WI_RID_CIF_ACT_RANGE 0xFD04 /* controller sup. compatibility */
+#define WI_RID_SERIALNO 0xFD0A /* card serial number */
+#define WI_RID_CARD_ID 0xFD0B /* card identification */
+#define WI_RID_MFI_SUP_RANGE 0xFD0C /* modem supplier compatibility */
+#define WI_RID_CFI_SUP_RANGE 0xFD0D /* controller sup. compatibility */
+#define WI_RID_CHANNEL_LIST 0xFD10 /* allowd comm. frequencies. */
+#define WI_RID_REG_DOMAINS 0xFD11 /* list of intendted regulatory doms */
+#define WI_RID_TEMP_TYPE 0xFD12 /* hw temp range code */
+#define WI_RID_CIS 0xFD13 /* PC card info struct */
+#define WI_RID_STA_IDENEITY 0xFD20 /* station funcs firmware ident */
+#define WI_RID_STA_SUP_RANGE 0xFD21 /* station supplier compat */
+#define WI_RID_MFI_ACT_RANGE 0xFD22
+#define WI_RID_CFI_ACT_RANGE 0xFD33
+
+/*
+ * MAC information
+ */
+#define WI_RID_PORT_STAT 0xFD40 /* actual MAC port con control stat */
+#define WI_RID_CURRENT_SSID 0xFD41 /* ID of actually connected SS */
+#define WI_RID_CURRENT_BSSID 0xFD42 /* ID of actually connected BSS */
+#define WI_RID_COMMS_QUALITY 0xFD43 /* quality of BSS connection */
+#define WI_RID_CUR_TX_RATE 0xFD44 /* current TX rate */
+#define WI_RID_OWN_BEACON_INT 0xFD45 /* beacon xmit time for BSS creation */
+#define WI_RID_CUR_SCALE_THRESH 0xFD46 /* actual system scane thresh setting */
+#define WI_RID_PROT_RESP_TIME 0xFD47 /* time to wait for resp to req msg */
+#define WI_RID_SHORT_RTR_LIM 0xFD48 /* max tx attempts for short frames */
+#define WI_RID_LONG_RTS_LIM 0xFD49 /* max tx attempts for long frames */
+#define WI_RID_MAX_TX_LIFE 0xFD4A /* max tx frame handling duration */
+#define WI_RID_MAX_RX_LIFE 0xFD4B /* max rx frame handling duration */
+#define WI_RID_CF_POLL 0xFD4C /* contention free pollable ind */
+#define WI_RID_AUTH_ALGS 0xFD4D /* auth algorithms available */
+#define WI_RID_AUTH_TYPE 0xFD4E /* availanle auth types */
+#define WI_RID_WEP_AVAIL 0xFD4F /* WEP privacy option available */
+#define WI_RID_CUR_TX_RATE1 0xFD80
+#define WI_RID_CUR_TX_RATE2 0xFD81
+#define WI_RID_CUR_TX_RATE3 0xFD82
+#define WI_RID_CUR_TX_RATE4 0xFD83
+#define WI_RID_CUR_TX_RATE5 0xFD84
+#define WI_RID_CUR_TX_RATE6 0xFD85
+#define WI_RID_OWN_MAC 0xFD86 /* unique local MAC addr */
+#define WI_RID_PCI_INFO 0xFD87 /* point coordination func cap */
+
+/*
+ * Modem information
+ */
+#define WI_RID_PHY_TYPE 0xFDC0 /* phys layer type indication */
+#define WI_RID_CURRENT_CHAN 0xFDC1 /* current frequency */
+#define WI_RID_PWR_STATE 0xFDC2 /* pwr consumption status */
+#define WI_RID_CCA_MODE 0xFDC3 /* clear chan assess mode indication */
+#define WI_RID_CCA_TIME 0xFDC4 /* clear chan assess time */
+#define WI_RID_MAC_PROC_DELAY 0xFDC5 /* MAC processing delay time */
+#define WI_RID_DATA_RATES 0xFDC6 /* supported data rates */
+#endif
+
+
+#endif
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index 59c73f0..35f585e 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/if_wi.c
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: if_wi.c,v 1.48 1999/05/05 00:32:13 wpaul Exp $
+ * $Id: if_wi.c,v 1.48 1999/05/05 00:32:13 wpaul Exp wpaul $
*/
/*
@@ -116,7 +116,7 @@
#if !defined(lint)
static const char rcsid[] =
- "$Id: if_wi.c,v 1.48 1999/05/05 00:32:13 wpaul Exp $";
+ "$Id: if_wi.c,v 1.48 1999/05/05 00:32:13 wpaul Exp wpaul $";
#endif
static struct wi_softc wi_softc[NWI];
@@ -1118,11 +1118,11 @@ static void wi_init(xsc)
wi_cmd(sc, WI_CMD_ENABLE|sc->wi_portnum, 0);
if (wi_alloc_nicmem(sc, 1518 + sizeof(struct wi_frame) + 8, &id))
- printf("wi%d: mem allocation failed...\n", sc->wi_unit);
+ printf("wi%d: tx buffer allocation failed\n", sc->wi_unit);
sc->wi_tx_data_id = id;
if (wi_alloc_nicmem(sc, 1518 + sizeof(struct wi_frame) + 8, &id))
- printf("wi%d: mem allocation failed...\n", sc->wi_unit);
+ printf("wi%d: mgmt. buffer allocation failed\n", sc->wi_unit);
sc->wi_tx_mgmt_id = id;
/* enable interrupts */
diff --git a/sys/dev/wi/if_wireg.h b/sys/dev/wi/if_wireg.h
new file mode 100644
index 0000000..010537d
--- /dev/null
+++ b/sys/dev/wi/if_wireg.h
@@ -0,0 +1,580 @@
+/*
+ * Copyright (c) 1997, 1998, 1999
+ * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Bill Paul.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD
+ * 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.
+ *
+ * $Id: if_wireg.h,v 1.28 1999/05/03 18:34:16 wpaul Exp $
+ */
+
+struct wi_counters {
+ u_int32_t wi_tx_unicast_frames;
+ u_int32_t wi_tx_multicast_frames;
+ u_int32_t wi_tx_fragments;
+ u_int32_t wi_tx_unicast_octets;
+ u_int32_t wi_tx_multicast_octets;
+ u_int32_t wi_tx_deferred_xmits;
+ u_int32_t wi_tx_single_retries;
+ u_int32_t wi_tx_multi_retries;
+ u_int32_t wi_tx_retry_limit;
+ u_int32_t wi_tx_discards;
+ u_int32_t wi_rx_unicast_frames;
+ u_int32_t wi_rx_multicast_frames;
+ u_int32_t wi_rx_fragments;
+ u_int32_t wi_rx_unicast_octets;
+ u_int32_t wi_rx_multicast_octets;
+ u_int32_t wi_rx_fcs_errors;
+ u_int32_t wi_rx_discards_nobuf;
+ u_int32_t wi_tx_discards_wrong_sa;
+ u_int32_t wi_rx_WEP_cant_decrypt;
+ u_int32_t wi_rx_msg_in_msg_frags;
+ u_int32_t wi_rx_msg_in_bad_msg_frags;
+};
+
+struct wi_softc {
+ struct arpcom arpcom;
+ struct ifmedia ifmedia;
+ int wi_unit;
+ bus_space_handle_t wi_bhandle;
+ bus_space_tag_t wi_btag;
+ int wi_tx_data_id;
+ int wi_tx_mgmt_id;
+ int wi_gone;
+ int wi_if_flags;
+ u_int16_t wi_ptype;
+ u_int16_t wi_portnum;
+ u_int16_t wi_max_data_len;
+ u_int16_t wi_rts_thresh;
+ u_int16_t wi_ap_density;
+ u_int16_t wi_tx_rate;
+ u_int16_t wi_create_ibss;
+ char wi_node_name[32];
+ char wi_net_name[32];
+ char wi_ibss_name[32];
+ u_int8_t wi_txbuf[1536];
+ struct wi_counters wi_stats;
+ struct callout_handle wi_stat_ch;
+};
+
+#define WI_TIMEOUT 65536
+
+#define WI_PORT0 0
+#define WI_PORT1 1
+#define WI_PORT2 2
+#define WI_PORT3 3
+#define WI_PORT4 4
+#define WI_PORT5 5
+
+/* Default port: 0 (only 0 exists on stations) */
+#define WI_DEFAULT_PORT (WI_PORT0 << 8)
+
+/* Default TX rate: 2Mbps, auto fallback */
+#define WI_DEFAULT_TX_RATE 3
+
+/* Default network name: ANY */
+#define WI_DEFAULT_NETNAME "ANY"
+
+#define WI_DEFAULT_AP_DENSITY 1
+
+#define WI_DEFAULT_RTS_THRESH 2347
+
+#define WI_DEFAULT_DATALEN 2304
+
+#define WI_DEFAULT_CREATE_IBSS 0
+
+#define WI_DEFAULT_NODENAME "FreeBSD WaveLAN/IEEE node"
+
+#define WI_DEFAULT_IBSS "FreeBSD IBSS"
+
+/*
+ * register space access macros
+ */
+#define CSR_WRITE_4(sc, reg, val) \
+ bus_space_write_4(sc->wi_btag, sc->wi_bhandle, reg, val)
+#define CSR_WRITE_2(sc, reg, val) \
+ bus_space_write_2(sc->wi_btag, sc->wi_bhandle, reg, val)
+#define CSR_WRITE_1(sc, reg, val) \
+ bus_space_write_1(sc->wi_btag, sc->wi_bhandle, reg, val)
+
+#define CSR_READ_4(sc, reg) \
+ bus_space_read_4(sc->wi_btag, sc->wi_bhandle, reg)
+#define CSR_READ_2(sc, reg) \
+ bus_space_read_2(sc->wi_btag, sc->wi_bhandle, reg)
+#define CSR_READ_1(sc, reg) \
+ bus_space_read_1(sc->wi_btag, sc->wi_bhandle, reg)
+
+/*
+ * The WaveLAN/IEEE cards contain an 802.11 MAC controller which Lucent
+ * calls 'Hermes.' In typical fashion, getting documentation about this
+ * controller is about as easy as squeezing blood from a stone. Here
+ * is more or less what I know:
+ *
+ * - The Hermes controller is firmware driven, and the host interacts
+ * with the Hermes via a firmware interface, which can change.
+ *
+ * - The Hermes is described in a document called: "Hermes Firmware
+ * WaveLAN/IEEE Station Functions," document #010245, which of course
+ * Lucent will not release without an NDA.
+ *
+ * - Lucent has created a library called HCF (Hardware Control Functions)
+ * though which it wants developers to interact with the card. The HCF
+ * is needlessly complex, ill conceived and badly documented. Actually,
+ * the comments in the HCP code itself aren't bad, but the publically
+ * available manual that comes with it is awful, probably due largely to
+ * the fact that it has been emasculated in order to hide information
+ * that Lucent wants to keep proprietary. The purpose of the HCF seems
+ * to be to insulate the driver programmer from the Hermes itself so that
+ * Lucent has an excuse not to release programming in for it.
+ *
+ * - Lucent only makes available documentation and code for 'HCF Light'
+ * which is a stripped down version of HCF with certain features not
+ * implemented, most notably support for 802.11 frames.
+ *
+ * - The HCF code which I have seen blows goats. Whoever decided to
+ * use a 132 column format should be shot.
+ *
+ * Rather than actually use the Lucent HCF library, I have stripped all
+ * the useful information from it and used it to create a driver in the
+ * usual BSD form. Note: I don't want to hear anybody whining about the
+ * fact that the Lucent code is GPLed and mine isn't. I did not actually
+ * put any of Lucent's code in this driver: I only used it as a reference
+ * to obtain information about the underlying hardware. The Hermes
+ * programming interface is not GPLed, so bite me.
+ */
+
+/*
+ * Size of Hermes I/O space.
+ */
+#define WI_IOSIZ 0x40
+
+/*
+ * Hermes register definitions and what little I know about them.
+ */
+
+/* Hermes command/status registers. */
+#define WI_COMMAND 0x00
+#define WI_PARAM0 0x02
+#define WI_PARAM1 0x04
+#define WI_PARAM2 0x06
+#define WI_STATUS 0x08
+#define WI_RESP0 0x0A
+#define WI_RESP1 0x0C
+#define WI_RESP2 0x0E
+
+/* Command register values. */
+#define WI_CMD_BUSY 0x8000 /* busy bit */
+#define WI_CMD_INI 0x0000 /* initialize */
+#define WI_CMD_ENABLE 0x0001 /* enable */
+#define WI_CMD_DISABLE 0x0002 /* disable */
+#define WI_CMD_DIAG 0x0003
+#define WI_CMD_ALLOC_MEM 0x000A /* allocate NIC memory */
+#define WI_CMD_TX 0x000B /* transmit */
+#define WI_CMD_NOTIFY 0x0010
+#define WI_CMD_INQUIRE 0x0011
+#define WI_CMD_ACCESS 0x0021
+#define WI_CMD_PROGRAM 0x0022
+
+#define WI_CMD_CODE_MASK 0x003F
+
+/*
+ * Reclaim qualifier bit, applicable to the
+ * TX and INQUIRE commands.
+ */
+#define WI_RECLAIM 0x0100 /* reclaim NIC memory */
+
+/*
+ * ACCESS command qualifier bits.
+ */
+#define WI_ACCESS_READ 0x0000
+#define WI_ACCESS_WRITE 0x0100
+
+/*
+ * PROGRAM command qualifier bits.
+ */
+#define WI_PROGRAM_DISABLE 0x0000
+#define WI_PROGRAM_ENABLE_RAM 0x0100
+#define WI_PROGRAM_ENABLE_NVRAM 0x0200
+#define WI_PROGRAM_NVRAM 0x0300
+
+/* Status register values */
+#define WI_STAT_CMD_CODE 0x003F
+#define WI_STAT_DIAG_ERR 0x0100
+#define WI_STAT_INQ_ERR 0x0500
+#define WI_STAT_CMD_RESULT 0x7F00
+
+/* memory handle management registers */
+#define WI_INFO_FID 0x10
+#define WI_RX_FID 0x20
+#define WI_ALLOC_FID 0x22
+#define WI_TX_CMP_FID 0x24
+
+/*
+ * Buffer Access Path (BAP) registers.
+ * These are I/O channels. I believe you can use each one for
+ * any desired purpose independently of the other. In general
+ * though, we use BAP1 for reading and writing LTV records and
+ * reading received data frames, and BAP0 for writing transmit
+ * frames. This is a convention though, not a rule.
+ */
+#define WI_SEL0 0x18
+#define WI_SEL1 0x1A
+#define WI_OFF0 0x1C
+#define WI_OFF1 0x1E
+#define WI_DATA0 0x36
+#define WI_DATA1 0x38
+#define WI_BAP0 WI_DATA0
+#define WI_BAP1 WI_DATA1
+
+#define WI_OFF_BUSY 0x8000
+#define WI_OFF_ERR 0x4000
+#define WI_OFF_DATAOFF 0x0FFF
+
+/* Event registers */
+#define WI_EVENT_STAT 0x30 /* Event status */
+#define WI_INT_EN 0x32 /* Interrupt enable/disable */
+#define WI_EVENT_ACK 0x34 /* Ack event */
+
+/* Events */
+#define WI_EV_TICK 0x8000 /* aux timer tick */
+#define WI_EV_RES 0x4000 /* controller h/w error (time out) */
+#define WI_EV_INFO_DROP 0x2000 /* no RAM to build unsolicited frame */
+#define WI_EV_NO_CARD 0x0800 /* card removed (hunh?) */
+#define WI_EV_DUIF_RX 0x0400 /* wavelan management packet received */
+#define WI_EV_INFO 0x0080 /* async info frame */
+#define WI_EV_CMD 0x0010 /* command completed */
+#define WI_EV_ALLOC 0x0008 /* async alloc/reclaim completed */
+#define WI_EV_TX_EXC 0x0004 /* async xmit completed with failure */
+#define WI_EV_TX 0x0002 /* async xmit completed succesfully */
+#define WI_EV_RX 0x0001 /* async rx completed */
+
+#define WI_INTRS \
+ (WI_EV_RX|WI_EV_TX|WI_EV_TX_EXC|WI_EV_ALLOC|WI_EV_INFO|WI_EV_INFO_DROP)
+
+/* Host software registers */
+#define WI_SW0 0x28
+#define WI_SW1 0x2A
+#define WI_SW2 0x2C
+#define WI_SW3 0x2E
+
+#define WI_CNTL 0x14
+
+#define WI_CNTL_AUX_ENA 0xC000
+#define WI_CNTL_AUX_ENA_STAT 0xC000
+#define WI_CNTL_AUX_DIS_STAT 0x0000
+#define WI_CNTL_AUX_ENA_CNTL 0x8000
+#define WI_CNTL_AUX_DIS_CNTL 0x4000
+
+#define WI_AUX_PAGE 0x3A
+#define WI_AUX_OFFSET 0x3C
+#define WI_AUX_DATA 0x3E
+
+/*
+ * One form of communication with the Hermes is with what Lucent calls
+ * LTV records, where LTV stands for Length, Type and Value. The length
+ * and type are 16 bits and are in native byte order. The value is in
+ * multiples of 16 bits and is in little endian byte order.
+ */
+struct wi_ltv_gen {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_val;
+};
+
+struct wi_ltv_str {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_str[17];
+};
+
+#define WI_SETVAL(recno, val) \
+ do { \
+ struct wi_ltv_gen g; \
+ \
+ g.wi_len = 2; \
+ g.wi_type = recno; \
+ g.wi_val = val; \
+ wi_write_record(sc, &g); \
+ } while (0)
+
+#define WI_SETSTR(recno, str) \
+ do { \
+ struct wi_ltv_str s; \
+ int l; \
+ \
+ l = (strlen(str) + 1) & ~0x1; \
+ bzero((char *)&s, sizeof(s)); \
+ s.wi_len = (l / 2) + 2; \
+ s.wi_type = recno; \
+ s.wi_str[0] = htons(strlen(str)); \
+ bcopy(str, (char *)&s.wi_str[1], strlen(str)); \
+ wi_write_record(sc, (struct wi_ltv_gen *)&s); \
+ } while (0)
+
+/*
+ * Download buffer location and length (0xFD01).
+ */
+#define WI_RID_DNLD_BUF 0xFD01
+struct wi_ltv_dnld_buf {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_buf_pg; /* page addr of intermediate dl buf*/
+ u_int16_t wi_buf_off; /* offset of idb */
+ u_int16_t wi_buf_len; /* len of idb */
+};
+
+/*
+ * Mem sizes (0xFD02).
+ */
+#define WI_RID_MEMSZ 0xFD02
+struct wi_ltv_memsz {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_mem_ram;
+ u_int16_t wi_mem_nvram;
+};
+
+/*
+ * List of intended regulatory domains (0xFD11).
+ */
+#define WI_RID_DOMAINS 0xFD11
+struct wi_ltv_domains {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_domains[6];
+};
+
+/*
+ * CIS struct (0xFD13).
+ */
+#define WI_RID_CIS 0xFD13
+struct wi_ltv_cis {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_cis[240];
+};
+
+/*
+ * Communications quality (0xFD43).
+ */
+#define WI_RID_COMMQUAL 0xFD43
+struct wi_ltv_commqual {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_coms_qual;
+ u_int16_t wi_sig_lvl;
+ u_int16_t wi_noise_lvl;
+};
+
+/*
+ * Actual system scale thresholds (0xFD46).
+ */
+#define WI_RID_SYSTEM_SCALE 0xFC06
+#define WI_RID_SCALETHRESH 0xFD46
+struct wi_ltv_scalethresh {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_energy_detect;
+ u_int16_t wi_carrier_detect;
+ u_int16_t wi_defer;
+ u_int16_t wi_cell_search;
+ u_int16_t wi_out_of_range;
+ u_int16_t wi_delta_snr;
+};
+
+/*
+ * PCF info struct (0xFD87).
+ */
+#define WI_RID_PCF 0xFD87
+struct wi_ltv_pcf {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_energy_detect;
+ u_int16_t wi_carrier_detect;
+ u_int16_t wi_defer;
+ u_int16_t wi_cell_search;
+ u_int16_t wi_range;
+};
+
+/*
+ * Connection control characteristics.
+ * 1 == Basic Service Set (BSS)
+ * 2 == Wireless Distribudion System (WDS)
+ * 3 == Pseudo IBSS
+ */
+#define WI_RID_PORTTYPE 0xFC00
+#define WI_PORTTYPE_BSS 0x1
+#define WI_PORTTYPE_WDS 0x2
+#define WI_PORTTYPE_ADHOC 0x3
+
+/*
+ * Mac addresses.
+ */
+#define WI_RID_MAC_NODE 0xFC01
+#define WI_RID_MAC_WDS 0xFC08
+struct wi_ltv_macaddr {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_mac_addr[3];
+};
+
+/*
+ * Station set identification (SSID).
+ */
+#define WI_RID_DESIRED_SSID 0xFC02
+#define WI_RID_OWN_SSID 0xFC04
+struct wi_ltv_ssid {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_id[17];
+};
+
+/*
+ * Set communications channel (radio frequency).
+ */
+#define WI_RID_CHNL 0xFC03
+
+/*
+ * Frame data size.
+ */
+#define WI_RID_MAX_DATALEN 0xFC07
+
+/*
+ * Set our station name.
+ */
+#define WI_RID_NODENAME 0xFC0E
+struct wi_ltv_nodename {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_nodename[17];
+};
+
+/*
+ * Multicast addresses to be put in filter. We're
+ * allowed up to 16 addresses in the filter.
+ */
+#define WI_RID_MCAST 0xFC80
+struct wi_ltv_mcast {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ struct ether_addr wi_mcast[16];
+};
+
+/*
+ * Create IBSS.
+ */
+#define WI_RID_CREATE_IBSS 0xFC81
+
+#define WI_RID_FRAG_THRESH 0xFC82
+#define WI_RID_RTS_THRESH 0xFC83
+
+/*
+ * TX rate control
+ * 0 == Fixed 1mbps
+ * 1 == Fixed 2mbps
+ * 2 == auto fallback
+ */
+#define WI_RID_TX_RATE 0xFC84
+
+/*
+ * promiscuous mode.
+ */
+#define WI_RID_PROMISC 0xFC85
+
+/*
+ * Auxiliary Timer tick interval
+ */
+#define WI_RID_TICK_TIME 0xFCE0
+
+/*
+ * Information frame types.
+ */
+#define WI_INFO_NOTIFY 0xF000 /* Handover address */
+#define WI_INFO_COUNTERS 0xF100 /* Statistics counters */
+#define WI_INFO_SCAN_RESULTS 0xF101 /* Scan results */
+#define WI_INFO_LINK_STAT 0xF200 /* Link status */
+#define WI_INFO_ASSOC_STAT 0xF201 /* Association status */
+
+/*
+ * Hermes transmit/receive frame structure
+ */
+struct wi_frame {
+ u_int16_t wi_status; /* 0x00 */
+ u_int32_t wi_rsvd0; /* 0x02 */
+ u_int16_t wi_q_info; /* 0x06 */
+ u_int16_t wi_rsvd1; /* 0x08 */
+ u_int16_t wi_tx_ctl; /* 0x0C */
+ u_int16_t wi_frame_ctl; /* 0x0E */
+ u_int16_t wi_id; /* 0x10 */
+ u_int8_t wi_addr1[6]; /* 0x12 */
+ u_int8_t wi_addr2[6]; /* 0x18 */
+ u_int8_t wi_addr3[6]; /* 0x1E */
+ u_int16_t wi_seq_ctl; /* 0x24 */
+ u_int8_t wi_addr4[6]; /* 0x26 */
+ u_int16_t wi_dat_len; /* 0x2C */
+ u_int8_t wi_dst_addr[6]; /* 0x2E */
+ u_int8_t wi_src_addr[6]; /* 0x34 */
+ u_int16_t wi_len; /* 0x3A */
+ u_int16_t wi_dat[3]; /* 0x3C */ /* SNAP header */
+ u_int16_t wi_type; /* 0x42 */
+};
+
+#define WI_802_3_OFFSET 0x2E
+#define WI_802_11_OFFSET 0x44
+#define WI_802_11_OFFSET_RAW 0x3C
+
+#define WI_STAT_BADCRC 0x0001
+#define WI_STAT_UNDECRYPTABLE 0x0002
+#define WI_STAT_ERRSTAT 0x0003
+#define WI_STAT_MAC_PORT 0x0700
+#define WI_STAT_1042 0x2000 /* RFC1042 encoded */
+#define WI_STAT_TUNNEL 0x4000 /* Bridge-tunnel encoded */
+#define WI_STAT_WMP_MSG 0x6000 /* WaveLAN-II management protocol */
+#define WI_RXSTAT_MSG_TYPE 0xE000
+
+#define WI_ENC_TX_802_3 0x00
+#define WI_ENC_TX_802_11 0x11
+#define WI_ENC_TX_E_II 0x0E
+
+#define WI_ENC_TX_1042 0x00
+#define WI_ENC_TX_TUNNEL 0xF8
+
+#define WI_TXCNTL_MACPORT 0x00FF
+#define WI_TXCNTL_STRUCTTYPE 0xFF00
+
+/*
+ * SNAP (sub-network access protocol) constants for transmission
+ * of IP datagrams over IEEE 802 networks, taken from RFC1042.
+ * We need these for the LLC/SNAP header fields in the TX/RX frame
+ * structure.
+ */
+#define WI_SNAP_K1 0xaa /* assigned global SAP for SNAP */
+#define WI_SNAP_K2 0x00
+#define WI_SNAP_CONTROL 0x03 /* unnumbered information format */
+#define WI_SNAP_WORD0 (WI_SNAP_K1 | (WI_SNAP_K1 << 8))
+#define WI_SNAP_WORD1 (WI_SNAP_K2 | (WI_SNAP_CONTROL << 8))
+#define WI_SNAPHDR_LEN 0x6
diff --git a/sys/i386/conf/LINT b/sys/i386/conf/LINT
index 4258e80..99edebc 100644
--- a/sys/i386/conf/LINT
+++ b/sys/i386/conf/LINT
@@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can.
#
-# $Id: LINT,v 1.590 1999/05/02 20:34:06 peter Exp $
+# $Id: LINT,v 1.591 1999/05/02 21:54:03 n_hibma Exp $
#
# NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from
@@ -1198,6 +1198,9 @@ options EXTRA_SIO=2 #number of extra sio ports to allocate
# rdp: RealTek RTL 8002-based pocket ethernet adapters
# sr: RISCom/N2 hdlc sync 1/2 port V.35/X.21 serial driver (requires sppp)
# wl: Lucent Wavelan (ISA card only).
+# wi: Lucent WaveLAN/IEEE 802.11 PCMCIA adapters. Note: this supports both
+ the PCMCIA and ISA cards: the ISA card is really a PCMCIA to ISA
+ bridge with a PCMCIA adapter plugged into it.
# ze: IBM/National Semiconductor PCMCIA ethernet controller.
# zp: 3Com PCMCIA Etherlink III (It does not require shared memory for
# send/receive operation, but it needs 'iomem' to read/write the
@@ -1219,6 +1222,7 @@ device le0 at isa? port 0x300 irq 5 iomem 0xd0000
device lnc0 at isa? port 0x280 irq 10 drq 0
device rdp0 at isa? port 0x378 irq 7 flags 2
device sr0 at isa? port 0x300 irq 5 iomem 0xd0000
+device wi0 at isa? port? irq?
options WLCACHE # enables the signal-strength cache
options WLDEBUG # enables verbose debugging output
device wl0 at isa? port 0x300 irq ?
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 4258e80..99edebc 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can.
#
-# $Id: LINT,v 1.590 1999/05/02 20:34:06 peter Exp $
+# $Id: LINT,v 1.591 1999/05/02 21:54:03 n_hibma Exp $
#
# NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from
@@ -1198,6 +1198,9 @@ options EXTRA_SIO=2 #number of extra sio ports to allocate
# rdp: RealTek RTL 8002-based pocket ethernet adapters
# sr: RISCom/N2 hdlc sync 1/2 port V.35/X.21 serial driver (requires sppp)
# wl: Lucent Wavelan (ISA card only).
+# wi: Lucent WaveLAN/IEEE 802.11 PCMCIA adapters. Note: this supports both
+ the PCMCIA and ISA cards: the ISA card is really a PCMCIA to ISA
+ bridge with a PCMCIA adapter plugged into it.
# ze: IBM/National Semiconductor PCMCIA ethernet controller.
# zp: 3Com PCMCIA Etherlink III (It does not require shared memory for
# send/receive operation, but it needs 'iomem' to read/write the
@@ -1219,6 +1222,7 @@ device le0 at isa? port 0x300 irq 5 iomem 0xd0000
device lnc0 at isa? port 0x280 irq 10 drq 0
device rdp0 at isa? port 0x378 irq 7 flags 2
device sr0 at isa? port 0x300 irq 5 iomem 0xd0000
+device wi0 at isa? port? irq?
options WLCACHE # enables the signal-strength cache
options WLDEBUG # enables verbose debugging output
device wl0 at isa? port 0x300 irq ?
diff --git a/sys/i386/conf/files.i386 b/sys/i386/conf/files.i386
index ba0dba1..53dc919 100644
--- a/sys/i386/conf/files.i386
+++ b/sys/i386/conf/files.i386
@@ -1,7 +1,7 @@
# This file tells config what files go into building a kernel,
# files marked standard are always included.
#
-# $Id: files.i386,v 1.235 1999/04/15 14:52:23 bde Exp $
+# $Id: files.i386,v 1.236 1999/04/16 21:22:10 peter Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -154,6 +154,7 @@ i386/isa/if_le.c optional le device-driver
i386/isa/if_lnc.c optional lnc device-driver
i386/isa/if_rdp.c optional rdp device-driver
i386/isa/if_sr.c optional sr device-driver
+i386/isa/if_wi.c optional wi device-driver
i386/isa/if_wl.c optional wl device-driver
i386/isa/if_ze.c optional ze device-driver
i386/isa/if_zp.c optional zp device-driver
diff --git a/sys/i386/include/if_wavelan_ieee.h b/sys/i386/include/if_wavelan_ieee.h
new file mode 100644
index 0000000..f002933
--- /dev/null
+++ b/sys/i386/include/if_wavelan_ieee.h
@@ -0,0 +1,281 @@
+/*
+ * Copyright (c) 1997, 1998, 1999
+ * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Bill Paul.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD
+ * 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.
+ *
+ * $Id: if_wavelan_ieee.h,v 1.4 1999/04/27 02:02:41 wpaul Exp $
+ */
+
+#ifndef _IF_WAVELAN_IEEE_H
+#define _IF_WAVELAN_IEEE_H
+
+/*
+ * This header defines a simple command interface to the FreeBSD
+ * WaveLAN/IEEE driver (wi) driver, which is used to set certain
+ * device-specific parameters which can't be easily managed through
+ * ifconfig(8). No, sysctl(2) is not the answer. I said a _simple_
+ * interface, didn't I.
+ */
+
+#ifndef SIOCSWAVELAN
+#define SIOCSWAVELAN SIOCSIFGENERIC
+#endif
+
+#ifndef SIOCGWAVELAN
+#define SIOCGWAVELAN SIOCGIFGENERIC
+#endif
+
+/*
+ * Technically I don't think there's a limit to a record
+ * length. The largest record is the one that contains the CIS
+ * data, which is 240 words long, so 256 should be a safe
+ * value.
+ */
+#define WI_MAX_DATALEN 512
+
+struct wi_req {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_val[WI_MAX_DATALEN];
+};
+
+/*
+ * Private LTV records (interpreted only by the driver). This is
+ * a minor kludge to allow reading the interface statistics from
+ * the driver.
+ */
+#define WI_RID_IFACE_STATS 0x0100
+#define WI_RID_MGMT_XMIT 0x0200
+
+struct wi_80211_hdr {
+ u_int16_t frame_ctl;
+ u_int16_t dur_id;
+ u_int8_t addr1[6];
+ u_int8_t addr2[6];
+ u_int8_t addr3[6];
+ u_int16_t seq_ctl;
+ u_int8_t addr4[6];
+};
+
+#define WI_FCTL_VERS 0x0002
+#define WI_FCTL_FTYPE 0x000C
+#define WI_FCTL_STYPE 0x00F0
+#define WI_FCTL_TODS 0x0100
+#define WI_FCTL_FROMDS 0x0200
+#define WI_FCTL_MOREFRAGS 0x0400
+#define WI_FCTL_RETRY 0x0800
+#define WI_FCTL_PM 0x1000
+#define WI_FCTL_MOREDATA 0x2000
+#define WI_FCTL_WEP 0x4000
+#define WI_FCTL_ORDER 0x8000
+
+#define WI_FTYPE_MGMT 0x0000
+#define WI_FTYPE_CTL 0x0004
+#define WI_FTYPE_DATA 0x0008
+
+#define WI_STYPE_MGMT_ASREQ 0x0000 /* association request */
+#define WI_STYPE_MGMT_ASRESP 0x0010 /* association response */
+#define WI_STYPE_MGMT_REASREQ 0x0020 /* reassociation request */
+#define WI_STYPE_MGMT_REASRESP 0x0030 /* reassociation response */
+#define WI_STYPE_MGMT_PROBEREQ 0x0040 /* probe request */
+#define WI_STYPE_MGMT_PROBERESP 0x0050 /* probe response */
+#define WI_STYPE_MGMT_BEACON 0x0080 /* beacon */
+#define WI_STYPE_MGMT_ATIM 0x0090 /* announcement traffic ind msg */
+#define WI_STYPE_MGMT_DISAS 0x00A0 /* disassociation */
+#define WI_STYPE_MGMT_AUTH 0x00B0 /* authentication */
+#define WI_STYPE_MGMT_DEAUTH 0x00C0 /* deauthentication */
+
+struct wi_mgmt_hdr {
+ u_int16_t frame_ctl;
+ u_int16_t duration;
+ u_int8_t dst_addr[6];
+ u_int8_t src_addr[6];
+ u_int8_t bssid[6];
+ u_int16_t seq_ctl;
+};
+
+#ifndef KERNEL
+struct wi_counters {
+ u_int32_t wi_tx_unicast_frames;
+ u_int32_t wi_tx_multicast_frames;
+ u_int32_t wi_tx_fragments;
+ u_int32_t wi_tx_unicast_octets;
+ u_int32_t wi_tx_multicast_octets;
+ u_int32_t wi_tx_deferred_xmits;
+ u_int32_t wi_tx_single_retries;
+ u_int32_t wi_tx_multi_retries;
+ u_int32_t wi_tx_retry_limit;
+ u_int32_t wi_tx_discards;
+ u_int32_t wi_rx_unicast_frames;
+ u_int32_t wi_rx_multicast_frames;
+ u_int32_t wi_rx_fragments;
+ u_int32_t wi_rx_unicast_octets;
+ u_int32_t wi_rx_multicast_octets;
+ u_int32_t wi_rx_fcs_errors;
+ u_int32_t wi_rx_discards_nobuf;
+ u_int32_t wi_tx_discards_wrong_sa;
+ u_int32_t wi_rx_WEP_cant_decrypt;
+ u_int32_t wi_rx_msg_in_msg_frags;
+ u_int32_t wi_rx_msg_in_bad_msg_frags;
+};
+
+/*
+ * These are all the LTV record types that we can read or write
+ * from the WaveLAN. Not all of them are temendously useful, but I
+ * list as many as I know about here for completeness.
+ */
+
+#define WI_RID_DNLD_BUF 0xFD01
+#define WI_RID_MEMSZ 0xFD02
+#define WI_RID_DOMAINS 0xFD11
+#define WI_RID_CIS 0xFD13
+#define WI_RID_COMMQUAL 0xFD43
+#define WI_RID_SCALETHRESH 0xFD46
+#define WI_RID_PCF 0xFD87
+
+/*
+ * Network parameters, static configuration entities.
+ */
+#define WI_RID_PORTTYPE 0xFC00 /* Connection control characteristics */
+#define WI_RID_MAC_NODE 0xFC01 /* MAC address of this station */
+#define WI_RID_DESIRED_SSID 0xFC02 /* Service Set ID for connection */
+#define WI_RID_OWN_CHNL 0xFC03 /* Comm channel for BSS creation */
+#define WI_RID_OWN_SSID 0xFC04 /* IBSS creation ID */
+#define WI_RID_OWN_ATIM_WIN 0xFC05 /* ATIM window time for IBSS creation */
+#define WI_RID_SYSTEM_SCALE 0xFC06 /* scale that specifies AP density */
+#define WI_RID_MAX_DATALEN 0xFC07 /* Max len of MAC frame body data */
+#define WI_RID_MAC_WDS 0xFC08 /* MAC addr of corresponding WDS node */
+#define WI_RID_PM_ENABLED 0xFC09 /* ESS power management enable */
+#define WI_RID_PM_EPS 0xFC0A /* PM EPS/PS mode */
+#define WI_RID_MCAST_RX 0xFC0B /* ESS PM mcast reception */
+#define WI_RID_MAX_SLEEP 0xFC0C /* max sleep time for ESS PM */
+#define WI_RID_HOLDOVER 0xFC0D /* holdover time for ESS PM */
+#define WI_RID_NODENAME 0xFC0E /* ID name of this node for diag */
+#define WI_RID_DTIM_PERIOD 0xFC10 /* beacon interval between DTIMs */
+#define WI_RID_WDS_ADDR1 0xFC11 /* port 1 MAC of WDS link node */
+#define WI_RID_WDS_ADDR2 0xFC12 /* port 1 MAC of WDS link node */
+#define WI_RID_WDS_ADDR3 0xFC13 /* port 1 MAC of WDS link node */
+#define WI_RID_WDS_ADDR4 0xFC14 /* port 1 MAC of WDS link node */
+#define WI_RID_WDS_ADDR5 0xFC15 /* port 1 MAC of WDS link node */
+#define WI_RID_WDS_ADDR6 0xFC16 /* port 1 MAC of WDS link node */
+#define WI_RID_MCAST_PM_BUF 0xFC17 /* PM buffering of mcast */
+
+/*
+ * Network parameters, dynamic configuration entities
+ */
+#define WI_RID_MCAST_LIST 0xFC80 /* list of multicast addrs */
+#define WI_RID_CREATE_IBSS 0xFC81 /* create IBSS */
+#define WI_RID_FRAG_THRESH 0xFC82 /* frag len, unicast msg xmit */
+#define WI_RID_RTS_THRESH 0xFC83 /* frame len for RTS/CTS handshake */
+#define WI_RID_TX_RATE 0xFC84 /* data rate for message xmit */
+#define WI_RID_PROMISC 0xFC85 /* enable promisc mode */
+#define WI_RID_FRAG_THRESH0 0xFC90
+#define WI_RID_FRAG_THRESH1 0xFC91
+#define WI_RID_FRAG_THRESH2 0xFC92
+#define WI_RID_FRAG_THRESH3 0xFC93
+#define WI_RID_FRAG_THRESH4 0xFC94
+#define WI_RID_FRAG_THRESH5 0xFC95
+#define WI_RID_FRAG_THRESH6 0xFC96
+#define WI_RID_RTS_THRESH0 0xFC97
+#define WI_RID_RTS_THRESH1 0xFC98
+#define WI_RID_RTS_THRESH2 0xFC99
+#define WI_RID_RTS_THRESH3 0xFC9A
+#define WI_RID_RTS_THRESH4 0xFC9B
+#define WI_RID_RTS_THRESH5 0xFC9C
+#define WI_RID_RTS_THRESH6 0xFC9D
+#define WI_RID_TX_RATE0 0xFC9E
+#define WI_RID_TX_RATE1 0xFC9F
+#define WI_RID_TX_RATE2 0xFCA0
+#define WI_RID_TX_RATE3 0xFCA1
+#define WI_RID_TX_RATE4 0xFCA2
+#define WI_RID_TX_RATE5 0xFCA3
+#define WI_RID_TX_RATE6 0xFCA4
+#define WI_RID_TICK_TIME 0xFCE0
+
+/*
+ * NIC information
+ */
+#define WI_RID_FIRM_ID 0xFD02 /* Primary func firmware ID. */
+#define WI_RID_PRI_SUP_RANGE 0xFD03 /* primary supplier compatibility */
+#define WI_RID_CIF_ACT_RANGE 0xFD04 /* controller sup. compatibility */
+#define WI_RID_SERIALNO 0xFD0A /* card serial number */
+#define WI_RID_CARD_ID 0xFD0B /* card identification */
+#define WI_RID_MFI_SUP_RANGE 0xFD0C /* modem supplier compatibility */
+#define WI_RID_CFI_SUP_RANGE 0xFD0D /* controller sup. compatibility */
+#define WI_RID_CHANNEL_LIST 0xFD10 /* allowd comm. frequencies. */
+#define WI_RID_REG_DOMAINS 0xFD11 /* list of intendted regulatory doms */
+#define WI_RID_TEMP_TYPE 0xFD12 /* hw temp range code */
+#define WI_RID_CIS 0xFD13 /* PC card info struct */
+#define WI_RID_STA_IDENEITY 0xFD20 /* station funcs firmware ident */
+#define WI_RID_STA_SUP_RANGE 0xFD21 /* station supplier compat */
+#define WI_RID_MFI_ACT_RANGE 0xFD22
+#define WI_RID_CFI_ACT_RANGE 0xFD33
+
+/*
+ * MAC information
+ */
+#define WI_RID_PORT_STAT 0xFD40 /* actual MAC port con control stat */
+#define WI_RID_CURRENT_SSID 0xFD41 /* ID of actually connected SS */
+#define WI_RID_CURRENT_BSSID 0xFD42 /* ID of actually connected BSS */
+#define WI_RID_COMMS_QUALITY 0xFD43 /* quality of BSS connection */
+#define WI_RID_CUR_TX_RATE 0xFD44 /* current TX rate */
+#define WI_RID_OWN_BEACON_INT 0xFD45 /* beacon xmit time for BSS creation */
+#define WI_RID_CUR_SCALE_THRESH 0xFD46 /* actual system scane thresh setting */
+#define WI_RID_PROT_RESP_TIME 0xFD47 /* time to wait for resp to req msg */
+#define WI_RID_SHORT_RTR_LIM 0xFD48 /* max tx attempts for short frames */
+#define WI_RID_LONG_RTS_LIM 0xFD49 /* max tx attempts for long frames */
+#define WI_RID_MAX_TX_LIFE 0xFD4A /* max tx frame handling duration */
+#define WI_RID_MAX_RX_LIFE 0xFD4B /* max rx frame handling duration */
+#define WI_RID_CF_POLL 0xFD4C /* contention free pollable ind */
+#define WI_RID_AUTH_ALGS 0xFD4D /* auth algorithms available */
+#define WI_RID_AUTH_TYPE 0xFD4E /* availanle auth types */
+#define WI_RID_WEP_AVAIL 0xFD4F /* WEP privacy option available */
+#define WI_RID_CUR_TX_RATE1 0xFD80
+#define WI_RID_CUR_TX_RATE2 0xFD81
+#define WI_RID_CUR_TX_RATE3 0xFD82
+#define WI_RID_CUR_TX_RATE4 0xFD83
+#define WI_RID_CUR_TX_RATE5 0xFD84
+#define WI_RID_CUR_TX_RATE6 0xFD85
+#define WI_RID_OWN_MAC 0xFD86 /* unique local MAC addr */
+#define WI_RID_PCI_INFO 0xFD87 /* point coordination func cap */
+
+/*
+ * Modem information
+ */
+#define WI_RID_PHY_TYPE 0xFDC0 /* phys layer type indication */
+#define WI_RID_CURRENT_CHAN 0xFDC1 /* current frequency */
+#define WI_RID_PWR_STATE 0xFDC2 /* pwr consumption status */
+#define WI_RID_CCA_MODE 0xFDC3 /* clear chan assess mode indication */
+#define WI_RID_CCA_TIME 0xFDC4 /* clear chan assess time */
+#define WI_RID_MAC_PROC_DELAY 0xFDC5 /* MAC processing delay time */
+#define WI_RID_DATA_RATES 0xFDC6 /* supported data rates */
+#endif
+
+
+#endif
diff --git a/sys/i386/isa/if_wi.c b/sys/i386/isa/if_wi.c
index 59c73f0..35f585e 100644
--- a/sys/i386/isa/if_wi.c
+++ b/sys/i386/isa/if_wi.c
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: if_wi.c,v 1.48 1999/05/05 00:32:13 wpaul Exp $
+ * $Id: if_wi.c,v 1.48 1999/05/05 00:32:13 wpaul Exp wpaul $
*/
/*
@@ -116,7 +116,7 @@
#if !defined(lint)
static const char rcsid[] =
- "$Id: if_wi.c,v 1.48 1999/05/05 00:32:13 wpaul Exp $";
+ "$Id: if_wi.c,v 1.48 1999/05/05 00:32:13 wpaul Exp wpaul $";
#endif
static struct wi_softc wi_softc[NWI];
@@ -1118,11 +1118,11 @@ static void wi_init(xsc)
wi_cmd(sc, WI_CMD_ENABLE|sc->wi_portnum, 0);
if (wi_alloc_nicmem(sc, 1518 + sizeof(struct wi_frame) + 8, &id))
- printf("wi%d: mem allocation failed...\n", sc->wi_unit);
+ printf("wi%d: tx buffer allocation failed\n", sc->wi_unit);
sc->wi_tx_data_id = id;
if (wi_alloc_nicmem(sc, 1518 + sizeof(struct wi_frame) + 8, &id))
- printf("wi%d: mem allocation failed...\n", sc->wi_unit);
+ printf("wi%d: mgmt. buffer allocation failed\n", sc->wi_unit);
sc->wi_tx_mgmt_id = id;
/* enable interrupts */
diff --git a/sys/i386/isa/if_wireg.h b/sys/i386/isa/if_wireg.h
new file mode 100644
index 0000000..010537d
--- /dev/null
+++ b/sys/i386/isa/if_wireg.h
@@ -0,0 +1,580 @@
+/*
+ * Copyright (c) 1997, 1998, 1999
+ * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Bill Paul.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD
+ * 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.
+ *
+ * $Id: if_wireg.h,v 1.28 1999/05/03 18:34:16 wpaul Exp $
+ */
+
+struct wi_counters {
+ u_int32_t wi_tx_unicast_frames;
+ u_int32_t wi_tx_multicast_frames;
+ u_int32_t wi_tx_fragments;
+ u_int32_t wi_tx_unicast_octets;
+ u_int32_t wi_tx_multicast_octets;
+ u_int32_t wi_tx_deferred_xmits;
+ u_int32_t wi_tx_single_retries;
+ u_int32_t wi_tx_multi_retries;
+ u_int32_t wi_tx_retry_limit;
+ u_int32_t wi_tx_discards;
+ u_int32_t wi_rx_unicast_frames;
+ u_int32_t wi_rx_multicast_frames;
+ u_int32_t wi_rx_fragments;
+ u_int32_t wi_rx_unicast_octets;
+ u_int32_t wi_rx_multicast_octets;
+ u_int32_t wi_rx_fcs_errors;
+ u_int32_t wi_rx_discards_nobuf;
+ u_int32_t wi_tx_discards_wrong_sa;
+ u_int32_t wi_rx_WEP_cant_decrypt;
+ u_int32_t wi_rx_msg_in_msg_frags;
+ u_int32_t wi_rx_msg_in_bad_msg_frags;
+};
+
+struct wi_softc {
+ struct arpcom arpcom;
+ struct ifmedia ifmedia;
+ int wi_unit;
+ bus_space_handle_t wi_bhandle;
+ bus_space_tag_t wi_btag;
+ int wi_tx_data_id;
+ int wi_tx_mgmt_id;
+ int wi_gone;
+ int wi_if_flags;
+ u_int16_t wi_ptype;
+ u_int16_t wi_portnum;
+ u_int16_t wi_max_data_len;
+ u_int16_t wi_rts_thresh;
+ u_int16_t wi_ap_density;
+ u_int16_t wi_tx_rate;
+ u_int16_t wi_create_ibss;
+ char wi_node_name[32];
+ char wi_net_name[32];
+ char wi_ibss_name[32];
+ u_int8_t wi_txbuf[1536];
+ struct wi_counters wi_stats;
+ struct callout_handle wi_stat_ch;
+};
+
+#define WI_TIMEOUT 65536
+
+#define WI_PORT0 0
+#define WI_PORT1 1
+#define WI_PORT2 2
+#define WI_PORT3 3
+#define WI_PORT4 4
+#define WI_PORT5 5
+
+/* Default port: 0 (only 0 exists on stations) */
+#define WI_DEFAULT_PORT (WI_PORT0 << 8)
+
+/* Default TX rate: 2Mbps, auto fallback */
+#define WI_DEFAULT_TX_RATE 3
+
+/* Default network name: ANY */
+#define WI_DEFAULT_NETNAME "ANY"
+
+#define WI_DEFAULT_AP_DENSITY 1
+
+#define WI_DEFAULT_RTS_THRESH 2347
+
+#define WI_DEFAULT_DATALEN 2304
+
+#define WI_DEFAULT_CREATE_IBSS 0
+
+#define WI_DEFAULT_NODENAME "FreeBSD WaveLAN/IEEE node"
+
+#define WI_DEFAULT_IBSS "FreeBSD IBSS"
+
+/*
+ * register space access macros
+ */
+#define CSR_WRITE_4(sc, reg, val) \
+ bus_space_write_4(sc->wi_btag, sc->wi_bhandle, reg, val)
+#define CSR_WRITE_2(sc, reg, val) \
+ bus_space_write_2(sc->wi_btag, sc->wi_bhandle, reg, val)
+#define CSR_WRITE_1(sc, reg, val) \
+ bus_space_write_1(sc->wi_btag, sc->wi_bhandle, reg, val)
+
+#define CSR_READ_4(sc, reg) \
+ bus_space_read_4(sc->wi_btag, sc->wi_bhandle, reg)
+#define CSR_READ_2(sc, reg) \
+ bus_space_read_2(sc->wi_btag, sc->wi_bhandle, reg)
+#define CSR_READ_1(sc, reg) \
+ bus_space_read_1(sc->wi_btag, sc->wi_bhandle, reg)
+
+/*
+ * The WaveLAN/IEEE cards contain an 802.11 MAC controller which Lucent
+ * calls 'Hermes.' In typical fashion, getting documentation about this
+ * controller is about as easy as squeezing blood from a stone. Here
+ * is more or less what I know:
+ *
+ * - The Hermes controller is firmware driven, and the host interacts
+ * with the Hermes via a firmware interface, which can change.
+ *
+ * - The Hermes is described in a document called: "Hermes Firmware
+ * WaveLAN/IEEE Station Functions," document #010245, which of course
+ * Lucent will not release without an NDA.
+ *
+ * - Lucent has created a library called HCF (Hardware Control Functions)
+ * though which it wants developers to interact with the card. The HCF
+ * is needlessly complex, ill conceived and badly documented. Actually,
+ * the comments in the HCP code itself aren't bad, but the publically
+ * available manual that comes with it is awful, probably due largely to
+ * the fact that it has been emasculated in order to hide information
+ * that Lucent wants to keep proprietary. The purpose of the HCF seems
+ * to be to insulate the driver programmer from the Hermes itself so that
+ * Lucent has an excuse not to release programming in for it.
+ *
+ * - Lucent only makes available documentation and code for 'HCF Light'
+ * which is a stripped down version of HCF with certain features not
+ * implemented, most notably support for 802.11 frames.
+ *
+ * - The HCF code which I have seen blows goats. Whoever decided to
+ * use a 132 column format should be shot.
+ *
+ * Rather than actually use the Lucent HCF library, I have stripped all
+ * the useful information from it and used it to create a driver in the
+ * usual BSD form. Note: I don't want to hear anybody whining about the
+ * fact that the Lucent code is GPLed and mine isn't. I did not actually
+ * put any of Lucent's code in this driver: I only used it as a reference
+ * to obtain information about the underlying hardware. The Hermes
+ * programming interface is not GPLed, so bite me.
+ */
+
+/*
+ * Size of Hermes I/O space.
+ */
+#define WI_IOSIZ 0x40
+
+/*
+ * Hermes register definitions and what little I know about them.
+ */
+
+/* Hermes command/status registers. */
+#define WI_COMMAND 0x00
+#define WI_PARAM0 0x02
+#define WI_PARAM1 0x04
+#define WI_PARAM2 0x06
+#define WI_STATUS 0x08
+#define WI_RESP0 0x0A
+#define WI_RESP1 0x0C
+#define WI_RESP2 0x0E
+
+/* Command register values. */
+#define WI_CMD_BUSY 0x8000 /* busy bit */
+#define WI_CMD_INI 0x0000 /* initialize */
+#define WI_CMD_ENABLE 0x0001 /* enable */
+#define WI_CMD_DISABLE 0x0002 /* disable */
+#define WI_CMD_DIAG 0x0003
+#define WI_CMD_ALLOC_MEM 0x000A /* allocate NIC memory */
+#define WI_CMD_TX 0x000B /* transmit */
+#define WI_CMD_NOTIFY 0x0010
+#define WI_CMD_INQUIRE 0x0011
+#define WI_CMD_ACCESS 0x0021
+#define WI_CMD_PROGRAM 0x0022
+
+#define WI_CMD_CODE_MASK 0x003F
+
+/*
+ * Reclaim qualifier bit, applicable to the
+ * TX and INQUIRE commands.
+ */
+#define WI_RECLAIM 0x0100 /* reclaim NIC memory */
+
+/*
+ * ACCESS command qualifier bits.
+ */
+#define WI_ACCESS_READ 0x0000
+#define WI_ACCESS_WRITE 0x0100
+
+/*
+ * PROGRAM command qualifier bits.
+ */
+#define WI_PROGRAM_DISABLE 0x0000
+#define WI_PROGRAM_ENABLE_RAM 0x0100
+#define WI_PROGRAM_ENABLE_NVRAM 0x0200
+#define WI_PROGRAM_NVRAM 0x0300
+
+/* Status register values */
+#define WI_STAT_CMD_CODE 0x003F
+#define WI_STAT_DIAG_ERR 0x0100
+#define WI_STAT_INQ_ERR 0x0500
+#define WI_STAT_CMD_RESULT 0x7F00
+
+/* memory handle management registers */
+#define WI_INFO_FID 0x10
+#define WI_RX_FID 0x20
+#define WI_ALLOC_FID 0x22
+#define WI_TX_CMP_FID 0x24
+
+/*
+ * Buffer Access Path (BAP) registers.
+ * These are I/O channels. I believe you can use each one for
+ * any desired purpose independently of the other. In general
+ * though, we use BAP1 for reading and writing LTV records and
+ * reading received data frames, and BAP0 for writing transmit
+ * frames. This is a convention though, not a rule.
+ */
+#define WI_SEL0 0x18
+#define WI_SEL1 0x1A
+#define WI_OFF0 0x1C
+#define WI_OFF1 0x1E
+#define WI_DATA0 0x36
+#define WI_DATA1 0x38
+#define WI_BAP0 WI_DATA0
+#define WI_BAP1 WI_DATA1
+
+#define WI_OFF_BUSY 0x8000
+#define WI_OFF_ERR 0x4000
+#define WI_OFF_DATAOFF 0x0FFF
+
+/* Event registers */
+#define WI_EVENT_STAT 0x30 /* Event status */
+#define WI_INT_EN 0x32 /* Interrupt enable/disable */
+#define WI_EVENT_ACK 0x34 /* Ack event */
+
+/* Events */
+#define WI_EV_TICK 0x8000 /* aux timer tick */
+#define WI_EV_RES 0x4000 /* controller h/w error (time out) */
+#define WI_EV_INFO_DROP 0x2000 /* no RAM to build unsolicited frame */
+#define WI_EV_NO_CARD 0x0800 /* card removed (hunh?) */
+#define WI_EV_DUIF_RX 0x0400 /* wavelan management packet received */
+#define WI_EV_INFO 0x0080 /* async info frame */
+#define WI_EV_CMD 0x0010 /* command completed */
+#define WI_EV_ALLOC 0x0008 /* async alloc/reclaim completed */
+#define WI_EV_TX_EXC 0x0004 /* async xmit completed with failure */
+#define WI_EV_TX 0x0002 /* async xmit completed succesfully */
+#define WI_EV_RX 0x0001 /* async rx completed */
+
+#define WI_INTRS \
+ (WI_EV_RX|WI_EV_TX|WI_EV_TX_EXC|WI_EV_ALLOC|WI_EV_INFO|WI_EV_INFO_DROP)
+
+/* Host software registers */
+#define WI_SW0 0x28
+#define WI_SW1 0x2A
+#define WI_SW2 0x2C
+#define WI_SW3 0x2E
+
+#define WI_CNTL 0x14
+
+#define WI_CNTL_AUX_ENA 0xC000
+#define WI_CNTL_AUX_ENA_STAT 0xC000
+#define WI_CNTL_AUX_DIS_STAT 0x0000
+#define WI_CNTL_AUX_ENA_CNTL 0x8000
+#define WI_CNTL_AUX_DIS_CNTL 0x4000
+
+#define WI_AUX_PAGE 0x3A
+#define WI_AUX_OFFSET 0x3C
+#define WI_AUX_DATA 0x3E
+
+/*
+ * One form of communication with the Hermes is with what Lucent calls
+ * LTV records, where LTV stands for Length, Type and Value. The length
+ * and type are 16 bits and are in native byte order. The value is in
+ * multiples of 16 bits and is in little endian byte order.
+ */
+struct wi_ltv_gen {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_val;
+};
+
+struct wi_ltv_str {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_str[17];
+};
+
+#define WI_SETVAL(recno, val) \
+ do { \
+ struct wi_ltv_gen g; \
+ \
+ g.wi_len = 2; \
+ g.wi_type = recno; \
+ g.wi_val = val; \
+ wi_write_record(sc, &g); \
+ } while (0)
+
+#define WI_SETSTR(recno, str) \
+ do { \
+ struct wi_ltv_str s; \
+ int l; \
+ \
+ l = (strlen(str) + 1) & ~0x1; \
+ bzero((char *)&s, sizeof(s)); \
+ s.wi_len = (l / 2) + 2; \
+ s.wi_type = recno; \
+ s.wi_str[0] = htons(strlen(str)); \
+ bcopy(str, (char *)&s.wi_str[1], strlen(str)); \
+ wi_write_record(sc, (struct wi_ltv_gen *)&s); \
+ } while (0)
+
+/*
+ * Download buffer location and length (0xFD01).
+ */
+#define WI_RID_DNLD_BUF 0xFD01
+struct wi_ltv_dnld_buf {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_buf_pg; /* page addr of intermediate dl buf*/
+ u_int16_t wi_buf_off; /* offset of idb */
+ u_int16_t wi_buf_len; /* len of idb */
+};
+
+/*
+ * Mem sizes (0xFD02).
+ */
+#define WI_RID_MEMSZ 0xFD02
+struct wi_ltv_memsz {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_mem_ram;
+ u_int16_t wi_mem_nvram;
+};
+
+/*
+ * List of intended regulatory domains (0xFD11).
+ */
+#define WI_RID_DOMAINS 0xFD11
+struct wi_ltv_domains {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_domains[6];
+};
+
+/*
+ * CIS struct (0xFD13).
+ */
+#define WI_RID_CIS 0xFD13
+struct wi_ltv_cis {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_cis[240];
+};
+
+/*
+ * Communications quality (0xFD43).
+ */
+#define WI_RID_COMMQUAL 0xFD43
+struct wi_ltv_commqual {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_coms_qual;
+ u_int16_t wi_sig_lvl;
+ u_int16_t wi_noise_lvl;
+};
+
+/*
+ * Actual system scale thresholds (0xFD46).
+ */
+#define WI_RID_SYSTEM_SCALE 0xFC06
+#define WI_RID_SCALETHRESH 0xFD46
+struct wi_ltv_scalethresh {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_energy_detect;
+ u_int16_t wi_carrier_detect;
+ u_int16_t wi_defer;
+ u_int16_t wi_cell_search;
+ u_int16_t wi_out_of_range;
+ u_int16_t wi_delta_snr;
+};
+
+/*
+ * PCF info struct (0xFD87).
+ */
+#define WI_RID_PCF 0xFD87
+struct wi_ltv_pcf {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_energy_detect;
+ u_int16_t wi_carrier_detect;
+ u_int16_t wi_defer;
+ u_int16_t wi_cell_search;
+ u_int16_t wi_range;
+};
+
+/*
+ * Connection control characteristics.
+ * 1 == Basic Service Set (BSS)
+ * 2 == Wireless Distribudion System (WDS)
+ * 3 == Pseudo IBSS
+ */
+#define WI_RID_PORTTYPE 0xFC00
+#define WI_PORTTYPE_BSS 0x1
+#define WI_PORTTYPE_WDS 0x2
+#define WI_PORTTYPE_ADHOC 0x3
+
+/*
+ * Mac addresses.
+ */
+#define WI_RID_MAC_NODE 0xFC01
+#define WI_RID_MAC_WDS 0xFC08
+struct wi_ltv_macaddr {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_mac_addr[3];
+};
+
+/*
+ * Station set identification (SSID).
+ */
+#define WI_RID_DESIRED_SSID 0xFC02
+#define WI_RID_OWN_SSID 0xFC04
+struct wi_ltv_ssid {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_id[17];
+};
+
+/*
+ * Set communications channel (radio frequency).
+ */
+#define WI_RID_CHNL 0xFC03
+
+/*
+ * Frame data size.
+ */
+#define WI_RID_MAX_DATALEN 0xFC07
+
+/*
+ * Set our station name.
+ */
+#define WI_RID_NODENAME 0xFC0E
+struct wi_ltv_nodename {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ u_int16_t wi_nodename[17];
+};
+
+/*
+ * Multicast addresses to be put in filter. We're
+ * allowed up to 16 addresses in the filter.
+ */
+#define WI_RID_MCAST 0xFC80
+struct wi_ltv_mcast {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ struct ether_addr wi_mcast[16];
+};
+
+/*
+ * Create IBSS.
+ */
+#define WI_RID_CREATE_IBSS 0xFC81
+
+#define WI_RID_FRAG_THRESH 0xFC82
+#define WI_RID_RTS_THRESH 0xFC83
+
+/*
+ * TX rate control
+ * 0 == Fixed 1mbps
+ * 1 == Fixed 2mbps
+ * 2 == auto fallback
+ */
+#define WI_RID_TX_RATE 0xFC84
+
+/*
+ * promiscuous mode.
+ */
+#define WI_RID_PROMISC 0xFC85
+
+/*
+ * Auxiliary Timer tick interval
+ */
+#define WI_RID_TICK_TIME 0xFCE0
+
+/*
+ * Information frame types.
+ */
+#define WI_INFO_NOTIFY 0xF000 /* Handover address */
+#define WI_INFO_COUNTERS 0xF100 /* Statistics counters */
+#define WI_INFO_SCAN_RESULTS 0xF101 /* Scan results */
+#define WI_INFO_LINK_STAT 0xF200 /* Link status */
+#define WI_INFO_ASSOC_STAT 0xF201 /* Association status */
+
+/*
+ * Hermes transmit/receive frame structure
+ */
+struct wi_frame {
+ u_int16_t wi_status; /* 0x00 */
+ u_int32_t wi_rsvd0; /* 0x02 */
+ u_int16_t wi_q_info; /* 0x06 */
+ u_int16_t wi_rsvd1; /* 0x08 */
+ u_int16_t wi_tx_ctl; /* 0x0C */
+ u_int16_t wi_frame_ctl; /* 0x0E */
+ u_int16_t wi_id; /* 0x10 */
+ u_int8_t wi_addr1[6]; /* 0x12 */
+ u_int8_t wi_addr2[6]; /* 0x18 */
+ u_int8_t wi_addr3[6]; /* 0x1E */
+ u_int16_t wi_seq_ctl; /* 0x24 */
+ u_int8_t wi_addr4[6]; /* 0x26 */
+ u_int16_t wi_dat_len; /* 0x2C */
+ u_int8_t wi_dst_addr[6]; /* 0x2E */
+ u_int8_t wi_src_addr[6]; /* 0x34 */
+ u_int16_t wi_len; /* 0x3A */
+ u_int16_t wi_dat[3]; /* 0x3C */ /* SNAP header */
+ u_int16_t wi_type; /* 0x42 */
+};
+
+#define WI_802_3_OFFSET 0x2E
+#define WI_802_11_OFFSET 0x44
+#define WI_802_11_OFFSET_RAW 0x3C
+
+#define WI_STAT_BADCRC 0x0001
+#define WI_STAT_UNDECRYPTABLE 0x0002
+#define WI_STAT_ERRSTAT 0x0003
+#define WI_STAT_MAC_PORT 0x0700
+#define WI_STAT_1042 0x2000 /* RFC1042 encoded */
+#define WI_STAT_TUNNEL 0x4000 /* Bridge-tunnel encoded */
+#define WI_STAT_WMP_MSG 0x6000 /* WaveLAN-II management protocol */
+#define WI_RXSTAT_MSG_TYPE 0xE000
+
+#define WI_ENC_TX_802_3 0x00
+#define WI_ENC_TX_802_11 0x11
+#define WI_ENC_TX_E_II 0x0E
+
+#define WI_ENC_TX_1042 0x00
+#define WI_ENC_TX_TUNNEL 0xF8
+
+#define WI_TXCNTL_MACPORT 0x00FF
+#define WI_TXCNTL_STRUCTTYPE 0xFF00
+
+/*
+ * SNAP (sub-network access protocol) constants for transmission
+ * of IP datagrams over IEEE 802 networks, taken from RFC1042.
+ * We need these for the LLC/SNAP header fields in the TX/RX frame
+ * structure.
+ */
+#define WI_SNAP_K1 0xaa /* assigned global SAP for SNAP */
+#define WI_SNAP_K2 0x00
+#define WI_SNAP_CONTROL 0x03 /* unnumbered information format */
+#define WI_SNAP_WORD0 (WI_SNAP_K1 | (WI_SNAP_K1 << 8))
+#define WI_SNAP_WORD1 (WI_SNAP_K2 | (WI_SNAP_CONTROL << 8))
+#define WI_SNAPHDR_LEN 0x6
diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile
index 576a238..4b57acc 100644
--- a/usr.sbin/Makefile
+++ b/usr.sbin/Makefile
@@ -1,5 +1,5 @@
# From: @(#)Makefile 5.20 (Berkeley) 6/12/93
-# $Id: Makefile,v 1.152 1999/04/28 08:00:50 obrien Exp $
+# $Id: Makefile,v 1.153 1999/04/28 11:36:28 phk Exp $
# XXX MISSING: mkproto
SUBDIR= IPXrouted \
@@ -135,6 +135,7 @@ SUBDIR+=apm \
sicontrol \
spkrtest \
stallion \
+ wicontrol \
wlconfig
.endif
diff --git a/usr.sbin/wicontrol/Makefile b/usr.sbin/wicontrol/Makefile
new file mode 100644
index 0000000..971f12c
--- /dev/null
+++ b/usr.sbin/wicontrol/Makefile
@@ -0,0 +1,9 @@
+# $Id: Makefile,v 1.2 1997/05/23 04:04:15 msmith Exp $
+PROG= wicontrol
+SRCS= wicontrol.c
+
+CFLAGS+= -Wall
+
+MAN8= wicontrol.8
+
+.include <bsd.prog.mk>
diff --git a/usr.sbin/wicontrol/wicontrol.8 b/usr.sbin/wicontrol/wicontrol.8
new file mode 100644
index 0000000..629a9c7
--- /dev/null
+++ b/usr.sbin/wicontrol/wicontrol.8
@@ -0,0 +1,187 @@
+.\" Copyright (c) 1997, 1998, 1999
+.\" Bill Paul <wpaul@ctr.columbia.edu> All rights reserved.
+.\"
+.\" 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.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD
+.\" 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.
+.\"
+.\" $Id$
+.\"
+.Dd April 21, 1999
+.Dt WICONTROL 8
+.Os FreeBSD 3.0
+.Sh NAME
+.Nm wicontrol
+.Nd configure WaveLAN/IEEE devices
+.Sh SYNOPSIS
+.Nm wicontrol
+.Fl i Ar iface Op Fl o
+.Nm wicontrol
+.Fl i Ar iface Fl t Ar tx rate
+.Nm wicontrol
+.Fl i Ar iface Fl n Ar network name
+.Nm wicontrol
+.Fl i Ar iface Fl s Ar station name
+.Nm wicontrol
+.Fl i Ar iface Fl c Ar 0|1
+.Nm wicontrol
+.Fl i Ar iface Fl q Ar SSID
+.Nm wicontrol
+.Fl i Ar iface Fl p Ar port type
+.Nm wicontrol
+.Fl i Ar iface Fl a Ar access point density
+.Nm wicontrol
+.Fl i Ar iface Fl m Ar mac address
+.Nm wicontrol
+.Fl i Ar iface Fl d Ar max data length
+.Nm wicontrol
+.Fl i Ar iface Fl r Ar RTS threshold
+.Sh DESCRIPTION
+The
+.Nm
+command controls the operation of WaveLAN/IEEE wireless networking
+devices via the
+.Xr wi 4
+driver. Most of the parameters that can be changed relate to the
+IEEE 802.11 protocol which the WaveLAN implements. This includes
+the station name, whether the station is operating in ad-hoc (point
+to point) or BSS (service set) mode, and the network name of a service
+set to join (IBSS) if BSS mode is enabled. The
+.Nm
+command can also be used to view the current settings of these paremeters
+and to dump out the values of the card's statistics counters.
+.Pp
+The
+.Ar iface
+argument given to
+.Nm
+should be the logical interface name associated with the WaveLAN/IEEE
+device (wi0, wi1, etc...). Interface parameters should only be changed
+when the interface is down. If the interface is already up, you should
+use the
+.Xr ifconfig 8
+command to bring the interface down, then set the interface parameters
+with
+.Nm ,
+and then bring the interface up again.
+.Sh OPTIONS
+The options are as follows:
+.Bl -tag -width Fl
+.It Fl i Ar iface Op Fl o
+Display the current settings of the specified WaveLAN/IEEE interface.
+This retrives the current card settings from the driver and prints them
+out. Using the additional
+.Fl o
+flag will cause
+.Nm
+to print out the statistics counters instead of the card settings.
+.It Fl i Ar iface Fl t Ar tx rate
+Set the transmit rate of the specified interface. The permitted values
+for the transmit rate are 1, 2 and 3, where 1 is fixed 1Mbps, 2 is
+fixed 2Mbps and 3 is 2Mbps with automatic fallback to 1Mbps. The default
+driver setting is 3.
+.It Fl i Ar iface Fl n Ar network name
+Set the name of the service set (IBSS) that this station wishes to
+join. The
+.Ar network name
+can be any text string up to 30 characters in length. The default name
+is the string "ANY" which should allow the station to connect to the first
+available access point. The interface should be set for BSS mode using
+the
+.Fl p
+flag in order for this to work.
+.Pp
+Note: the WaveLAN manual indicates that an empty string will allow the
+host to connect to any access point, however I have also seen a reference
+in another driver which indicates that the "ANY" string works as well.
+.It Fl i Ar iface Fl s Ar station name
+Sets the
+.Ar station name
+for the specified interface. The
+.Ar station name
+is used for diagnostic purposes. The Lucent WaveMANAGER sofware can
+poll the names of remove hosts.
+.It Fl i Ar iface Fl c Ar 0|1
+Allow the station to create a service set (IBSS). Permitted values
+are 0 (don't create IBSS) and 1 (enable creation of IBSS). The default
+is 0.
+.Pp
+Note: this option is provided for experimental purposes only: enabling
+the creation of an IBSS on a host system doesn't appear to actually work.
+.It Fl i Ar iface Fl q Ar SSID
+Specify the name of an IBSS (SSID) to create on a given interface.
+The
+.Ar SSID
+can be any text string up to 30 characters long.
+.Pp
+Note: this option is provided for experimental purposes only: enabling
+the creation of an IBSS on a host system doesn't appear to actually work.
+.It Fl i Ar iface Fl p Ar port type
+Set the
+.Ar port type
+for a specified interface. The legal values for
+.Ar port type
+are 1 (BSS mode) and 3 (ad-hoc) mode. In ad-hoc mode, the station can
+comminicate directly with any other stations within direct radio range
+(provided that they are also operating in ad-hoc mode). In BSS mode,
+hosts must associate with a service set controlled by an access point,
+which relays traffic between end stations. The default setting is 3
+(ad-hoc mode).
+.It Fl i Ar iface Fl a Ar access_point_density
+Specify the
+.Ar access point density
+for a given interface. Legal values are 1 (low), 2 (medium) and 3 (high).
+This setting influences some of the radio modem threshold settings.
+.It Fl i Ar iface Fl m Ar mac address
+Set the station address for the specified interface. The
+.Ar mac address
+is specified as a series of six hexadecimal values separated by colons,
+e.g.: 00:60:1d:12:34:56. This programs the new address into the card
+and updates the interface as well.
+.It Fl i Ar iface Fl d Ar max_data_length
+Set the maximum receive and transmit frame size for a specified interface.
+The
+.Ar max data length
+can be any number from 350 to 2304. The default is 2304.
+.It Fl i Ar iface Fl r Ar RTS threshold
+Set the RTS/CTS threshold for a given interface. This controls the
+number of bytes used for the RTS/CTS handhake boundary. The
+.Ar RTS threshold
+can be any value between 0 and 2047. The default is 2347.
+.El
+.Sh SEE ALSO
+.Xr wi 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+command first appeared in
+.Fx 3.0 .
+.Sh AUTHOR
+The
+.Nm
+command was written by
+.An Bill Paul Aq wpaul@ctr.columbia.edu .
diff --git a/usr.sbin/wicontrol/wicontrol.c b/usr.sbin/wicontrol/wicontrol.c
new file mode 100644
index 0000000..3c0f490
--- /dev/null
+++ b/usr.sbin/wicontrol/wicontrol.c
@@ -0,0 +1,499 @@
+/*
+ * Copyright (c) 1997, 1998, 1999
+ * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Bill Paul.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD
+ * 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.
+ *
+ * $Id: wicontrol.c,v 1.14 1999/05/05 01:33:16 wpaul Exp $
+ */
+
+#include <sys/types.h>
+#include <sys/cdefs.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+
+#include <net/if.h>
+#include <net/if_var.h>
+#include <net/ethernet.h>
+
+#include <machine/if_wavelan_ieee.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <err.h>
+
+#if !defined(lint)
+static const char copyright[] = "@(#) Copyright (c) 1997, 1998, 1999\
+ Bill Paul. All rights reserved.";
+static const char rcsid[] =
+ "@(#) $Id: wicontrol.c,v 1.14 1999/05/05 01:33:16 wpaul Exp $";
+#endif
+
+static void wi_getval __P((char *, struct wi_req *));
+static void wi_setval __P((char *, struct wi_req *));
+static void wi_printstr __P((struct wi_req *));
+static void wi_setstr __P((char *, int, char *));
+static void wi_setbytes __P((char *, int, char *, int));
+static void wi_setword __P((char *, int, int));
+static void wi_sethex __P((char *, int, char *));
+static void wi_printwords __P((struct wi_req *));
+static void wi_printbool __P((struct wi_req *));
+static void wi_printhex __P((struct wi_req *));
+static void wi_dumpinfo __P((char *));
+static void usage __P((char *));
+
+static void wi_getval(iface, wreq)
+ char *iface;
+ struct wi_req *wreq;
+{
+ struct ifreq ifr;
+ int s;
+
+ bzero((char *)&ifr, sizeof(ifr));
+
+ strcpy(ifr.ifr_name, iface);
+ ifr.ifr_data = (caddr_t)wreq;
+
+ s = socket(AF_INET, SOCK_DGRAM, 0);
+
+ if (s == -1)
+ err(1, "socket");
+
+ if (ioctl(s, SIOCGWAVELAN, &ifr) == -1)
+ err(1, "SIOCGWAVELAN");
+
+ close(s);
+
+ return;
+}
+
+static void wi_setval(iface, wreq)
+ char *iface;
+ struct wi_req *wreq;
+{
+ struct ifreq ifr;
+ int s;
+
+ bzero((char *)&ifr, sizeof(ifr));
+
+ strcpy(ifr.ifr_name, iface);
+ ifr.ifr_data = (caddr_t)wreq;
+
+ s = socket(AF_INET, SOCK_DGRAM, 0);
+
+ if (s == -1)
+ err(1, "socket");
+
+ if (ioctl(s, SIOCSWAVELAN, &ifr) == -1)
+ err(1, "SIOCSWAVELAN");
+
+ close(s);
+
+ return;
+}
+
+void wi_printstr(wreq)
+ struct wi_req *wreq;
+{
+ char *ptr;
+ int i;
+
+ if (wreq->wi_type == WI_RID_SERIALNO) {
+ ptr = (char *)&wreq->wi_val;
+ for (i = 0; i < (wreq->wi_len - 1) * 2; i++) {
+ if (ptr[i] == '\0')
+ ptr[i] = ' ';
+ }
+ } else {
+ ptr = (char *)&wreq->wi_val[1];
+ for (i = 0; i < ntohs(wreq->wi_val[0]); i++) {
+ if (ptr[i] == '\0')
+ ptr[i] = ' ';
+ }
+ }
+
+ ptr[i] = '\0';
+ printf("[ %s ]", ptr);
+
+ return;
+}
+
+void wi_setstr(iface, code, str)
+ char *iface;
+ int code;
+ char *str;
+{
+ struct wi_req wreq;
+
+ if (iface == NULL)
+ errx(1, "must specify interface name");
+
+ if (str == NULL)
+ errx(1, "must specify string");
+
+ bzero((char *)&wreq, sizeof(wreq));
+
+ if (strlen(str) > 30)
+ errx(1, "string too long");
+
+ wreq.wi_type = code;
+ wreq.wi_len = 18;
+ wreq.wi_val[0] = htons(strlen(str));
+ bcopy(str, (char *)&wreq.wi_val[1], strlen(str));
+
+ wi_setval(iface, &wreq);
+
+ return;
+}
+
+void wi_setbytes(iface, code, bytes, len)
+ char *iface;
+ int code;
+ char *bytes;
+ int len;
+{
+ struct wi_req wreq;
+
+ if (iface == NULL)
+ errx(1, "must specify interface name");
+
+ bzero((char *)&wreq, sizeof(wreq));
+
+ wreq.wi_type = code;
+ wreq.wi_len = (len / 2) + 1;
+ bcopy(bytes, (char *)&wreq.wi_val[0], len);
+
+ wi_setval(iface, &wreq);
+
+ return;
+}
+
+void wi_setword(iface, code, word)
+ char *iface;
+ int code;
+ int word;
+{
+ struct wi_req wreq;
+
+ bzero((char *)&wreq, sizeof(wreq));
+
+ wreq.wi_type = code;
+ wreq.wi_len = 2;
+ wreq.wi_val[0] = word;
+
+ wi_setval(iface, &wreq);
+
+ return;
+}
+
+void wi_sethex(iface, code, str)
+ char *iface;
+ int code;
+ char *str;
+{
+ struct ether_addr *addr;
+
+ if (str == NULL)
+ errx(1, "must specify address");
+
+ addr = ether_aton(str);
+
+ if (addr == NULL)
+ errx(1, "badly formatted address");
+
+ wi_setbytes(iface, code, (char *)addr, ETHER_ADDR_LEN);
+
+ return;
+}
+
+void wi_printwords(wreq)
+ struct wi_req *wreq;
+{
+ int i;
+
+ printf("[ ");
+ for (i = 0; i < wreq->wi_len - 1; i++)
+ printf("%d ", wreq->wi_val[i]);
+ printf("]");
+
+ return;
+}
+
+void wi_printbool(wreq)
+ struct wi_req *wreq;
+{
+ if (wreq->wi_val[0])
+ printf("[ On ]");
+ else
+ printf("[ Off ]");
+
+ return;
+}
+
+void wi_printhex(wreq)
+ struct wi_req *wreq;
+{
+ int i;
+ unsigned char *c;
+
+ c = (unsigned char *)&wreq->wi_val;
+
+ printf("[ ");
+ for (i = 0; i < (wreq->wi_len - 1) * 2; i++) {
+ printf("%02x", c[i]);
+ if (i < ((wreq->wi_len - 1) * 2) - 1)
+ printf(":");
+ }
+
+ printf(" ]");
+ return;
+}
+
+#define WI_STRING 0x01
+#define WI_BOOL 0x02
+#define WI_WORDS 0x03
+#define WI_HEXBYTES 0x04
+
+struct wi_table {
+ int wi_code;
+ int wi_type;
+ char *wi_str;
+};
+
+static struct wi_table wi_table[] = {
+ { WI_RID_SERIALNO, WI_STRING, "NIC serial number:\t\t\t" },
+ { WI_RID_NODENAME, WI_STRING, "Station name:\t\t\t\t" },
+ { WI_RID_OWN_SSID, WI_STRING, "SSID for IBSS creation:\t\t\t" },
+ { WI_RID_CURRENT_SSID, WI_STRING, "Current netname (SSID):\t\t\t" },
+ { WI_RID_DESIRED_SSID, WI_STRING, "Desired netname (SSID):\t\t\t" },
+ { WI_RID_CURRENT_BSSID, WI_HEXBYTES, "Current BSSID:\t\t\t\t" },
+ { WI_RID_CHANNEL_LIST, WI_WORDS, "Channel list:\t\t\t\t" },
+ { WI_RID_OWN_CHNL, WI_WORDS, "IBSS channel:\t\t\t\t" },
+ { WI_RID_CURRENT_CHAN, WI_WORDS, "Current channel:\t\t\t" },
+ { WI_RID_COMMS_QUALITY, WI_WORDS, "Comms quality/signal/noise:\t\t" },
+ { WI_RID_PROMISC, WI_BOOL, "Promiscuous mode:\t\t\t" },
+ { WI_RID_PORTTYPE, WI_WORDS, "Port type (1=BSS, 3=ad-hoc):\t\t"},
+ { WI_RID_MAC_NODE, WI_HEXBYTES, "MAC address:\t\t\t\t"},
+ { WI_RID_TX_RATE, WI_WORDS, "TX rate (1=1Mbps, 2=2Mbps, 3=auto):\t"},
+ { WI_RID_RTS_THRESH, WI_WORDS, "RTS/CTS handshake threshold:\t\t"},
+ { WI_RID_CREATE_IBSS, WI_BOOL, "Create IBSS:\t\t\t\t" },
+ { WI_RID_SYSTEM_SCALE, WI_WORDS, "Access point density:\t\t\t" },
+ { 0, NULL }
+};
+
+static void wi_dumpinfo(iface)
+ char *iface;
+{
+ struct wi_req wreq;
+ int i;
+ struct wi_table *w;
+
+ w = wi_table;
+
+ for (i = 0; w[i].wi_type; i++) {
+ bzero((char *)&wreq, sizeof(wreq));
+
+ wreq.wi_len = WI_MAX_DATALEN;
+ wreq.wi_type = w[i].wi_code;
+
+ wi_getval(iface, &wreq);
+ printf("%s", w[i].wi_str);
+ switch(w[i].wi_type) {
+ case WI_STRING:
+ wi_printstr(&wreq);
+ break;
+ case WI_WORDS:
+ wi_printwords(&wreq);
+ break;
+ case WI_BOOL:
+ wi_printbool(&wreq);
+ break;
+ case WI_HEXBYTES:
+ wi_printhex(&wreq);
+ break;
+ default:
+ break;
+ }
+ printf("\n");
+ }
+
+ return;
+}
+
+static void wi_dumpstats(iface)
+ char *iface;
+{
+ struct wi_req wreq;
+ struct wi_counters *c;
+
+ if (iface == NULL)
+ errx(1, "must specify interface name");
+
+ bzero((char *)&wreq, sizeof(wreq));
+ wreq.wi_len = WI_MAX_DATALEN;
+ wreq.wi_type = WI_RID_IFACE_STATS;
+
+ wi_getval(iface, &wreq);
+
+ c = (struct wi_counters *)&wreq.wi_val;
+
+ printf("Transmitted unicast frames:\t\t%d\n",
+ c->wi_tx_unicast_frames);
+ printf("Transmitted multicast frames:\t\t%d\n",
+ c->wi_tx_multicast_frames);
+ printf("Transmitted fragments:\t\t\t%d\n",
+ c->wi_tx_fragments);
+ printf("Transmitted unicast octets:\t\t%d\n",
+ c->wi_tx_unicast_octets);
+ printf("Transmitted multicast octets:\t\t%d\n",
+ c->wi_tx_multicast_octets);
+ printf("Single transmit retries:\t\t%d\n",
+ c->wi_tx_single_retries);
+ printf("Multiple transmit retries:\t\t%d\n",
+ c->wi_tx_multi_retries);
+ printf("Transmit retry limit exceeded:\t\t%d\n",
+ c->wi_tx_retry_limit);
+ printf("Transmit discards:\t\t\t%d\n",
+ c->wi_tx_discards);
+ printf("Transmit discards due to wrong SA:\t%d\n",
+ c->wi_tx_discards_wrong_sa);
+ printf("Received unicast frames:\t\t%d\n",
+ c->wi_rx_unicast_frames);
+ printf("Received multicast frames:\t\t%d\n",
+ c->wi_rx_multicast_frames);
+ printf("Received fragments:\t\t\t%d\n",
+ c->wi_rx_fragments);
+ printf("Received unicast octets:\t\t%d\n",
+ c->wi_rx_unicast_octets);
+ printf("Received multicast octets:\t\t%d\n",
+ c->wi_rx_multicast_octets);
+ printf("Receive FCS errors:\t\t\t%d\n",
+ c->wi_rx_fcs_errors);
+ printf("Receive discards due to no buffer:\t%d\n",
+ c->wi_rx_discards_nobuf);
+ printf("Can't decrypt WEP frame:\t\t%d\n",
+ c->wi_rx_WEP_cant_decrypt);
+ printf("Received message fragments:\t\t%d\n",
+ c->wi_rx_msg_in_msg_frags);
+ printf("Received message bad fragments:\t\t%d\n",
+ c->wi_rx_msg_in_bad_msg_frags);
+
+ return;
+}
+
+static void usage(p)
+ char *p;
+{
+ fprintf(stderr, "usage: %s -i iface\n", p);
+ fprintf(stderr, "\t%s -i iface -o\n", p);
+ fprintf(stderr, "\t%s -i iface -t tx rate\n", p);
+ fprintf(stderr, "\t%s -i iface -n network name\n", p);
+ fprintf(stderr, "\t%s -i iface -s station name\n", p);
+ fprintf(stderr, "\t%s -i iface -c create IBSS\n", p);
+ fprintf(stderr, "\t%s -i iface -q SSID of IBSS to create\n", p);
+ fprintf(stderr, "\t%s -i iface -p port type\n", p);
+ fprintf(stderr, "\t%s -i iface -a access point density\n", p);
+ fprintf(stderr, "\t%s -i iface -m mac address\n", p);
+ fprintf(stderr, "\t%s -i iface -d max data length\n", p);
+ fprintf(stderr, "\t%s -i iface -r RTS threshold\n", p);
+
+ exit(1);
+}
+
+int main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ int ch;
+ char *iface = NULL;
+ char *p = argv[0];
+
+ while((ch = getopt(argc, argv, "hoc:d:i:p:r:q:t:n:s:m:")) != -1) {
+ switch(ch) {
+ case 'o':
+ wi_dumpstats(iface);
+ exit(0);
+ break;
+ case 'i':
+ iface = optarg;
+ break;
+ case 'c':
+ wi_setword(iface, WI_RID_CREATE_IBSS, atoi(optarg));
+ exit(0);
+ break;
+ case 'd':
+ wi_setword(iface, WI_RID_MAX_DATALEN, atoi(optarg));
+ exit(0);
+ break;
+ case 'p':
+ wi_setword(iface, WI_RID_PORTTYPE, atoi(optarg));
+ exit(0);
+ break;
+ case 'r':
+ wi_setword(iface, WI_RID_RTS_THRESH, atoi(optarg));
+ exit(0);
+ break;
+ case 't':
+ wi_setword(iface, WI_RID_TX_RATE, atoi(optarg));
+ exit(0);
+ break;
+ case 'n':
+ wi_setstr(iface, WI_RID_DESIRED_SSID, optarg);
+ exit(0);
+ break;
+ case 's':
+ wi_setstr(iface, WI_RID_NODENAME, optarg);
+ exit(0);
+ break;
+ case 'm':
+ wi_sethex(iface, WI_RID_MAC_NODE, optarg);
+ exit(0);
+ break;
+ case 'q':
+ wi_setstr(iface, WI_RID_OWN_SSID, optarg);
+ exit(0);
+ break;
+ case 'h':
+ default:
+ usage(p);
+ break;
+ }
+ }
+
+ if (iface == NULL)
+ usage(p);
+
+ wi_dumpinfo(iface);
+
+ exit(0);
+}
OpenPOWER on IntegriCloud