提交 68c0bdff 编写于 作者: H Henk de Groot 提交者: Greg Kroah-Hartman

Staging: wlags49_h2: add Agere driver for HERMES II and HERMES II.5 chipsets

WLAN driver for cards using the HERMES II and HERMES II.5 chipset

Based on Agere Systems Linux LKM Wireless Driver Source Code,
Version 7.22; complies with Open Source BSD License.

The software is a modified version of wl_lkm_722_abg.tar.gz from the
Agere Systems website, addapted for Ubuntu 9.04 and modified to
fit in the current Linux kernel (2.6.31).

Modified for kernel 2.6 by Henk de Groot <pe1dnn@amsat.org>
Based on 7.18 version by Andrey Borzenkov <arvidjaar@mail.ru> $Revision: 39 $
Signed-off-by: NHenk de Groot <pe1dnn@amsat.org>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 349f535c
......@@ -125,6 +125,10 @@ source "drivers/staging/iio/Kconfig"
source "drivers/staging/ramzswap/Kconfig"
source "drivers/staging/wlags49_h2/Kconfig"
source "drivers/staging/wlags49_h25/Kconfig"
source "drivers/staging/strip/Kconfig"
source "drivers/staging/arlan/Kconfig"
......
......@@ -44,6 +44,8 @@ obj-$(CONFIG_RAR_REGISTER) += rar/
obj-$(CONFIG_DX_SEP) += sep/
obj-$(CONFIG_IIO) += iio/
obj-$(CONFIG_RAMZSWAP) += ramzswap/
obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/
obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/
obj-$(CONFIG_STRIP) += strip/
obj-$(CONFIG_ARLAN) += arlan/
obj-$(CONFIG_WAVELAN) += wavelan/
......
config WLAGS49_H2
tristate "Agere Systems HERMES II Wireless PC Card Model 0110"
depends on WLAN_80211 && WIRELESS_EXT
---help---
Driver for wireless cards using Agere's HERMES II chipset
which are identified with Manufacture ID: 0156,0003
The software is a modified version of wl_lkm_722_abg.tar.gz
from the Agere Systems website, addapted for Ubuntu 9.04.
#
# Makefile for wlags49_h2_cs.ko and wlags49_h25_cs.ko
#
# Default build for Hermes-II base cards (possibly identified with
# "manfid: 0x0156, 0x0003" in "pccardctl ident" output), comment
# -DHERMES25 below
#
# If you want to build for Hermes-II.5 base cards (possibly identified with
# "manfid: 0x0156, 0x0004" in "pccardctl ident" output), uncomment
# -DHERMES25 below
#
# If you want to build AP support (untested), comment out -DSTA_ONLY
INSTALLDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
EXTRA_CFLAGS += -I$(KERNELDIR)/include
EXTRA_CFLAGS += -I$(src) \
-DBUS_PCMCIA \
-DUSE_WPA \
-DUSE_WEXT \
-DSTA_ONLY \
-DWVLAN_49 \
# -DHERMES25 \
# -DDBG \
# -DDBG_LVL=5 \
# -DUSE_UIL \
# -DUSE_PROFILE \
ifeq ($(findstring HERMES25,$(EXTRA_CFLAGS)),)
WLNAME := wlags49_h2_cs
$(WLNAME)-y := sta_h2.o
ifeq ($(findstring STA_ONLY,$(EXTRA_CFLAGS)),)
$(WLNAME)-y += ap_h2.o
endif
else
WLNAME=wlags49_h25_cs
$(WLNAME)-y := sta_h25.o
ifeq ($(findstring STA_ONLY,$(EXTRA_CFLAGS)),)
$(WLNAME)-y += ap_h25.o
endif
endif
# If KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
obj-m += $(WLNAME).o
$(WLNAME)-y += wl_profile.o \
wl_wext.o \
wl_priv.o \
wl_main.o \
wl_enc.o \
wl_util.o \
wl_netdev.o \
wl_cs.o \
mmd.o \
hcf.o \
dhf.o
$(WLNAME)-$(CONFIG_SYSFS) += wl_sysfs.o
# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif
clean:
rm -fr *.o *.ko *.mod.c *.mod.o .*.*.cmd Module.symvers \
Module.markers modules.order .tmp_versions
install: default
-rmmod $(WLNAME)
install -d $(INSTALLDIR)
install -m 0644 -o root -g root $(WLNAME).ko $(INSTALLDIR)
/sbin/depmod -aq
=======================================================================
WLAN driver for cards using the HERMES II and HERMES II.5 chipset
HERMES II Card
PCMCIA Info: "Agere Systems" "Wireless PC Card Model 0110"
Manufacture ID: 0156,0003
HERMES II.5 Card
PCMCIA Info: "Linksys" "WCF54G_Wireless-G_CompactFlash_Card"
Manufacture ID: 0156,0004
Based on Agere Systems Linux LKM Wireless Driver Source Code,
Version 7.22; complies with Open Source BSD License.
=======================================================================
DESCRIPTION
The software is a modified version of wl_lkm_722_abg.tar.gz from the
Agere Systems website, addapted for Ubuntu 9.04.
Modified for kernel 2.6 by Henk de Groot <pe1dnn@amsat.org>
Based on 7.18 version by Andrey Borzenkov <arvidjaar@mail.ru> $Revision: 39 $
INSTALLATION
Unpack in a new directory.
Open a terminal screen.
Change directory to the source directory
Type command
make
and wait until it is finshed. Now you have build the module
wlags49_h2_cs; this module is meant for a HERMES II card.
The driver is tested with a Thomson SpeedTouch 110 Wireless PC Card.
For the test Station mode was used with WEP. The driver is supposed
to support WAP and as accesspoint that is NOT tested.
If you have a card using the HERMES II.5 chip you have to make
changes to the Makefile and uncomment -DHERMES25. This will build
driver wlags49_h25_cs.
Note: You can detemine the type with command "pccardctrl info"
MANIFID: 0156,0002 = HERMES - not supported by this driver
MANIFID: 0156,0003 = HERMES II (Wireless B)
MANIFID: 0156,0004 = HERMES II.5 (Wireless B/G)
After succesfull compile type command
sudo make install
to install the module.
Now the card should be recognized. It should be able to configure
and use the card with NetworkManager. Wpa_supplicant also works, as does
manual configuration using the iwconfig/iwlist programs.
Note: I only tested Station mode with WEP but if I didn't break anything
WPA and AP mode should also work; note however that WPA was experimental
in the original Agere driver!
Note: to compile as AP change the makefile and remove the line
-DSTA_ONLY \
(or comment it, but in that case make sure to move it after all the
flags you want to use)
CHANGES
The HCF functions to control the card are virtually unchanged, the only
changes are meant to fix compiler warnings. The only real change is in
HCF_WAIT_WHILE which now has a udelay(2) added to give a small delay.
The linux driver files (wl_xxxx.c) are changed in the following ways:
- Addaptations of Andrey Borzenkov applied to 7.22 source
- Alterations to avoid most HCF_ASSERTs
-- Switching interrupts off and on in the HCF
-- Bugfixes, things that were aparently wrong like reporting link status
change which checked a variable that was not changed in HCF anymore.
-- Used on WEP but setting keys via SIOCSIWENCODEEXT was not supported
-- Recovery actions added
The major problem was the order in which calls can be made. The original
looks like a traditonal UNIX driver. To call an "ioctl" function you
have to "open" the device first to get a handle and after "close" no
"ioctl" function can be called anymore. With the 2.6 driver this all
changed; the former ioctl functions are now called before "open" and
after "close", which was not expected. One of the problems was enable/
disable of interrupts in the HCF. Interrupt handling starts at "open"
so if a former "ioctl" routinge is called before "open" or after "close"
then nothing should be done with interrupt switching in the HCF. Once
this was solved most HCF_ASSERTS went away.
The last point, recovery actions added, needs some clarification.
Starting the card works most of the time, but unfortunately not always.
At a few times recovery code was added; when the card starts to
misbehave or the communication between the HCF and the card is
out of sync and the HCF enters DEFUNCT mode everything is reset and
reinitialized. Note, hcf.c contains a lot of documentation. It takes
some time but slowly some things become clear. Also some unresolved
issues are mentioned in hcf.c, so there are still unknown bugs.
The card problems are almost in all cases when starting up and before
the first association with an AP, once the card is in operation it
seems to stay that way; when debugging no HCF_ASSERTS appear anymore.
Note: some HCF_ASSERTS still appear, in a number of cases it is a real
error, for example at card removal the missing card is detected.
LICENSE
The Agere Systems license applies. This is why I include the original
README.wlags49. The instructions in that file are bogus now. I also
include the man page. Eventhough setting parameters on the module
does not work anymore but it provides some information about all the
settings.
I have not have personal contact with Agere, but others have. Agere
agreed to make their software available under the BSD licence.
This driver is based on the 7.22 version.
The following was mailed by Agere to Andrey Borzenkov about this:
--- Begin Message ---
* From: TJ <tj@xxxxxxxxxxx>
* Date: Mon, 05 Feb 2007 19:28:59 +0000
Hi Andrey,
I've got some good news for you/us/the world of Hermes :)
I got a reply from the legal representative at Agere confirming that
their source-code is BSD licensed, and I've included the contents of the
email here.
I hope this re-assures you so that your excellent work on the drivers
can be made widely available for other hackers to work with.
Regards,
TJ.
---------
On Mon, 2007-02-05 at 13:54 -0500, Pathare, Viren M (Viren) wrote:
"I would like to confirm that the two drivers; Linux LKM Wireless Driver
Source Code, Version 7.18 and Linux LKM Wireless Driver Source Code,
Version 7.22 comply with Open Source BSD License. Therefore the source
code can be distributed in unmodified or modified form consistent with
the terms of the license.
The Linux driver architecture was based on two modules, the MSF (Module
specific functions) and the HCF (Hardware Control Functions). Included
in the HCF is run-time firmware (binary format) which is downloaded into
the RAM of the Hermes 1/2/2.5 WMAC.
This hex coded firmware is not based on any open source software and
hence it is not subject to any Open Source License. The firmware was
developed by Agere and runs on the DISC processor embedded within the
Hermes 1/2/2.5 Wireless MAC devices.
Hope this helps.
Sincerely,
Viren Pathare
Intellectual Property Licensing Manager
Agere"
--- End Message ---
此差异已折叠。
These sources are shared with the wlags49_h25 driver. Some files are even
exclusively used by that driver. Do not delete them here without looking
at that other driver.
因为 它太大了无法显示 source diff 。你可以改为 查看blob
此差异已折叠。
/*******************************************************************************
* Agere Systems Inc.
* Wireless device driver for Linux (wlags49).
*
* Copyright (c) 1998-2003 Agere Systems Inc.
* All rights reserved.
* http://www.agere.com
*
* Initially developed by TriplePoint, Inc.
* http://www.triplepoint.com
*
*------------------------------------------------------------------------------
*
* This file contains definitions and macros for debugging.
*
*------------------------------------------------------------------------------
*
* SOFTWARE LICENSE
*
* This software is provided subject to the following terms and conditions,
* which you should read carefully before using the software. Using this
* software indicates your acceptance of these terms and conditions. If you do
* not agree with these terms and conditions, do not use the software.
*
* Copyright 2003 Agere Systems Inc.
* All rights reserved.
*
* Redistribution and use in source or binary forms, with or without
* modifications, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following Disclaimer as comments in the code as
* well as in the documentation and/or other materials provided with the
* distribution.
*
* . 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.
*
* . Neither the name of Agere Systems Inc. nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* Disclaimer
*
* THIS SOFTWARE IS PROVIDED AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, 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.
*
******************************************************************************/
/*******************************************************************************
* VERSION CONTROL INFORMATION
*******************************************************************************
*
* $Author: nico $
* $Date: 2004/07/20 09:29:45 $
* $Revision: 1.3 $
* $Source: /usr/local/cvs/wl_lkm/include/hcf/debug.h,v $
*
******************************************************************************/
#ifndef _DEBUG_H
#define _DEBUG_H
/* Turn on debugging here if not done with a preprocessor define */
#ifndef DBG
#define DBG 0
#else
#undef DBG
#define DBG 1
#endif //DBG
#if DBG
/****************************************************************************/
/* Set the level of debugging if not done with a preprocessor define. See
wl_main.c, init_module() for how the debug level translates into the
the types of messages displayed */
#ifndef DBG_LVL
#define DBG_LVL 5 /* yields nothing via init_module,
original value of 5 yields DBG_TRACE_ON and DBG_VERBOSE_ON */
#endif // DBG_LVL
#define DBG_ERROR_ON 0x00000001L
#define DBG_WARNING_ON 0x00000002L
#define DBG_NOTICE_ON 0x00000004L
#define DBG_TRACE_ON 0x00000008L
#define DBG_VERBOSE_ON 0x00000010L
#define DBG_PARAM_ON 0x00000020L
#define DBG_BREAK_ON 0x00000040L
#define DBG_RX_ON 0x00000100L
#define DBG_TX_ON 0x00000200L
#define DBG_DS_ON 0x00000400L
#define DBG_DEFAULTS (DBG_ERROR_ON | DBG_WARNING_ON | DBG_BREAK_ON)
#define DBG_FLAGS(A) (A)->DebugFlag
#define DBG_NAME(A) (A)->dbgName
#define DBG_LEVEL(A) (A)->dbgLevel
#ifndef PRINTK
# define PRINTK(S...) printk(S)
#endif // PRINTK
#ifndef DBG_PRINT
# define DBG_PRINT(S...) PRINTK(KERN_DEBUG S)
#endif // DBG_PRINT
#ifndef DBG_PRINTC
# define DBG_PRINTC(S...) PRINTK(S)
#endif // DBG_PRINTC
#ifndef DBG_TRAP
# define DBG_TRAP {}
#endif // DBG_TRAP
#define _ENTER_STR ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
#define _LEAVE_STR "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
#define _DBG_ENTER(A) DBG_PRINT("%s:%.*s:%s\n",DBG_NAME(A),++DBG_LEVEL(A),_ENTER_STR,__FUNC__)
#define _DBG_LEAVE(A) DBG_PRINT("%s:%.*s:%s\n",DBG_NAME(A),DBG_LEVEL(A)--,_LEAVE_STR,__FUNC__)
#define DBG_FUNC(F) static const char *__FUNC__ = F;
#define DBG_ENTER(A) {if (DBG_FLAGS(A) & DBG_TRACE_ON) _DBG_ENTER(A);}
#define DBG_LEAVE(A) {if (DBG_FLAGS(A) & DBG_TRACE_ON) _DBG_LEAVE(A);}
#define DBG_PARAM(A,N,F,S...) {if (DBG_FLAGS(A) & DBG_PARAM_ON) \
DBG_PRINT(" %s -- "F"\n",N,S);}
#define DBG_ERROR(A,S...) {if (DBG_FLAGS(A) & DBG_ERROR_ON) \
{DBG_PRINT("%s:ERROR:%s ",DBG_NAME(A),__FUNC__);DBG_PRINTC(S);DBG_TRAP;}}
#define DBG_WARNING(A,S...) {if (DBG_FLAGS(A) & DBG_WARNING_ON) \
{DBG_PRINT("%s:WARNING:%s ",DBG_NAME(A),__FUNC__);DBG_PRINTC(S);}}
#define DBG_NOTICE(A,S...) {if (DBG_FLAGS(A) & DBG_NOTICE_ON) \
{DBG_PRINT("%s:NOTICE:%s ",DBG_NAME(A),__FUNC__);DBG_PRINTC(S);}}
#define DBG_TRACE(A,S...) do {if (DBG_FLAGS(A) & DBG_TRACE_ON) \
{DBG_PRINT("%s:%s ",DBG_NAME(A),__FUNC__);DBG_PRINTC(S);}} while (0)
#define DBG_RX(A,S...) {if (DBG_FLAGS(A) & DBG_RX_ON) \
{DBG_PRINT(S);}}
#define DBG_TX(A,S...) {if (DBG_FLAGS(A) & DBG_TX_ON) \
{DBG_PRINT(S);}}
#define DBG_DS(A,S...) {if (DBG_FLAGS(A) & DBG_DS_ON) \
{DBG_PRINT(S);}}
#define DBG_ASSERT(C) {if (!(C)) \
{DBG_PRINT("ASSERT(%s) -- %s#%d (%s)\n", \
#C,__FILE__,__LINE__,__FUNC__); \
DBG_TRAP;}}
typedef struct {
char *dbgName;
int dbgLevel;
unsigned long DebugFlag;
} dbg_info_t;
/****************************************************************************/
#else // DBG
/****************************************************************************/
#define DBG_DEFN
#define DBG_TRAP
#define DBG_FUNC(F)
#define DBG_PRINT(S...)
#define DBG_ENTER(A)
#define DBG_LEAVE(A)
#define DBG_PARAM(A,N,F,S...)
#define DBG_ERROR(A,S...)
#define DBG_WARNING(A,S...)
#define DBG_NOTICE(A,S...)
#define DBG_TRACE(A,S...)
#define DBG_RX(A,S...)
#define DBG_TX(A,S...)
#define DBG_DS(A,S...)
#define DBG_ASSERT(C)
#endif // DBG
/****************************************************************************/
#endif // _DEBUG_H
// vim:tw=110:ts=4:
/**************************************************************************************************************
*
* FILE : DHF.C
*
* DATE : $Date: 2004/07/19 08:16:14 $ $Revision: 1.2 $
* Original : 2004/05/28 14:05:34 Revision: 1.36 Tag: hcf7_t20040602_01
* Original : 2004/05/11 06:22:57 Revision: 1.32 Tag: hcf7_t7_20040513_01
* Original : 2004/04/15 09:24:42 Revision: 1.28 Tag: hcf7_t7_20040415_01
* Original : 2004/04/08 15:18:16 Revision: 1.27 Tag: t7_20040413_01
* Original : 2004/04/01 15:32:55 Revision: 1.25 Tag: t7_20040401_01
* Original : 2004/03/10 15:39:28 Revision: 1.21 Tag: t20040310_01
* Original : 2004/03/04 11:03:37 Revision: 1.19 Tag: t20040304_01
* Original : 2004/03/02 09:27:11 Revision: 1.17 Tag: t20040302_03
* Original : 2004/02/24 13:00:28 Revision: 1.15 Tag: t20040224_01
* Original : 2004/02/19 10:57:28 Revision: 1.14 Tag: t20040219_01
* Original : 2003/11/27 09:00:09 Revision: 1.3 Tag: t20021216_01
*
* AUTHOR : John Meertens
* Nico Valster
*
* SPECIFICATION: ........
*
* DESC : generic functions to handle the download of NIC firmware
* Local Support Routines for above procedures
*
* Customizable via HCFCFG.H, which is included by HCF.H
*
*
* DHF is (intended to be) platform-independent.
* DHF is a module that provides a number of routines to download firmware
* images (the names primary, station, access point, secondary and tertiary
* are used or have been used) to volatile or nonvolatile memory
* in WaveLAN/IEEE NICs. To achieve this DHF makes use of the WaveLAN/IEEE
* WCI as implemented by the HCF-module.
*
* Download to non-volatile memory is used to update a WaveLAN/IEEE NIC to new
* firmware. Normally this will be an upgrade to newer firmware, although
* downgrading to older firmware is possible too.
*
* Note: relative to Asserts, the following can be observed:
* Since the IFB is not known inside the routine, the macro HCFASSERT is replaced with MMDASSERT.
* Also the line number reported in the assert is raised by FILE_NAME_OFFSET (10000) to discriminate the
* DHF Asserts from HCF and MMD asserts.
*
***************************************************************************************************************
*
*
* SOFTWARE LICENSE
*
* This software is provided subject to the following terms and conditions,
* which you should read carefully before using the software. Using this
* software indicates your acceptance of these terms and conditions. If you do
* not agree with these terms and conditions, do not use the software.
*
* COPYRIGHT © 1999 - 2000 by Lucent Technologies. All Rights Reserved
* COPYRIGHT © 2001 - 2004 by Agere Systems Inc. All Rights Reserved
* All rights reserved.
*
* Redistribution and use in source or binary forms, with or without
* modifications, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following Disclaimer as comments in the code as
* well as in the documentation and/or other materials provided with the
* distribution.
*
* . 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.
*
* . Neither the name of Agere Systems Inc. nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* Disclaimer
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, 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.
*
*
**************************************************************************************************************/
#include "hcf.h"
#include "hcfdef.h"
#include "dhf.h"
#include "mmd.h"
//to distinguish MMD from HCF asserts by means of line number
#undef FILE_NAME_OFFSET
#define FILE_NAME_OFFSET MMD_FILE_NAME_OFFSET
/*-----------------------------------------------------------------------------
*
* Defines, data structures, and global variables
*
*---------------------------------------------------------------------------*/
// 12345678901234
char signature[14] = "FUPU7D37dhfwci";
//The binary download function "relocates" the image using constructions like:
// fw->identity = (CFG_IDENTITY_STRCT FAR *)((char FAR *)fw->identity + (hcf_32)fw );
//under some of the memory models under MSVC 1.52 these constructions degrade to 16-bits pointer arithmetic.
//fw->identity is limited, such that adding it to fw, does not need to carry over from offset to segment.
//However the segment is not set at all.
//As a workaround the PSEUDO_CHARP macro is introduced which is a char pointer except for MSVC 1.52, in
//which case we know that a 32-bit quantity is adequate as a pointer.
//Note that other platforms may experience comparable problems when using the binary download feature.
#if defined(_MSC_VER) && _MSC_VER == 800 // Visual C++ 1.5
#define PSEUDO_CHARP hcf_32
#else
#define PSEUDO_CHARP hcf_8*
#endif
/*-----------------------------------------------------------------------------
*
* LTV-records retrieved from the NIC to:
* - determine compatibility between NIC and image
* - ((setup the buffer size dynamically for non-volatile download (see note below) ))
* - supply plugging information contained in the PDA (H-I only)
*
*---------------------------------------------------------------------------*/
// for USB/H1 we needed a smaller value than the CFG_DL_BUF_STRCT reported 8192
// for the time being it seems simpler to always use 2000 for USB/H1 as well as all other cases rather than
// using the "fixed anyway" CFG_DL_BUF_STRCT.
#define DL_SIZE 2000
//CFG_IDENTITY_STRCT pri_identity = { LOF(CFG_IDENTITY_STRCT), CFG_PRI_IDENTITY };
CFG_SUP_RANGE_STRCT mfi_sup = { LOF(CFG_SUP_RANGE_STRCT), CFG_NIC_MFI_SUP_RANGE };
CFG_SUP_RANGE_STRCT cfi_sup = { LOF(CFG_SUP_RANGE_STRCT), CFG_NIC_CFI_SUP_RANGE };
/* Note: could be used rather than the above explained and defined DL_SIZE if need arises
* CFG_DL_BUF_STRCT dl_buf = { LOF(CFG_DL_BUF_STRCT), CFG_DL_BUF };
*/
/*-----------------------------------------------------------------------------
* Array ltv_info stores NIC information (in the form of LTV-records)
* needed for download. A NULL record indicates the end of the array.
*---------------------------------------------------------------------------*/
/* The LTV_INFO_STRUCT is needed to save the sizes of the structs, because after a GET_INFO()
* the len field is changed to the real len of the RID by the called routine.
* This is only relevant if the DHF used without reloading the driver/utility.
*/
LTV_INFO_STRUCT ltv_info[] = {
{ (LTVP)&mfi_sup, LOF(CFG_SUP_RANGE_STRCT) } ,
{ (LTVP)&cfi_sup, LOF(CFG_SUP_RANGE_STRCT) } ,
{ (LTVP) NULL, 0 }
};
/***********************************************************************************************************/
/*************************************** PROTOTYPES ******************************************************/
/***********************************************************************************************************/
static int check_comp_fw( memimage *fw );
/************************************************************************************************************
*.SUBMODULE int check_comp_fw( memimage *fw )
*.PURPOSE Checks compatibility of CFI and MFI, NIC as supplier, station/AP firmware image as supplier.
*
*.ARGUMENTS
* fw F/W image to be downloaded
*
*.RETURNS
* HFC_SUCCESS - firmware OK
* DHF_ERR_INCOMP_FW
*
*.DESCRIPTION
* This function uses compatibility and identity information that has been
* retrieved from the card which is currently inserted to check whether the
* station firmware image to be downloaded is compatible.
*.ENDDOC END DOCUMENTATION
*************************************************************************************************************/
int
check_comp_fw( memimage *fw )
{
CFG_RANGE20_STRCT *p;
int rc = HCF_SUCCESS;
CFG_RANGE_SPEC_STRCT* i;
switch( fw->identity->typ ) {
case CFG_FW_IDENTITY: //Station F/W
case COMP_ID_FW_AP_FAKE: //;?is this useful (used to be: CFG_AP_IDENTITY)
break;
default:
MMDASSERT( DO_ASSERT, fw->identity->typ ) //unknown/unsupported firmware_type:
rc = DHF_ERR_INCOMP_FW;
return rc; /* ;? how useful is this anyway,
* till that is sorted out might as well violate my own single exit principle
*/
}
p = fw->compat;
i = NULL;
while( p->len && i == NULL ) { // check the MFI ranges
if ( p->typ == CFG_MFI_ACT_RANGES_STA ) {
i = mmd_check_comp( (void*)p, &mfi_sup );
}
p++;
}
MMDASSERT( i, 0 ) //MFI: NIC Supplier not compatible with F/W image Actor
if ( i ) {
p = fw->compat;
i = NULL;
while ( p->len && i == NULL ) { // check the CFI ranges
if ( p->typ == CFG_CFI_ACT_RANGES_STA ) {
i = mmd_check_comp( (void*)p, &cfi_sup );
}
p++;
}
MMDASSERT( i, 0 ) //CFI: NIC Supplier not compatible with F/W image Actor
}
if ( i == NULL ) {
rc = DHF_ERR_INCOMP_FW;
}
return rc;
} // check_comp_fw
/*-----------------------------------------------------------------------------
*
* Exported functions
*
*---------------------------------------------------------------------------*/
/*************************************************************************************************************
*
*.MODULE int dhf_download_binary( void *ifbp, memimage *fw )
*.PURPOSE Downloads a complete (primary, station, or access point) firmware image to the NIC.
*
*.ARGUMENTS
* ifbp address of the Interface Block
* fw F/W image to be downloaded
*
*.RETURNS
* HCF_SUCCESS - download completed successfully.
* DHF_ERR_INCOMP_FW - firmware not compatible
*
*.DESCRIPTION
* Initialize global variables
* Connect to the DHF
* Check the compatibility of the image (For primary firmware images it is checked first
* whether download is necessary).
* If everything's download the firmware.
* Disconnect from the DHF.
*
*
*.DIAGRAM
*
*.NOTICE:
MMDASSERT is unacceptable because some drivers call dhf_download_binary before hcf_connect
* The old comment was:
*.ENDDOC END DOCUMENTATION
*************************************************************************************************************/
int
dhf_download_binary( memimage *fw )
{
int rc = HCF_SUCCESS;
CFG_PROG_STRCT *p;
int i;
//validate the image
for ( i = 0; i < sizeof(signature) && fw->signature[i] == signature[i]; i++ ) /*NOP*/;
if ( i != sizeof(signature) ||
fw->signature[i] != 0x01 ||
//test for Little/Big Endian Binary flag
fw->signature[i+1] != ( /*HCF_BIG_ENDIAN ? 'B' : */ 'L' ) ) rc = DHF_ERR_INCOMP_FW;
else { //Little Endian Binary format
fw->codep = (CFG_PROG_STRCT FAR *)((PSEUDO_CHARP)fw->codep + (hcf_32)fw );
fw->identity = (CFG_IDENTITY_STRCT FAR *)((PSEUDO_CHARP)fw->identity + (hcf_32)fw );
fw->compat = (CFG_RANGE20_STRCT FAR *)((PSEUDO_CHARP)fw->compat + (hcf_32)fw );
for ( i = 0; fw->p[i]; i++ ) fw->p[i] = ((PSEUDO_CHARP)fw->p[i] + (hcf_32)fw );
p = fw->codep;
while ( p->len ) {
p->host_addr = (PSEUDO_CHARP)p->host_addr + (hcf_32)fw;
p++;
}
}
return rc;
} // dhf_download_binary
/*************************************************************************************************************
*
*.MODULE int dhf_download_fw( void *ifbp, memimage *fw )
*.PURPOSE Downloads a complete (primary or tertiary) firmware image to the NIC.
*
*.ARGUMENTS
* ifbp address of the Interface Block
* fw F/W image to be downloaded
*
*.RETURNS
* HCF_SUCCESS - download completed successfully.
* HCF_ERR_NO_NIC - no NIC present
* DHF_ERR_INCOMP_FW - firmware not compatible
*
*.DESCRIPTION
* - check the signature of the image
* - get the compatibility information from the components on the NIC
* - Primary Firmware Identity
* - Modem - Firmware I/F
* - Controller - Firmware I/F
*!! - if necessary ( i.e. H-I) get the PDA contents from the NIC
* - check the compatibility of the MFI and CFI of the NIC with the F/W image
* Note: the Primary F/W compatibility is only relevant for the "running" HCF and is already verified in
* hcf_connect
*!! - if necessary ( i.e. H-I)
*!! - verify the sumcheck of the PDA
*!! - plug the image (based on the PDA and the default plug records)
* - loop over all the download LTVs in the image which consists of a sequence of
* - CFG_PROG_VOLATILE/CFG_PROG_NON_VOLATILE
* - 1 or more sequences of CFG_PROG_ADDR, CFG_PROG_DATA,....,CFG_PROG_DATA
* - CFG_PROG_STOP
*
*.DIAGRAM
*
*.NOTICE
* The old comment was:
* // Download primary firmware if necessary and allowed. This is done silently (without telling
* // the user) and only if the firmware in the download image is newer than the firmware in the
* // card. In Major version 4 of the primary firmware functions of Hermes and Shark were
* // combined. Prior to that two separate versions existed. We only have to download primary
* // firmware if major version of primary firmware in the NIC < 4.
* // download = pri_identity.version_major < 4;
* // if ( download ) {
* // rc = check_comp_primary( fw );
* // }
* It is my understanding that Pri Variant 1 must be updated by Pri Variant 2. The test on
* major version < 4 should amount to the same result but be "principally" less correct
* In deliberation with the Architecture team, it was decided that this upgrade for old H-I
* NICs, is an aspect which belongs on the WSU level not on the DHF level
*
*.ENDDOC END DOCUMENTATION
*************************************************************************************************************/
int
dhf_download_fw( void *ifbp, memimage *fw )
{
int rc = HCF_SUCCESS;
LTV_INFO_STRUCT_PTR pp = ltv_info;
CFG_PROG_STRCT *p = fw->codep;
LTVP ltvp;
int i;
MMDASSERT( fw != NULL, 0 )
//validate the image
for ( i = 0; i < sizeof(signature) && fw->signature[i] == signature[i]; i++ ) /*NOP*/;
if ( i != sizeof(signature) ||
fw->signature[i] != 0x01 ||
//check for binary image
( fw->signature[i+1] != 'C' && fw->signature[i+1] != ( /*HCF_BIG_ENDIAN ? 'B' : */ 'L' ) ) )
rc = DHF_ERR_INCOMP_FW;
// Retrieve all information needed for download from the NIC
while ( ( rc == HCF_SUCCESS ) && ( ( ltvp = pp->ltvp) != NULL ) ) {
ltvp->len = pp++->len; // Set len to original len. This len is changed to real len by GET_INFO()
rc = GET_INFO( ltvp );
MMDASSERT( rc == HCF_SUCCESS, rc )
MMDASSERT( rc == HCF_SUCCESS, ltvp->typ )
MMDASSERT( rc == HCF_SUCCESS, ltvp->len )
}
if ( rc == HCF_SUCCESS ) rc = check_comp_fw( fw );
if ( rc == HCF_SUCCESS ) {
while ( rc == HCF_SUCCESS && p->len ) {
rc = PUT_INFO( p );
p++;
}
}
MMDASSERT( rc == HCF_SUCCESS, rc )
return rc;
} // dhf_download_fw
// vim:tw=110:ts=4:
#ifndef DHF_H
#define DHF_H
/**************************************************************************************************************
*
* FILE : DHF.H
*
* DATE : $Date: 2004/07/19 08:16:14 $ $Revision: 1.2 $
* Original : 2004/05/17 07:33:13 Revision: 1.25 Tag: hcf7_t20040602_01
* Original : 2004/05/11 06:03:14 Revision: 1.24 Tag: hcf7_t7_20040513_01
* Original : 2004/04/15 09:24:42 Revision: 1.22 Tag: hcf7_t7_20040415_01
* Original : 2004/04/09 14:35:52 Revision: 1.21 Tag: t7_20040413_01
* Original : 2004/04/01 15:32:55 Revision: 1.18 Tag: t7_20040401_01
* Original : 2004/03/10 15:39:28 Revision: 1.15 Tag: t20040310_01
* Original : 2004/03/04 11:03:38 Revision: 1.13 Tag: t20040304_01
* Original : 2004/02/25 14:14:37 Revision: 1.11 Tag: t20040302_03
* Original : 2004/02/24 13:00:28 Revision: 1.10 Tag: t20040224_01
* Original : 2004/02/19 10:57:28 Revision: 1.8 Tag: t20040219_01
*
* AUTHOR : John Meertens
* Nico Valster
*
* SPECIFICATION: .........
*
* DESC : structure definitions and function prototypes for unit DHF.
*
* Customizable via HCFCFG.H, which is included indirectly via HCF.H
*
***************************************************************************************************************
*
*
* SOFTWARE LICENSE
*
* This software is provided subject to the following terms and conditions,
* which you should read carefully before using the software. Using this
* software indicates your acceptance of these terms and conditions. If you do
* not agree with these terms and conditions, do not use the software.
*
* COPYRIGHT © 1994 - 1995 by AT&T. All Rights Reserved
* COPYRIGHT © 1999 - 2000 by Lucent Technologies. All Rights Reserved
* COPYRIGHT © 2001 - 2004 by Agere Systems Inc. All Rights Reserved
* All rights reserved.
*
* Redistribution and use in source or binary forms, with or without
* modifications, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following Disclaimer as comments in the code as
* well as in the documentation and/or other materials provided with the
* distribution.
*
* . 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.
*
* . Neither the name of Agere Systems Inc. nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* Disclaimer
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, 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.
*
*
**************************************************************************************************************/
#ifdef _WIN32_WCE
#include <windef.h>
#endif
#include "hcf.h" // includes HCFCFG.H too
#ifdef DHF_UIL
#define GET_INFO( pp ) uil_get_info( (LTVP)pp )
#define PUT_INFO( pp ) uil_put_info( (LTVP)pp )
#else
#define GET_INFO( pp ) hcf_get_info( ifbp, (LTVP)pp )
#define PUT_INFO( pp ) hcf_put_info( ifbp, (LTVP)pp )
#endif
/*---- Defines --------------------------------------------------------------*/
#define CODEMASK 0x0000FFFFL // Codemask for plug records
/*---- Error numbers --------------------------------------------------------*/
#define DHF_ERR_INCOMP_FW 0x40 //Image not compatible with NIC
/*---- Type definitions -----------------------------------------------------*/
//* needed by dhf_wrap.c
//
typedef struct {
LTVP ltvp;
hcf_16 len;
} LTV_INFO_STRUCT , *LTV_INFO_STRUCT_PTR;
/*
* Type: plugrecord
*
* Abstract: This structure represents a Plug Data Record.
*
* Description:
* This structure is used to overlay the plug records in the firmware memory image.
*/
typedef struct {
hcf_32 code; // Code to plug
hcf_32 addr; // Address within the memory image to plug it in
hcf_32 len; // The # of bytes which are available to store it
} plugrecord;
/*
* Type: stringrecord
*
* Abstract: This structure represents a Firmware debug/assert string
*
* Description:
* This structure is used to get assert and debug outputs in the driver and/or utility to be
* able to get more visability of the FW.
*/
#define MAX_DEBUGSTRINGS 1024
#define MAX_DEBUGSTRING_LEN 82
typedef struct {
hcf_32 id;
char str[MAX_DEBUGSTRING_LEN];
} stringrecord;
/*
* Type: exportrecord
*
* Abstract: This structure represents a Firmware export of a variable
*
* Description:
* This structure is used to get the address and name of a FW variable.
*/
#define MAX_DEBUGEXPORTS 2048
#define MAX_DEBUGEXPORT_LEN 12
typedef struct {
hcf_32 id;
char str[MAX_DEBUGEXPORT_LEN];
} exportrecord;
// Offsets in memimage array p[]
#define FWSTRINGS_FUNCTION 0
#define FWEXPORTS_FUNCTION 1
/*
* Type: memimage
*
* Abstract: The "root" description of a complete memory image
*
* Description:
* This type represents an entire memory image. The image is built up of several
* segments. These segments need not be contiguous areas in memory, in other words
* the image may contain 'holes'.
*
* The 'codep' field points to an array of segment_descriptor structures.
* The end of the array is indicated by a segment_descriptor of which all fields are zero.
* The 'execution' field is a 32-bit address representing the execution address
* of the firmware within the memory image. This address is zero in case of non-volatile
* memory download.
* The 'compat' field points to an array of TODO
* The end of the array is indicated by a plug record of which all fields are zero.
* The 'identity' field points to an array of TODO
* The end of the array is indicated by a plug record of which all fields are zero.
* The Hermes-I specific 'pdaplug' field points to an array of Production Data Plug record structures.
* The end of the array is indicated by a plug record of which all fields are zero.
* The Hermes-I specific 'priplug' field points to an array of Primary Information Plug record structures.
* The end of the array is indicated by a plug record of which all fields are zero.
*/
typedef struct {
char signature[14+1+1]; // signature (see DHF.C) + C/LE-Bin/BE-Bin-flag + format version
CFG_PROG_STRCT FAR *codep; //
hcf_32 execution; // Execution address of the firmware
void FAR *place_holder_1;
void FAR *place_holder_2;
CFG_RANGE20_STRCT FAR *compat; // Pointer to the compatibility info records
CFG_IDENTITY_STRCT FAR *identity; // Pointer to the identity info records
void FAR *p[2]; /* (Up to 9) pointers for (future) expansion
* currently in use:
* - F/W printf information
*/
} memimage;
/*-----------------------------------------------------------------------------
*
* DHF function prototypes
*
*---------------------------------------------------------------------------*/
EXTERN_C int dhf_download_fw( void *ifbp, memimage *fw ); // ifbp, ignored when using the UIL
EXTERN_C int dhf_download_binary( memimage *fw );
/*-----------------------------------------------------------------------------
*
* Functions to be provided by the user of the DHF module.
*
*---------------------------------------------------------------------------*/
// defined in DHF.C; see there for comments
EXTERN_C hcf_16 *find_record_in_pda( hcf_16 *pdap, hcf_16 code );
#endif // DHF_H
/*******************************************************************************
* Agere Systems Inc.
* Wireless device driver for Linux (wlags49).
*
* Copyright (c) 1998-2003 Agere Systems Inc.
* All rights reserved.
* http://www.agere.com
*
* Initially developed by TriplePoint, Inc.
* http://www.triplepoint.com
*
*------------------------------------------------------------------------------
*
* This file contains DHF configuration info.
*
*------------------------------------------------------------------------------
*
* SOFTWARE LICENSE
*
* This software is provided subject to the following terms and conditions,
* which you should read carefully before using the software. Using this
* software indicates your acceptance of these terms and conditions. If you do
* not agree with these terms and conditions, do not use the software.
*
* Copyright © 2003 Agere Systems Inc.
* All rights reserved.
*
* Redistribution and use in source or binary forms, with or without
* modifications, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following Disclaimer as comments in the code as
* well as in the documentation and/or other materials provided with the
* distribution.
*
* . 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.
*
* . Neither the name of Agere Systems Inc. nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* Disclaimer
*
* THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, 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.
*
******************************************************************************/
/*******************************************************************************
* VERSION CONTROL INFORMATION
*******************************************************************************
*
* $Author: nico $
* $Date: 2004/07/19 07:08:33 $
* $Revision: 1.1.1.1 $
* $Source: /usr/local/cvs/wl_lkm/include/hcf/dhfcfg.h,v $
*
******************************************************************************/
#ifndef DHFCFG_H
#define DHFCFG_H
/*-----------------------------------------------------------------------------
* File DHFCFG.H
*
* Contents: #defines for the DHF module
*
* Comments:
* Some combinations of the #defines in this file are illegal (as noted below).
* If an illegal combinations of #defines is specified a compile error is
* generated. See document DHFUG.DOC for more information.
*
* Author: John Meertens
* Date: 11-01-2000
*
* Change history:
*---------------------------------------------------------------------------*/
// Define DHF_WCI if you want to use the WCI to access the ORiNOCO card.
// Define DHF_UIL if you want to use the UIL to access the ORiNOCO card.
// You must define either DHF_WCI or DHF_UIL. If neither of the two is defined
// or both a compile error is generated.
#define DHF_WCI
//!!!#define DHF_UIL
// Define DHF_BIG_ENDIAN if you are working on a big endian platform.
// Define DHF_LITTLE_ENDIAN if you are working on a little endian platform.
// You must define either DHF_BIG_ENDIAN or DHF_LITTLE_ENDIAN. If neither of
// the two is defined or both a compile error is generated.
#ifdef USE_BIG_ENDIAN
#define DHF_BIG_ENDIAN
#else
#define DHF_LITTLE_ENDIAN
#endif /* USE_BIG_ENDIAN */
// Define DHF_WIN if you are working on Windows platform.
// Define DHF_DOS if you are working on DOS.
// You must define either DHF_WIN or DHF_DOS. If neither of
// the two is defined or both a compile error is generated.
//!!!#define DHF_WIN
//!!!#define DHF_DOS
// Define if you want the DHF to users. Not defining DHF_GET_RES_MSG
// leads to a decrease in code size as message strings are not included.
//!!!#define DHF_GET_RES_MSG
// Linux driver specific
// Prevent inclusion of stdlib.h and string.h
#define _INC_STDLIB
#define _INC_STRING
//-----------------------------------------------------------------------------
// Define one or more of the following DSF #defines if you want to implement
// the related DSF-function. Function dsf_callback must allways be implemented.
// See file DHF.H for prototypes of the functions.
// Define DSF_ALLOC if you want to manage memory allocation and de-allocation
// for the DHF. If DSF_ALLOC is defined you must implement dsf_alloc and dsf_free.
//!!!#define DSF_ALLOC
// Define DSF_CONFIRM if you want the DHF to ask the user for confirmation in a
// number of situations. If DSF_CONFIRM is defined you must implement dsf_confirm.
// Not defining DSF_CONFIRM leads to a decrease in code size as confirmation
// strings are not included.
//!!!#define DSF_CONFIRM
// Define DSF_DEBUG_MESSAGE if you want debug messages added to your output.
// If you define DSF_DEBUG_MESSAGE then you must implement function
// dsf_debug_message.
//#define DSF_DEBUG_MESSAGE
// Define DSF_ASSERT if you want asserts to be activated.
// If you define DSF_ASSERT then you must implement function dsf_assert.
//#define DBG 1
//#define DSF_ASSERT
// Define DSF_DBWIN if you want asserts and debug messages to be send to a debug
// window like SOFTICE or DebugView from SysInternals.
//!!!#define DSF_DBWIN
//!!! Not implemented yet!
// Define DSF_VOLATILE_ONLY if you only wants to use valatile functions
// This is a typical setting for a AP and a driver.
#define DSF_VOLATILE_ONLY
// Define DSF_HERMESII if you want to use the DHF for the Hermes-II
#ifdef HERMES2
#define DSF_HERMESII
#else
#undef DSF_HERMESII
#endif // HERMES2
// Define DSF_BINARY_FILE if you want to use the DHF in combination with
// reading the Firmware from a separate binary file.
//!!!#define DSF_BINARY_FILE
#endif // DHFCFG_H
此差异已折叠。
// vim:tw=110:ts=4:
#ifndef HCF_H
#define HCF_H 1
/************************************************************************************************************
*
* FILE : hcf.h
*
* DATE : $Date: 2004/08/05 11:47:10 $ $Revision: 1.7 $
* Original: 2004/05/19 07:26:01 Revision: 1.56 Tag: hcf7_t20040602_01
* Original: 2004/05/12 08:47:23 Revision: 1.53 Tag: hcf7_t7_20040513_01
* Original: 2004/04/15 09:24:42 Revision: 1.46 Tag: hcf7_t7_20040415_01
* Original: 2004/04/08 15:18:16 Revision: 1.45 Tag: t7_20040413_01
* Original: 2004/04/01 15:32:55 Revision: 1.43 Tag: t7_20040401_01
* Original: 2004/03/10 15:39:28 Revision: 1.39 Tag: t20040310_01
* Original: 2004/03/04 11:03:38 Revision: 1.37 Tag: t20040304_01
* Original: 2004/03/02 14:51:21 Revision: 1.35 Tag: t20040302_03
* Original: 2004/02/24 13:00:28 Revision: 1.28 Tag: t20040224_01
* Original: 2004/02/09 14:50:14 Revision: 1.26 Tag: t20040219_01
*
* AUTHOR : Nico Valster
*
* SPECIFICATION: ..........
*
* DESC : Definitions and Prototypes for MSF as well as HCF sources
*
* Customizable via HCFCFG.H
*
*
**************************************************************************************************************
**************************************************************************************************************
*
*
* SOFTWARE LICENSE
*
* This software is provided subject to the following terms and conditions,
* which you should read carefully before using the software. Using this
* software indicates your acceptance of these terms and conditions. If you do
* not agree with these terms and conditions, do not use the software.
*
* COPYRIGHT © 1994 - 1995 by AT&T. All Rights Reserved
* COPYRIGHT © 1996 - 2000 by Lucent Technologies. All Rights Reserved
* COPYRIGHT © 2001 - 2004 by Agere Systems Inc. All Rights Reserved
* All rights reserved.
*
* Redistribution and use in source or binary forms, with or without
* modifications, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following Disclaimer as comments in the code as
* well as in the documentation and/or other materials provided with the
* distribution.
*
* . 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.
*
* . Neither the name of Agere Systems Inc. nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* Disclaimer
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, 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.
*
*
*************************************************************************************************************/
#include "hcfcfg.h" // System Constants to be defined by the MSF-programmer to tailor the HCF
#include "mdd.h" // Include file common for HCF, MSF
/************************************************************************************************/
/************************************** MACROS ************************************************/
/************************************************************************************************/
#define LOF(x) (sizeof(x)/sizeof(hcf_16)-1)
/* Endianess
* Little Endian (a.k.a. Intel), least significant byte first
* Big Endian (a.k.a. Motorola), most significant byte first
*
* The following macros are supplied
* o CNV_LITTLE_TO_SHORT(w) interprets the 16-bits input value as Little Endian, returns an hcf_16
* o CNV_BIG_TO_SHORT(w) interprets the 16-bits input value as Big Endian, returns an hcf_16
*
*/
/* To increase portability, use unsigned char and unsigned char * when accessing parts of larger
* types to convert their Endianess
*/
#define CNV_END_SHORT(w) (hcf_16)( ((hcf_16)(w) & 0x00FF) << 8 | ((hcf_16)(w) & 0xFF00) >> 8 )
#define CNV_END_LONG(dw) (hcf_32)( (dw >> 24) | ((dw >> 8) & 0xff00) | ((dw << 8) & 0xff0000) | (dw << 24) )
#if HCF_BIG_ENDIAN
//******************************************** B I G E N D I A N *******************************************
#define CNV_LITTLE_TO_SHORT(w) CNV_END_SHORT(w) // endianess conversion needed
#define CNV_BIG_TO_SHORT(w) (w) // no endianess conversion needed
#define CNV_LITTLE_TO_LONG(dw) CNV_END_LONG(dw)
#define CNV_LONG_TO_LITTLE(dw) CNV_END_LONG(dw)
#else
//****************************************** L I T T L E E N D I A N ****************************************
#define CNV_LITTLE_TO_SHORT(w) (w) // no endianess conversion needed
#define CNV_BIG_TO_SHORT(w) CNV_END_SHORT(w) // endianess conversion needed
#define CNV_LITTLE_TO_LONG(dw) (dw)
#define CNV_LONG_TO_LITTLE(dw) (dw)
#if defined HCF_ALIGN && HCF_ALIGN > 1
#define CNV_SHORTP_TO_LITTLE(pw) ((hcf_16)(*(hcf_8 *)pw)) | ((hcf_16)(*((hcf_8 *)pw+1)) << 8)
#define CNV_LONGP_TO_LITTLE(pdw) ((hcf_32)(*(hcf_8 *)pdw)) | ((hcf_32)(*((hcf_8 *)pdw+1)) << 8) | \
((hcf_32)(*((hcf_8 *)pdw+2)) << 16) | ((hcf_32)(*((hcf_8 *)pdw+3)) << 24)
#else
#define CNV_LONGP_TO_LITTLE(pdw) (*(hcf_32 *)pdw)
#define CNV_SHORTP_TO_LITTLE(pw) (*(hcf_16 *)pw)
#endif
#endif // HCF_BIG_ENDIAN
// conversion macros which can be expressed in other macros
#define CNV_SHORT_TO_LITTLE(w) CNV_LITTLE_TO_SHORT(w)
#define CNV_SHORT_TO_BIG(w) CNV_BIG_TO_SHORT(w)
/************************************************************************************************/
/************************************** END OF MACROS *****************************************/
/************************************************************************************************/
/***********************************************************************************************************/
/***************** ****************************************/
/***********************************************************************************************************/
// offsets Transmit/Receive Frame Structure
#define HFS_STAT 0x0000
#define HFS_SWSUP 0x0006 //SW Support
#define HFS_Q_INFO 0x0006 //Signal/Silence level
#define HFS_RATE 0x0008 //RxFlow/Rate
#define HFS_STAT_ERR RX_STAT_ERR //link "natural" HCF name to "natural" MSF name
#define HFS_TX_CNTL 0x0036
// H-I H-II
#define HFS_DAT_LEN (HFS_ADDR_DEST - 2) // 0x002C 0x0038
#define HFS_ADDR_DEST 0x003A // 0x002E 0x003A
#define HFS_ADDR_SRC (HFS_ADDR_DEST + 6) // 0x0034 0x0040
#define HFS_LEN (HFS_ADDR_SRC + 6) // 0x003A 0x0046
#define HFS_DAT (HFS_LEN + 2) // 0x003C 0x0048
#define HFS_TYPE (HFS_DAT + 6) // 0x0042 0x004E
//============================= D E S C R I P T O R S T R U C T U R E ==============================
//;?MDD.H stuff ;?
#if HCF_BIG_ENDIAN
#define DESC_STRCT_CNT 0
#define DESC_STRCT_SIZE 1
#else
#define DESC_STRCT_CNT 1
#define DESC_STRCT_SIZE 0
#endif // HCF_BIG_ENDIAN
#define BUF_CNT buf_dim[DESC_STRCT_CNT]
#define BUF_SIZE buf_dim[DESC_STRCT_SIZE]
typedef struct DESC_STRCT {
hcf_16 buf_dim[2];
hcf_32 buf_phys_addr;
hcf_32 next_desc_phys_addr; // physical address of next descriptor
hcf_32 desc_phys_addr; // physical address of this descriptor
struct DESC_STRCT *next_desc_addr;
hcf_8 FAR *buf_addr;
#if (HCF_EXT) & HCF_EXT_DESC_STRCT
void FAR *DESC_MSFSup; // pointer for arbitrary use by the MSF
#endif // HCF_DESC_STRCT_EXT
} DESC_STRCT;
#define HCF_DASA_SIZE 12 //size in bytes for DA/SA
#define DESC_CNT_MASK 0x0FFF
#define GET_BUF_SIZE(descp) ((descp)->BUF_SIZE)
#define GET_BUF_CNT(descp) ((descp)->BUF_CNT)
#define SET_BUF_SIZE(descp, size) (descp)->BUF_SIZE = size;
#define SET_BUF_CNT(descp, count) (descp)->BUF_CNT = count;
//========================================= T A L L I E S ===================================================
typedef struct { //Hermes Tallies (IFB substructure)
hcf_32 TxUnicastFrames;
hcf_32 TxMulticastFrames;
hcf_32 TxFragments;
hcf_32 TxUnicastOctets;
hcf_32 TxMulticastOctets;
hcf_32 TxDeferredTransmissions;
hcf_32 TxSingleRetryFrames;
hcf_32 TxMultipleRetryFrames;
hcf_32 TxRetryLimitExceeded;
hcf_32 TxDiscards;
hcf_32 RxUnicastFrames;
hcf_32 RxMulticastFrames;
hcf_32 RxFragments;
hcf_32 RxUnicastOctets;
hcf_32 RxMulticastOctets;
hcf_32 RxFCSErrors;
hcf_32 RxDiscardsNoBuffer;
hcf_32 TxDiscardsWrongSA;
hcf_32 RxWEPUndecryptable;
hcf_32 RxMsgInMsgFragments;
hcf_32 RxMsgInBadMsgFragments;
hcf_32 RxDiscardsWEPICVError;
hcf_32 RxDiscardsWEPExcluded;
#if (HCF_EXT) & HCF_EXT_TALLIES_FW
hcf_32 TalliesExtra[32];
#endif // HCF_EXT_TALLIES_FW
} CFG_HERMES_TALLIES_STRCT;
typedef struct { //HCF Tallies (IFB substructure)
hcf_32 NoBufInfo; //No buffer available for unsolicited Notify frame
hcf_32 NoBufMB; //No space available in MailBox
hcf_32 MiscErr; /* Command errors
* - time out on completion synchronous part Hermes Command
* - completed Hermes Command doesn't match original command
* - status of completed Hermes Command contains error bits
*/
#if (HCF_EXT) & HCF_EXT_TALLIES_FW
hcf_32 EngCnt[8];
#endif // HCF_EXT_TALLIES_FW
} CFG_HCF_TALLIES_STRCT;
//Note this way to define ..._TAL_CNT implies that all tallies must keep the same (hcf_32) size
#if (HCF_TALLIES) & ( HCF_TALLIES_NIC | HCF_TALLIES_HCF )
#if (HCF_TALLIES) & HCF_TALLIES_NIC //Hermes tally support
#define HCF_NIC_TAL_CNT (sizeof(CFG_HERMES_TALLIES_STRCT)/ sizeof(hcf_32))
#else
#define HCF_NIC_TAL_CNT 0
#endif // HCF_TALLIES
#if (HCF_TALLIES) & HCF_TALLIES_HCF //HCF tally support
#define HCF_HCF_TAL_CNT (sizeof(CFG_HCF_TALLIES_STRCT) / sizeof(hcf_32))
#else
#define HCF_HCF_TAL_CNT 0
#endif // HCF_TALLIES
#define HCF_TOT_TAL_CNT ( HCF_NIC_TAL_CNT + HCF_NIC_TAL_CNT )
#endif // HCF_TALLIES_NIC / HCF_TALLIES_HCF
/***********************************************************************************************************/
/********************************** I N T E R F A C E B L O C K ******************************************/
/***********************************************************************************************************/
#define IFB_VERSION 0x0E // initially 0, to be incremented by every IFB layout change
typedef struct {
hcf_io IFB_IOBase; // I/O address of Hermes chip as passed by MSF at hcf_connect call
hcf_16 IFB_IORange; // I/O Range used by Hermes chip
hcf_16 IFB_DLMode; // Download Mode state
hcf_16 IFB_Cmd; // cmd in progress flag, to be ack-ed before next cmd can be issued
hcf_16 IFB_RxFID; // FID of "current" RxFS (non-DMA mode)
//;?#if tx_delay option
hcf_16 IFB_TxFID; // fid storage during "delayed" send
//;?#endif tx_delay option
hcf_16 IFB_RxLen; //
hcf_16 IFB_DefunctStat; // BAP initialization or Cmd Completion failed
hcf_16 IFB_ErrCmd; // contents Status reg when error bits and/or mismatch in cmd_wait
hcf_16 IFB_ErrQualifier; // contents Resp0 reg when error bits and/or mismatch in cmd_wait
hcf_16 IFB_lal; // LookAhead Length
wci_bufp IFB_lap; // LookAhead Buffer pointer
hcf_16 IFB_LinkStat; // Link Status
hcf_16 IFB_DSLinkStat; // Link Status, new strategy introduced for DeepSleep
hcf_16 IFB_CarryIn; // carry and carry-flag to move 1 byte from one get_frag to the next
hcf_16 IFB_CarryOut; // carry and carry-flag to move 1 byte from one put_frag to the next
hcf_16 IFB_Version; // IFB_VERSION, incremented by every SIGNIFICANT IFB layout change
hcf_16 IFB_CardStat; // NIC error / F/W incompatibility status
hcf_16 IFB_RscInd; // non-DMA: TxFID available, DMA: always 1
hcf_16 IFB_CntlOpt; // flags: 32 bits I/O, DMA available, DMA enabled
hcf_16 IFB_BusType; // BusType, derived via CFG_NIC_BUS_TYPE
CFG_FW_IDENTITY_STRCT IFB_FWIdentity; /* keep FWIdentity/Sup and PRIIdentity/Sup in sequence
* because of the (dumb) copy in init() */
#if defined MSF_COMPONENT_ID
CFG_SUP_RANGE_STRCT IFB_FWSup;
CFG_PRI_IDENTITY_STRCT IFB_PRIIdentity;
CFG_SUP_RANGE_STRCT IFB_PRISup;
CFG_SUP_RANGE_STRCT IFB_HSISup;
#endif // MSF_COMPONENT_ID
#if (HCF_EXT) & HCF_EXT_INFO_LOG
RID_LOGP IFB_RIDLogp; // pointer to RID_LOG structure
#endif // HCF_EXT_INFO_LOG
#if HCF_PROT_TIME
hcf_32 IFB_TickIni; // initialization of S/W counter based protection loop
#endif // HCF_PROT_TIME
#if (HCF_EXT) & HCF_EXT_INT_TICK
int IFB_TickCnt; // Hermes Timer Tick Counter
#endif // HCF_EXT_INT_TICK
#if (HCF_EXT) & HCF_EXT_MB
hcf_16 *IFB_MBp; // pointer to the MailBox
hcf_16 IFB_MBSize; // size of the MailBox
hcf_16 IFB_MBWp; // zero-based write index into the MailBox
hcf_16 IFB_MBRp; // zero-based read index into the MailBox
hcf_16 IFB_MBInfoLen; // contents of L-field of the oldest available MailBoxInfoBlock
#endif // HCF_EXT_MB
#if (HCF_TYPE) & HCF_TYPE_WPA
hcf_16 IFB_MICTxCntl; // MIC bit and Key index in TxControl field of TxFS
hcf_32 IFB_MICTxKey[2]; // calculating key
hcf_32 IFB_MICTx[2]; // Tx MIC calculation Engine state
hcf_16 IFB_MICTxCarry; // temp length, carries over from one Tx fragment to another
hcf_16 IFB_MICRxCarry; // temp length, carries over from one Rx fragment to another
hcf_32 IFB_MICRxKey[4*2]; // 4 checking keys
hcf_32 IFB_MICRx[2]; // Rx MIC calculation Engine state
#endif // HCF_TYPE_WPA
#if HCF_ASSERT
#if (HCF_ASSERT) & HCF_ASSERT_MB
CFG_MB_INFO_RANGE1_STRCT IFB_AssertStrct; // Add some complication to the HCF as prize for the new MSF I/F
#endif // HCF_ASSERT_MB
// target of above IFB_AssertStrct
hcf_16 IFB_AssertLine; // - line number ( + encoded module name )
hcf_16 IFB_AssertTrace; // - bit based trace of all hcf_.... invocations
hcf_32 IFB_AssertQualifier; // - qualifier
hcf_16 IFB_AssertLvl; // Assert Filtering, Not yet implemented
hcf_16 IFB_AssertWhere; // Where parameter of the Assert macro
#if (HCF_ASSERT) & ( HCF_ASSERT_LNK_MSF_RTN | HCF_ASSERT_RT_MSF_RTN )
MSF_ASSERT_RTNP IFB_AssertRtn; // MSF Assert Call back routine (inspired by GEF, DrDobbs Nov 1998 )
#endif // HCF_ASSERT_LNK_MSF_RTN
#if (HCF_ASSERT) & HCF_ASSERT_PRINTF // engineering facilty intended as F/W debugging aid
hcf_16 IFB_DbgPrintF_Cnt;
CFG_FW_PRINTF_BUFFER_LOCATION_STRCT IFB_FwPfBuff;
#endif // HCF_ASSERT_PRINTF
#endif // HCF_ASSERT
#if ! defined HCF_INT_OFF
hcf_16 volatile IFB_IntOffCnt; // 0xFFFF based HCF_ACT_INT_OFF nesting counter, DeepSleep flag
#endif // HCF_INT_OFF
#if (HCF_TYPE) & HCF_TYPE_CCX
hcf_16 IFB_CKIPStat; // CKIP Status flag
#endif // HCF_TYPE_CCX
#if (HCF_TALLIES) & ( HCF_TALLIES_NIC | HCF_TALLIES_HCF ) //Hermes and/or HCF tally support
hcf_32 IFB_Silly_you_should_align; //;?
hcf_16 IFB_TallyLen; // Tally length (to build an LTV)
hcf_16 IFB_TallyTyp; // Tally Type (to build an LTV)
#endif // HCF_TALLIES_NIC / HCF_TALLIES_HCF
#if (HCF_TALLIES) & HCF_TALLIES_NIC //Hermes tally support
CFG_HERMES_TALLIES_STRCT IFB_NIC_Tallies;
#endif // HCF_TALLIES_NIC
#if (HCF_TALLIES) & HCF_TALLIES_HCF //HCF tally support
CFG_HCF_TALLIES_STRCT IFB_HCF_Tallies;
#endif // HCF_TALLIES_HCF
#if HCF_DMA
//used for a pool of destination_address descriptor/buffers, used during tx encapsulation points to the
//first/last descriptor in the descriptor chain, so we can easily remove and append a packet.
DESC_STRCT *IFB_FirstDesc[2];
DESC_STRCT *IFB_LastDesc[2];
DESC_STRCT *IFB_ConfinedDesc[2]; // pointers to descriptor used for host reclaim purposes.
hcf_16 IFB_DmaPackets; // HREG_EV_[TX/RX]DMA_DONE flags, reports DMA Frame availability to MSF
#endif // HCF_DMA
#if (HCF_EXT) & HCF_EXT_INT_TX_EX
hcf_16 IFB_TxFsStat; // Tx message monitoring
hcf_16 IFB_TxFsGap[2]; //;?make this robust
hcf_16 IFB_TxFsSwSup;
#endif // HCF_EXT_INT_TX_EX
hcf_16 IFB_Magic; /* "Magic" signature, to help the debugger interpret a memory dump
* also the last field cleared at hcf_connect
*/
#if (HCF_EXT) & HCF_EXT_IFB_STRCT // for usage by the MSF
void FAR *IFB_MSFSup; // pointer for arbitrary use by the MSF
#endif // HCF_EXT_IFB_STRCT_EXT
} IFB_STRCT;
typedef IFB_STRCT* IFBP;
/***********************************************************************************************************/
/********************** W C I F U N C T I O N S P R O T O T Y P E S ******************************/
/***********************************************************************************************************/
EXTERN_C int hcf_action (IFBP ifbp, hcf_16 cmd );
EXTERN_C int hcf_connect (IFBP ifbp, hcf_io io_base );
#if (HCF_ENCAP) & HCF_ENC_SUP
EXTERN_C hcf_8 hcf_encap (wci_bufp type );
#endif // HCF_ENC_SUP
EXTERN_C int hcf_get_info (IFBP ifbp, LTVP ltvp );
EXTERN_C int hcf_service_nic (IFBP ifbp, wci_bufp bufp, unsigned int len );
EXTERN_C int hcf_cntl (IFBP ifbp, hcf_16 cmd );
EXTERN_C int hcf_put_info (IFBP ifbp, LTVP ltvp );
EXTERN_C int hcf_rcv_msg (IFBP ifbp, DESC_STRCT *descp, unsigned int offset );
EXTERN_C int hcf_send_msg (IFBP ifbp, DESC_STRCT *dp, hcf_16 tx_cntl );
#if HCF_DMA
EXTERN_C void hcf_dma_tx_put (IFBP ifbp, DESC_STRCT *d, hcf_16 tx_cntl );
EXTERN_C DESC_STRCT* hcf_dma_tx_get (IFBP ifbp );
EXTERN_C DESC_STRCT* hcf_dma_rx_get (IFBP ifbp );
EXTERN_C void hcf_dma_rx_put (IFBP ifbp, DESC_STRCT *d );
#endif // HCF_DMA
#if (HCF_ASSERT) & HCF_ASSERT_LNK_MSF_RTN
EXTERN_C void msf_assert (unsigned int line_number, hcf_16 trace, hcf_32 qual );
#endif // HCF_ASSERT_LNK_MSF_RTN
#endif // HCF_H
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
// vim:tw=110:ts=4:
/************************************************************************************************************
*
* FILE : mmd.c
*
* DATE : $Date: 2004/07/23 11:57:45 $ $Revision: 1.4 $
* Original: 2004/05/28 14:05:35 Revision: 1.32 Tag: hcf7_t20040602_01
* Original: 2004/05/13 15:31:45 Revision: 1.30 Tag: hcf7_t7_20040513_01
* Original: 2004/04/15 09:24:42 Revision: 1.25 Tag: hcf7_t7_20040415_01
* Original: 2004/04/08 15:18:17 Revision: 1.24 Tag: t7_20040413_01
* Original: 2004/04/01 15:32:55 Revision: 1.22 Tag: t7_20040401_01
* Original: 2004/03/10 15:39:28 Revision: 1.18 Tag: t20040310_01
* Original: 2004/03/03 14:10:12 Revision: 1.16 Tag: t20040304_01
* Original: 2004/03/02 09:27:12 Revision: 1.14 Tag: t20040302_03
* Original: 2004/02/24 13:00:29 Revision: 1.12 Tag: t20040224_01
* Original: 2004/01/30 09:59:33 Revision: 1.11 Tag: t20040219_01
*
* AUTHOR : Nico Valster
*
* DESC : Common routines for HCF, MSF, UIL as well as USF sources
*
* Note: relative to Asserts, the following can be observed:
* Since the IFB is not known inside the routine, the macro HCFASSERT is replaced with MDDASSERT.
* Also the line number reported in the assert is raised by FILE_NAME_OFFSET (20000) to discriminate the
* MMD Asserts from HCF and DHF asserts.
*
***************************************************************************************************************
*
*
* SOFTWARE LICENSE
*
* This software is provided subject to the following terms and conditions,
* which you should read carefully before using the software. Using this
* software indicates your acceptance of these terms and conditions. If you do
* not agree with these terms and conditions, do not use the software.
*
* COPYRIGHT © 2001 - 2004 by Agere Systems Inc. All Rights Reserved
* All rights reserved.
*
* Redistribution and use in source or binary forms, with or without
* modifications, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following Disclaimer as comments in the code as
* well as in the documentation and/or other materials provided with the
* distribution.
*
* . 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.
*
* . Neither the name of Agere Systems Inc. nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* Disclaimer
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, 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.
*
*
**************************************************************************************************************/
#include "hcf.h" // Needed as long as we do not really sort out the mess
#include "hcfdef.h" // get CNV_LITTLE_TO_SHORT
#include "mmd.h" // MoreModularDriver common include file
//to distinguish DHF from HCF asserts by means of line number
#undef FILE_NAME_OFFSET
#define FILE_NAME_OFFSET DHF_FILE_NAME_OFFSET
/*************************************************************************************************************
*
*.MODULE CFG_RANGE_SPEC_STRCT* mmd_check_comp( CFG_RANGES_STRCT *actp, CFG_SUP_RANGE_STRCT *supp )
*.PURPOSE Checks compatibility between an actor and a supplier.
*
*.ARGUMENTS
* actp
* supp
*
*.RETURNS
* NULL incompatible
* <>NULL pointer to matching CFG_RANGE_SPEC_STRCT substructure in actor-structure matching the supplier
*
*.NARRATIVE
*
* Parameters:
* actp address of the actor specification
* supp address of the supplier specification
*
* Description: mmd_check_comp is a support routine to check the compatibility between an actor and a
* supplier. mmd_check_comp is independent of the endianess of the actp and supp structures. This is
* achieved by checking the "bottom" or "role" fields of these structures. Since these fields are restricted
* to a limited range, comparing the contents to a value with a known endian-ess gives a clue to their actual
* endianess.
*
*.DIAGRAM
*1a: The role-field of the actor structure has a known non-zero, not "byte symmetric" value (namely
* COMP_ROLE_ACT or 0x0001), so if and only the contents of this field matches COMP_ROLE_ACT (in Native
* Endian format), the actor structure is Native Endian.
*2a: Since the role-field of the supplier structure is 0x0000, the test as used for the actor does not work
* for a supplier. A supplier has always exactly 1 variant,top,bottom record with (officially, but see the
* note below) each of these 3 values in the range 1 through 99, so one byte of the word value of variant,
* top and bottom words is 0x00 and the other byte is non-zero. Whether the lowest address byte or the
* highest address byte is non-zero depends on the Endianess of the LTV. If and only if the word value of
* bottom is less than 0x0100, the supplier is Native Endian.
* NOTE: the variant field of the supplier structure can not be used for the Endian Detection Algorithm,
* because a a zero-valued variant has been used as Controlled Deployment indication in the past.
* Note: An actor may have multiple sets of variant,top,bottom records, including dummy sets with variant,
* top and bottom fields with a zero-value. As a consequence the endianess of the actor can not be determined
* based on its variant,top,bottom values.
*
* Note: the L and T field of the structures are always in Native Endian format, so you can not draw
* conclusions concerning the Endianess of the structure based on these two fields.
*
*1b/2b
* The only purpose of the CFG_RANGE_SPEC_BYTE_STRCT is to give easy access to the non-zero byte of the word
* value of variant, top and bottom. The variables sup_endian and act_endian are used for the supplier and
* actor structure respectively. These variables must be 0 when the structure has LE format and 1 if the
* structure has BE format. This can be phrased as:
* the variable is false (i.e 0x0000) if either
* (the platform is LE and the LTV is the same as the platform)
* or
* (the platform is BE and the LTV differs from the platform).
* the variable is true (i.e 0x0001) if either
* (the platform is BE and the LTV is the same as the platform)
* or
* (the platform is LE and the LTV differs from the platform).
*
* Alternatively this can be phrased as:
* if the platform is LE
* if the LTV is LE (i.e the same as the platform), then the variable = 0
* else (the LTV is BE (i.e. different from the platform) ), then the variable = 1
* if the platform is BE
* if the LTV is BE (i.e the same as the platform), then the variable = 1
* else (the LTV is LE (i.e. different from the platform) ), then the variable = 0
*
* This is implemented as:
* #if HCF_BIG_ENDIAN == 0 //platform is LE
* sup/act_endian becomes reverse of structure-endianess as determined in 1a/1b
* #endif
*6: Each of the actor variant-bottom-top records is checked against the (single) supplier variant-bottom-top
* range till either an acceptable match is found or all actor records are tried. As explained above, due to
* the limited ranges of these values, checking a byte is acceptable and suitable.
*8: depending on whether a match was found or not (as reflected by the value of the control variable of the
* for loop), the NULL pointer or a pointer to the matching Number/Bottom/Top record of the Actor structure
* is returned.
* As an additional safety, checking the supplier length protects against invalid Supplier structures, which
* may be caused by failing hcf_get_info (in which case the len-field is zero). Note that the contraption
* "supp->len != sizeof(CFG_SUP_RANGE_STRCT)/sizeof(hcf_16) - 1"
* did turn out not to work for a compiler which padded the structure definition.
*
* Note: when consulting references like DesignNotes and Architecture specifications there is a confusing use
* of the notions number and variant. This resulted in an inconsistent use in the HCF nomenclature as well.
* This makes the logic hard to follow and one has to be very much aware of the context when walking through
* the code.
* NOTE: The Endian Detection Algorithm places limitations on future extensions of the fields, i.e. they should
* stay within the currently defined boundaries of 1 through 99 (although 1 through 255) would work as well
* and there should never be used a zero value for the bottom of a valid supplier.
* Note: relative to Asserts, the following can be observed:
* 1: Supplier variant 0x0000 has been used for Controlled Deployment
* 2: An actor may have one or more variant record specifications with a top of zero and a non-zero bottom
* to override the HCF default support of a particular variant by the MSF programmer via hcfcfg.h
* 3: An actor range can be specified as all zeros, e.g. as padding in the automatically generated firmware
* image files.
*.ENDDOC END DOCUMENTATION
*************************************************************************************************************/
CFG_RANGE_SPEC_STRCT*
mmd_check_comp( CFG_RANGES_STRCT *actp, CFG_SUP_RANGE_STRCT *supp )
{
CFG_RANGE_SPEC_BYTE_STRCT *actq = (CFG_RANGE_SPEC_BYTE_STRCT*)actp->var_rec;
CFG_RANGE_SPEC_BYTE_STRCT *supq = (CFG_RANGE_SPEC_BYTE_STRCT*)&(supp->variant);
hcf_16 i;
int act_endian; //actor endian flag
int sup_endian; //supplier endian flag
act_endian = actp->role == COMP_ROLE_ACT; //true if native endian /* 1a */
sup_endian = supp->bottom < 0x0100; //true if native endian /* 2a */
#if HCF_ASSERT
MMDASSERT( supp->len == 6, supp->len )
MMDASSERT( actp->len >= 6 && actp->len%3 == 0, actp->len )
if ( act_endian ) { //native endian
MMDASSERT( actp->role == COMP_ROLE_ACT, actp->role )
MMDASSERT( 1 <= actp->id && actp->id <= 99, actp->id )
} else { //non-native endian
MMDASSERT( actp->role == CNV_END_SHORT(COMP_ROLE_ACT), actp->role )
MMDASSERT( 1 <= CNV_END_SHORT(actp->id) && CNV_END_SHORT(actp->id) <= 99, actp->id )
}
if ( sup_endian ) { //native endian
MMDASSERT( supp->role == COMP_ROLE_SUPL, supp->role )
MMDASSERT( 1 <= supp->id && supp->id <= 99, supp->id )
MMDASSERT( 1 <= supp->variant && supp->variant <= 99, supp->variant )
MMDASSERT( 1 <= supp->bottom && supp->bottom <= 99, supp->bottom )
MMDASSERT( 1 <= supp->top && supp->top <= 99, supp->top )
MMDASSERT( supp->bottom <= supp->top, supp->bottom << 8 | supp->top )
} else { //non-native endian
MMDASSERT( supp->role == CNV_END_SHORT(COMP_ROLE_SUPL), supp->role )
MMDASSERT( 1 <= CNV_END_SHORT(supp->id) && CNV_END_SHORT(supp->id) <= 99, supp->id )
MMDASSERT( 1 <= CNV_END_SHORT(supp->variant) && CNV_END_SHORT(supp->variant) <= 99, supp->variant )
MMDASSERT( 1 <= CNV_END_SHORT(supp->bottom) && CNV_END_SHORT(supp->bottom) <=99, supp->bottom )
MMDASSERT( 1 <= CNV_END_SHORT(supp->top) && CNV_END_SHORT(supp->top) <=99, supp->top )
MMDASSERT( CNV_END_SHORT(supp->bottom) <= CNV_END_SHORT(supp->top), supp->bottom << 8 | supp->top )
}
#endif // HCF_ASSERT
#if HCF_BIG_ENDIAN == 0
act_endian = !act_endian; /* 1b*/
sup_endian = !sup_endian; /* 2b*/
#endif // HCF_BIG_ENDIAN
for ( i = actp->len ; i > 3; actq++, i -= 3 ) { /* 6 */
MMDASSERT( actq->variant[act_endian] <= 99, i<<8 | actq->variant[act_endian] )
MMDASSERT( actq->bottom[act_endian] <= 99 , i<<8 | actq->bottom[act_endian] )
MMDASSERT( actq->top[act_endian] <= 99 , i<<8 | actq->top[act_endian] )
MMDASSERT( actq->bottom[act_endian] <= actq->top[act_endian], i<<8 | actq->bottom[act_endian] )
if ( actq->variant[act_endian] == supq->variant[sup_endian] &&
actq->bottom[act_endian] <= supq->top[sup_endian] &&
actq->top[act_endian] >= supq->bottom[sup_endian]
) break;
}
if ( i <= 3 || supp->len != 6 /*sizeof(CFG_SUP_RANGE_STRCT)/sizeof(hcf_16) - 1 */ ) {
actq = NULL; /* 8 */
}
#if HCF_ASSERT
if ( actq == NULL ) {
for ( i = 0; i <= supp->len; i += 2 ) {
MMDASSERT( DO_ASSERT, MERGE_2( ((hcf_16*)supp)[i], ((hcf_16*)supp)[i+1] ) );
}
for ( i = 0; i <= actp->len; i += 2 ) {
MMDASSERT( DO_ASSERT, MERGE_2( ((hcf_16*)actp)[i], ((hcf_16*)actp)[i+1] ) );
}
}
#endif // HCF_ASSERT
return (CFG_RANGE_SPEC_STRCT*)actq;
} // mmd_check_comp
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
#ifdef CONFIG_SYSFS
extern void register_wlags_sysfs(struct net_device *);
extern void unregister_wlags_sysfs(struct net_device *);
#else
static void register_wlags_sysfs(struct net_device *) { return; };
static void unregister_wlags_sysfs(struct net_device *) { return; };
#endif
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
config WLAGS49_H25
tristate "Linksys HERMES II.5 WCF54G_Wireless-G_CompactFlash_Card"
depends on WLAN_80211 && WIRELESS_EXT
---help---
Driver for wireless cards using Agere's HERMES II.5 chipset
which are identified with Manufacture ID: 0156,0004
The software is a modified version of wl_lkm_722_abg.tar.gz
from the Agere Systems website, addapted for Ubuntu 9.04.
此差异已折叠。
=======================================================================
WLAN driver for cards using the HERMES II and HERMES II.5 chipset
HERMES II Card
PCMCIA Info: "Agere Systems" "Wireless PC Card Model 0110"
Manufacture ID: 0156,0003
HERMES II.5 Card
PCMCIA Info: "Linksys" "WCF54G_Wireless-G_CompactFlash_Card"
Manufacture ID: 0156,0004
Based on Agere Systems Linux LKM Wireless Driver Source Code,
Version 7.22; complies with Open Source BSD License.
=======================================================================
DESCRIPTION
This directory only contains files that refer to the source in wlags49_h2.
Only real sourcefiles are the Makefile which has been configured to build
the driver for the HERMES II.5 chipset and Kconfig to describe the driver.
The wlags49_h2 directory contains the full source, including the files
exclusively used by this driver.
For more information about the driver look at the wlags49_h2 direcory.
=======================================================================
/* Use common source from wlags49_h2 */
#include "../wlags49_h2/ap_h25.c"
/* Use common source from wlags49_h2 */
#include "../wlags49_h2/debug.h"
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册