aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2021-01-07 22:45:23 +0000
committerWarner Losh <imp@FreeBSD.org>2021-01-08 03:41:06 +0000
commita21def4d568fd2f6723252c16e116b5e7d8125eb (patch)
tree0677796da27bda642f1c8a2e21fe6732c93b611f
parent23e124c78bcb46ac78d9f06449c4454f43732805 (diff)
downloadsrc-a21def4d568fd2f6723252c16e116b5e7d8125eb.tar.gz
src-a21def4d568fd2f6723252c16e116b5e7d8125eb.zip
pccard: Remove wi(4) driver
Remove wi(4). pccard is going away, and wi only supports PC Card devices, though it has a minor amount of glue to also support PCI cards. However, removing the one without removing the other is hard, so the whole driver is being removed. Relnotes: Yes
-rw-r--r--ObsoleteFiles.inc6
-rw-r--r--include/Makefile2
-rw-r--r--share/man/man4/Makefile2
-rw-r--r--share/man/man4/wi.4380
-rw-r--r--sys/amd64/conf/GENERIC1
-rw-r--r--sys/conf/NOTES4
-rw-r--r--sys/conf/files3
-rw-r--r--sys/dev/wi/if_wavelan_ieee.h747
-rw-r--r--sys/dev/wi/if_wi.c2088
-rw-r--r--sys/dev/wi/if_wi_macio.c148
-rw-r--r--sys/dev/wi/if_wi_pccard.c205
-rw-r--r--sys/dev/wi/if_wi_pci.c267
-rw-r--r--sys/dev/wi/if_wireg.h726
-rw-r--r--sys/dev/wi/if_wivar.h189
-rw-r--r--sys/i386/conf/GENERIC1
-rw-r--r--sys/modules/Makefile3
-rw-r--r--sys/modules/wi/Makefile15
-rw-r--r--tools/kerneldoc/subsys/Doxyfile-dev_wi21
18 files changed, 6 insertions, 4802 deletions
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 85d6e3eecd43..cf8b2ed118ab 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -36,10 +36,14 @@
# xargs -n1 | sort | uniq -d;
# done
-# 20210108: retire cmx, ng_bt3c drivers
+# 20210108: retire cmx, ng_bt3c, wi drivers
+OLD_FILES+=usr/include/dev/wi/if_wireg.h
+OLD_FILES+=usr/include/dev/wi/if_wavelan_ieee.h
+OLD_FILES+=usr/include/dev/wi/if_wivar.h
OLD_FILES+=usr/sbin/bt3cfw
OLD_FILES+=usr/share/man/man4/cmw.4.gz
OLD_FILES+=usr/share/man/man4/ng_bt3c.4.gz
+OLD_FILES+=usr/share/man/man4/wi.4.gz
OLD_FILES+=usr/share/man/man8/bt3cfw.8.gz
# 20210107: retire a.out support
diff --git a/include/Makefile b/include/Makefile
index 59f62f1d4897..4533dfea1b67 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -46,7 +46,7 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \
dev/hwpmc dev/hyperv \
dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/nvme \
dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \
- dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd dev/wi \
+ dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \
fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \
fs/procfs fs/smbfs fs/udf fs/unionfs \
geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index 95f11ed3ca1b..c72caf0199c9 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -580,7 +580,6 @@ MAN= aac.4 \
${_vtnet.4} \
watchdog.4 \
${_wbwd.4} \
- wi.4 \
witness.4 \
wlan.4 \
wlan_acl.4 \
@@ -763,7 +762,6 @@ MLINKS+=vr.4 if_vr.4
MLINKS+=vte.4 if_vte.4
MLINKS+=${_vtnet.4} ${_if_vtnet.4}
MLINKS+=watchdog.4 SW_WATCHDOG.4
-MLINKS+=wi.4 if_wi.4
MLINKS+=${_wpi.4} ${_if_wpi.4}
MLINKS+=xl.4 if_xl.4
diff --git a/share/man/man4/wi.4 b/share/man/man4/wi.4
deleted file mode 100644
index c3a6a2b713c2..000000000000
--- a/share/man/man4/wi.4
+++ /dev/null
@@ -1,380 +0,0 @@
-.\" 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.
-.\"
-.\" $FreeBSD$
-.\" $OpenBSD: wi.4tbl,v 1.14 2002/04/29 19:53:50 jsyn Exp $
-.\"
-.Dd July 23, 2011
-.Dt WI 4
-.Os
-.Sh NAME
-.Nm wi
-.Nd "Lucent Hermes, and Intersil PRISM IEEE 802.11 driver"
-.Sh SYNOPSIS
-To compile this driver into the kernel,
-place the following lines in your
-kernel configuration file:
-.Bd -ragged -offset indent
-.Cd "device wi"
-.Cd "device wlan"
-.Ed
-.Pp
-Alternatively, to load the driver as a
-module at boot time, place the following line in
-.Xr loader.conf 5 :
-.Bd -literal -offset indent
-if_wi_load="YES"
-.Ed
-.Sh DEPRECATION NOTICE
-This driver is scheduled for removal prior to the release of
-.Fx 13.0
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for 802.11b wireless network adapters based around
-the Lucent Hermes, Intersil PRISM-II, Intersil PRISM-2.5, and Intersil
-Prism-3 chipsets.
-All chipsets provide a similar interface to the driver.
-Only the Intersil chipsets support access point operation or WPA.
-Very old versions of firmware are not supported at all.
-Older versions of the firmware that are supported may severely limit
-the ability to use these cards in newer networks.
-Only relatively recent versions of Intersil firmware supports WPA.
-See CAVEATS for details.
-All host/device interaction is via programmed I/O, even on those cards
-that support a DMA interface.
-.Pp
-For more information on configuring this device, see
-.Xr ifconfig 8 .
-.Pp
-.Nm
-supports
-.Cm station ,
-.Cm adhoc ,
-.Cm adhoc-demo ,
-.Cm hostap ,
-and
-.Cm monitor
-mode operation.
-Only one
-virtual interface may be configured at a time.
-For more information on configuring this device, see
-.Xr ifconfig 8 .
-.Pp
-Cards supported by the
-.Nm
-driver come in a variety of packages, though the most common
-are of the PCMCIA type.
-In many cases, the PCI version of a wireless card is simply
-a PCMCIA card bundled with a PCI adapter.
-The PCI adapters come in two flavors: true PCMCIA bridges and
-dumb PCMCIA bridges.
-A true PCMCIA bridge (such as those sold by Lucent) will attach
-as a real PCMCIA controller.
-The wireless card will then attach to the PCMCIA bus.
-Wireless cards in PCMCIA slots may be inserted and ejected on the fly.
-.Pp
-A dumb bridge, on the other hand, does not show up as a true PCMCIA bus.
-The wireless card will simply appear to the host as a normal PCI
-device and will not require any PCMCIA support.
-Cards in this type of adapter should only be removed when the
-machine is powered down.
-.Pp
-The following cards are among those supported by the
-.Nm
-driver:
-.Pp
-.Bl -column -compact "Linksys Instant Wireless WPC11 2.5" "Spectrum24" "PCI or PCMCIA"
-.Em "Card Chip Bus"
-3Com AirConnect 3CRWE777A Prism-II PCI
-Accton airDirect WN3301 PCMCIA
-ACTIONTEC HWC01170 Prism-2.5 PCMCIA
-Adaptech ANW-8030 Prism-3 PCMCIA
-Addtron AWP-100 Prism-II PCMCIA
-Adtec Adlink/340C Prism-II PCMCIA
-Airvast WN 100 Prism-3 PCMCIA
-Airway 802.11 Adapter PCMCIA
-Agere Orinoco Hermes PCMCIA
-Allied Telesis WR211PCM Prism-II PCMCIA
-ArTem OnAir Prism? PCMCIA
-Asus WL100 Prism-2.5 PCMCIA
-Avaya Wireless Prism-II PCMCIA
-Bay eMobility 11B Prism-2.5? PCMCIA
-Blue Concentric Circle WL-379F Prism-II CF
-BreezeNet Wireless Prism-II PCMCIA
-Buffalo WLI-PCM-S11 Prism-II PCMCIA
-Buffalo WLI-PCM-L11G Hermes PCMCIA
-Buffalo WLI-CF-S11G Prism-II CF
-Buffalo WLI2-CF-S11G Prism 2.5 CF
-Cabletron RoamAbout Hermes PCMCIA
-Compaq Agency NC5004 Prism-II PCMCIA
-Compaq WL100 Prism-II PCMCIA
-Compaq WL110 Hermes PCMCIA
-Compaq WL200 Prism-II PCMCIA
-Contec FLEXLAN/FX-DS110-PCC Prism-II PCMCIA
-Corega PCC-11 Prism-II PCMCIA
-Corega PCCA-11 Prism-II PCMCIA
-Corega PCCB-11 Prism-II PCMCIA
-Corega CGWLPCIA11 Prism-II PCI
-Dell TrueMobile 1150 Hermes PCMCIA
-Dlink Air 660 Prism-II PCMCIA
-Dlink DWL520 Prism-2.5 PCI
-Dlink DWL650 Prism-2.5 PCMCIA
-ELECOM Air@Hawk/LD-WL11/PCC PCMCIA
-ELSA MC-11 PCMCIA
-ELSA XI300 Prism-II PCMCIA
-ELSA XI325 Prism-2.5 PCMCIA
-ELSA APDL325 Prism-2.5 PCMCIA
-ELSA XI330 Prism-3 PCMCIA
-ELSA XI800 Prism-II CF
-EMTAC A2424i Prism-II PCMCIA
-Farallon Skyline Prism-II PCMCIA
-Gemtek WL-311 Prism-2.5 PCMCIA
-Hawking Technology WE110P Prism-2.5 PCMCIA
-Home Wireless Networks Prism-II PCMCIA
-IBM High Rate Wireless Hermes PCMCIA
-ICOM SL-1100 Prism-II PCMCIA
-I-O DATA WN-B11/PCM Prism-II PCMCIA
-Intersil Prism II Prism-II PCMCIA
-Intersil Mini-PCI Prism-2.5 PCI
-Intersil ISL37100P Prism-3 PCMCIA
-Intersil ISL37110P Prism-3 PCMCIA
-Intersil ISL37300P Prism-3 PCMCIA
-Laneed Wireless PCMCIA
-Linksys Instant Wireless WPC11 Prism-II PCMCIA
-Linksys Instant Wireless WPC11 2.5 Prism-2.5 PCMCIA
-Linksys Instant Wireless WPC11 3.0 Prism-3 PCMCIA
-Linksys WCF11 Prism-3 PCMCIA
-Linksys WCF12 Prism-3 CF
-Lucent WaveLAN Hermes PCMCIA
-Melco Airconnect Prism-II PCMCIA
-Microsoft MN-520 WLAN Prism-II PCMCIA
-NANOSPEED ROOT-RZ2000 Prism-II PCMCIA
-NCR WaveLAN/IEEE 802.11 PCMCIA
-NDC/Sohoware NCP130 Prism-II PCI
-NEC CMZ-RT-WP Prism-II PCMCIA
-NEC PK-WL001 Lucent PCMCIA
-NEC PC-WL/11C Prism-II PCMCIA
-Netgear MA311 Prism-2.5 PCI
-Netgear MA401 Prism-II/2.5 PCMCIA
-Netgear MA401RA Prism-II PCMCIA
-Netgear MA701 Prism-II CF
-NOKIA C020 WLAN Prism-II PCMCIA
-NOKIA C110 WLAN Prism-2.5 PCMCIA
-NTT-ME 11Mbps Wireless LAN Prism-II PCMCIA
-Planex GeoWave/GW-NS110 Prism-II PCMCIA
-Planex GW-NS11H Prism-II PCMCIA
-Proxim Harmony Prism-II PCMCIA
-Proxim RangeLAN-DS Prism-II PCMCIA
-Samsung MagicLAN SWL-2000N Prism-II PCMCIA
-SENAO SL-2511CD Prism-3 PCMCIA
-Siemens SpeedStream SS1021 Prism-II PCMCIA
-Siemens SpeedStream SS1021 Prism-3 PCMCIA
-SMC 2532W-B Prism-II PCMCIA
-SMC 2602 EZ Connect (3.3V) Prism-II PCI or PCMCIA
-SMC 2632 EZ Connect Prism-II PCMCIA
-Socket Low Power WLAN-CF Prism-II CF
-Sony PCWA-C100 Lucent PCMCIA
-Sony PEGA-WL110 Prism-2.5 PCMCIA
-TDK LAK-CD011WL Prism-II PCMCIA
-Toshiba Wireless LAN Card Prism-II PCMCIA
-U.S.\& Robotics Wireless Card 2410 Prism-II PCMCIA
-YIS YWL-11B Prism-II PCMCIA
-.El
-.Pp
-Several vendors sell PCI adapters built around the PLX Technology 9050
-or 9052 chip.
-The following such adapters are supported or expected to work:
-.Pp
-.Bl -item -compact
-.It
-3Com AirConnect 3CRWE777A (3.3V)
-.It
-Belkin F5D6000 (a rebadged WL11000P)
-.It
-Eumitcom WL11000P
-.It
-Global Sun Technology GL24110P (untested)
-.It
-Global Sun Technology GL24110P02
-.It
-LinkSys WDT11 (a rebadged GL24110P02)
-.It
-Netgear MA301
-.It
-US Robotics 2415 (rebadged WL11000P)
-.It
-Wisecom Wireless LAN PCI Adapter
-.El
-.Pp
-The following adapters have the same model numbers as those listed
-above, but might not work if the actual card is after the change away
-from the Prism family:
-.Pp
-.Bl -item -compact
-.It
-DLink DWL520
-.El
-.Sh EXAMPLES
-Join an existing BSS network (ie: connect to an access point):
-.Bd -literal -offset indent
-ifconfig wlan create wlandev wi0 inet 192.168.0.20 \e
- netmask 0xffffff00
-.Ed
-.Pp
-Join a specific BSS network with network name
-.Dq Li my_net :
-.Bd -literal -offset indent
-ifconfig wlan create wlandev wi0 inet 192.168.0.20 \e
- netmask 0xffffff00 ssid my_net
-.Ed
-.Pp
-Join a specific BSS network with WEP encryption:
-.Bd -literal -offset indent
-ifconfig wlan create wlandev wi0 inet 192.168.0.20 \e
- netmask 0xffffff00 ssid my_net \e
- wepmode on wepkey 0x8736639624 weptxkey 1
-.Ed
-.Pp
-Join a Lucent legacy demo ad-hoc network with network name
-.Dq Li my_net :
-.Bd -literal -offset indent
-ifconfig wlan create wlandev wi0 wlanmode ahdemo \e
- inet 192.168.0.20 netmask 0xffffff00 ssid my_net
-.Ed
-.Pp
-Join/create an IBSS network with network name
-.Dq Li my_net :
-.Bd -literal -offset indent
-ifconfig wlan create wlandev wi0 wlanmode adhoc wi0 \e
- inet 192.168.0.22 netmask 0xffffff00 ssid my_net
-.Ed
-.Pp
-Create a host-based access point (Prism only):
-.Bd -literal -offset indent
-ifconfig wlan create wlandev wi0 wlanmode hostap \e
- inet 192.168.0.10 netmask 0xffffff00 ssid my_ap
-.Ed
-.Pp
-Create a host-based access point with WEP enabled (Prism only)
-and plumb it into bridge to fxp0:
-.Bd -literal -offset indent
-ifconfig wlan0 create wlandev wi0 wlanmode hostap \e
- inet 192.168.0.10 netmask 0xffffff00 ssid my_ap \e
- wepmode on wepkey 0x1234567890 weptxkey 1
-ifconfig bridge0 create
-ifconfig bridge0 addm wlan0 addm fxp0 up
-.Ed
-.Pp
-This will give you the same functionality as an access point.
-.Sh DIAGNOSTICS
-.Bl -diag
-.It "wi%d: init failed"
-The WaveLAN card failed to become 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.
-This can also be an indication of an incorrectly configured interrupt.
-.It "wi%d: device timeout"
-The WaveLAN card failed to generate an interrupt to acknowledge a transmit
-command.
-.El
-.Sh SEE ALSO
-.Xr intro 4 ,
-.Xr pccard 4 ,
-.Xr pccbb 4 ,
-.Xr pcic 4 ,
-.Xr wlan 4 ,
-.Xr wlan_ccmp 4 ,
-.Xr wlan_tkip 4 ,
-.Xr wlan_wep 4 ,
-.Xr wlan_xauth 4 ,
-.Xr hostapd 8 ,
-.Xr ifconfig 8 ,
-.Xr wpa_supplicant 8
-.Rs
-.%T HCF Light programming specification
-.%U http://web.archive.org/web/20040130141721/http://wavelan.com/
-.Re
-.Sh HISTORY
-The
-.Nm
-device driver first appeared in
-.Fx 3.0 .
-.Sh AUTHORS
-The original
-.Nm
-driver was written by
-.An Bill Paul Aq Mt wpaul@ctr.columbia.edu .
-This man page comes from
-.Ox .
-.Sh CAVEATS
-The driver will reject devices with old firmware to
-avoid dealing with numerous defects.
-Unfortunately the driver does not support downloading new firmware
-to the card so if new firmware is needed users will have to boot
-a different system to accomplish this.
-.Pp
-Intersil Prism cards must have firmware versions 0.8.0 or later and
-version 1.7.0 or later are required to support functionality such as WPA.
-Some users of Prism-II and 2.5 based cards report that station firmware
-version 1.3.4 works better for them in hostap than 1.4.9.
-Older versions of the Prism station firmware have a number of issues
-with hostap mode.
-The IBSS/adhoc mode appears to work well on station firmware 1.3.1 and
-later.
-The IBSS/adhoc mode appears to have problems for some people with
-older versions of station firmware.
-.Pp
-Lucent cards prior to firmware version 6.0.6 do not implement IBSS
-mode and are not supported.
-.Pp
-Prior versions of
-.Nm
-supported Symbol firmware.
-That support has been removed due to persistent problems with this
-firmware as well as getting proper documentation on this firmware.
-.Pp
-Hermes 2 and Hermes 3 chips are not supported by this driver.
-.Pp
-Here's the above requirements in the form of a table
-.Pp
-.Bl -column -compact "Prims II/2.5" "xxxxxxxx" "xxxxxxxx" "xxxxxxxx" "xxxxxxxx"
-.Em "Firmware Minimum WPA Host AP Adhoc/IBSS"
-Prism II/2.5 0.8.0 1.7.0 1.3.4 1.3.1
-Prism 3 0.8.0 1.7.0 1.4.9 1.3.1
-Hermes 6.0.6 none none 6.0.6
-Symbol none none none none
-.El
-.Sh BUGS
-Not all the new messages are documented here, and many of them are
-indications of transient errors that are not indications of serious
-problems.
diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
index 94f184334648..1ccd06669951 100644
--- a/sys/amd64/conf/GENERIC
+++ b/sys/amd64/conf/GENERIC
@@ -311,7 +311,6 @@ device iwn # Intel 4965/1000/5000/6000 wireless NICs.
device malo # Marvell Libertas wireless NICs.
device mwl # Marvell 88W8363 802.11n wireless NICs.
device ral # Ralink Technology RT2500 wireless NICs.
-device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs.
device wpi # Intel 3945ABG wireless NICs.
# Pseudo devices.
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index c3a9c097dedb..4a9e09184caa 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -1923,9 +1923,6 @@ device xmphy # XaQti XMAC II
# including the D-Link DFE520TX and D-Link DFE530TX (see 'rl' for
# DFE530TX+), the Hawking Technologies PN102TX, and the AOpen/Acer ALN-320.
# vte: DM&P Vortex86 RDC R6040 Fast Ethernet
-# 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.
# xl: Support for the 3Com 3c900, 3c905, 3c905B and 3c905C (Fast)
# Etherlink XL cards and integrated controllers. This includes the
# integrated 3c905B-TX chips in certain Dell Optiplex and Dell
@@ -1936,7 +1933,6 @@ device xmphy # XaQti XMAC II
# Order for ISA devices is important here
device an
-device wi
# PCI Ethernet NICs that use the common MII bus controller code.
device ae # Attansic/Atheros L2 FastEthernet
diff --git a/sys/conf/files b/sys/conf/files
index 370b67709ad6..860fae3c8273 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -3499,9 +3499,6 @@ dev/vt/vt_font.c optional vt
dev/vt/vt_sysmouse.c optional vt
dev/vte/if_vte.c optional vte pci
dev/watchdog/watchdog.c standard
-dev/wi/if_wi.c optional wi
-dev/wi/if_wi_pccard.c optional wi pccard
-dev/wi/if_wi_pci.c optional wi pci
dev/wpi/if_wpi.c optional wpi pci
wpifw.c optional wpifw \
compile-with "${AWK} -f $S/tools/fw_stub.awk wpi.fw:wpifw:153229 -mwpi -c${.TARGET}" \
diff --git a/sys/dev/wi/if_wavelan_ieee.h b/sys/dev/wi/if_wavelan_ieee.h
deleted file mode 100644
index 27b7ed0f80bb..000000000000
--- a/sys/dev/wi/if_wavelan_ieee.h
+++ /dev/null
@@ -1,747 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#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
-
-#if 0
-struct wi_req {
- u_int16_t wi_len;
- u_int16_t wi_type;
- u_int16_t wi_val[WI_MAX_DATALEN];
-};
-#endif
-
-/*
- * 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
-#define WI_RID_ZERO_CACHE 0x0300
-#define WI_RID_READ_CACHE 0x0400
-#define WI_RID_FWDOWNLOAD 0x0500
-#define WI_RID_MONITOR_MODE 0x0600
-#define WI_RID_MIF 0x0700
-#define WI_RID_SCAN_APS 0x0800
-#define WI_RID_READ_APS 0x0900
-
-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 */
-
-#define WI_STYPE_CTL_PSPOLL 0x00A0
-#define WI_STYPE_CTL_RTS 0x00B0
-#define WI_STYPE_CTL_CTS 0x00C0
-#define WI_STYPE_CTL_ACK 0x00D0
-#define WI_STYPE_CTL_CFEND 0x00E0
-#define WI_STYPE_CTL_CFENDACK 0x00F0
-
-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;
-};
-
-/*
- * Lucent/wavelan IEEE signal strength cache
- *
- * driver keeps cache of last
- * MAXWICACHE packets to arrive including signal strength info.
- * daemons may read this via ioctl
- *
- * Each entry in the wi_sigcache has a unique macsrc.
- */
-struct wi_sigcache {
- char macsrc[6]; /* unique MAC address for entry */
- int ipsrc; /* ip address associated with packet */
- int signal; /* signal strength of the packet */
- int noise; /* noise value */
- int quality; /* quality of the packet */
-};
-
-/*
- * Firmware downloading API. We support downloading into RAM and into
- * flash. We copy the entire .hex file for both the primary and secondary
- * firmware into the kernel, which is minorly gross, but matches the
- * format of the compiled in firmware.
- */
-struct wi_fwdownload {
- int type; /* What type of download. */
-#define WI_FW_RAM 1
-#define WI_FW_FLASH 2
- size_t pri_len; /* Primary firmware length */
- size_t sec_len; /* Secondary firmware length */
- caddr_t pri_data; /* Pointer (user) to primary data */
- caddr_t sec_data; /* Pointer (user) to secondary data */
-};
-
-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;
-};
-
-/*
- * 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 */
-#define WI_RID_ENCRYPTION 0xFC20 /* enable/disable WEP */
-#define WI_RID_AUTHTYPE 0xFC21 /* specify authentication type */
-#define WI_RID_P2_TX_CRYPT_KEY 0xFC23
-#define WI_RID_P2_CRYPT_KEY0 0xFC24
-#define WI_RID_P2_CRYPT_KEY1 0xFC25
-#define WI_RID_MICROWAVE_OVEN 0xFC25
-#define WI_RID_P2_CRYPT_KEY2 0xFC26
-#define WI_RID_P2_CRYPT_KEY3 0xFC27
-#define WI_RID_P2_ENCRYPTION 0xFC28
-#define WI_RID_ALT_RETRY_CNT 0xFC32
-#define PRIVACY_INVOKED 0x01
-#define EXCLUDE_UNENCRYPTED 0x02
-#define HOST_ENCRYPT 0x10
-#define IV_EVERY_FRAME 0x00 /* IV = Initialization Vector */
-#define IV_EVERY10_FRAME 0x20 /* every 10 frame IV reuse */
-#define IV_EVERY50_FRAME 0x40 /* every 50 frame IV reuse */
-#define IV_EVERY100_FRAME 0x60 /* every 100 frame IV reuse */
-#define HOST_DECRYPT 0x80
-#define WI_RID_WEP_MAPTABLE 0xFC29
-#define WI_RID_CNFAUTHMODE 0xFC2A
-#define WI_RID_ROAMING_MODE 0xFC2D
-#define WI_RID_OWN_BEACON_INT 0xFC33 /* beacon xmit time for BSS creation */
-#define WI_RID_ENH_SECURITY 0xFC43 /* enhanced security (AP mode) */
-#define WI_RID_CNF_DBM_ADJUST 0xFC46
-#define WI_RID_DBM_ADJUST 0xFC46 /* RSSI - WI_RID_DBM_ADJUST ~ dBm */
-#define WI_RID_WPA_DATA 0xFC48 /* WPA IE */
-#define WI_RID_BASIC_RATE 0xFCB3
-#define WI_RID_SUPPORT_RATE 0xFCB4
-#define WI_RID_WPA_HANDLING 0xFCBB /* WPA handling procedures */
-
-/*
- * 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
- * 0 == Fixed 1mbps
- * 1 == Fixed 2mbps
- * 2 == auto fallback
- */
-#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_DEFLT_CRYPT_KEYS 0xFCB0
-#define WI_RID_TX_CRYPT_KEY 0xFCB1
-#define WI_RID_TICK_TIME 0xFCE0
-
-struct wi_key {
- u_int16_t wi_keylen;
- u_int8_t wi_keydat[14];
-};
-
-#define WI_NLTV_KEYS 4
-struct wi_ltv_keys {
- u_int16_t wi_len;
- u_int16_t wi_type;
- struct wi_key wi_keys[WI_NLTV_KEYS];
-};
-
-/*
- * NIC information
- */
-#define WI_RID_DNLD_BUF 0xFD01
-#define WI_RID_MEMSZ 0xFD02 /* memory size info (XXX Lucent) */
- /* Looks like on lucnet pri firm too */
-#define WI_RID_PRI_IDENTITY 0xFD02 /* primary funcs firmware ident (PRISM2) */
-#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_IDENTITY 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_SYMBOL_IDENTITY 0xFD24
-#define WI_RID_CFI_ACT_RANGE 0xFD33
-#define WI_RID_COMMQUAL 0xFD43
-#define WI_RID_SCALETHRESH 0xFD46
-#define WI_RID_PCF 0xFD87
-
-/*
- * 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_CUR_BEACON_INT 0xFD45 /* current beacon interval */
-#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_DBM_COMMS_QUAL 0xFD51 /* CommQuality normalized to dBm */
-#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 */
-
-/*
- * Scan Information
- */
-#define WI_RID_BCAST_SCAN_REQ 0xFCAB /* Broadcast Scan request (Symbol) */
-#define BSCAN_5SEC 0x01
-#define BSCAN_ONETIME 0x02
-#define BSCAN_PASSIVE 0x40
-#define BSCAN_BCAST 0x80
-#define WI_RID_SCAN_REQ 0xFCE1 /* Scan request (STA only) */
-#define WI_RID_JOIN_REQ 0xFCE2 /* Join request (STA only) */
-#define WI_RID_AUTH_STATION 0xFCE3 /* Authenticates Station (AP) */
-#define WI_RID_CHANNEL_REQ 0xFCE4 /* Channel Information Request (AP) */
-#define WI_RID_SCAN_RESULTS 0xFD88 /* Scan Results Table */
-
-struct wi_apinfo {
- int scanreason; /* ScanReason */
- char bssid[6]; /* BSSID (mac address) */
- int channel; /* Channel */
- int signal; /* Signal level */
- int noise; /* Average Noise Level*/
- int quality; /* Quality */
- int namelen; /* Length of SSID string */
- char name[32]; /* SSID string */
- int capinfo; /* Capability info. */
- int interval; /* BSS Beacon Interval */
- int rate; /* Data Rate */
-};
-
-/*
- * 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 */
-
-/*
- * bsd-airtools v0.2 - source-mods v0.2 [common.h]
- * by h1kari - (c) Dachb0den Labs 2001
- */
-
-/*
- * Copyright (c) 2001 Dachb0den Labs.
- * David Hulton <h1kari@dachb0den.com>. 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 David Hulton.
- * 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 David Hulton 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 David Hulton 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.
- */
-
-/*
- * standard hermes receive frame used by wavelan/prism2 cards
- */
-struct wi_rx_frame {
- /*
- * hermes prefix header. supplies information on the current status of
- * the network and various other statistics gathered from the
- * management/control frames as used internally.
- */
- u_int16_t wi_status;
- u_int16_t wi_ts0;
- u_int16_t wi_ts1;
- u_int8_t wi_silence;
- u_int8_t wi_signal;
- u_int8_t wi_rate;
- u_int8_t wi_rx_flow;
- u_int16_t wi_rsvd0;
- u_int16_t wi_rsvd1;
- /*
- * standard 80211 frame header. all packets have to use this header as
- * per the AN9900 from intersil, even management/control. for
- * management packets, they just threw the header into the data field,
- * but for control packets the headers are lost in translation and
- * therefore not all control packet info can be displayed.
- */
- u_int16_t wi_frame_ctl;
- u_int16_t wi_id;
- u_int8_t wi_addr1[6];
- u_int8_t wi_addr2[6];
- u_int8_t wi_addr3[6];
- u_int16_t wi_seq_ctl;
- u_int8_t wi_addr4[6];
- u_int16_t wi_dat_len;
- /*
- * another wierdity with the drivers. they append a 802.3 header which
- * is somewhat redundant, since all the same data is provided in the
- * 802.11 header.
- */
- u_int8_t wi_dst_addr[6];
- u_int8_t wi_src_addr[6];
- u_int16_t wi_len;
-};
-#define WI_DATA_HDRLEN 0x3C
-#define WI_MGMT_HDRLEN 0x3C
-#define WI_CTL_HDRLEN 0x3C
-
-/*
- * all data packets have a snap (sub-network access protocol) header that
- * isn't entirely definied, but added for ethernet compatibility.
- */
-struct wi_snap_frame {
- u_int16_t wi_dat[3];
- u_int16_t wi_type;
-};
-
-/*
- * management frame headers
- * note: all management frames consist of a static header and variable length
- * fields.
- */
-
-/*
- * variable length field structure
- */
-struct wi_mgmt_var_hdr {
- u_int8_t wi_code;
- u_int8_t wi_len;
- u_int8_t wi_data[256];
-};
-
-/*
- * management beacon frame prefix
- */
-struct wi_mgmt_beacon_hdr {
- u_int32_t wi_ts0;
- u_int32_t wi_ts1;
- u_int16_t wi_interval;
- u_int16_t wi_capinfo;
-};
-
-/*
- * ibss announcement traffic indication message (atim) frame
- * note: no parameters
- */
-
-/*
- * management disassociation frame
- */
-struct wi_mgmt_disas_hdr {
- u_int16_t wi_reason;
-};
-
-/*
- * management association request frame prefix
- */
-struct wi_mgmt_asreq_hdr {
- u_int16_t wi_capinfo;
- u_int16_t wi_interval;
-};
-
-/*
- * management association response frame prefix
- */
-struct wi_mgmt_asresp_hdr {
- u_int16_t wi_capinfo;
- u_int16_t wi_status;
- u_int16_t wi_aid;
-};
-
-/*
- * management reassociation request frame prefix
- */
-struct wi_mgmt_reasreq_hdr {
- u_int16_t wi_capinfo;
- u_int16_t wi_interval;
- u_int8_t wi_currap[6];
-};
-
-/*
- * management reassociation response frame prefix
- */
-struct wi_mgmt_reasresp_hdr {
- u_int16_t wi_capinfo;
- u_int16_t wi_status;
- u_int16_t wi_aid;
-};
-
-/*
- * management probe request frame prefix
- * note: no static parameters, only variable length
- */
-
-/*
- * management probe response frame prefix
- */
-struct wi_mgmt_proberesp_hdr {
- u_int32_t wi_ts0;
- u_int32_t wi_ts1;
- u_int16_t wi_interval;
- u_int16_t wi_capinfo;
-};
-
-/*
- * management authentication frame prefix
- */
-struct wi_mgmt_auth_hdr {
- u_int16_t wi_algo;
- u_int16_t wi_seq;
- u_int16_t wi_status;
-};
-
-/*
- * management deauthentication frame
- */
-struct wi_mgmt_deauth_hdr {
- u_int16_t wi_reason;
-};
-
-/*
- * rid configuration register definitions
- */
-#define WI_RID_SCAN_REQ 0xFCE1 /* scan request information */
-#define WI_RID_SCAN_RES 0xFD88 /* scan result information */
-
-#define WI_RID_PROCFRAME 0x3137 /* Return full frame information */
-#define WI_RID_PRISM2 0x3138 /* tell if we're a prism2 card or not */
-
-/*
- * 802.11 definitions
- */
-#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
-#define WI_STAT_TUNNEL 0x4000
-#define WI_STAT_WMP_MSG 0x6000
-#define WI_RXSTAT_MSG_TYPE 0xE000
-
-#define WI_FCTL_OPT_MASK 0xFF00
-#define WI_AID_SET 0xC000
-#define WI_AID_MASK 0x3FFF
-#define WI_SCTL_FRAGNUM_MASK 0x000F
-#define WI_SCTL_SEQNUM_MASK 0xFFF0
-
-#define WI_STAT_UNSPEC_FAIL 1
-#define WI_STAT_CAPINFO_FAIL 10
-#define WI_STAT_REAS_DENY 11
-#define WI_STAT_ASSOC_DENY 12
-#define WI_STAT_ALGO_FAIL 13
-#define WI_STAT_SEQ_FAIL 14
-#define WI_STAT_CHAL_FAIL 15
-#define WI_STAT_TOUT_FAIL 16
-#define WI_STAT_OVERL_DENY 17
-#define WI_STAT_RATE_DENY 18
-
-#define WI_FTYPE_MGMT 0x0000
-#define WI_FTYPE_CTL 0x0004
-#define WI_FTYPE_DATA 0x0008
-
-#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_FCS_LEN 0x4 /* checksum length */
-
-/*
- * management definitions
- */
-#define WI_STYPE_MGMT_ASREQ 0x0000
-#define WI_STYPE_MGMT_ASRESP 0x0010
-#define WI_STYPE_MGMT_REASREQ 0x0020
-#define WI_STYPE_MGMT_REASRESP 0x0030
-#define WI_STYPE_MGMT_PROBEREQ 0x0040
-#define WI_STYPE_MGMT_PROBERESP 0x0050
-#define WI_STYPE_MGMT_BEACON 0x0080
-#define WI_STYPE_MGMT_ATIM 0x0090
-#define WI_STYPE_MGMT_DISAS 0x00A0
-#define WI_STYPE_MGMT_AUTH 0x00B0
-#define WI_STYPE_MGMT_DEAUTH 0x00C0
-
-#define WI_CAPINFO_ESS 0x01
-#define WI_CAPINFO_IBSS 0x02
-#define WI_CAPINFO_CFPOLL 0x04
-#define WI_CAPINFO_CFPOLLREQ 0x08
-#define WI_CAPINFO_PRIV 0x10
-
-#define WI_REASON_UNSPEC 1
-#define WI_REASON_AUTH_INVALID 2
-#define WI_REASON_DEAUTH_LEAVE 3
-#define WI_REASON_DISAS_INACT 4
-#define WI_REASON_DISAS_OVERL 5
-#define WI_REASON_CLASS2 6
-#define WI_REASON_CLASS3 7
-#define WI_REASON_DISAS_LEAVE 8
-#define WI_REASON_NOAUTH 9
-
-#define WI_VAR_SSID 0
-#define WI_VAR_SRATES 1
-#define WI_VAR_FH 2
-#define WI_VAR_DS 3
-#define WI_VAR_CF 4
-#define WI_VAR_TIM 5
-#define WI_VAR_IBSS 6
-#define WI_VAR_CHAL 16
-
-#define WI_VAR_SRATES_MASK 0x7F
-
-/*
- * control definitions
- */
-#define WI_STYPE_CTL_PSPOLL 0x00A0
-#define WI_STYPE_CTL_RTS 0x00B0
-#define WI_STYPE_CTL_CTS 0x00C0
-#define WI_STYPE_CTL_ACK 0x00D0
-#define WI_STYPE_CTL_CFEND 0x00E0
-#define WI_STYPE_CTL_CFENDCFACK 0x00F0
-
-/*
- * ap scanning structures
- */
-struct wi_scan_res {
- u_int16_t wi_chan;
- u_int16_t wi_noise;
- u_int16_t wi_signal;
- u_int8_t wi_bssid[6];
- u_int16_t wi_interval;
- u_int16_t wi_capinfo;
- u_int16_t wi_ssid_len;
- u_int8_t wi_ssid[32];
- u_int8_t wi_srates[10];
- u_int8_t wi_rate;
- u_int8_t wi_rsvd;
-};
-#define WI_WAVELAN_RES_SIZE 50
-
-struct wi_scan_p2_hdr {
- u_int16_t wi_rsvd;
- u_int16_t wi_reason;
-};
-#define WI_PRISM2_RES_SIZE 62
-
-/*
- * prism2 debug mode definitions
- */
-#define SIOCSPRISM2DEBUG _IOW('i', 137, struct ifreq)
-#define SIOCGPRISM2DEBUG _IOWR('i', 138, struct ifreq)
-
-#define WI_DEBUG_RESET 0x00
-#define WI_DEBUG_INIT 0x01
-#define WI_DEBUG_SLEEP 0x02
-#define WI_DEBUG_WAKE 0x03
-#define WI_DEBUG_CHAN 0x08
-#define WI_DEBUG_DELAYSUPP 0x09
-#define WI_DEBUG_TXSUPP 0x0A
-#define WI_DEBUG_MONITOR 0x0B
-#define WI_DEBUG_LEDTEST 0x0C
-#define WI_DEBUG_CONTTX 0x0E
-#define WI_DEBUG_STOPTEST 0x0F
-#define WI_DEBUG_CONTRX 0x10
-#define WI_DEBUG_SIGSTATE 0x11
-#define WI_DEBUG_CALENABLE 0x13
-#define WI_DEBUG_CONFBITS 0x15
-
-#endif
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
deleted file mode 100644
index 2ad582de32a9..000000000000
--- a/sys/dev/wi/if_wi.c
+++ /dev/null
@@ -1,2088 +0,0 @@
-/*-
- * 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.
- */
-
-/*
- * Lucent WaveLAN/IEEE 802.11 PCMCIA driver.
- *
- * Original FreeBSD driver written by Bill Paul <wpaul@ctr.columbia.edu>
- * Electrical Engineering Department
- * Columbia University, New York City
- */
-
-/*
- * The WaveLAN/IEEE adapter is the second generation of the WaveLAN
- * from Lucent. Unlike the older cards, the new ones are programmed
- * entirely via a firmware-driven controller called the Hermes.
- * Unfortunately, Lucent will not release the Hermes programming manual
- * without an NDA (if at all). What they do release is an API library
- * called the HCF (Hardware Control Functions) which is supposed to
- * do the device-specific operations of a device driver for you. The
- * publicly available version of the HCF library (the 'HCF Light') is
- * a) extremely gross, b) lacks certain features, particularly support
- * for 802.11 frames, and c) is contaminated by the GNU Public License.
- *
- * This driver does not use the HCF or HCF Light at all. Instead, it
- * programs the Hermes controller directly, using information gleaned
- * from the HCF Light code and corresponding documentation.
- *
- * This driver supports the ISA, PCMCIA and PCI versions of the Lucent
- * WaveLan cards (based on the Hermes chipset), as well as the newer
- * Prism 2 chipsets with firmware from Intersil and Symbol.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_wlan.h"
-
-#define WI_HERMES_STATS_WAR /* Work around stats counter bug. */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/endian.h>
-#include <sys/sockio.h>
-#include <sys/mbuf.h>
-#include <sys/priv.h>
-#include <sys/proc.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/socket.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/random.h>
-#include <sys/syslog.h>
-#include <sys/sysctl.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <machine/atomic.h>
-#include <sys/rman.h>
-
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/if_arp.h>
-#include <net/ethernet.h>
-#include <net/if_dl.h>
-#include <net/if_llc.h>
-#include <net/if_media.h>
-#include <net/if_types.h>
-
-#include <net80211/ieee80211_var.h>
-#include <net80211/ieee80211_ioctl.h>
-#include <net80211/ieee80211_radiotap.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-
-#include <net/bpf.h>
-
-#include <dev/wi/if_wavelan_ieee.h>
-#include <dev/wi/if_wireg.h>
-#include <dev/wi/if_wivar.h>
-
-static struct ieee80211vap *wi_vap_create(struct ieee80211com *,
- const char [IFNAMSIZ], int, enum ieee80211_opmode, int,
- const uint8_t [IEEE80211_ADDR_LEN],
- const uint8_t [IEEE80211_ADDR_LEN]);
-static void wi_vap_delete(struct ieee80211vap *vap);
-static int wi_transmit(struct ieee80211com *, struct mbuf *);
-static void wi_start(struct wi_softc *);
-static int wi_start_tx(struct wi_softc *, struct wi_frame *, struct mbuf *);
-static int wi_raw_xmit(struct ieee80211_node *, struct mbuf *,
- const struct ieee80211_bpf_params *);
-static int wi_newstate_sta(struct ieee80211vap *, enum ieee80211_state, int);
-static int wi_newstate_hostap(struct ieee80211vap *, enum ieee80211_state,
- int);
-static void wi_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m,
- int subtype, const struct ieee80211_rx_stats *rxs,
- int rssi, int nf);
-static int wi_reset(struct wi_softc *);
-static void wi_watchdog(void *);
-static void wi_parent(struct ieee80211com *);
-static void wi_media_status(struct ifnet *, struct ifmediareq *);
-static void wi_rx_intr(struct wi_softc *);
-static void wi_tx_intr(struct wi_softc *);
-static void wi_tx_ex_intr(struct wi_softc *);
-
-static void wi_info_intr(struct wi_softc *);
-
-static int wi_write_txrate(struct wi_softc *, struct ieee80211vap *);
-static int wi_write_wep(struct wi_softc *, struct ieee80211vap *);
-static int wi_write_multi(struct wi_softc *);
-static void wi_update_mcast(struct ieee80211com *);
-static void wi_update_promisc(struct ieee80211com *);
-static int wi_alloc_fid(struct wi_softc *, int, int *);
-static void wi_read_nicid(struct wi_softc *);
-static int wi_write_ssid(struct wi_softc *, int, u_int8_t *, int);
-
-static int wi_cmd(struct wi_softc *, int, int, int, int);
-static int wi_seek_bap(struct wi_softc *, int, int);
-static int wi_read_bap(struct wi_softc *, int, int, void *, int);
-static int wi_write_bap(struct wi_softc *, int, int, const void *, int);
-static int wi_mwrite_bap(struct wi_softc *, int, int, struct mbuf *, int);
-static int wi_read_rid(struct wi_softc *, int, void *, int *);
-static int wi_write_rid(struct wi_softc *, int, const void *, int);
-static int wi_write_appie(struct wi_softc *, int, const struct ieee80211_appie *);
-static u_int16_t wi_read_chanmask(struct wi_softc *);
-
-static void wi_scan_start(struct ieee80211com *);
-static void wi_scan_end(struct ieee80211com *);
-static void wi_getradiocaps(struct ieee80211com *, int, int *,
- struct ieee80211_channel[]);
-static void wi_set_channel(struct ieee80211com *);
-
-static __inline int
-wi_write_val(struct wi_softc *sc, int rid, u_int16_t val)
-{
-
- val = htole16(val);
- return wi_write_rid(sc, rid, &val, sizeof(val));
-}
-
-static SYSCTL_NODE(_hw, OID_AUTO, wi, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
- "Wireless driver parameters");
-
-static struct timeval lasttxerror; /* time of last tx error msg */
-static int curtxeps; /* current tx error msgs/sec */
-static int wi_txerate = 0; /* tx error rate: max msgs/sec */
-SYSCTL_INT(_hw_wi, OID_AUTO, txerate, CTLFLAG_RW, &wi_txerate,
- 0, "max tx error msgs/sec; 0 to disable msgs");
-
-#define WI_DEBUG
-#ifdef WI_DEBUG
-static int wi_debug = 0;
-SYSCTL_INT(_hw_wi, OID_AUTO, debug, CTLFLAG_RW, &wi_debug,
- 0, "control debugging printfs");
-#define DPRINTF(X) if (wi_debug) printf X
-#else
-#define DPRINTF(X)
-#endif
-
-#define WI_INTRS (WI_EV_RX | WI_EV_ALLOC | WI_EV_INFO)
-
-struct wi_card_ident wi_card_ident[] = {
- /* CARD_ID CARD_NAME FIRM_TYPE */
- { WI_NIC_LUCENT_ID, WI_NIC_LUCENT_STR, WI_LUCENT },
- { WI_NIC_SONY_ID, WI_NIC_SONY_STR, WI_LUCENT },
- { WI_NIC_LUCENT_EMB_ID, WI_NIC_LUCENT_EMB_STR, WI_LUCENT },
- { WI_NIC_EVB2_ID, WI_NIC_EVB2_STR, WI_INTERSIL },
- { WI_NIC_HWB3763_ID, WI_NIC_HWB3763_STR, WI_INTERSIL },
- { WI_NIC_HWB3163_ID, WI_NIC_HWB3163_STR, WI_INTERSIL },
- { WI_NIC_HWB3163B_ID, WI_NIC_HWB3163B_STR, WI_INTERSIL },
- { WI_NIC_EVB3_ID, WI_NIC_EVB3_STR, WI_INTERSIL },
- { WI_NIC_HWB1153_ID, WI_NIC_HWB1153_STR, WI_INTERSIL },
- { WI_NIC_P2_SST_ID, WI_NIC_P2_SST_STR, WI_INTERSIL },
- { WI_NIC_EVB2_SST_ID, WI_NIC_EVB2_SST_STR, WI_INTERSIL },
- { WI_NIC_3842_EVA_ID, WI_NIC_3842_EVA_STR, WI_INTERSIL },
- { WI_NIC_3842_PCMCIA_AMD_ID, WI_NIC_3842_PCMCIA_STR, WI_INTERSIL },
- { WI_NIC_3842_PCMCIA_SST_ID, WI_NIC_3842_PCMCIA_STR, WI_INTERSIL },
- { WI_NIC_3842_PCMCIA_ATL_ID, WI_NIC_3842_PCMCIA_STR, WI_INTERSIL },
- { WI_NIC_3842_PCMCIA_ATS_ID, WI_NIC_3842_PCMCIA_STR, WI_INTERSIL },
- { WI_NIC_3842_MINI_AMD_ID, WI_NIC_3842_MINI_STR, WI_INTERSIL },
- { WI_NIC_3842_MINI_SST_ID, WI_NIC_3842_MINI_STR, WI_INTERSIL },
- { WI_NIC_3842_MINI_ATL_ID, WI_NIC_3842_MINI_STR, WI_INTERSIL },
- { WI_NIC_3842_MINI_ATS_ID, WI_NIC_3842_MINI_STR, WI_INTERSIL },
- { WI_NIC_3842_PCI_AMD_ID, WI_NIC_3842_PCI_STR, WI_INTERSIL },
- { WI_NIC_3842_PCI_SST_ID, WI_NIC_3842_PCI_STR, WI_INTERSIL },
- { WI_NIC_3842_PCI_ATS_ID, WI_NIC_3842_PCI_STR, WI_INTERSIL },
- { WI_NIC_3842_PCI_ATL_ID, WI_NIC_3842_PCI_STR, WI_INTERSIL },
- { WI_NIC_P3_PCMCIA_AMD_ID, WI_NIC_P3_PCMCIA_STR, WI_INTERSIL },
- { WI_NIC_P3_PCMCIA_SST_ID, WI_NIC_P3_PCMCIA_STR, WI_INTERSIL },
- { WI_NIC_P3_PCMCIA_ATL_ID, WI_NIC_P3_PCMCIA_STR, WI_INTERSIL },
- { WI_NIC_P3_PCMCIA_ATS_ID, WI_NIC_P3_PCMCIA_STR, WI_INTERSIL },
- { WI_NIC_P3_MINI_AMD_ID, WI_NIC_P3_MINI_STR, WI_INTERSIL },
- { WI_NIC_P3_MINI_SST_ID, WI_NIC_P3_MINI_STR, WI_INTERSIL },
- { WI_NIC_P3_MINI_ATL_ID, WI_NIC_P3_MINI_STR, WI_INTERSIL },
- { WI_NIC_P3_MINI_ATS_ID, WI_NIC_P3_MINI_STR, WI_INTERSIL },
- { 0, NULL, 0 },
-};
-
-static char *wi_firmware_names[] = { "none", "Hermes", "Intersil", "Symbol" };
-
-devclass_t wi_devclass;
-
-int
-wi_attach(device_t dev)
-{
- struct wi_softc *sc = device_get_softc(dev);
- struct ieee80211com *ic = &sc->sc_ic;
- int i, nrates, buflen;
- u_int16_t val;
- u_int8_t ratebuf[2 + IEEE80211_RATE_SIZE];
- struct ieee80211_rateset *rs;
- struct sysctl_ctx_list *sctx;
- struct sysctl_oid *soid;
- static const u_int8_t empty_macaddr[IEEE80211_ADDR_LEN] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
- int error;
-
- sc->sc_firmware_type = WI_NOTYPE;
- sc->wi_cmd_count = 500;
- /* Reset the NIC. */
- if (wi_reset(sc) != 0) {
- wi_free(dev);
- return ENXIO; /* XXX */
- }
-
- /* Read NIC identification */
- wi_read_nicid(sc);
- switch (sc->sc_firmware_type) {
- case WI_LUCENT:
- if (sc->sc_sta_firmware_ver < 60006)
- goto reject;
- break;
- case WI_INTERSIL:
- if (sc->sc_sta_firmware_ver < 800)
- goto reject;
- break;
- default:
- reject:
- device_printf(dev, "Sorry, this card is not supported "
- "(type %d, firmware ver %d)\n",
- sc->sc_firmware_type, sc->sc_sta_firmware_ver);
- wi_free(dev);
- return EOPNOTSUPP;
- }
-
- /* Export info about the device via sysctl */
- sctx = device_get_sysctl_ctx(dev);
- soid = device_get_sysctl_tree(dev);
- SYSCTL_ADD_STRING(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
- "firmware_type", CTLFLAG_RD,
- wi_firmware_names[sc->sc_firmware_type], 0,
- "Firmware type string");
- SYSCTL_ADD_INT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "sta_version",
- CTLFLAG_RD, &sc->sc_sta_firmware_ver, 0,
- "Station Firmware version");
- if (sc->sc_firmware_type == WI_INTERSIL)
- SYSCTL_ADD_INT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
- "pri_version", CTLFLAG_RD, &sc->sc_pri_firmware_ver, 0,
- "Primary Firmware version");
- SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "nic_id",
- CTLFLAG_RD, &sc->sc_nic_id, 0, "NIC id");
- SYSCTL_ADD_STRING(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "nic_name",
- CTLFLAG_RD, sc->sc_nic_name, 0, "NIC name");
-
- mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
- MTX_DEF | MTX_RECURSE);
- callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0);
- mbufq_init(&sc->sc_snd, ifqmaxlen);
-
- /*
- * Read the station address.
- * And do it twice. I've seen PRISM-based cards that return
- * an error when trying to read it the first time, which causes
- * the probe to fail.
- */
- buflen = IEEE80211_ADDR_LEN;
- error = wi_read_rid(sc, WI_RID_MAC_NODE, &ic->ic_macaddr, &buflen);
- if (error != 0) {
- buflen = IEEE80211_ADDR_LEN;
- error = wi_read_rid(sc, WI_RID_MAC_NODE, &ic->ic_macaddr,
- &buflen);
- }
- if (error || IEEE80211_ADDR_EQ(&ic->ic_macaddr, empty_macaddr)) {
- if (error != 0)
- device_printf(dev, "mac read failed %d\n", error);
- else {
- device_printf(dev, "mac read failed (all zeros)\n");
- error = ENXIO;
- }
- wi_free(dev);
- return (error);
- }
-
- ic->ic_softc = sc;
- ic->ic_name = device_get_nameunit(dev);
- ic->ic_phytype = IEEE80211_T_DS;
- ic->ic_opmode = IEEE80211_M_STA;
- ic->ic_caps = IEEE80211_C_STA
- | IEEE80211_C_PMGT
- | IEEE80211_C_MONITOR
- ;
-
- /*
- * Query the card for available channels and setup the
- * channel table. We assume these are all 11b channels.
- */
- sc->sc_chanmask = wi_read_chanmask(sc);
- wi_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans,
- ic->ic_channels);
-
- /*
- * Set flags based on firmware version.
- */
- switch (sc->sc_firmware_type) {
- case WI_LUCENT:
- sc->sc_ntxbuf = 1;
- ic->ic_caps |= IEEE80211_C_IBSS;
-
- sc->sc_ibss_port = WI_PORTTYPE_BSS;
- sc->sc_monitor_port = WI_PORTTYPE_ADHOC;
- sc->sc_min_rssi = WI_LUCENT_MIN_RSSI;
- sc->sc_max_rssi = WI_LUCENT_MAX_RSSI;
- sc->sc_dbm_offset = WI_LUCENT_DBM_OFFSET;
- break;
- case WI_INTERSIL:
- sc->sc_ntxbuf = WI_NTXBUF;
- sc->sc_flags |= WI_FLAGS_HAS_FRAGTHR
- | WI_FLAGS_HAS_ROAMING;
- /*
- * Old firmware are slow, so give peace a chance.
- */
- if (sc->sc_sta_firmware_ver < 10000)
- sc->wi_cmd_count = 5000;
- if (sc->sc_sta_firmware_ver > 10101)
- sc->sc_flags |= WI_FLAGS_HAS_DBMADJUST;
- ic->ic_caps |= IEEE80211_C_IBSS;
- /*
- * version 0.8.3 and newer are the only ones that are known
- * to currently work. Earlier versions can be made to work,
- * at least according to the Linux driver but we require
- * monitor mode so this is irrelevant.
- */
- ic->ic_caps |= IEEE80211_C_HOSTAP;
- if (sc->sc_sta_firmware_ver >= 10603)
- sc->sc_flags |= WI_FLAGS_HAS_ENHSECURITY;
- if (sc->sc_sta_firmware_ver >= 10700) {
- /*
- * 1.7.0+ have the necessary support for sta mode WPA.
- */
- sc->sc_flags |= WI_FLAGS_HAS_WPASUPPORT;
- ic->ic_caps |= IEEE80211_C_WPA;
- }
-
- sc->sc_ibss_port = WI_PORTTYPE_IBSS;
- sc->sc_monitor_port = WI_PORTTYPE_APSILENT;
- sc->sc_min_rssi = WI_PRISM_MIN_RSSI;
- sc->sc_max_rssi = WI_PRISM_MAX_RSSI;
- sc->sc_dbm_offset = WI_PRISM_DBM_OFFSET;
- break;
- }
-
- /*
- * Find out if we support WEP on this card.
- */
- buflen = sizeof(val);
- if (wi_read_rid(sc, WI_RID_WEP_AVAIL, &val, &buflen) == 0 &&
- val != htole16(0))
- ic->ic_cryptocaps |= IEEE80211_CRYPTO_WEP;
-
- /* Find supported rates. */
- buflen = sizeof(ratebuf);
- rs = &ic->ic_sup_rates[IEEE80211_MODE_11B];
- if (wi_read_rid(sc, WI_RID_DATA_RATES, ratebuf, &buflen) == 0) {
- nrates = le16toh(*(u_int16_t *)ratebuf);
- if (nrates > IEEE80211_RATE_MAXSIZE)
- nrates = IEEE80211_RATE_MAXSIZE;
- rs->rs_nrates = 0;
- for (i = 0; i < nrates; i++)
- if (ratebuf[2+i])
- rs->rs_rates[rs->rs_nrates++] = ratebuf[2+i];
- } else {
- /* XXX fallback on error? */
- }
-
- buflen = sizeof(val);
- if ((sc->sc_flags & WI_FLAGS_HAS_DBMADJUST) &&
- wi_read_rid(sc, WI_RID_DBM_ADJUST, &val, &buflen) == 0) {
- sc->sc_dbm_offset = le16toh(val);
- }
-
- sc->sc_portnum = WI_DEFAULT_PORT;
-
- ieee80211_ifattach(ic);
- ic->ic_raw_xmit = wi_raw_xmit;
- ic->ic_scan_start = wi_scan_start;
- ic->ic_scan_end = wi_scan_end;
- ic->ic_getradiocaps = wi_getradiocaps;
- ic->ic_set_channel = wi_set_channel;
- ic->ic_vap_create = wi_vap_create;
- ic->ic_vap_delete = wi_vap_delete;
- ic->ic_update_mcast = wi_update_mcast;
- ic->ic_update_promisc = wi_update_promisc;
- ic->ic_transmit = wi_transmit;
- ic->ic_parent = wi_parent;
-
- ieee80211_radiotap_attach(ic,
- &sc->sc_tx_th.wt_ihdr, sizeof(sc->sc_tx_th),
- WI_TX_RADIOTAP_PRESENT,
- &sc->sc_rx_th.wr_ihdr, sizeof(sc->sc_rx_th),
- WI_RX_RADIOTAP_PRESENT);
-
- if (bootverbose)
- ieee80211_announce(ic);
-
- error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE,
- NULL, wi_intr, sc, &sc->wi_intrhand);
- if (error) {
- device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);
- ieee80211_ifdetach(ic);
- wi_free(dev);
- return error;
- }
-
- return (0);
-}
-
-int
-wi_detach(device_t dev)
-{
- struct wi_softc *sc = device_get_softc(dev);
- struct ieee80211com *ic = &sc->sc_ic;
-
- WI_LOCK(sc);
-
- /* check if device was removed */
- sc->wi_gone |= !bus_child_present(dev);
-
- wi_stop(sc, 0);
- WI_UNLOCK(sc);
- ieee80211_ifdetach(ic);
-
- bus_teardown_intr(dev, sc->irq, sc->wi_intrhand);
- wi_free(dev);
- mbufq_drain(&sc->sc_snd);
- mtx_destroy(&sc->sc_mtx);
- return (0);
-}
-
-static struct ieee80211vap *
-wi_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit,
- enum ieee80211_opmode opmode, int flags,
- const uint8_t bssid[IEEE80211_ADDR_LEN],
- const uint8_t mac[IEEE80211_ADDR_LEN])
-{
- struct wi_softc *sc = ic->ic_softc;
- struct wi_vap *wvp;
- struct ieee80211vap *vap;
-
- if (!TAILQ_EMPTY(&ic->ic_vaps)) /* only one at a time */
- return NULL;
- wvp = malloc(sizeof(struct wi_vap), M_80211_VAP, M_WAITOK | M_ZERO);
-
- vap = &wvp->wv_vap;
- ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid);
-
- vap->iv_max_aid = WI_MAX_AID;
-
- switch (opmode) {
- case IEEE80211_M_STA:
- sc->sc_porttype = WI_PORTTYPE_BSS;
- wvp->wv_newstate = vap->iv_newstate;
- vap->iv_newstate = wi_newstate_sta;
- /* need to filter mgt frames to avoid confusing state machine */
- wvp->wv_recv_mgmt = vap->iv_recv_mgmt;
- vap->iv_recv_mgmt = wi_recv_mgmt;
- break;
- case IEEE80211_M_IBSS:
- sc->sc_porttype = sc->sc_ibss_port;
- wvp->wv_newstate = vap->iv_newstate;
- vap->iv_newstate = wi_newstate_sta;
- break;
- case IEEE80211_M_AHDEMO:
- sc->sc_porttype = WI_PORTTYPE_ADHOC;
- break;
- case IEEE80211_M_HOSTAP:
- sc->sc_porttype = WI_PORTTYPE_HOSTAP;
- wvp->wv_newstate = vap->iv_newstate;
- vap->iv_newstate = wi_newstate_hostap;
- break;
- case IEEE80211_M_MONITOR:
- sc->sc_porttype = sc->sc_monitor_port;
- break;
- default:
- break;
- }
-
- /* complete setup */
- ieee80211_vap_attach(vap, ieee80211_media_change, wi_media_status, mac);
- ic->ic_opmode = opmode;
- return vap;
-}
-
-static void
-wi_vap_delete(struct ieee80211vap *vap)
-{
- struct wi_vap *wvp = WI_VAP(vap);
-
- ieee80211_vap_detach(vap);
- free(wvp, M_80211_VAP);
-}
-
-int
-wi_shutdown(device_t dev)
-{
- struct wi_softc *sc = device_get_softc(dev);
-
- WI_LOCK(sc);
- wi_stop(sc, 1);
- WI_UNLOCK(sc);
- return (0);
-}
-
-void
-wi_intr(void *arg)
-{
- struct wi_softc *sc = arg;
- u_int16_t status;
-
- WI_LOCK(sc);
-
- if (sc->wi_gone || !sc->sc_enabled ||
- (sc->sc_flags & WI_FLAGS_RUNNING) == 0) {
- CSR_WRITE_2(sc, WI_INT_EN, 0);
- CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
- WI_UNLOCK(sc);
- return;
- }
-
- /* Disable interrupts. */
- CSR_WRITE_2(sc, WI_INT_EN, 0);
-
- status = CSR_READ_2(sc, WI_EVENT_STAT);
- if (status & WI_EV_RX)
- wi_rx_intr(sc);
- if (status & WI_EV_ALLOC)
- wi_tx_intr(sc);
- if (status & WI_EV_TX_EXC)
- wi_tx_ex_intr(sc);
- if (status & WI_EV_INFO)
- wi_info_intr(sc);
- if (mbufq_first(&sc->sc_snd) != NULL)
- wi_start(sc);
-
- /* Re-enable interrupts. */
- CSR_WRITE_2(sc, WI_INT_EN, WI_INTRS);
-
- WI_UNLOCK(sc);
-
- return;
-}
-
-static void
-wi_enable(struct wi_softc *sc)
-{
- /* Enable interrupts */
- CSR_WRITE_2(sc, WI_INT_EN, WI_INTRS);
-
- /* enable port */
- wi_cmd(sc, WI_CMD_ENABLE | sc->sc_portnum, 0, 0, 0);
- sc->sc_enabled = 1;
-}
-
-static int
-wi_setup_locked(struct wi_softc *sc, int porttype, int mode,
- const uint8_t mac[IEEE80211_ADDR_LEN])
-{
- int i;
-
- wi_reset(sc);
-
- wi_write_val(sc, WI_RID_PORTTYPE, porttype);
- wi_write_val(sc, WI_RID_CREATE_IBSS, mode);
- wi_write_val(sc, WI_RID_MAX_DATALEN, 2304);
- /* XXX IEEE80211_BPF_NOACK wants 0 */
- wi_write_val(sc, WI_RID_ALT_RETRY_CNT, 2);
- if (sc->sc_flags & WI_FLAGS_HAS_ROAMING)
- wi_write_val(sc, WI_RID_ROAMING_MODE, 3); /* NB: disabled */
-
- wi_write_rid(sc, WI_RID_MAC_NODE, mac, IEEE80211_ADDR_LEN);
-
- /* Allocate fids for the card */
- sc->sc_buflen = IEEE80211_MAX_LEN + sizeof(struct wi_frame);
- for (i = 0; i < sc->sc_ntxbuf; i++) {
- int error = wi_alloc_fid(sc, sc->sc_buflen,
- &sc->sc_txd[i].d_fid);
- if (error) {
- device_printf(sc->sc_dev,
- "tx buffer allocation failed (error %u)\n",
- error);
- return error;
- }
- sc->sc_txd[i].d_len = 0;
- }
- sc->sc_txcur = sc->sc_txnext = 0;
-
- return 0;
-}
-
-void
-wi_init(struct wi_softc *sc)
-{
- int wasenabled;
-
- WI_LOCK_ASSERT(sc);
-
- wasenabled = sc->sc_enabled;
- if (wasenabled)
- wi_stop(sc, 1);
-
- if (wi_setup_locked(sc, sc->sc_porttype, 3,
- sc->sc_ic.ic_macaddr) != 0) {
- device_printf(sc->sc_dev, "interface not running\n");
- wi_stop(sc, 1);
- return;
- }
-
- sc->sc_flags |= WI_FLAGS_RUNNING;
-
- callout_reset(&sc->sc_watchdog, hz, wi_watchdog, sc);
-
- wi_enable(sc); /* Enable desired port */
-}
-
-void
-wi_stop(struct wi_softc *sc, int disable)
-{
-
- WI_LOCK_ASSERT(sc);
-
- if (sc->sc_enabled && !sc->wi_gone) {
- CSR_WRITE_2(sc, WI_INT_EN, 0);
- wi_cmd(sc, WI_CMD_DISABLE | sc->sc_portnum, 0, 0, 0);
- if (disable)
- sc->sc_enabled = 0;
- } else if (sc->wi_gone && disable) /* gone --> not enabled */
- sc->sc_enabled = 0;
-
- callout_stop(&sc->sc_watchdog);
- sc->sc_tx_timer = 0;
- sc->sc_false_syns = 0;
-
- sc->sc_flags &= ~WI_FLAGS_RUNNING;
-}
-
-static void
-wi_getradiocaps(struct ieee80211com *ic,
- int maxchans, int *nchans, struct ieee80211_channel chans[])
-{
- struct wi_softc *sc = ic->ic_softc;
- u_int8_t bands[IEEE80211_MODE_BYTES];
- int i;
-
- memset(bands, 0, sizeof(bands));
- setbit(bands, IEEE80211_MODE_11B);
-
- for (i = 1; i < 16; i++) {
- if (sc->sc_chanmask & (1 << i)) {
- /* XXX txpowers? */
- ieee80211_add_channel(chans, maxchans, nchans,
- i, 0, 0, 0, bands);
- }
- }
-}
-
-static void
-wi_set_channel(struct ieee80211com *ic)
-{
- struct wi_softc *sc = ic->ic_softc;
-
- DPRINTF(("%s: channel %d, %sscanning\n", __func__,
- ieee80211_chan2ieee(ic, ic->ic_curchan),
- ic->ic_flags & IEEE80211_F_SCAN ? "" : "!"));
-
- WI_LOCK(sc);
- wi_write_val(sc, WI_RID_OWN_CHNL,
- ieee80211_chan2ieee(ic, ic->ic_curchan));
- WI_UNLOCK(sc);
-}
-
-static void
-wi_scan_start(struct ieee80211com *ic)
-{
- struct wi_softc *sc = ic->ic_softc;
- struct ieee80211_scan_state *ss = ic->ic_scan;
-
- DPRINTF(("%s\n", __func__));
-
- WI_LOCK(sc);
- /*
- * Switch device to monitor mode.
- */
- wi_write_val(sc, WI_RID_PORTTYPE, sc->sc_monitor_port);
- if (sc->sc_firmware_type == WI_INTERSIL) {
- wi_cmd(sc, WI_CMD_DISABLE | WI_PORT0, 0, 0, 0);
- wi_cmd(sc, WI_CMD_ENABLE | WI_PORT0, 0, 0, 0);
- }
- /* force full dwell time to compensate for firmware overhead */
- ss->ss_mindwell = ss->ss_maxdwell = msecs_to_ticks(400);
- WI_UNLOCK(sc);
-
-}
-
-static void
-wi_scan_end(struct ieee80211com *ic)
-{
- struct wi_softc *sc = ic->ic_softc;
-
- DPRINTF(("%s: restore port type %d\n", __func__, sc->sc_porttype));
-
- WI_LOCK(sc);
- wi_write_val(sc, WI_RID_PORTTYPE, sc->sc_porttype);
- if (sc->sc_firmware_type == WI_INTERSIL) {
- wi_cmd(sc, WI_CMD_DISABLE | WI_PORT0, 0, 0, 0);
- wi_cmd(sc, WI_CMD_ENABLE | WI_PORT0, 0, 0, 0);
- }
- WI_UNLOCK(sc);
-}
-
-static void
-wi_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m,
- int subtype, const struct ieee80211_rx_stats *rxs, int rssi, int nf)
-{
- struct ieee80211vap *vap = ni->ni_vap;
-
- switch (subtype) {
- case IEEE80211_FC0_SUBTYPE_AUTH:
- case IEEE80211_FC0_SUBTYPE_ASSOC_RESP:
- case IEEE80211_FC0_SUBTYPE_REASSOC_RESP:
- /* NB: filter frames that trigger state changes */
- return;
- }
- WI_VAP(vap)->wv_recv_mgmt(ni, m, subtype, rxs, rssi, nf);
-}
-
-static int
-wi_newstate_sta(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
-{
- struct ieee80211com *ic = vap->iv_ic;
- struct ieee80211_node *bss;
- struct wi_softc *sc = ic->ic_softc;
-
- DPRINTF(("%s: %s -> %s\n", __func__,
- ieee80211_state_name[vap->iv_state],
- ieee80211_state_name[nstate]));
-
- if (nstate == IEEE80211_S_AUTH) {
- WI_LOCK(sc);
- wi_setup_locked(sc, WI_PORTTYPE_BSS, 3, vap->iv_myaddr);
-
- if (vap->iv_flags & IEEE80211_F_PMGTON) {
- wi_write_val(sc, WI_RID_MAX_SLEEP, ic->ic_lintval);
- wi_write_val(sc, WI_RID_PM_ENABLED, 1);
- }
- wi_write_val(sc, WI_RID_RTS_THRESH, vap->iv_rtsthreshold);
- if (sc->sc_flags & WI_FLAGS_HAS_FRAGTHR)
- wi_write_val(sc, WI_RID_FRAG_THRESH,
- vap->iv_fragthreshold);
- wi_write_txrate(sc, vap);
-
- bss = vap->iv_bss;
- wi_write_ssid(sc, WI_RID_DESIRED_SSID, bss->ni_essid, bss->ni_esslen);
- wi_write_val(sc, WI_RID_OWN_CHNL,
- ieee80211_chan2ieee(ic, bss->ni_chan));
-
- /* Configure WEP. */
- if (ic->ic_cryptocaps & IEEE80211_CRYPTO_WEP)
- wi_write_wep(sc, vap);
- else
- sc->sc_encryption = 0;
-
- if ((sc->sc_flags & WI_FLAGS_HAS_WPASUPPORT) &&
- (vap->iv_flags & IEEE80211_F_WPA)) {
- wi_write_val(sc, WI_RID_WPA_HANDLING, 1);
- if (vap->iv_appie_wpa != NULL)
- wi_write_appie(sc, WI_RID_WPA_DATA,
- vap->iv_appie_wpa);
- }
-
- wi_enable(sc); /* enable port */
-
- /* Lucent firmware does not support the JOIN RID. */
- if (sc->sc_firmware_type == WI_INTERSIL) {
- struct wi_joinreq join;
-
- memset(&join, 0, sizeof(join));
- IEEE80211_ADDR_COPY(&join.wi_bssid, bss->ni_bssid);
- join.wi_chan = htole16(
- ieee80211_chan2ieee(ic, bss->ni_chan));
- wi_write_rid(sc, WI_RID_JOIN_REQ, &join, sizeof(join));
- }
- WI_UNLOCK(sc);
-
- /*
- * NB: don't go through 802.11 layer, it'll send auth frame;
- * instead we drive the state machine from the link status
- * notification we get on association.
- */
- vap->iv_state = nstate;
- return (0);
- }
- return WI_VAP(vap)->wv_newstate(vap, nstate, arg);
-}
-
-static int
-wi_newstate_hostap(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
-{
- struct ieee80211com *ic = vap->iv_ic;
- struct ieee80211_node *bss;
- struct wi_softc *sc = ic->ic_softc;
- int error;
-
- DPRINTF(("%s: %s -> %s\n", __func__,
- ieee80211_state_name[vap->iv_state],
- ieee80211_state_name[nstate]));
-
- error = WI_VAP(vap)->wv_newstate(vap, nstate, arg);
- if (error == 0 && nstate == IEEE80211_S_RUN) {
- WI_LOCK(sc);
- wi_setup_locked(sc, WI_PORTTYPE_HOSTAP, 0, vap->iv_myaddr);
-
- bss = vap->iv_bss;
- wi_write_ssid(sc, WI_RID_OWN_SSID,
- bss->ni_essid, bss->ni_esslen);
- wi_write_val(sc, WI_RID_OWN_CHNL,
- ieee80211_chan2ieee(ic, bss->ni_chan));
- wi_write_val(sc, WI_RID_BASIC_RATE, 0x3);
- wi_write_val(sc, WI_RID_SUPPORT_RATE, 0xf);
- wi_write_txrate(sc, vap);
-
- wi_write_val(sc, WI_RID_OWN_BEACON_INT, bss->ni_intval);
- wi_write_val(sc, WI_RID_DTIM_PERIOD, vap->iv_dtim_period);
-
- wi_write_val(sc, WI_RID_RTS_THRESH, vap->iv_rtsthreshold);
- if (sc->sc_flags & WI_FLAGS_HAS_FRAGTHR)
- wi_write_val(sc, WI_RID_FRAG_THRESH,
- vap->iv_fragthreshold);
-
- if ((sc->sc_flags & WI_FLAGS_HAS_ENHSECURITY) &&
- (vap->iv_flags & IEEE80211_F_HIDESSID)) {
- /*
- * bit 0 means hide SSID in beacons,
- * bit 1 means don't respond to bcast probe req
- */
- wi_write_val(sc, WI_RID_ENH_SECURITY, 0x3);
- }
-
- if ((sc->sc_flags & WI_FLAGS_HAS_WPASUPPORT) &&
- (vap->iv_flags & IEEE80211_F_WPA) &&
- vap->iv_appie_wpa != NULL)
- wi_write_appie(sc, WI_RID_WPA_DATA, vap->iv_appie_wpa);
-
- wi_write_val(sc, WI_RID_PROMISC, 0);
-
- /* Configure WEP. */
- if (ic->ic_cryptocaps & IEEE80211_CRYPTO_WEP)
- wi_write_wep(sc, vap);
- else
- sc->sc_encryption = 0;
-
- wi_enable(sc); /* enable port */
- WI_UNLOCK(sc);
- }
- return error;
-}
-
-static int
-wi_transmit(struct ieee80211com *ic, struct mbuf *m)
-{
- struct wi_softc *sc = ic->ic_softc;
- int error;
-
- WI_LOCK(sc);
- if ((sc->sc_flags & WI_FLAGS_RUNNING) == 0) {
- WI_UNLOCK(sc);
- return (ENXIO);
- }
- error = mbufq_enqueue(&sc->sc_snd, m);
- if (error) {
- WI_UNLOCK(sc);
- return (error);
- }
- wi_start(sc);
- WI_UNLOCK(sc);
- return (0);
-}
-
-static void
-wi_start(struct wi_softc *sc)
-{
- struct ieee80211_node *ni;
- struct ieee80211_frame *wh;
- struct mbuf *m0;
- struct ieee80211_key *k;
- struct wi_frame frmhdr;
- const struct llc *llc;
- int cur;
-
- WI_LOCK_ASSERT(sc);
-
- if (sc->wi_gone)
- return;
-
- memset(&frmhdr, 0, sizeof(frmhdr));
- cur = sc->sc_txnext;
- while (sc->sc_txd[cur].d_len == 0 &&
- (m0 = mbufq_dequeue(&sc->sc_snd)) != NULL) {
- ni = (struct ieee80211_node *) m0->m_pkthdr.rcvif;
-
- /* reconstruct 802.3 header */
- wh = mtod(m0, struct ieee80211_frame *);
- switch (wh->i_fc[1]) {
- case IEEE80211_FC1_DIR_TODS:
- IEEE80211_ADDR_COPY(frmhdr.wi_ehdr.ether_shost,
- wh->i_addr2);
- IEEE80211_ADDR_COPY(frmhdr.wi_ehdr.ether_dhost,
- wh->i_addr3);
- break;
- case IEEE80211_FC1_DIR_NODS:
- IEEE80211_ADDR_COPY(frmhdr.wi_ehdr.ether_shost,
- wh->i_addr2);
- IEEE80211_ADDR_COPY(frmhdr.wi_ehdr.ether_dhost,
- wh->i_addr1);
- break;
- case IEEE80211_FC1_DIR_FROMDS:
- IEEE80211_ADDR_COPY(frmhdr.wi_ehdr.ether_shost,
- wh->i_addr3);
- IEEE80211_ADDR_COPY(frmhdr.wi_ehdr.ether_dhost,
- wh->i_addr1);
- break;
- }
- llc = (const struct llc *)(
- mtod(m0, const uint8_t *) + ieee80211_hdrsize(wh));
- frmhdr.wi_ehdr.ether_type = llc->llc_snap.ether_type;
- frmhdr.wi_tx_ctl = htole16(WI_ENC_TX_802_11|WI_TXCNTL_TX_EX);
- if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) {
- k = ieee80211_crypto_encap(ni, m0);
- if (k == NULL) {
- ieee80211_free_node(ni);
- m_freem(m0);
- continue;
- }
- frmhdr.wi_tx_ctl |= htole16(WI_TXCNTL_NOCRYPT);
- }
-
- if (ieee80211_radiotap_active_vap(ni->ni_vap)) {
- sc->sc_tx_th.wt_rate = ni->ni_txrate;
- ieee80211_radiotap_tx(ni->ni_vap, m0);
- }
-
- m_copydata(m0, 0, sizeof(struct ieee80211_frame),
- (caddr_t)&frmhdr.wi_whdr);
- m_adj(m0, sizeof(struct ieee80211_frame));
- frmhdr.wi_dat_len = htole16(m0->m_pkthdr.len);
- ieee80211_free_node(ni);
- if (wi_start_tx(sc, &frmhdr, m0))
- continue;
-
- sc->sc_txnext = cur = (cur + 1) % sc->sc_ntxbuf;
- }
-}
-
-static int
-wi_start_tx(struct wi_softc *sc, struct wi_frame *frmhdr, struct mbuf *m0)
-{
- int cur = sc->sc_txnext;
- int fid, off, error;
-
- fid = sc->sc_txd[cur].d_fid;
- off = sizeof(*frmhdr);
- error = wi_write_bap(sc, fid, 0, frmhdr, sizeof(*frmhdr)) != 0
- || wi_mwrite_bap(sc, fid, off, m0, m0->m_pkthdr.len) != 0;
- m_freem(m0);
- if (error) {
- counter_u64_add(sc->sc_ic.ic_oerrors, 1);
- return -1;
- }
- sc->sc_txd[cur].d_len = off;
- if (sc->sc_txcur == cur) {
- if (wi_cmd(sc, WI_CMD_TX | WI_RECLAIM, fid, 0, 0)) {
- device_printf(sc->sc_dev, "xmit failed\n");
- sc->sc_txd[cur].d_len = 0;
- return -1;
- }
- sc->sc_tx_timer = 5;
- }
- return 0;
-}
-
-static int
-wi_raw_xmit(struct ieee80211_node *ni, struct mbuf *m0,
- const struct ieee80211_bpf_params *params)
-{
- struct ieee80211com *ic = ni->ni_ic;
- struct ieee80211vap *vap = ni->ni_vap;
- struct wi_softc *sc = ic->ic_softc;
- struct ieee80211_key *k;
- struct ieee80211_frame *wh;
- struct wi_frame frmhdr;
- int cur;
- int rc = 0;
-
- WI_LOCK(sc);
-
- if (sc->wi_gone) {
- rc = ENETDOWN;
- goto out;
- }
- memset(&frmhdr, 0, sizeof(frmhdr));
- cur = sc->sc_txnext;
- if (sc->sc_txd[cur].d_len != 0) {
- rc = ENOBUFS;
- goto out;
- }
- m0->m_pkthdr.rcvif = NULL;
-
- m_copydata(m0, 4, ETHER_ADDR_LEN * 2,
- (caddr_t)&frmhdr.wi_ehdr);
- frmhdr.wi_ehdr.ether_type = 0;
- wh = mtod(m0, struct ieee80211_frame *);
-
- frmhdr.wi_tx_ctl = htole16(WI_ENC_TX_802_11|WI_TXCNTL_TX_EX);
- if (params && (params->ibp_flags & IEEE80211_BPF_NOACK))
- frmhdr.wi_tx_ctl |= htole16(WI_TXCNTL_ALTRTRY);
- if ((wh->i_fc[1] & IEEE80211_FC1_PROTECTED) &&
- (!params || (params && (params->ibp_flags & IEEE80211_BPF_CRYPTO)))) {
- k = ieee80211_crypto_encap(ni, m0);
- if (k == NULL) {
- rc = ENOMEM;
- goto out;
- }
- frmhdr.wi_tx_ctl |= htole16(WI_TXCNTL_NOCRYPT);
- }
- if (ieee80211_radiotap_active_vap(vap)) {
- sc->sc_tx_th.wt_rate = ni->ni_txrate;
- ieee80211_radiotap_tx(vap, m0);
- }
- m_copydata(m0, 0, sizeof(struct ieee80211_frame),
- (caddr_t)&frmhdr.wi_whdr);
- m_adj(m0, sizeof(struct ieee80211_frame));
- frmhdr.wi_dat_len = htole16(m0->m_pkthdr.len);
- if (wi_start_tx(sc, &frmhdr, m0) < 0) {
- m0 = NULL;
- rc = EIO;
- goto out;
- }
- m0 = NULL;
- ieee80211_free_node(ni);
-
- sc->sc_txnext = cur = (cur + 1) % sc->sc_ntxbuf;
-out:
- WI_UNLOCK(sc);
-
- if (m0 != NULL)
- m_freem(m0);
- return rc;
-}
-
-static int
-wi_reset(struct wi_softc *sc)
-{
-#define WI_INIT_TRIES 3
- int i, error = 0;
-
- for (i = 0; i < WI_INIT_TRIES; i++) {
- error = wi_cmd(sc, WI_CMD_INI, 0, 0, 0);
- if (error == 0)
- break;
- DELAY(WI_DELAY * 1000);
- }
- sc->sc_reset = 1;
- if (i == WI_INIT_TRIES) {
- device_printf(sc->sc_dev, "reset failed\n");
- return error;
- }
-
- CSR_WRITE_2(sc, WI_INT_EN, 0);
- CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
-
- /* Calibrate timer. */
- wi_write_val(sc, WI_RID_TICK_TIME, 8);
-
- return 0;
-#undef WI_INIT_TRIES
-}
-
-static void
-wi_watchdog(void *arg)
-{
- struct wi_softc *sc = arg;
-
- WI_LOCK_ASSERT(sc);
-
- if (!sc->sc_enabled)
- return;
-
- if (sc->sc_tx_timer && --sc->sc_tx_timer == 0) {
- device_printf(sc->sc_dev, "device timeout\n");
- counter_u64_add(sc->sc_ic.ic_oerrors, 1);
- wi_init(sc);
- return;
- }
- callout_reset(&sc->sc_watchdog, hz, wi_watchdog, sc);
-}
-
-static void
-wi_parent(struct ieee80211com *ic)
-{
- struct wi_softc *sc = ic->ic_softc;
- int startall = 0;
-
- WI_LOCK(sc);
- /*
- * Can't do promisc and hostap at the same time. If all that's
- * changing is the promisc flag, try to short-circuit a call to
- * wi_init() by just setting PROMISC in the hardware.
- */
- if (ic->ic_nrunning > 0) {
- if (ic->ic_opmode != IEEE80211_M_HOSTAP &&
- sc->sc_flags & WI_FLAGS_RUNNING) {
- if (ic->ic_promisc > 0 &&
- (sc->sc_flags & WI_FLAGS_PROMISC) == 0) {
- wi_write_val(sc, WI_RID_PROMISC, 1);
- sc->sc_flags |= WI_FLAGS_PROMISC;
- } else if (ic->ic_promisc == 0 &&
- (sc->sc_flags & WI_FLAGS_PROMISC) != 0) {
- wi_write_val(sc, WI_RID_PROMISC, 0);
- sc->sc_flags &= ~WI_FLAGS_PROMISC;
- } else {
- wi_init(sc);
- startall = 1;
- }
- } else {
- wi_init(sc);
- startall = 1;
- }
- } else if (sc->sc_flags & WI_FLAGS_RUNNING) {
- wi_stop(sc, 1);
- sc->wi_gone = 0;
- }
- WI_UNLOCK(sc);
- if (startall)
- ieee80211_start_all(ic);
-}
-
-static void
-wi_media_status(struct ifnet *ifp, struct ifmediareq *imr)
-{
- struct ieee80211vap *vap = ifp->if_softc;
- struct ieee80211com *ic = vap->iv_ic;
- struct wi_softc *sc = ic->ic_softc;
- u_int16_t val;
- int rate, len;
-
- len = sizeof(val);
- if (sc->sc_enabled &&
- wi_read_rid(sc, WI_RID_CUR_TX_RATE, &val, &len) == 0 &&
- len == sizeof(val)) {
- /* convert to 802.11 rate */
- val = le16toh(val);
- rate = val * 2;
- if (sc->sc_firmware_type == WI_LUCENT) {
- if (rate == 10)
- rate = 11; /* 5.5Mbps */
- } else {
- if (rate == 4*2)
- rate = 11; /* 5.5Mbps */
- else if (rate == 8*2)
- rate = 22; /* 11Mbps */
- }
- vap->iv_bss->ni_txrate = rate;
- }
- ieee80211_media_status(ifp, imr);
-}
-
-static void
-wi_sync_bssid(struct wi_softc *sc, u_int8_t new_bssid[IEEE80211_ADDR_LEN])
-{
- struct ieee80211com *ic = &sc->sc_ic;
- struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
- struct ieee80211_node *ni = vap->iv_bss;
-
- if (IEEE80211_ADDR_EQ(new_bssid, ni->ni_bssid))
- return;
-
- DPRINTF(("wi_sync_bssid: bssid %s -> ", ether_sprintf(ni->ni_bssid)));
- DPRINTF(("%s ?\n", ether_sprintf(new_bssid)));
-
- /* In promiscuous mode, the BSSID field is not a reliable
- * indicator of the firmware's BSSID. Damp spurious
- * change-of-BSSID indications.
- */
- if (ic->ic_promisc > 0 &&
- !ppsratecheck(&sc->sc_last_syn, &sc->sc_false_syns,
- WI_MAX_FALSE_SYNS))
- return;
-
- sc->sc_false_syns = MAX(0, sc->sc_false_syns - 1);
-#if 0
- /*
- * XXX hack; we should create a new node with the new bssid
- * and replace the existing ic_bss with it but since we don't
- * process management frames to collect state we cheat by
- * reusing the existing node as we know wi_newstate will be
- * called and it will overwrite the node state.
- */
- ieee80211_sta_join(ic, ieee80211_ref_node(ni));
-#endif
-}
-
-static __noinline void
-wi_rx_intr(struct wi_softc *sc)
-{
- struct epoch_tracker et;
- struct ieee80211com *ic = &sc->sc_ic;
- struct wi_frame frmhdr;
- struct mbuf *m;
- struct ieee80211_frame *wh;
- struct ieee80211_node *ni;
- int fid, len, off;
- u_int8_t dir;
- u_int16_t status;
- int8_t rssi, nf;
-
- fid = CSR_READ_2(sc, WI_RX_FID);
-
- /* First read in the frame header */
- if (wi_read_bap(sc, fid, 0, &frmhdr, sizeof(frmhdr))) {
- CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_RX);
- counter_u64_add(ic->ic_ierrors, 1);
- DPRINTF(("wi_rx_intr: read fid %x failed\n", fid));
- return;
- }
-
- /*
- * Drop undecryptable or packets with receive errors here
- */
- status = le16toh(frmhdr.wi_status);
- if (status & WI_STAT_ERRSTAT) {
- CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_RX);
- counter_u64_add(ic->ic_ierrors, 1);
- DPRINTF(("wi_rx_intr: fid %x error status %x\n", fid, status));
- return;
- }
-
- len = le16toh(frmhdr.wi_dat_len);
- off = ALIGN(sizeof(struct ieee80211_frame));
-
- /*
- * Sometimes the PRISM2.x returns bogusly large frames. Except
- * in monitor mode, just throw them away.
- */
- if (off + len > MCLBYTES) {
- if (ic->ic_opmode != IEEE80211_M_MONITOR) {
- CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_RX);
- counter_u64_add(ic->ic_ierrors, 1);
- DPRINTF(("wi_rx_intr: oversized packet\n"));
- return;
- } else
- len = 0;
- }
-
- if (off + len > MHLEN)
- m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
- else
- m = m_gethdr(M_NOWAIT, MT_DATA);
- if (m == NULL) {
- CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_RX);
- counter_u64_add(ic->ic_ierrors, 1);
- DPRINTF(("wi_rx_intr: MGET failed\n"));
- return;
- }
- m->m_data += off - sizeof(struct ieee80211_frame);
- memcpy(m->m_data, &frmhdr.wi_whdr, sizeof(struct ieee80211_frame));
- wi_read_bap(sc, fid, sizeof(frmhdr),
- m->m_data + sizeof(struct ieee80211_frame), len);
- m->m_pkthdr.len = m->m_len = sizeof(struct ieee80211_frame) + len;
-
- CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_RX);
-
- rssi = frmhdr.wi_rx_signal;
- nf = frmhdr.wi_rx_silence;
- if (ieee80211_radiotap_active(ic)) {
- struct wi_rx_radiotap_header *tap = &sc->sc_rx_th;
- uint32_t rstamp;
-
- rstamp = (le16toh(frmhdr.wi_rx_tstamp0) << 16) |
- le16toh(frmhdr.wi_rx_tstamp1);
- tap->wr_tsf = htole64((uint64_t)rstamp);
- /* XXX replace divide by table */
- tap->wr_rate = frmhdr.wi_rx_rate / 5;
- tap->wr_flags = 0;
- if (frmhdr.wi_status & WI_STAT_PCF)
- tap->wr_flags |= IEEE80211_RADIOTAP_F_CFP;
- if (m->m_flags & M_WEP)
- tap->wr_flags |= IEEE80211_RADIOTAP_F_WEP;
- tap->wr_antsignal = rssi;
- tap->wr_antnoise = nf;
- }
-
- /* synchronize driver's BSSID with firmware's BSSID */
- wh = mtod(m, struct ieee80211_frame *);
- dir = wh->i_fc[1] & IEEE80211_FC1_DIR_MASK;
- if (ic->ic_opmode == IEEE80211_M_IBSS && dir == IEEE80211_FC1_DIR_NODS)
- wi_sync_bssid(sc, wh->i_addr3);
-
- WI_UNLOCK(sc);
-
- ni = ieee80211_find_rxnode(ic, mtod(m, struct ieee80211_frame_min *));
-
- NET_EPOCH_ENTER(et);
- if (ni != NULL) {
- (void) ieee80211_input(ni, m, rssi, nf);
- ieee80211_free_node(ni);
- } else
- (void) ieee80211_input_all(ic, m, rssi, nf);
- NET_EPOCH_EXIT(et);
-
- WI_LOCK(sc);
-}
-
-static __noinline void
-wi_tx_ex_intr(struct wi_softc *sc)
-{
- struct wi_frame frmhdr;
- int fid;
-
- fid = CSR_READ_2(sc, WI_TX_CMP_FID);
- /* Read in the frame header */
- if (wi_read_bap(sc, fid, 0, &frmhdr, sizeof(frmhdr)) == 0) {
- u_int16_t status = le16toh(frmhdr.wi_status);
- /*
- * Spontaneous station disconnects appear as xmit
- * errors. Don't announce them and/or count them
- * as an output error.
- */
- if ((status & WI_TXSTAT_DISCONNECT) == 0) {
- if (ppsratecheck(&lasttxerror, &curtxeps, wi_txerate)) {
- device_printf(sc->sc_dev, "tx failed");
- if (status & WI_TXSTAT_RET_ERR)
- printf(", retry limit exceeded");
- if (status & WI_TXSTAT_AGED_ERR)
- printf(", max transmit lifetime exceeded");
- if (status & WI_TXSTAT_DISCONNECT)
- printf(", port disconnected");
- if (status & WI_TXSTAT_FORM_ERR)
- printf(", invalid format (data len %u src %6D)",
- le16toh(frmhdr.wi_dat_len),
- frmhdr.wi_ehdr.ether_shost, ":");
- if (status & ~0xf)
- printf(", status=0x%x", status);
- printf("\n");
- }
- counter_u64_add(sc->sc_ic.ic_oerrors, 1);
- } else
- DPRINTF(("port disconnected\n"));
- } else
- DPRINTF(("wi_tx_ex_intr: read fid %x failed\n", fid));
- CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_TX_EXC);
-}
-
-static __noinline void
-wi_tx_intr(struct wi_softc *sc)
-{
- int fid, cur;
-
- if (sc->wi_gone)
- return;
-
- fid = CSR_READ_2(sc, WI_ALLOC_FID);
- CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_ALLOC);
-
- cur = sc->sc_txcur;
- if (sc->sc_txd[cur].d_fid != fid) {
- device_printf(sc->sc_dev, "bad alloc %x != %x, cur %d nxt %d\n",
- fid, sc->sc_txd[cur].d_fid, cur, sc->sc_txnext);
- return;
- }
- sc->sc_tx_timer = 0;
- sc->sc_txd[cur].d_len = 0;
- sc->sc_txcur = cur = (cur + 1) % sc->sc_ntxbuf;
- if (sc->sc_txd[cur].d_len != 0) {
- if (wi_cmd(sc, WI_CMD_TX | WI_RECLAIM, sc->sc_txd[cur].d_fid,
- 0, 0)) {
- device_printf(sc->sc_dev, "xmit failed\n");
- sc->sc_txd[cur].d_len = 0;
- } else {
- sc->sc_tx_timer = 5;
- }
- }
-}
-
-static __noinline void
-wi_info_intr(struct wi_softc *sc)
-{
- struct ieee80211com *ic = &sc->sc_ic;
- struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
- int i, fid, len, off;
- u_int16_t ltbuf[2];
- u_int16_t stat;
- u_int32_t *ptr;
-
- fid = CSR_READ_2(sc, WI_INFO_FID);
- wi_read_bap(sc, fid, 0, ltbuf, sizeof(ltbuf));
-
- switch (le16toh(ltbuf[1])) {
- case WI_INFO_LINK_STAT:
- wi_read_bap(sc, fid, sizeof(ltbuf), &stat, sizeof(stat));
- DPRINTF(("wi_info_intr: LINK_STAT 0x%x\n", le16toh(stat)));
-
- if (vap == NULL)
- goto finish;
-
- switch (le16toh(stat)) {
- case WI_INFO_LINK_STAT_CONNECTED:
- if (vap->iv_state == IEEE80211_S_RUN &&
- vap->iv_opmode != IEEE80211_M_IBSS)
- break;
- /* fall thru... */
- case WI_INFO_LINK_STAT_AP_CHG:
- IEEE80211_LOCK(ic);
- vap->iv_bss->ni_associd = 1 | 0xc000; /* NB: anything will do */
- ieee80211_new_state(vap, IEEE80211_S_RUN, 0);
- IEEE80211_UNLOCK(ic);
- break;
- case WI_INFO_LINK_STAT_AP_INR:
- break;
- case WI_INFO_LINK_STAT_DISCONNECTED:
- /* we dropped off the net; e.g. due to deauth/disassoc */
- IEEE80211_LOCK(ic);
- vap->iv_bss->ni_associd = 0;
- vap->iv_stats.is_rx_deauth++;
- ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
- IEEE80211_UNLOCK(ic);
- break;
- case WI_INFO_LINK_STAT_AP_OOR:
- /* XXX does this need to be per-vap? */
- ieee80211_beacon_miss(ic);
- break;
- case WI_INFO_LINK_STAT_ASSOC_FAILED:
- if (vap->iv_opmode == IEEE80211_M_STA)
- ieee80211_new_state(vap, IEEE80211_S_SCAN,
- IEEE80211_SCAN_FAIL_TIMEOUT);
- break;
- }
- break;
- case WI_INFO_COUNTERS:
- /* some card versions have a larger stats structure */
- len = min(le16toh(ltbuf[0]) - 1, sizeof(sc->sc_stats) / 4);
- ptr = (u_int32_t *)&sc->sc_stats;
- off = sizeof(ltbuf);
- for (i = 0; i < len; i++, off += 2, ptr++) {
- wi_read_bap(sc, fid, off, &stat, sizeof(stat));
-#ifdef WI_HERMES_STATS_WAR
- if (stat & 0xf000)
- stat = ~stat;
-#endif
- *ptr += stat;
- }
- break;
- default:
- DPRINTF(("wi_info_intr: got fid %x type %x len %d\n", fid,
- le16toh(ltbuf[1]), le16toh(ltbuf[0])));
- break;
- }
-finish:
- CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_INFO);
-}
-
-struct wi_mcast_ctx {
- struct wi_mcast mlist;
- int mcnt;
-};
-
-static u_int
-wi_copy_mcast(void *arg, struct sockaddr_dl *sdl, u_int count)
-{
- struct wi_mcast_ctx *ctx = arg;
-
- if (ctx->mcnt >= 16)
- return (0);
- IEEE80211_ADDR_COPY(&ctx->mlist.wi_mcast[ctx->mcnt++], LLADDR(sdl));
-
- return (1);
-}
-
-static int
-wi_write_multi(struct wi_softc *sc)
-{
- struct ieee80211com *ic = &sc->sc_ic;
- struct ieee80211vap *vap;
- struct wi_mcast_ctx ctx;
-
- if (ic->ic_allmulti > 0 || ic->ic_promisc > 0) {
-allmulti:
- memset(&ctx.mlist, 0, sizeof(ctx.mlist));
- return wi_write_rid(sc, WI_RID_MCAST_LIST, &ctx.mlist,
- sizeof(ctx.mlist));
- }
-
- ctx.mcnt = 0;
- TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
- if_foreach_llmaddr(vap->iv_ifp, wi_copy_mcast, &ctx);
- if (ctx.mcnt >= 16)
- goto allmulti;
- }
- return wi_write_rid(sc, WI_RID_MCAST_LIST, &ctx.mlist,
- IEEE80211_ADDR_LEN * ctx.mcnt);
-}
-
-static void
-wi_update_mcast(struct ieee80211com *ic)
-{
-
- wi_write_multi(ic->ic_softc);
-}
-
-static void
-wi_update_promisc(struct ieee80211com *ic)
-{
- struct wi_softc *sc = ic->ic_softc;
-
- WI_LOCK(sc);
- /* XXX handle WEP special case handling? */
- wi_write_val(sc, WI_RID_PROMISC,
- (ic->ic_opmode == IEEE80211_M_MONITOR ||
- (ic->ic_promisc > 0)));
- WI_UNLOCK(sc);
-}
-
-static void
-wi_read_nicid(struct wi_softc *sc)
-{
- struct wi_card_ident *id;
- char *p;
- int len;
- u_int16_t ver[4];
-
- /* getting chip identity */
- memset(ver, 0, sizeof(ver));
- len = sizeof(ver);
- wi_read_rid(sc, WI_RID_CARD_ID, ver, &len);
-
- sc->sc_firmware_type = WI_NOTYPE;
- sc->sc_nic_id = le16toh(ver[0]);
- for (id = wi_card_ident; id->card_name != NULL; id++) {
- if (sc->sc_nic_id == id->card_id) {
- sc->sc_nic_name = id->card_name;
- sc->sc_firmware_type = id->firm_type;
- break;
- }
- }
- if (sc->sc_firmware_type == WI_NOTYPE) {
- if (sc->sc_nic_id & 0x8000) {
- sc->sc_firmware_type = WI_INTERSIL;
- sc->sc_nic_name = "Unknown Prism chip";
- } else {
- sc->sc_firmware_type = WI_LUCENT;
- sc->sc_nic_name = "Unknown Lucent chip";
- }
- }
- if (bootverbose)
- device_printf(sc->sc_dev, "using %s\n", sc->sc_nic_name);
-
- /* get primary firmware version (Only Prism chips) */
- if (sc->sc_firmware_type != WI_LUCENT) {
- memset(ver, 0, sizeof(ver));
- len = sizeof(ver);
- wi_read_rid(sc, WI_RID_PRI_IDENTITY, ver, &len);
- sc->sc_pri_firmware_ver = le16toh(ver[2]) * 10000 +
- le16toh(ver[3]) * 100 + le16toh(ver[1]);
- }
-
- /* get station firmware version */
- memset(ver, 0, sizeof(ver));
- len = sizeof(ver);
- wi_read_rid(sc, WI_RID_STA_IDENTITY, ver, &len);
- sc->sc_sta_firmware_ver = le16toh(ver[2]) * 10000 +
- le16toh(ver[3]) * 100 + le16toh(ver[1]);
- if (sc->sc_firmware_type == WI_INTERSIL &&
- (sc->sc_sta_firmware_ver == 10102 ||
- sc->sc_sta_firmware_ver == 20102)) {
- char ident[12];
- memset(ident, 0, sizeof(ident));
- len = sizeof(ident);
- /* value should be the format like "V2.00-11" */
- if (wi_read_rid(sc, WI_RID_SYMBOL_IDENTITY, ident, &len) == 0 &&
- *(p = (char *)ident) >= 'A' &&
- p[2] == '.' && p[5] == '-' && p[8] == '\0') {
- sc->sc_firmware_type = WI_SYMBOL;
- sc->sc_sta_firmware_ver = (p[1] - '0') * 10000 +
- (p[3] - '0') * 1000 + (p[4] - '0') * 100 +
- (p[6] - '0') * 10 + (p[7] - '0');
- }
- }
- if (bootverbose) {
- device_printf(sc->sc_dev, "%s Firmware: ",
- wi_firmware_names[sc->sc_firmware_type]);
- if (sc->sc_firmware_type != WI_LUCENT) /* XXX */
- printf("Primary (%u.%u.%u), ",
- sc->sc_pri_firmware_ver / 10000,
- (sc->sc_pri_firmware_ver % 10000) / 100,
- sc->sc_pri_firmware_ver % 100);
- printf("Station (%u.%u.%u)\n",
- sc->sc_sta_firmware_ver / 10000,
- (sc->sc_sta_firmware_ver % 10000) / 100,
- sc->sc_sta_firmware_ver % 100);
- }
-}
-
-static int
-wi_write_ssid(struct wi_softc *sc, int rid, u_int8_t *buf, int buflen)
-{
- struct wi_ssid ssid;
-
- if (buflen > IEEE80211_NWID_LEN)
- return ENOBUFS;
- memset(&ssid, 0, sizeof(ssid));
- ssid.wi_len = htole16(buflen);
- memcpy(ssid.wi_ssid, buf, buflen);
- return wi_write_rid(sc, rid, &ssid, sizeof(ssid));
-}
-
-static int
-wi_write_txrate(struct wi_softc *sc, struct ieee80211vap *vap)
-{
- static const uint16_t lucent_rates[12] = {
- [ 0] = 3, /* auto */
- [ 1] = 1, /* 1Mb/s */
- [ 2] = 2, /* 2Mb/s */
- [ 5] = 4, /* 5.5Mb/s */
- [11] = 5 /* 11Mb/s */
- };
- static const uint16_t intersil_rates[12] = {
- [ 0] = 0xf, /* auto */
- [ 1] = 0, /* 1Mb/s */
- [ 2] = 1, /* 2Mb/s */
- [ 5] = 2, /* 5.5Mb/s */
- [11] = 3, /* 11Mb/s */
- };
- const uint16_t *rates = sc->sc_firmware_type == WI_LUCENT ?
- lucent_rates : intersil_rates;
- struct ieee80211com *ic = vap->iv_ic;
- const struct ieee80211_txparam *tp;
-
- tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_bsschan)];
- return wi_write_val(sc, WI_RID_TX_RATE,
- (tp->ucastrate == IEEE80211_FIXED_RATE_NONE ?
- rates[0] : rates[tp->ucastrate / 2]));
-}
-
-static int
-wi_write_wep(struct wi_softc *sc, struct ieee80211vap *vap)
-{
- int error = 0;
- int i, keylen;
- u_int16_t val;
- struct wi_key wkey[IEEE80211_WEP_NKID];
-
- switch (sc->sc_firmware_type) {
- case WI_LUCENT:
- val = (vap->iv_flags & IEEE80211_F_PRIVACY) ? 1 : 0;
- error = wi_write_val(sc, WI_RID_ENCRYPTION, val);
- if (error)
- break;
- if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0)
- break;
- error = wi_write_val(sc, WI_RID_TX_CRYPT_KEY, vap->iv_def_txkey);
- if (error)
- break;
- memset(wkey, 0, sizeof(wkey));
- for (i = 0; i < IEEE80211_WEP_NKID; i++) {
- keylen = vap->iv_nw_keys[i].wk_keylen;
- wkey[i].wi_keylen = htole16(keylen);
- memcpy(wkey[i].wi_keydat, vap->iv_nw_keys[i].wk_key,
- keylen);
- }
- error = wi_write_rid(sc, WI_RID_DEFLT_CRYPT_KEYS,
- wkey, sizeof(wkey));
- sc->sc_encryption = 0;
- break;
-
- case WI_INTERSIL:
- val = HOST_ENCRYPT | HOST_DECRYPT;
- if (vap->iv_flags & IEEE80211_F_PRIVACY) {
- /*
- * ONLY HWB3163 EVAL-CARD Firmware version
- * less than 0.8 variant2
- *
- * If promiscuous mode disable, Prism2 chip
- * does not work with WEP .
- * It is under investigation for details.
- * (ichiro@netbsd.org)
- */
- if (sc->sc_sta_firmware_ver < 802 ) {
- /* firm ver < 0.8 variant 2 */
- wi_write_val(sc, WI_RID_PROMISC, 1);
- }
- wi_write_val(sc, WI_RID_CNFAUTHMODE,
- vap->iv_bss->ni_authmode);
- val |= PRIVACY_INVOKED;
- } else {
- wi_write_val(sc, WI_RID_CNFAUTHMODE, IEEE80211_AUTH_OPEN);
- }
- error = wi_write_val(sc, WI_RID_P2_ENCRYPTION, val);
- if (error)
- break;
- sc->sc_encryption = val;
- if ((val & PRIVACY_INVOKED) == 0)
- break;
- error = wi_write_val(sc, WI_RID_P2_TX_CRYPT_KEY, vap->iv_def_txkey);
- break;
- }
- return error;
-}
-
-static int
-wi_cmd(struct wi_softc *sc, int cmd, int val0, int val1, int val2)
-{
- int i, s = 0;
-
- if (sc->wi_gone)
- return (ENODEV);
-
- /* wait for the busy bit to clear */
- for (i = sc->wi_cmd_count; i > 0; i--) { /* 500ms */
- if (!(CSR_READ_2(sc, WI_COMMAND) & WI_CMD_BUSY))
- break;
- DELAY(1*1000); /* 1ms */
- }
- if (i == 0) {
- device_printf(sc->sc_dev, "%s: busy bit won't clear, cmd 0x%x\n",
- __func__, cmd);
- sc->wi_gone = 1;
- return(ETIMEDOUT);
- }
-
- CSR_WRITE_2(sc, WI_PARAM0, val0);
- CSR_WRITE_2(sc, WI_PARAM1, val1);
- CSR_WRITE_2(sc, WI_PARAM2, val2);
- CSR_WRITE_2(sc, WI_COMMAND, cmd);
-
- if (cmd == WI_CMD_INI) {
- /* XXX: should sleep here. */
- DELAY(100*1000); /* 100ms delay for init */
- }
- for (i = 0; i < WI_TIMEOUT; i++) {
- /*
- * Wait for 'command complete' bit to be
- * set in the event status register.
- */
- s = CSR_READ_2(sc, WI_EVENT_STAT);
- if (s & WI_EV_CMD) {
- /* Ack the event and read result code. */
- s = CSR_READ_2(sc, WI_STATUS);
- CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_CMD);
- if (s & WI_STAT_CMD_RESULT) {
- return(EIO);
- }
- break;
- }
- DELAY(WI_DELAY);
- }
-
- if (i == WI_TIMEOUT) {
- device_printf(sc->sc_dev, "%s: timeout on cmd 0x%04x; "
- "event status 0x%04x\n", __func__, cmd, s);
- if (s == 0xffff)
- sc->wi_gone = 1;
- return(ETIMEDOUT);
- }
- return (0);
-}
-
-static int
-wi_seek_bap(struct wi_softc *sc, int id, int off)
-{
- int i, status;
-
- CSR_WRITE_2(sc, WI_SEL0, id);
- CSR_WRITE_2(sc, WI_OFF0, off);
-
- for (i = 0; ; i++) {
- status = CSR_READ_2(sc, WI_OFF0);
- if ((status & WI_OFF_BUSY) == 0)
- break;
- if (i == WI_TIMEOUT) {
- device_printf(sc->sc_dev, "%s: timeout, id %x off %x\n",
- __func__, id, off);
- sc->sc_bap_off = WI_OFF_ERR; /* invalidate */
- if (status == 0xffff)
- sc->wi_gone = 1;
- return ETIMEDOUT;
- }
- DELAY(1);
- }
- if (status & WI_OFF_ERR) {
- device_printf(sc->sc_dev, "%s: error, id %x off %x\n",
- __func__, id, off);
- sc->sc_bap_off = WI_OFF_ERR; /* invalidate */
- return EIO;
- }
- sc->sc_bap_id = id;
- sc->sc_bap_off = off;
- return 0;
-}
-
-static int
-wi_read_bap(struct wi_softc *sc, int id, int off, void *buf, int buflen)
-{
- int error, cnt;
-
- if (buflen == 0)
- return 0;
- if (id != sc->sc_bap_id || off != sc->sc_bap_off) {
- if ((error = wi_seek_bap(sc, id, off)) != 0)
- return error;
- }
- cnt = (buflen + 1) / 2;
- CSR_READ_MULTI_STREAM_2(sc, WI_DATA0, (u_int16_t *)buf, cnt);
- sc->sc_bap_off += cnt * 2;
- return 0;
-}
-
-static int
-wi_write_bap(struct wi_softc *sc, int id, int off, const void *buf, int buflen)
-{
- int error, cnt;
-
- if (buflen == 0)
- return 0;
-
- if (id != sc->sc_bap_id || off != sc->sc_bap_off) {
- if ((error = wi_seek_bap(sc, id, off)) != 0)
- return error;
- }
- cnt = (buflen + 1) / 2;
- CSR_WRITE_MULTI_STREAM_2(sc, WI_DATA0, (const uint16_t *)buf, cnt);
- sc->sc_bap_off += cnt * 2;
-
- return 0;
-}
-
-static int
-wi_mwrite_bap(struct wi_softc *sc, int id, int off, struct mbuf *m0, int totlen)
-{
- int error, len;
- struct mbuf *m;
-
- for (m = m0; m != NULL && totlen > 0; m = m->m_next) {
- if (m->m_len == 0)
- continue;
-
- len = min(m->m_len, totlen);
-
- if (((u_long)m->m_data) % 2 != 0 || len % 2 != 0) {
- m_copydata(m, 0, totlen, (caddr_t)&sc->sc_txbuf);
- return wi_write_bap(sc, id, off, (caddr_t)&sc->sc_txbuf,
- totlen);
- }
-
- if ((error = wi_write_bap(sc, id, off, m->m_data, len)) != 0)
- return error;
-
- off += m->m_len;
- totlen -= len;
- }
- return 0;
-}
-
-static int
-wi_alloc_fid(struct wi_softc *sc, int len, int *idp)
-{
- int i;
-
- if (wi_cmd(sc, WI_CMD_ALLOC_MEM, len, 0, 0)) {
- device_printf(sc->sc_dev, "%s: failed to allocate %d bytes on NIC\n",
- __func__, len);
- return ENOMEM;
- }
-
- for (i = 0; i < WI_TIMEOUT; i++) {
- if (CSR_READ_2(sc, WI_EVENT_STAT) & WI_EV_ALLOC)
- break;
- DELAY(1);
- }
- if (i == WI_TIMEOUT) {
- device_printf(sc->sc_dev, "%s: timeout in alloc\n", __func__);
- return ETIMEDOUT;
- }
- *idp = CSR_READ_2(sc, WI_ALLOC_FID);
- CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_ALLOC);
- return 0;
-}
-
-static int
-wi_read_rid(struct wi_softc *sc, int rid, void *buf, int *buflenp)
-{
- int error, len;
- u_int16_t ltbuf[2];
-
- /* Tell the NIC to enter record read mode. */
- error = wi_cmd(sc, WI_CMD_ACCESS | WI_ACCESS_READ, rid, 0, 0);
- if (error)
- return error;
-
- error = wi_read_bap(sc, rid, 0, ltbuf, sizeof(ltbuf));
- if (error)
- return error;
-
- if (le16toh(ltbuf[1]) != rid) {
- device_printf(sc->sc_dev, "record read mismatch, rid=%x, got=%x\n",
- rid, le16toh(ltbuf[1]));
- return EIO;
- }
- len = (le16toh(ltbuf[0]) - 1) * 2; /* already got rid */
- if (*buflenp < len) {
- device_printf(sc->sc_dev, "record buffer is too small, "
- "rid=%x, size=%d, len=%d\n",
- rid, *buflenp, len);
- return ENOSPC;
- }
- *buflenp = len;
- return wi_read_bap(sc, rid, sizeof(ltbuf), buf, len);
-}
-
-static int
-wi_write_rid(struct wi_softc *sc, int rid, const void *buf, int buflen)
-{
- int error;
- u_int16_t ltbuf[2];
-
- ltbuf[0] = htole16((buflen + 1) / 2 + 1); /* includes rid */
- ltbuf[1] = htole16(rid);
-
- error = wi_write_bap(sc, rid, 0, ltbuf, sizeof(ltbuf));
- if (error) {
- device_printf(sc->sc_dev, "%s: bap0 write failure, rid 0x%x\n",
- __func__, rid);
- return error;
- }
- error = wi_write_bap(sc, rid, sizeof(ltbuf), buf, buflen);
- if (error) {
- device_printf(sc->sc_dev, "%s: bap1 write failure, rid 0x%x\n",
- __func__, rid);
- return error;
- }
-
- return wi_cmd(sc, WI_CMD_ACCESS | WI_ACCESS_WRITE, rid, 0, 0);
-}
-
-static int
-wi_write_appie(struct wi_softc *sc, int rid, const struct ieee80211_appie *ie)
-{
- /* NB: 42 bytes is probably ok to have on the stack */
- char buf[sizeof(uint16_t) + 40];
-
- if (ie->ie_len > 40)
- return EINVAL;
- /* NB: firmware requires 16-bit ie length before ie data */
- *(uint16_t *) buf = htole16(ie->ie_len);
- memcpy(buf + sizeof(uint16_t), ie->ie_data, ie->ie_len);
- return wi_write_rid(sc, rid, buf, ie->ie_len + sizeof(uint16_t));
-}
-
-static u_int16_t
-wi_read_chanmask(struct wi_softc *sc)
-{
- u_int16_t val;
- int buflen;
-
- buflen = sizeof(val);
- if (wi_read_rid(sc, WI_RID_CHANNEL_LIST, &val, &buflen) != 0)
- val = htole16(0x1fff); /* assume 1-13 */
- KASSERT(val != 0, ("%s: no available channels listed!", __func__));
-
- val <<= 1; /* shift for base 1 indices */
-
- return (val);
-}
-
-int
-wi_alloc(device_t dev, int rid)
-{
- struct wi_softc *sc = device_get_softc(dev);
-
- if (sc->wi_bus_type != WI_BUS_PCI_NATIVE) {
- sc->iobase_rid = rid;
- sc->iobase = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT,
- &sc->iobase_rid, (1 << 6),
- rman_make_alignment_flags(1 << 6) | RF_ACTIVE);
- if (sc->iobase == NULL) {
- device_printf(dev, "No I/O space?!\n");
- return ENXIO;
- }
-
- sc->wi_io_addr = rman_get_start(sc->iobase);
- sc->wi_btag = rman_get_bustag(sc->iobase);
- sc->wi_bhandle = rman_get_bushandle(sc->iobase);
- } else {
- sc->mem_rid = rid;
- sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
- &sc->mem_rid, RF_ACTIVE);
- if (sc->mem == NULL) {
- device_printf(dev, "No Mem space on prism2.5?\n");
- return ENXIO;
- }
-
- sc->wi_btag = rman_get_bustag(sc->mem);
- sc->wi_bhandle = rman_get_bushandle(sc->mem);
- }
-
- sc->irq_rid = 0;
- sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid,
- RF_ACTIVE |
- ((sc->wi_bus_type == WI_BUS_PCCARD) ? 0 : RF_SHAREABLE));
- if (sc->irq == NULL) {
- wi_free(dev);
- device_printf(dev, "No irq?!\n");
- return ENXIO;
- }
-
- sc->sc_dev = dev;
- sc->sc_unit = device_get_unit(dev);
- return 0;
-}
-
-void
-wi_free(device_t dev)
-{
- struct wi_softc *sc = device_get_softc(dev);
-
- if (sc->iobase != NULL) {
- bus_release_resource(dev, SYS_RES_IOPORT, sc->iobase_rid, sc->iobase);
- sc->iobase = NULL;
- }
- if (sc->irq != NULL) {
- bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq);
- sc->irq = NULL;
- }
- if (sc->mem != NULL) {
- bus_release_resource(dev, SYS_RES_MEMORY, sc->mem_rid, sc->mem);
- sc->mem = NULL;
- }
-}
diff --git a/sys/dev/wi/if_wi_macio.c b/sys/dev/wi/if_wi_macio.c
deleted file mode 100644
index 42f86c91c60d..000000000000
--- a/sys/dev/wi/if_wi_macio.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * Copyright (c) 2013 Justin Hibbits
- * All rights reserved.
- * 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.
- */
-
-/*
- * Lucent WaveLAN/IEEE 802.11 MacIO attachment for FreeBSD.
- *
- * Based on the PCMCIA driver
- * Written by Bill Paul <wpaul@ctr.columbia.edu>
- * Electrical Engineering Department
- * Columbia University, New York City
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/socket.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <dev/ofw/ofw_bus.h>
-#include <dev/ofw/openfirm.h>
-#include <machine/ofw_machdep.h>
-
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/ethernet.h>
-#include <net/if_dl.h>
-#include <net/if_media.h>
-#include <net/if_types.h>
-
-#include <net80211/ieee80211_var.h>
-#include <net80211/ieee80211_radiotap.h>
-
-#include <dev/wi/if_wavelan_ieee.h>
-#include <dev/wi/if_wireg.h>
-#include <dev/wi/if_wivar.h>
-
-#include <powerpc/powermac/maciovar.h>
-
-static int wi_macio_probe(device_t);
-static int wi_macio_attach(device_t);
-
-static device_method_t wi_macio_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, wi_macio_probe),
- DEVMETHOD(device_attach, wi_macio_attach),
- DEVMETHOD(device_detach, wi_detach),
- DEVMETHOD(device_shutdown, wi_shutdown),
- { 0, 0 }
-};
-
-static driver_t wi_macio_driver = {
- "wi",
- wi_macio_methods,
- sizeof(struct wi_softc)
-};
-
-DRIVER_MODULE(wi, macio, wi_macio_driver, wi_devclass, 0, 0);
-MODULE_DEPEND(wi, wlan, 1, 1, 1);
-
-static int
-wi_macio_probe(device_t dev)
-{
- const char *name, *compat;
-
- /* Make sure we're a network driver */
- name = ofw_bus_get_name(dev);
- if (name == NULL)
- return (ENXIO);
-
- if (strcmp(name, "radio") != 0) {
- return ENXIO;
- }
- compat = ofw_bus_get_compat(dev);
- if (strcmp(compat, "wireless") != 0) {
- return ENXIO;
- }
-
- device_set_desc(dev, "Apple Airport");
- return 0;
-}
-
-static int
-wi_macio_attach(device_t dev)
-{
- struct wi_softc *sc;
- int error;
-
- sc = device_get_softc(dev);
- sc->wi_gone = 0;
- sc->wi_bus_type = 0;
-
- error = wi_alloc(dev, 0);
- if (error == 0) {
- macio_enable_wireless(device_get_parent(dev), 1);
- /* Make sure interrupts are disabled. */
- CSR_WRITE_2(sc, WI_INT_EN, 0);
- CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
-
- error = wi_attach(dev);
- if (error != 0)
- wi_free(dev);
- else
- gone_in_dev(dev, 13, "pccard removed, wi doesn't support modern crypto");
- }
- return error;
-}
diff --git a/sys/dev/wi/if_wi_pccard.c b/sys/dev/wi/if_wi_pccard.c
deleted file mode 100644
index ef24271f4ab5..000000000000
--- a/sys/dev/wi/if_wi_pccard.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * 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.
- */
-
-/*
- * Lucent WaveLAN/IEEE 802.11 PCMCIA driver for FreeBSD.
- *
- * Written by Bill Paul <wpaul@ctr.columbia.edu>
- * Electrical Engineering Department
- * Columbia University, New York City
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/socket.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/ethernet.h>
-#include <net/if_dl.h>
-#include <net/if_media.h>
-#include <net/if_types.h>
-
-#include <net80211/ieee80211_var.h>
-#include <net80211/ieee80211_radiotap.h>
-
-#include <dev/pccard/pccardvar.h>
-#include <dev/pccard/pccard_cis.h>
-
-#include <dev/wi/if_wavelan_ieee.h>
-#include <dev/wi/if_wireg.h>
-#include <dev/wi/if_wivar.h>
-
-#include "card_if.h"
-#include "pccarddevs.h"
-
-static int wi_pccard_probe(device_t);
-static int wi_pccard_attach(device_t);
-
-static device_method_t wi_pccard_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, wi_pccard_probe),
- DEVMETHOD(device_attach, wi_pccard_attach),
- DEVMETHOD(device_detach, wi_detach),
- DEVMETHOD(device_shutdown, wi_shutdown),
- { 0, 0 }
-};
-
-static driver_t wi_pccard_driver = {
- "wi",
- wi_pccard_methods,
- sizeof(struct wi_softc)
-};
-
-DRIVER_MODULE(wi, pccard, wi_pccard_driver, wi_devclass, 0, 0);
-MODULE_DEPEND(wi, wlan, 1, 1, 1);
-
-static const struct pccard_product wi_pccard_products[] = {
- PCMCIA_CARD(3COM, 3CRWE737A),
- PCMCIA_CARD(3COM, 3CRWE777A),
- PCMCIA_CARD(ACTIONTEC, PRISM),
- PCMCIA_CARD(ADAPTEC2, ANW8030),
- PCMCIA_CARD(ADDTRON, AWP100),
- PCMCIA_CARD(AIRVAST, WN_100B),
- PCMCIA_CARD(AIRVAST, WN_100),
- PCMCIA_CARD(ALLIEDTELESIS, WR211PCM),
- PCMCIA_CARD(ARTEM, ONAIR),
- PCMCIA_CARD(ASUS, WL100),
- PCMCIA_CARD(BAY, EMOBILITY_11B),
- PCMCIA_CARD(BROMAX, IWN),
- PCMCIA_CARD(BROMAX, IWN3),
- PCMCIA_CARD(BROMAX, WCF11),
- PCMCIA_CARD(BUFFALO, WLI_CF_S11G),
- PCMCIA_CARD(BUFFALO, WLI_PCM_S11),
- PCMCIA_CARD(COMPAQ, NC5004),
- PCMCIA_CARD(CONTEC, FX_DS110_PCC),
- PCMCIA_CARD(COREGA, WIRELESS_LAN_PCC_11),
- PCMCIA_CARD(COREGA, WIRELESS_LAN_PCCA_11),
- PCMCIA_CARD(COREGA, WIRELESS_LAN_PCCB_11),
- PCMCIA_CARD(COREGA, WIRELESS_LAN_PCCL_11),
- PCMCIA_CARD(DLINK, DWL650H),
- PCMCIA_CARD(ELSA, XI300_IEEE),
- PCMCIA_CARD(ELSA, XI325_IEEE),
- PCMCIA_CARD(ELSA, APDL325_IEEE),
- PCMCIA_CARD(ELSA, XI330_IEEE),
- PCMCIA_CARD(ELSA, XI800_IEEE),
- PCMCIA_CARD(ELSA, WIFI_FLASH),
- PCMCIA_CARD(EMTAC, WLAN),
- PCMCIA_CARD(ERICSSON, WIRELESSLAN),
- PCMCIA_CARD(GEMTEK, WLAN),
- PCMCIA_CARD(HWN, AIRWAY80211),
- PCMCIA_CARD(INTEL, PRO_WLAN_2011),
- PCMCIA_CARD(INTERSIL, ISL37100P),
- PCMCIA_CARD(INTERSIL, ISL37110P),
- PCMCIA_CARD(INTERSIL, ISL37300P),
- PCMCIA_CARD(INTERSIL2, PRISM2),
- PCMCIA_CARD(IODATA2, WCF12),
- PCMCIA_CARD(IODATA2, WNB11PCM),
- PCMCIA_CARD(FUJITSU, WL110),
- PCMCIA_CARD(LUCENT, WAVELAN_IEEE),
- PCMCIA_CARD(MICROSOFT, MN_520),
- PCMCIA_CARD(NOKIA, C020_WLAN),
- PCMCIA_CARD(NOKIA, C110_WLAN),
- PCMCIA_CARD(PLANEX, GWNS11H),
- PCMCIA_CARD(PROXIM, HARMONY),
- PCMCIA_CARD(PROXIM, RANGELANDS_8430),
- PCMCIA_CARD(SAMSUNG, SWL_2000N),
- PCMCIA_CARD(SIEMENS, SS1021),
- PCMCIA_CARD(SIEMENS, SS1021A),
- PCMCIA_CARD(SIMPLETECH, SPECTRUM24_ALT),
- PCMCIA_CARD(SOCKET, LP_WLAN_CF),
- PCMCIA_CARD(TDK, LAK_CD011WL),
- { NULL }
-};
-PCCARD_PNP_INFO(wi_pccard_products);
-
-static int
-wi_pccard_probe(device_t dev)
-{
- const struct pccard_product *pp;
- u_int32_t fcn = PCCARD_FUNCTION_UNSPEC;
- int error;
-
- /* Make sure we're a network driver */
- error = pccard_get_function(dev, &fcn);
- if (error != 0)
- return error;
- if (fcn != PCCARD_FUNCTION_NETWORK)
- return ENXIO;
-
- pp = pccard_product_lookup(dev, wi_pccard_products,
- sizeof(wi_pccard_products[0]), NULL);
- if (pp != NULL) {
- if (pp->pp_name != NULL)
- device_set_desc(dev, pp->pp_name);
- return 0;
- }
- return ENXIO;
-}
-
-static int
-wi_pccard_attach(device_t dev)
-{
- struct wi_softc *sc;
- int error;
-
- sc = device_get_softc(dev);
- sc->wi_gone = 0;
- sc->wi_bus_type = WI_BUS_PCCARD;
-
- error = wi_alloc(dev, 0);
- if (error == 0) {
- /* Make sure interrupts are disabled. */
- CSR_WRITE_2(sc, WI_INT_EN, 0);
- CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
-
- error = wi_attach(dev);
- if (error != 0)
- wi_free(dev);
- gone_in_dev(dev, 13, "pccard removed, wi doesn't support modern crypto");
- }
- return error;
-}
diff --git a/sys/dev/wi/if_wi_pci.c b/sys/dev/wi/if_wi_pci.c
deleted file mode 100644
index e537239408a5..000000000000
--- a/sys/dev/wi/if_wi_pci.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-/*
- * Lucent WaveLAN/IEEE 802.11 PCMCIA driver for FreeBSD.
- *
- * Written by Bill Paul <wpaul@ctr.columbia.edu>
- * Electrical Engineering Department
- * Columbia University, New York City
- */
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/socket.h>
-#include <sys/systm.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <dev/pci/pcireg.h>
-#include <dev/pci/pcivar.h>
-
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/if_arp.h>
-#include <net/ethernet.h>
-#include <net/if_media.h>
-#include <net/if_types.h>
-
-#include <net80211/ieee80211_var.h>
-#include <net80211/ieee80211_radiotap.h>
-
-#include <dev/wi/if_wavelan_ieee.h>
-#include <dev/wi/if_wireg.h>
-#include <dev/wi/if_wivar.h>
-
-static int wi_pci_probe(device_t);
-static int wi_pci_attach(device_t);
-static int wi_pci_suspend(device_t);
-static int wi_pci_resume(device_t);
-
-static device_method_t wi_pci_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, wi_pci_probe),
- DEVMETHOD(device_attach, wi_pci_attach),
- DEVMETHOD(device_detach, wi_detach),
- DEVMETHOD(device_shutdown, wi_shutdown),
- DEVMETHOD(device_suspend, wi_pci_suspend),
- DEVMETHOD(device_resume, wi_pci_resume),
- { 0, 0 }
-};
-
-static driver_t wi_pci_driver = {
- "wi",
- wi_pci_methods,
- sizeof(struct wi_softc)
-};
-
-static struct {
- unsigned int vendor,device;
- int bus_type;
- char *desc;
-} pci_ids[] = {
- /* Sorted by description */
- {0x10b7, 0x7770, WI_BUS_PCI_PLX, "3Com Airconnect"},
- {0x16ab, 0x1101, WI_BUS_PCI_PLX, "GLPRISM2 WaveLAN"},
- {0x1260, 0x3872, WI_BUS_PCI_NATIVE, "Intersil Prism3"},
- {0x1260, 0x3873, WI_BUS_PCI_NATIVE, "Intersil Prism2.5"},
- {0x16ab, 0x1102, WI_BUS_PCI_PLX, "Linksys WDT11"},
- {0x1385, 0x4100, WI_BUS_PCI_PLX, "Netgear MA301"},
- {0x1638, 0x1100, WI_BUS_PCI_PLX, "PRISM2STA WaveLAN"},
- {0x111a, 0x1023, WI_BUS_PCI_PLX, "Siemens SpeedStream"},
- {0x10b5, 0x9050, WI_BUS_PCI_PLX, "SMC 2602W"},
- {0x16ec, 0x3685, WI_BUS_PCI_PLX, "US Robotics 2415"},
- {0x4033, 0x7001, WI_BUS_PCI_PLX, "Addtron AWA-100 PCI"},
- {0, 0, 0, NULL}
-};
-
-DRIVER_MODULE(wi, pci, wi_pci_driver, wi_devclass, 0, 0);
-MODULE_DEPEND(wi, pci, 1, 1, 1);
-MODULE_DEPEND(wi, wlan, 1, 1, 1);
-
-static int
-wi_pci_probe(dev)
- device_t dev;
-{
- struct wi_softc *sc;
- int i;
-
- sc = device_get_softc(dev);
- for(i=0; pci_ids[i].vendor != 0; i++) {
- if ((pci_get_vendor(dev) == pci_ids[i].vendor) &&
- (pci_get_device(dev) == pci_ids[i].device)) {
- sc->wi_bus_type = pci_ids[i].bus_type;
- device_set_desc(dev, pci_ids[i].desc);
- return (BUS_PROBE_DEFAULT);
- }
- }
- return(ENXIO);
-}
-
-static int
-wi_pci_attach(device_t dev)
-{
- struct wi_softc *sc;
- u_int32_t command;
- u_int16_t reg;
- int error;
- int timeout;
-
- sc = device_get_softc(dev);
-
- if (sc->wi_bus_type != WI_BUS_PCI_NATIVE) {
- error = wi_alloc(dev, WI_PCI_IORES);
- if (error)
- return (error);
-
- /* Make sure interrupts are disabled. */
- CSR_WRITE_2(sc, WI_INT_EN, 0);
- CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
-
- /* We have to do a magic PLX poke to enable interrupts */
- sc->local_rid = WI_PCI_LOCALRES;
- sc->local = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
- &sc->local_rid, RF_ACTIVE);
- sc->wi_localtag = rman_get_bustag(sc->local);
- sc->wi_localhandle = rman_get_bushandle(sc->local);
- command = bus_space_read_4(sc->wi_localtag, sc->wi_localhandle,
- WI_LOCAL_INTCSR);
- command |= WI_LOCAL_INTEN;
- bus_space_write_4(sc->wi_localtag, sc->wi_localhandle,
- WI_LOCAL_INTCSR, command);
- bus_release_resource(dev, SYS_RES_IOPORT, sc->local_rid,
- sc->local);
- sc->local = NULL;
-
- sc->mem_rid = WI_PCI_MEMRES;
- sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
- &sc->mem_rid, RF_ACTIVE);
- if (sc->mem == NULL) {
- device_printf(dev, "couldn't allocate memory\n");
- wi_free(dev);
- return (ENXIO);
- }
- sc->wi_bmemtag = rman_get_bustag(sc->mem);
- sc->wi_bmemhandle = rman_get_bushandle(sc->mem);
-
- /*
- * Write COR to enable PC card
- * This is a subset of the protocol that the pccard bus code
- * would do. In theory, we should parse the CIS to find the
- * COR offset. In practice, the COR_OFFSET is always 0x3e0.
- */
- CSM_WRITE_1(sc, WI_COR_OFFSET, WI_COR_VALUE);
- reg = CSM_READ_1(sc, WI_COR_OFFSET);
- if (reg != WI_COR_VALUE) {
- device_printf(dev, "CSM_READ_1(WI_COR_OFFSET) "
- "wanted %d, got %d\n", WI_COR_VALUE, reg);
- wi_free(dev);
- return (ENXIO);
- }
- } else {
- error = wi_alloc(dev, WI_PCI_LMEMRES);
- if (error)
- return (error);
-
- CSR_WRITE_2(sc, WI_PCICOR_OFF, WI_PCICOR_RESET);
- DELAY(250000);
-
- CSR_WRITE_2(sc, WI_PCICOR_OFF, 0x0000);
- DELAY(500000);
-
- timeout=2000000;
- while ((--timeout > 0) &&
- (CSR_READ_2(sc, WI_COMMAND) & WI_CMD_BUSY))
- DELAY(10);
-
- if (timeout == 0) {
- device_printf(dev, "couldn't reset prism pci core.\n");
- wi_free(dev);
- return(ENXIO);
- }
- }
-
- CSR_WRITE_2(sc, WI_HFA384X_SWSUPPORT0_OFF, WI_PRISM2STA_MAGIC);
- reg = CSR_READ_2(sc, WI_HFA384X_SWSUPPORT0_OFF);
- if (reg != WI_PRISM2STA_MAGIC) {
- device_printf(dev,
- "CSR_READ_2(WI_HFA384X_SWSUPPORT0_OFF) "
- "wanted %d, got %d\n", WI_PRISM2STA_MAGIC, reg);
- wi_free(dev);
- return (ENXIO);
- }
-
- error = wi_attach(dev);
- if (error != 0)
- wi_free(dev);
- else
- gone_in_dev(dev, 13, "pccard removed, wi doesn't support modern crypto");
- return (error);
-}
-
-static int
-wi_pci_suspend(device_t dev)
-{
- struct wi_softc *sc = device_get_softc(dev);
-
- WI_LOCK(sc);
- wi_stop(sc, 1);
- WI_UNLOCK(sc);
-
- return (0);
-}
-
-static int
-wi_pci_resume(device_t dev)
-{
- struct wi_softc *sc = device_get_softc(dev);
- struct ieee80211com *ic = &sc->sc_ic;
-
- WI_LOCK(sc);
- if (sc->wi_bus_type != WI_BUS_PCI_NATIVE) {
- WI_UNLOCK(sc);
- return (0);
- }
- if (ic->ic_nrunning > 0)
- wi_init(sc);
- WI_UNLOCK(sc);
- return (0);
-}
diff --git a/sys/dev/wi/if_wireg.h b/sys/dev/wi/if_wireg.h
deleted file mode 100644
index b86a207cdc11..000000000000
--- a/sys/dev/wi/if_wireg.h
+++ /dev/null
@@ -1,726 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#define WI_DELAY 5
-#define WI_TIMEOUT (500000/WI_DELAY) /* 500 ms */
-
-#define WI_PORT0 (0 << 8)
-#define WI_PORT1 (1 << 8)
-#define WI_PORT2 (2 << 8)
-#define WI_PORT3 (3 << 8)
-#define WI_PORT4 (4 << 8)
-#define WI_PORT5 (5 << 8)
-
-#define WI_PCI_LMEMRES 0x10 /* PCI Memory (native PCI implementations) */
-#define WI_PCI_LOCALRES 0x14 /* The PLX chip's local registers */
-#define WI_PCI_MEMRES 0x18 /* The PCCard's attribute memory */
-#define WI_PCI_IORES 0x1C /* The PCCard's I/O space */
-
-#define WI_LOCAL_INTCSR 0x4c
-#define WI_LOCAL_INTEN 0x40
-#define WI_HFA384X_SWSUPPORT0_OFF 0x28
-#define WI_PRISM2STA_MAGIC 0x4A2D
-#define WI_PCICOR_OFF 0x26
-#define WI_PCICOR_RESET 0x0080
-
-/* Default port: 0 (only 0 exists on stations) */
-#define WI_DEFAULT_PORT WI_PORT0
-
-/* Default network name: ANY */
-/*
- * [sommerfeld 1999/07/15] Changed from "ANY" to ""; according to Bill Fenner,
- * ANY is used in MS driver user interfaces, while "" is used over the
- * wire..
- */
-#define WI_DEFAULT_NETNAME ""
-
-#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_PM_ENABLED 0
-
-#define WI_DEFAULT_MAX_SLEEP 100
-
-#define WI_DEFAULT_ROAMING 1
-
-#define WI_DEFAULT_AUTHTYPE 1
-
-#ifdef __NetBSD__
-#define OS_STRING_NAME "NetBSD"
-#endif
-#ifdef __FreeBSD__
-#define OS_STRING_NAME "FreeBSD"
-#endif
-#ifdef __OpenBSD__
-#define OS_STRING_NAME "OpenBSD"
-#endif
-
-#define WI_DEFAULT_NODENAME OS_STRING_NAME " WaveLAN/IEEE node"
-
-#define WI_DEFAULT_IBSS OS_STRING_NAME " IBSS"
-
-#define WI_BUS_PCCARD 0 /* pccard device */
-#define WI_BUS_PCI_PLX 1 /* PCI card w/ PLX PCI/PCMICA bridge */
-#define WI_BUS_PCI_NATIVE 2 /* native PCI device (Prism 2.5) */
-
-/*
- * register space access macros
- */
-#define CSR_WRITE_4(sc, reg, val) \
- bus_space_write_4((sc)->wi_btag, (sc)->wi_bhandle, \
- (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg), val)
-#define CSR_WRITE_2(sc, reg, val) \
- bus_space_write_2((sc)->wi_btag, (sc)->wi_bhandle, \
- (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg), val)
-#define CSR_WRITE_1(sc, reg, val) \
- bus_space_write_1((sc)->wi_btag, (sc)->wi_bhandle, \
- (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg), val)
-
-#define CSR_READ_4(sc, reg) \
- bus_space_read_4((sc)->wi_btag, (sc)->wi_bhandle, \
- (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg))
-#define CSR_READ_2(sc, reg) \
- bus_space_read_2((sc)->wi_btag, (sc)->wi_bhandle, \
- (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg))
-#define CSR_READ_1(sc, reg) \
- bus_space_read_1((sc)->wi_btag, (sc)->wi_bhandle, \
- (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg))
-
-#define CSM_WRITE_1(sc, off, val) \
- bus_space_write_1((sc)->wi_bmemtag, (sc)->wi_bmemhandle, off, val)
-
-#define CSM_READ_1(sc, off) \
- bus_space_read_1((sc)->wi_bmemtag, (sc)->wi_bmemhandle, off)
-
-#define CSR_WRITE_STREAM_2(sc, reg, val) \
- bus_space_write_stream_2(sc->wi_btag, sc->wi_bhandle, \
- (sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)), val)
-#define CSR_WRITE_MULTI_STREAM_2(sc, reg, val, count) \
- bus_space_write_multi_stream_2(sc->wi_btag, sc->wi_bhandle, \
- (sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)), val, count)
-#define CSR_READ_STREAM_2(sc, reg) \
- bus_space_read_stream_2(sc->wi_btag, sc->wi_bhandle, \
- (sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)))
-#define CSR_READ_MULTI_STREAM_2(sc, reg, buf, count) \
- bus_space_read_multi_stream_2(sc->wi_btag, sc->wi_bhandle, \
- (sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)), buf, count)
-
-/*
- * 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 publicly
- * 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 & Prism2 I/O space.
- */
-#define WI_IOSIZ 0x40
-
-/*
- * Hermes & Prism2 register definitions
- */
-
-/* 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_ACCESS_WRITE 0x0121
-#define WI_CMD_PROGRAM 0x0022
-#define WI_CMD_READEE 0x0030 /* symbol only */
-#define WI_CMD_READMIF 0x0030 /* prism2 */
-#define WI_CMD_WRITEMIF 0x0031 /* prism2 */
-#define WI_CMD_DEBUG 0x0038 /* Various test commands */
-
-#define WI_CMD_CODE_MASK 0x003F
-
-/*
- * Various cmd test stuff.
- */
-#define WI_TEST_MONITOR 0x0B
-#define WI_TEST_STOP 0x0F
-#define WI_TEST_CFG_BITS 0x15
-#define WI_TEST_CFG_BIT_ALC 0x08
-
-/*
- * 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 successfully */
-#define WI_EV_RX 0x0001 /* async rx completed */
-
-/* Host software registers */
-#define WI_SW0 0x28
-#define WI_SW1 0x2A
-#define WI_SW2 0x2C
-#define WI_SW3 0x2E /* does not appear in Prism2 */
-
-#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
-
-#define WI_AUX_PGSZ 128
-#define WI_AUX_KEY0 0xfe01
-#define WI_AUX_KEY1 0xdc23
-#define WI_AUX_KEY2 0xba45
-
-#define WI_COR 0x40 /* only for Symbol */
-#define WI_COR_RESET 0x0080
-#define WI_COR_IOMODE 0x0041
-
-#define WI_HCR 0x42 /* only for Symbol */
-#define WI_HCR_4WIRE 0x0010
-#define WI_HCR_RUN 0x0007
-#define WI_HCR_HOLD 0x000f
-#define WI_HCR_EEHOLD 0x00ce
-
-#define WI_COR_OFFSET 0x3e0 /* OK for PCI, default COR for Prism PC Card */
-#define WI_COR_VALUE 0x41
-
-/*
- * 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_lt_hdr {
- u_int16_t wi_len;
- u_int16_t wi_type;
- /* value is vary depends on resource id */
-};
-
-/*
- * Download buffer location and length (0xFD01).
- */
-struct wi_dnld_buf {
- 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).
- */
-struct wi_memsz {
- u_int16_t wi_mem_ram;
- u_int16_t wi_mem_nvram;
-};
-
-/*
- * NIC Identification (0xFD0B, 0xFD20)
- */
-struct wi_ver {
- u_int16_t wi_ver[4];
-};
-
-/* define card ident */
-#define WI_NIC_LUCENT_ID 0x0001
-#define WI_NIC_LUCENT_STR "Lucent Technologies, WaveLAN/IEEE"
-
-#define WI_NIC_SONY_ID 0x0002
-#define WI_NIC_SONY_STR "Sony WaveLAN/IEEE"
-
-#define WI_NIC_LUCENT_EMB_ID 0x0005
-#define WI_NIC_LUCENT_EMB_STR "Lucent Embedded WaveLAN/IEEE"
-
-#define WI_NIC_EVB2_ID 0x8000
-#define WI_NIC_EVB2_STR "RF:PRISM2 MAC:HFA3841"
-
-#define WI_NIC_HWB3763_ID 0x8001
-#define WI_NIC_HWB3763_STR "RF:PRISM2 MAC:HFA3841 CARD:HWB3763 rev.B"
-
-#define WI_NIC_HWB3163_ID 0x8002
-#define WI_NIC_HWB3163_STR "RF:PRISM2 MAC:HFA3841 CARD:HWB3163 rev.A"
-
-#define WI_NIC_HWB3163B_ID 0x8003
-#define WI_NIC_HWB3163B_STR "RF:PRISM2 MAC:HFA3841 CARD:HWB3163 rev.B"
-
-#define WI_NIC_EVB3_ID 0x8004
-#define WI_NIC_EVB3_STR "RF:PRISM2 MAC:HFA3842 CARD:HFA3842 EVAL"
-
-#define WI_NIC_HWB1153_ID 0x8007
-#define WI_NIC_HWB1153_STR "RF:PRISM1 MAC:HFA3841 CARD:HWB1153"
-
-#define WI_NIC_P2_SST_ID 0x8008 /* Prism2 with SST flush */
-#define WI_NIC_P2_SST_STR "RF:PRISM2 MAC:HFA3841 CARD:HWB3163-SST-flash"
-
-#define WI_NIC_EVB2_SST_ID 0x8009
-#define WI_NIC_EVB2_SST_STR "RF:PRISM2 MAC:HFA3841 CARD:HWB3163-SST-flash"
-
-#define WI_NIC_3842_EVA_ID 0x800A /* 3842 Evaluation Board */
-#define WI_NIC_3842_EVA_STR "RF:PRISM2 MAC:HFA3842 CARD:HFA3842 EVAL"
-
-#define WI_NIC_3842_PCMCIA_AMD_ID 0x800B /* Prism2.5 PCMCIA */
-#define WI_NIC_3842_PCMCIA_SST_ID 0x800C
-#define WI_NIC_3842_PCMCIA_ATL_ID 0x800D
-#define WI_NIC_3842_PCMCIA_ATS_ID 0x800E
-#define WI_NIC_3842_PCMCIA_STR "RF:PRISM2.5 MAC:ISL3873"
-
-#define WI_NIC_3842_MINI_AMD_ID 0x8012 /* Prism2.5 Mini-PCI */
-#define WI_NIC_3842_MINI_SST_ID 0x8013
-#define WI_NIC_3842_MINI_ATL_ID 0x8014
-#define WI_NIC_3842_MINI_ATS_ID 0x8015
-#define WI_NIC_3842_MINI_STR "RF:PRISM2.5 MAC:ISL3874A(Mini-PCI)"
-
-#define WI_NIC_3842_PCI_AMD_ID 0x8016 /* Prism2.5 PCI-bridge */
-#define WI_NIC_3842_PCI_SST_ID 0x8017
-#define WI_NIC_3842_PCI_ATL_ID 0x8018
-#define WI_NIC_3842_PCI_ATS_ID 0x8019
-#define WI_NIC_3842_PCI_STR "RF:PRISM2.5 MAC:ISL3874A(PCI-bridge)"
-
-#define WI_NIC_P3_PCMCIA_AMD_ID 0x801A /* Prism3 PCMCIA */
-#define WI_NIC_P3_PCMCIA_SST_ID 0x801B
-#define WI_NIC_P3_PCMCIA_ATL_ID 0x801C
-#define WI_NIC_P3_PCMCIA_ATS_ID 0x801D
-#define WI_NIC_P3_PCMCIA_STR "RF:PRISM3(PCMCIA)"
-
-#define WI_NIC_P3_USB_AMD_ID 0x801E
-#define WI_NIC_P3_USB_SST_ID 0x801F
-#define WI_NIC_P3_USB_ATL_ID 0x8020
-
-#define WI_NIC_P3_MINI_AMD_ID 0x8021 /* Prism3 Mini-PCI */
-#define WI_NIC_P3_MINI_SST_ID 0x8022
-#define WI_NIC_P3_MINI_ATL_ID 0x8023
-#define WI_NIC_P3_MINI_ATS_ID 0x8024
-#define WI_NIC_P3_MINI_STR "RF:PRISM3(Mini-PCI)"
-
-/*
- * List of intended regulatory domains (0xFD11).
- */
-struct wi_ltv_domains {
- u_int16_t wi_len;
- u_int16_t wi_type;
- u_int16_t wi_num_dom;
- u_int8_t wi_domains[10];
-};
-
-/*
- * CIS struct (0xFD13).
- */
-struct wi_cis {
- u_int16_t wi_cis[240];
-};
-
-/*
- * Communications quality (0xFD43).
- */
-struct wi_commqual {
- u_int16_t wi_coms_qual;
- u_int16_t wi_sig_lvl;
- u_int16_t wi_noise_lvl;
-};
-
-/*
- * Actual system scale thresholds (0xFC06, 0xFD46).
- */
-struct wi_scalethresh {
- 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).
- */
-struct wi_pcf {
- u_int16_t wi_medium_occupancy_limit;
- u_int16_t wi_cfp_period;
- u_int16_t wi_cfp_max_duration;
-};
-
-/*
- * Connection control characteristics. (0xFC00)
- * 0 == IBSS (802.11 compliant mode) (Only PRISM2)
- * 1 == Basic Service Set (BSS)
- * 2 == Wireless Distribudion System (WDS)
- * 3 == Pseudo IBSS
- * (Only PRISM2; not 802.11 compliant mode, testing use only)
- * 6 == HOST AP (Only PRISM2)
- */
-#define WI_PORTTYPE_IBSS 0x0
-#define WI_PORTTYPE_BSS 0x1
-#define WI_PORTTYPE_WDS 0x2
-#define WI_PORTTYPE_ADHOC 0x3
-#define WI_PORTTYPE_APSILENT 0x5
-#define WI_PORTTYPE_HOSTAP 0x6
-
-/*
- * Mac addresses. (0xFC01, 0xFC08)
- */
-struct wi_macaddr {
- u_int8_t wi_mac_addr[6];
-};
-
-/*
- * Station set identification (SSID). (0xFC02, 0xFC04)
- */
-struct wi_ssid {
- u_int16_t wi_len;
- u_int8_t wi_ssid[32];
-};
-
-/*
- * Set our station name. (0xFC0E)
- */
-struct wi_nodename {
- u_int16_t wi_nodelen;
- u_int8_t wi_nodename[32];
-};
-
-/*
- * Multicast addresses to be put in filter. We're
- * allowed up to 16 addresses in the filter. (0xFC80)
- */
-struct wi_mcast {
- struct ether_addr wi_mcast[16];
-};
-
-/*
- * Join request. (0xFCE2)
- */
-struct wi_joinreq {
- struct ether_addr wi_bssid;
- u_int16_t wi_chan;
-};
-
-/*
- * supported rates. (0xFCB4)
- */
-#define WI_SUPPRATES_1M 0x0001
-#define WI_SUPPRATES_2M 0x0002
-#define WI_SUPPRATES_5M 0x0004
-#define WI_SUPPRATES_11M 0x0008
-#define WI_RATES_BITS "\20\0011M\0022M\0035.5M\00411M"
-
-/*
- * 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_HOST_SCAN_RESULTS 0xF104 /* Scan results */
-#define WI_INFO_LINK_STAT 0xF200 /* Link status */
-#define WI_INFO_LINK_STAT_CONNECTED 1
-#define WI_INFO_LINK_STAT_DISCONNECTED 2
-#define WI_INFO_LINK_STAT_AP_CHG 3 /* AP Change */
-#define WI_INFO_LINK_STAT_AP_OOR 4 /* AP Out Of Range */
-#define WI_INFO_LINK_STAT_AP_INR 5 /* AP In Range */
-#define WI_INFO_LINK_STAT_ASSOC_FAILED 6
-#define WI_INFO_ASSOC_STAT 0xF201 /* Association status */
-#define WI_INFO_AUTH_REQUEST 0xF202 /* Authentication Request (AP) */
-#define WI_INFO_POWERSAVE_COUNT 0xF203 /* PowerSave User Count (AP) */
-
-struct wi_assoc {
- u_int16_t wi_assoc_stat; /* Association Status */
-#define ASSOC 1
-#define REASSOC 2
-#define DISASSOC 3
-#define ASSOCFAIL 4
-#define AUTHFAIL 5
- u_int8_t wi_assoc_sta[6]; /* Station Address */
- u_int8_t wi_assoc_osta[6]; /* OLD Station Address */
- u_int16_t wi_assoc_reason; /* Reason */
- u_int16_t wi_assoc_reserve; /* Reserved */
-};
-
-/*
- * Scan Results of Prism2 chip
- */
-
-struct wi_scan_header {
- u_int16_t wi_reserve; /* future use */
- u_int16_t wi_reason; /* The reason this scan was initiated
- 1: Host initiated
- 2: Firmware initiated
- 3: Inquiry request from host */
-};
-
-struct wi_scan_data_p2 {
- u_int16_t wi_chid; /* BSS Channel ID from Probe Res.(PR)*/
- u_int16_t wi_noise; /* Average Noise Level of the PR */
- u_int16_t wi_signal; /* Signal Level on the PR */
- u_int8_t wi_bssid[6]; /* MACaddress of BSS responder from PR */
- u_int16_t wi_interval; /* BSS beacon interval */
- u_int16_t wi_capinfo; /* BSS Capability Information
- IEEE Std 802.11(1997) ,see 7.3.1.4 */
- u_int16_t wi_namelen; /* Length of SSID strings */
- u_int8_t wi_name[32]; /* SSID strings */
- u_int16_t wi_suprate[5]; /* Supported Rates element from the PR
- IEEE Std 802.11(1997) ,see 7.3.2.2 */
- u_int16_t wi_rate; /* Data rate of the PR */
-#define WI_APRATE_1 0x0A /* 1 Mbps */
-#define WI_APRATE_2 0x14 /* 2 Mbps */
-#define WI_APRATE_5 0x37 /* 5.5 Mbps */
-#define WI_APRATE_11 0x6E /* 11 Mbps */
-};
-
-/*
- * Scan Results of Lucent chip
- */
-struct wi_scan_data {
- u_int16_t wi_chid; /* BSS Channel ID from PR */
- u_int16_t wi_noise; /* Average Noise Level of the PR */
- u_int16_t wi_signal; /* Signal Level on the PR */
- u_int8_t wi_bssid[6]; /* MACaddress of BSS responder from PR */
- u_int16_t wi_interval; /* BSS beacon interval */
- u_int16_t wi_capinfo; /* BSS Capability Information
- IEEE Std 802.11(1997) ,see 7.3.1.4 */
- u_int16_t wi_namelen; /* Length of SSID strings */
- u_int8_t wi_name[32]; /* SSID strings */
-};
-
-/*
- * transmit/receive frame structure
- */
-struct wi_frame {
- u_int16_t wi_status; /* 0x00 */
- u_int16_t wi_rx_tstamp1; /* 0x02 */
- u_int16_t wi_rx_tstamp0; /* 0x04 */
- u_int8_t wi_rx_silence; /* 0x06 */
- u_int8_t wi_rx_signal; /* 0x07 */
- u_int8_t wi_rx_rate; /* 0x08 */
- u_int8_t wi_rx_flow; /* 0x09 */
- u_int8_t wi_tx_rtry; /* 0x0a */ /* Prism2 AP Only */
- u_int8_t wi_tx_rate; /* 0x0b */ /* Prism2 AP Only */
- u_int16_t wi_tx_ctl; /* 0x0c */
- struct ieee80211_frame_addr4 wi_whdr; /* 0x0e */
- u_int16_t wi_dat_len; /* 0x2c */
- struct ether_header wi_ehdr; /* 0x2e */
-} __attribute__((__packed__));
-
-/* Tx Status Field */
-#define WI_TXSTAT_RET_ERR 0x0001
-#define WI_TXSTAT_AGED_ERR 0x0002
-#define WI_TXSTAT_DISCONNECT 0x0004
-#define WI_TXSTAT_FORM_ERR 0x0008
-
-/* Rx Status Field */
-#define WI_STAT_BADCRC 0x0001
-#define WI_STAT_UNDECRYPTABLE 0x0002
-#define WI_STAT_ERRSTAT 0x0003
-#define WI_STAT_MAC_PORT 0x0700
-#define WI_STAT_PCF 0x1000
-#define WI_RXSTAT_MSG_TYPE 0xE000
-#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_STAT_MGMT 0x8000 /* 802.11b management frames */
-
-#define WI_ENC_TX_E_II 0x0E
-
-#define WI_ENC_TX_1042 0x00
-#define WI_ENC_TX_TUNNEL 0xF8
-
-/* TxControl Field (enhanced) */
-#define WI_TXCNTL_TX_OK 0x0002
-#define WI_TXCNTL_TX_EX 0x0004
-#define WI_TXCNTL_STRUCT_TYPE 0x0018
-#define WI_ENC_TX_802_3 0x00
-#define WI_ENC_TX_802_11 0x08
-#define WI_TXCNTL_ALTRTRY 0x0020
-#define WI_TXCNTL_NOCRYPT 0x0080
-
-/*
- * HFA3861/3863 (BBP) Control Registers
- */
-#define WI_HFA386X_CR_A_D_TEST_MODES2 0x1A
-#define WI_HFA386X_CR_MANUAL_TX_POWER 0x3E
-
-#ifdef IEEE80211_RADIOTAP_F_CFP
-/*
- * Radio capture format for Prism.
- */
-#define WI_RX_RADIOTAP_PRESENT \
- ((1 << IEEE80211_RADIOTAP_TSFT) | \
- (1 << IEEE80211_RADIOTAP_FLAGS) | \
- (1 << IEEE80211_RADIOTAP_RATE) | \
- (1 << IEEE80211_RADIOTAP_CHANNEL) | \
- (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \
- (1 << IEEE80211_RADIOTAP_DB_ANTNOISE))
-
-struct wi_rx_radiotap_header {
- struct ieee80211_radiotap_header wr_ihdr;
- u_int64_t wr_tsf;
- u_int8_t wr_flags;
- u_int8_t wr_rate;
- u_int16_t wr_chan_freq;
- u_int16_t wr_chan_flags;
- u_int8_t wr_antsignal;
- u_int8_t wr_antnoise;
-} __packed __aligned(8);
-
-#define WI_TX_RADIOTAP_PRESENT \
- ((1 << IEEE80211_RADIOTAP_FLAGS) | \
- (1 << IEEE80211_RADIOTAP_RATE) | \
- (1 << IEEE80211_RADIOTAP_CHANNEL))
-
-struct wi_tx_radiotap_header {
- struct ieee80211_radiotap_header wt_ihdr;
- u_int8_t wt_flags;
- u_int8_t wt_rate;
- u_int16_t wt_chan_freq;
- u_int16_t wt_chan_flags;
-} __packed;
-#endif /* IEEE80211_RADIOTAP_F_CFP */
diff --git a/sys/dev/wi/if_wivar.h b/sys/dev/wi/if_wivar.h
deleted file mode 100644
index eef1297fc87b..000000000000
--- a/sys/dev/wi/if_wivar.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * Copyright (c) 1997, 1998, 1999
- * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
- * Copyright (c) 2002 M Warner Losh <imp@FreeBSD.org>
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-/*
- * Encryption controls. We can enable or disable encryption as
- * well as specify up to 4 encryption keys. We can also specify
- * which of the four keys will be used for transmit encryption.
- */
-#define WI_RID_ENCRYPTION 0xFC20
-#define WI_RID_AUTHTYPE 0xFC21
-#define WI_RID_DEFLT_CRYPT_KEYS 0xFCB0
-#define WI_RID_TX_CRYPT_KEY 0xFCB1
-#define WI_RID_WEP_AVAIL 0xFD4F
-#define WI_RID_P2_TX_CRYPT_KEY 0xFC23
-#define WI_RID_P2_CRYPT_KEY0 0xFC24
-#define WI_RID_P2_CRYPT_KEY1 0xFC25
-#define WI_RID_MICROWAVE_OVEN 0xFC25
-#define WI_RID_P2_CRYPT_KEY2 0xFC26
-#define WI_RID_P2_CRYPT_KEY3 0xFC27
-#define WI_RID_P2_ENCRYPTION 0xFC28
-#define WI_RID_ROAMING_MODE 0xFC2D
-#define WI_RID_CUR_TX_RATE 0xFD44 /* current TX rate */
-
-#define WI_MAX_AID 256 /* max stations for ap operation */
-
-struct wi_vap {
- struct ieee80211vap wv_vap;
-
- void (*wv_recv_mgmt)(struct ieee80211_node *, struct mbuf *,
- int, const struct ieee80211_rx_stats *rxs, int, int);
- int (*wv_newstate)(struct ieee80211vap *,
- enum ieee80211_state, int);
-};
-#define WI_VAP(vap) ((struct wi_vap *)(vap))
-
-struct wi_softc {
- struct ieee80211com sc_ic;
- struct mbufq sc_snd;
- device_t sc_dev;
- struct mtx sc_mtx;
- struct callout sc_watchdog;
- int sc_unit;
- int wi_gone;
- int sc_enabled;
- int sc_reset;
- int sc_firmware_type;
-#define WI_NOTYPE 0
-#define WI_LUCENT 1
-#define WI_INTERSIL 2
-#define WI_SYMBOL 3
- int sc_pri_firmware_ver; /* Primary firmware */
- int sc_sta_firmware_ver; /* Station firmware */
- unsigned int sc_nic_id; /* Type of NIC */
- char * sc_nic_name;
-
- int wi_bus_type; /* Bus attachment type */
- struct resource * local;
- int local_rid;
- struct resource * iobase;
- int iobase_rid;
- struct resource * irq;
- int irq_rid;
- struct resource * mem;
- int mem_rid;
- bus_space_handle_t wi_localhandle;
- bus_space_tag_t wi_localtag;
- bus_space_handle_t wi_bhandle;
- bus_space_tag_t wi_btag;
- bus_space_handle_t wi_bmemhandle;
- bus_space_tag_t wi_bmemtag;
- void * wi_intrhand;
- struct ieee80211_channel *wi_channel;
- int wi_io_addr;
- int wi_cmd_count;
-
- int sc_flags;
- int sc_bap_id;
- int sc_bap_off;
-
- int sc_porttype;
- u_int16_t sc_portnum;
- u_int16_t sc_encryption;
- u_int16_t sc_monitor_port;
- u_int16_t sc_chanmask;
-
- /* RSSI interpretation */
- u_int16_t sc_min_rssi; /* clamp sc_min_rssi < RSSI */
- u_int16_t sc_max_rssi; /* clamp RSSI < sc_max_rssi */
- u_int16_t sc_dbm_offset; /* dBm ~ RSSI - sc_dbm_offset */
-
- int sc_buflen; /* TX buffer size */
- int sc_ntxbuf;
-#define WI_NTXBUF 3
- struct {
- int d_fid;
- int d_len;
- } sc_txd[WI_NTXBUF]; /* TX buffers */
- int sc_txnext; /* index of next TX */
- int sc_txcur; /* index of current TX*/
- int sc_tx_timer;
-
- struct wi_counters sc_stats;
- u_int16_t sc_ibss_port;
-
- struct timeval sc_last_syn;
- int sc_false_syns;
-
- u_int16_t sc_txbuf[IEEE80211_MAX_LEN/2];
-
- struct wi_tx_radiotap_header sc_tx_th;
- struct wi_rx_radiotap_header sc_rx_th;
-};
-
-/* maximum consecutive false change-of-BSSID indications */
-#define WI_MAX_FALSE_SYNS 10
-
-#define WI_FLAGS_HAS_ENHSECURITY 0x0001
-#define WI_FLAGS_HAS_WPASUPPORT 0x0002
-#define WI_FLAGS_HAS_ROAMING 0x0020
-#define WI_FLAGS_HAS_FRAGTHR 0x0200
-#define WI_FLAGS_HAS_DBMADJUST 0x0400
-#define WI_FLAGS_RUNNING 0x0800
-#define WI_FLAGS_PROMISC 0x1000
-
-struct wi_card_ident {
- u_int16_t card_id;
- char *card_name;
- u_int8_t firm_type;
-};
-
-#define WI_PRISM_MIN_RSSI 0x1b
-#define WI_PRISM_MAX_RSSI 0x9a
-#define WI_PRISM_DBM_OFFSET 100 /* XXX */
-
-#define WI_LUCENT_MIN_RSSI 47
-#define WI_LUCENT_MAX_RSSI 138
-#define WI_LUCENT_DBM_OFFSET 149
-
-#define WI_RSSI_TO_DBM(sc, rssi) (MIN((sc)->sc_max_rssi, \
- MAX((sc)->sc_min_rssi, (rssi))) - (sc)->sc_dbm_offset)
-
-#define WI_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
-#define WI_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
-#define WI_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED)
-
-int wi_attach(device_t);
-int wi_detach(device_t);
-int wi_shutdown(device_t);
-int wi_alloc(device_t, int);
-void wi_free(device_t);
-extern devclass_t wi_devclass;
-void wi_intr(void *);
-int wi_mgmt_xmit(struct wi_softc *, caddr_t, int);
-void wi_stop(struct wi_softc *, int);
-void wi_init(struct wi_softc *);
diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC
index 3425c2a74905..2f1b8c545994 100644
--- a/sys/i386/conf/GENERIC
+++ b/sys/i386/conf/GENERIC
@@ -282,7 +282,6 @@ device iwn # Intel 4965/1000/5000/6000 wireless NICs.
device malo # Marvell Libertas wireless NICs.
device mwl # Marvell 88W8363 802.11n wireless NICs.
device ral # Ralink Technology RT2500 wireless NICs.
-device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs.
device wpi # Intel 3945ABG wireless NICs.
# Pseudo devices.
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 8eb1491ace2a..d2ac7b6375ff 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -384,7 +384,6 @@ SUBDIR= \
vr \
vte \
${_wbwd} \
- ${_wi} \
wlan \
wlan_acl \
wlan_amrr \
@@ -646,7 +645,6 @@ _speaker= speaker
_splash= splash
_sppp= sppp
_wbwd= wbwd
-_wi= wi
_aac= aac
_aacraid= aacraid
@@ -784,7 +782,6 @@ _ffec= ffec
_nvd= nvd
_nvme= nvme
_pccard= pccard
-_wi= wi
_virtio= virtio
.endif
diff --git a/sys/modules/wi/Makefile b/sys/modules/wi/Makefile
deleted file mode 100644
index 6268ddb83074..000000000000
--- a/sys/modules/wi/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${SRCTOP}/sys/dev/wi
-
-KMOD= if_wi
-SRCS= if_wi.c if_wi_pccard.c if_wi_pci.c \
- card_if.h device_if.h bus_if.h pci_if.h pccarddevs.h \
- opt_wlan.h
-
-.if ${MACHINE_CPUARCH} == "powerpc"
-SRCS+= if_wi_macio.c
-SRCS+= ofw_bus_if.h
-.endif
-
-.include <bsd.kmod.mk>
diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_wi b/tools/kerneldoc/subsys/Doxyfile-dev_wi
deleted file mode 100644
index f3c33119502a..000000000000
--- a/tools/kerneldoc/subsys/Doxyfile-dev_wi
+++ /dev/null
@@ -1,21 +0,0 @@
-# Doxyfile 1.5.2
-
-# $FreeBSD$
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "FreeBSD kernel WI device code"
-OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_wi/
-EXTRACT_ALL = YES # for undocumented src, no warnings enabled
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = $(DOXYGEN_SRC_PATH)/dev/wi/ \
- $(NOTREVIEWED)
-
-GENERATE_TAGFILE = dev_wi/dev_wi.tag
-
-@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH)
-@INCLUDE = common-Doxyfile
-