Source-Changes-HG archive

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

[src/trunk]: src/contrib/sys/dev/ic Initial import of ath(4) from FreeBSD.



details:   https://anonhg.NetBSD.org/src/rev/c85266d1f6dc
branches:  trunk
changeset: 552951:c85266d1f6dc
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Tue Oct 07 06:04:00 2003 +0000

description:
Initial import of ath(4) from FreeBSD.

diffstat:

 contrib/sys/dev/ic/athhal-COPYRIGHT |   42 ++
 contrib/sys/dev/ic/athhal-README    |   64 ++++
 contrib/sys/dev/ic/athhal.h         |  527 ++++++++++++++++++++++++++++++++++++
 contrib/sys/dev/ic/athhal_desc.h    |  172 +++++++++++
 contrib/sys/dev/ic/athhal_devid.h   |   62 ++++
 contrib/sys/dev/ic/athhal_if.m      |   90 ++++++
 contrib/sys/dev/ic/athhal_osdep.c   |  367 +++++++++++++++++++++++++
 contrib/sys/dev/ic/athhal_osdep.h   |   75 +++++
 contrib/sys/dev/ic/athhal_version.h |   38 ++
 9 files changed, 1437 insertions(+), 0 deletions(-)

diffs (truncated from 1473 to 300 lines):

diff -r f6e81d203862 -r c85266d1f6dc contrib/sys/dev/ic/athhal-COPYRIGHT
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/sys/dev/ic/athhal-COPYRIGHT       Tue Oct 07 06:04:00 2003 +0000
@@ -0,0 +1,42 @@
+All files contained in this distribution are covered by the following
+copyright unless explicitly identified otherwise.  Note that this
+copyright does _NOT_ contain a "or GPL" clause and does _NOT_ permit
+redistribution with changes.
+
+/*-
+ * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting, Atheros
+ * Communications, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. The materials contained herein are unmodified and are used
+ *    unmodified.
+ * 2. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following NO
+ *    ''WARRANTY'' disclaimer below (''Disclaimer''), without
+ *    modification.
+ * 3. Redistributions in binary form must reproduce at minimum a
+ *    disclaimer similar to the Disclaimer below and any redistribution
+ *    must be conditioned upon including a substantially similar
+ *    Disclaimer requirement for further binary redistribution.
+ * 4. Neither the names of the above-listed copyright holders nor the
+ *    names of any contributors may be used to endorse or promote
+ *    product derived from this software without specific prior written
+ *    permission.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT,
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
+ * FOR 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 DAMAGES.
+ *
+ * $Id: COPYRIGHT,v 1.2 2003/06/25 04:50:21 sam Exp $
+ */
diff -r f6e81d203862 -r c85266d1f6dc contrib/sys/dev/ic/athhal-README
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/sys/dev/ic/athhal-README  Tue Oct 07 06:04:00 2003 +0000
@@ -0,0 +1,64 @@
+$Id: README,v 1.2 2003/07/02 01:55:27 sam Exp $
+
+
+WARNING: THIS IS A BETA DISTRIBUTION.  THIS SOFTWARE HAS KNOWN PROBLEMS AND
+WARNING: LIMITATIONS THAT WILL BE CORRECTED BEFORE A PRODUCTION RELEASE.
+WARNING: USE AT YOUR OWN RISK!
+
+
+Atheros Hardware Access Layer (HAL)
+===================================
+
+* Copyright (c) 2002, 2003 Sam Leffler.
+* Copyright (c) 2002, 2003 Atheros Communications, Inc.
+* All rights reserved.
+
+Read the file COPYRIGHT for the complete copyright.
+
+This code manages much of the chip-specific operation of the Atheros driver.
+The HAL is provided in a binary-only form in order to comply with FCC
+regulations.  In particular, a radio transmitter can only be operated at
+power levels and on frequency channels for which it is approved.  The FCC
+requires that a software-defined radio cannot be configured by a user
+to operate outside the approved power levels and frequency channels.
+This makes it difficult to open-source code that enforces limits on
+the power levels, frequency channels and other parameters of the radio
+transmitter.  See
+
+http://ftp.fcc.gov/Bureaus/Engineering_Technology/Orders/2001/fcc01264.pdf
+
+for the specific FCC regulation.  Because the module is provided in a
+binary-only form it is marked "Proprietary"; this means when you load
+it you will see messages that your system is now "tainted".
+
+If you wish to use this driver on a platform for which an ath_hal
+module is not already provided please contact the author.  Note that
+this is only necessary for new _architectures_; the HAL is not tied to
+any specific version of your operating system.
+
+
+Atheros Hardware
+================
+There are currently 3 generations of Atheros 802.11 wireless devices:
+
+5210   supports 11a only
+5211   supports both 11a and 11b
+5212   supports 11a, 11b, and 11g
+
+These parts have been incorporated in a variety of retail products
+including cardbus cards from DLink, Linksys, Netgear, and Proxim; and
+mini-pci cards from some of these same vendors.  In addition many
+laptop vendors use Atheros mini-pci cards for their builtin wireless
+support.  An (incomplete) list of products that use Atheros parts is:
+
+Netgear WAG511         D-Link DWL-AG520        Linksys WPC55AG
+Netgear WAB501         D-Link DWL-AG650        Linksys WMP55AG
+                       D-Link DWL-AB650        Linksys WPC51AB
+
+In general, if a device is identified as ``11a only'' it is almost
+certain to contain an Atheros 5210 part in it.  All retail a+b
+products use the 5211.  The latest generation of universal a+b+g
+combo products use the 5212.  When in doubt check the PCI vendor
+id with a tool like lspci, the Atheros vendor id is 0x168c; e.g.
+
+   00:13.0 Ethernet controller: Unknown device 168c:0012 (rev 01)
diff -r f6e81d203862 -r c85266d1f6dc contrib/sys/dev/ic/athhal.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/sys/dev/ic/athhal.h       Tue Oct 07 06:04:00 2003 +0000
@@ -0,0 +1,527 @@
+/*-
+ * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting, Atheros
+ * Communications, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the following conditions are met:
+ * 1. The materials contained herein are unmodified and are used
+ *    unmodified.
+ * 2. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following NO
+ *    ''WARRANTY'' disclaimer below (''Disclaimer''), without
+ *    modification.
+ * 3. Redistributions in binary form must reproduce at minimum a
+ *    disclaimer similar to the Disclaimer below and any redistribution
+ *    must be conditioned upon including a substantially similar
+ *    Disclaimer requirement for further binary redistribution.
+ * 4. Neither the names of the above-listed copyright holders nor the
+ *    names of any contributors may be used to endorse or promote
+ *    product derived from this software without specific prior written
+ *    permission.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT,
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
+ * FOR 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 DAMAGES.
+ *
+ * $Id: ah.h,v 1.35 2003/07/21 02:36:53 sam Exp $
+ */
+
+#ifndef _ATH_AH_H_
+#define _ATH_AH_H_
+/*
+ * Atheros Hardware Access Layer
+ *
+ * Clients of the HAL call ath_hal_attach to obtain a reference to an ath_hal
+ * structure for use with the device.  Hardware-related operations that
+ * follow must call back into the HAL through interface, supplying the
+ * reference as the first parameter.
+ */
+#include "ah_osdep.h"
+
+/*
+ * Status codes that may be returned by the HAL.  Note that
+ * interfaces that return a status code set it only when an
+ * error occurs--i.e. you cannot check it for success.
+ */
+typedef enum {
+       HAL_OK = 0,             /* No error */
+       HAL_ENXIO,              /* No hardware present */
+       HAL_ENOMEM,             /* Memory allocation failed */
+       HAL_EIO,                /* Hardware didn't respond as expected */
+       HAL_EEMAGIC,            /* EEPROM magic number invalid */
+       HAL_EEVERSION,          /* EEPROM version invalid */
+       HAL_EELOCKED,           /* EEPROM unreadable */
+       HAL_EEBADSUM,           /* EEPROM checksum invalid */
+       HAL_EEREAD,             /* EEPROM read problem */
+       HAL_EEBADMAC,           /* EEPROM mac address invalid */
+       HAL_EESIZE,             /* EEPROM size not supported */
+       HAL_EEWRITE,            /* Attempt to change write-locked EEPROM */
+       HAL_EINVAL,             /* Invalid parameter to function */
+       HAL_ENOTSUPP,           /* Hardware revision not supported */
+       HAL_ESELFTEST,          /* Hardware self-test failed */
+       HAL_EINPROGRESS,        /* Operation incomplete */
+} HAL_STATUS;
+
+typedef enum {
+       AH_FALSE = 0,           /* NB: lots of code assumes false is zero */
+       AH_TRUE  = 1,
+} HAL_BOOL;
+
+/* 
+ * "States" for setting the LED.  These correspond to
+ * the possible 802.11 operational states and there may
+ * be a many-to-one mapping between these states and the
+ * actual hardware states for the LED's (i.e. the hardware
+ * may have fewer states).
+ */
+typedef enum {
+       HAL_LED_INIT    = 0,
+       HAL_LED_SCAN    = 1,
+       HAL_LED_AUTH    = 2,
+       HAL_LED_ASSOC   = 3,
+       HAL_LED_RUN     = 4
+} HAL_LED_STATE;
+
+/*
+ * Transmit queue types/numbers.  These are used to tag
+ * each transmit queue in the hardware and to identify a set
+ * of transmit queues for operations such as start/stop dma.
+ */
+typedef enum {
+       HAL_TX_QUEUE_INACTIVE   = 0,            /* queue is inactive/unused */
+       HAL_TX_QUEUE_DATA,                      /* data xmit q's */
+       HAL_TX_QUEUE_BEACON,                    /* beacon xmit q */
+       HAL_TX_QUEUE_CAB,                       /* "crap after beacon" xmit q */
+       HAL_TX_QUEUE_PSPOLL,                    /* power-save poll xmit q */
+} HAL_TX_QUEUE;
+
+#define        HAL_NUM_TX_QUEUES       10              /* max possible # of queues */
+
+/*
+ * Transmit packet types.  This belongs in ah_desc.h, but
+ * is here so we can give a proper type to various parameters
+ * (and not require everyone include the file).
+ *
+ * NB: These values are intentionally assigned for
+ *     direct use when setting up h/w descriptors.
+ */
+typedef enum {
+       HAL_PKT_TYPE_NORMAL     = 0,
+       HAL_PKT_TYPE_ATIM       = 1,
+       HAL_PKT_TYPE_PSPOLL     = 2,
+       HAL_PKT_TYPE_BEACON     = 3,
+       HAL_PKT_TYPE_PROBE_RESP = 4,
+} HAL_PKT_TYPE;
+
+/* Rx Filter Frame Types */
+typedef enum {
+       HAL_RX_FILTER_UCAST     = 0x00000001,   /* Allow unicast frames */
+       HAL_RX_FILTER_MCAST     = 0x00000002,   /* Allow multicast frames */
+       HAL_RX_FILTER_BCAST     = 0x00000004,   /* Allow broadcast frames */
+       HAL_RX_FILTER_CONTROL   = 0x00000008,   /* Allow control frames */
+       HAL_RX_FILTER_BEACON    = 0x00000010,   /* Allow beacon frames */
+       HAL_RX_FILTER_PROM      = 0x00000020,   /* Promiscuous mode */
+       HAL_RX_FILTER_PROBEREQ  = 0x00000080,   /* Allow probe request frames */
+       HAL_RX_FILTER_PHYERR    = 0x00000100,   /* Allow phy errors */
+       HAL_RX_FILTER_PHYRADAR  = 0x00000200,   /* Allow phy radar errors*/
+} HAL_RX_FILTER;
+
+typedef enum {
+       HAL_PM_UNDEFINED        = 0,
+       HAL_PM_AUTO             = 1,
+       HAL_PM_AWAKE            = 2,
+       HAL_PM_FULL_SLEEP       = 3,
+       HAL_PM_NETWORK_SLEEP    = 4
+} HAL_POWER_MODE;
+
+/*
+ * NOTE WELL:
+ * These are mapped to take advantage of the common locations for many of
+ * the bits on all of the currently supported MAC chips. This is to make
+ * the ISR as efficient as possible, while still abstracting HW differences.
+ * When new hardware breaks this commonality this enumerated type, as well
+ * as the HAL functions using it, must be modified. All values are directly
+ * mapped unless commented otherwise.
+ */
+typedef enum {
+       HAL_INT_RX      = 0x00000001,   /* Non-common mapping */
+       HAL_INT_RXDESC  = 0x00000002,
+       HAL_INT_RXNOFRM = 0x00000008,
+       HAL_INT_RXEOL   = 0x00000010,
+       HAL_INT_RXORN   = 0x00000020,
+       HAL_INT_TX      = 0x00000040,   /* Non-common mapping */
+       HAL_INT_TXDESC  = 0x00000080,
+       HAL_INT_TXURN   = 0x00000800,
+       HAL_INT_MIB     = 0x00001000,
+       HAL_INT_RXPHY   = 0x00004000,
+       HAL_INT_RXKCM   = 0x00008000,
+       HAL_INT_SWBA    = 0x00010000,
+       HAL_INT_BMISS   = 0x00040000,
+       HAL_INT_BNR     = 0x00100000,   /* Non-common mapping */
+       HAL_INT_GPIO    = 0x01000000,
+       HAL_INT_FATAL   = 0x40000000,   /* Non-common mapping */
+       HAL_INT_GLOBAL  = 0x80000000,   /* Set/clear IER */
+
+       /* Interrupt bits that map directly to ISR/IMR bits */
+       HAL_INT_COMMON  = HAL_INT_RXNOFRM
+                       | HAL_INT_RXDESC
+                       | HAL_INT_RXEOL
+                       | HAL_INT_RXORN
+                       | HAL_INT_TXURN
+                       | HAL_INT_TXDESC
+                       | HAL_INT_MIB



Home | Main Index | Thread Index | Old Index