staging: bcm: remove driver
The Beceem WiMAX driver was barely function in its current state and was non-functional on 64 bit systems. Based on repeated statements from Greg KH that he wanted the driver removed, I am removing the driver. CC: Matthias Beyer <mail@beyermatthias.de> CC: Kevin McKinney <klmckinney1@gmail.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
2359b5c2d9
commit
d09e9b160f
|
@ -1883,13 +1883,6 @@ W: http://bcache.evilpiepirate.org
|
|||
S: Maintained:
|
||||
F: drivers/md/bcache/
|
||||
|
||||
BECEEM BCS200/BCS220-3/BCSM250 WIMAX SUPPORT
|
||||
M: Kevin McKinney <klmckinney1@gmail.com>
|
||||
M: Matthias Beyer <mail@beyermatthias.de>
|
||||
L: devel@driverdev.osuosl.org
|
||||
S: Maintained
|
||||
F: drivers/staging/bcm*
|
||||
|
||||
BEFS FILE SYSTEM
|
||||
S: Orphan
|
||||
F: Documentation/filesystems/befs.txt
|
||||
|
|
|
@ -62,8 +62,6 @@ source "drivers/staging/xgifb/Kconfig"
|
|||
|
||||
source "drivers/staging/emxx_udc/Kconfig"
|
||||
|
||||
source "drivers/staging/bcm/Kconfig"
|
||||
|
||||
source "drivers/staging/ft1000/Kconfig"
|
||||
|
||||
source "drivers/staging/speakup/Kconfig"
|
||||
|
|
|
@ -25,7 +25,6 @@ obj-$(CONFIG_VME_BUS) += vme/
|
|||
obj-$(CONFIG_IIO) += iio/
|
||||
obj-$(CONFIG_FB_XGI) += xgifb/
|
||||
obj-$(CONFIG_USB_EMXX) += emxx_udc/
|
||||
obj-$(CONFIG_BCM_WIMAX) += bcm/
|
||||
obj-$(CONFIG_FT1000) += ft1000/
|
||||
obj-$(CONFIG_SPEAKUP) += speakup/
|
||||
obj-$(CONFIG_TOUCHSCREEN_CLEARPAD_TM1217) += cptm1217/
|
||||
|
|
|
@ -1,474 +0,0 @@
|
|||
/***********************************
|
||||
* Adapter.h
|
||||
************************************/
|
||||
#ifndef __ADAPTER_H__
|
||||
#define __ADAPTER_H__
|
||||
|
||||
#define MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES 256
|
||||
#include "Debug.h"
|
||||
|
||||
struct bcm_leader {
|
||||
USHORT Vcid;
|
||||
USHORT PLength;
|
||||
UCHAR Status;
|
||||
UCHAR Unused[3];
|
||||
} __packed;
|
||||
|
||||
struct bcm_packettosend {
|
||||
struct bcm_leader Leader;
|
||||
UCHAR ucPayload;
|
||||
} __packed;
|
||||
|
||||
struct bcm_control_packet {
|
||||
PVOID ControlBuff;
|
||||
UINT ControlBuffLen;
|
||||
struct bcm_control_packet *next;
|
||||
} __packed;
|
||||
|
||||
struct bcm_link_request {
|
||||
struct bcm_leader Leader;
|
||||
UCHAR szData[4];
|
||||
} __packed;
|
||||
|
||||
#define MAX_IP_RANGE_LENGTH 4
|
||||
#define MAX_PORT_RANGE 4
|
||||
#define MAX_PROTOCOL_LENGTH 32
|
||||
#define IPV6_ADDRESS_SIZEINBYTES 0x10
|
||||
|
||||
union u_ip_address {
|
||||
struct {
|
||||
/* Source Ip Address Range */
|
||||
ULONG ulIpv4Addr[MAX_IP_RANGE_LENGTH];
|
||||
/* Source Ip Mask Address Range */
|
||||
ULONG ulIpv4Mask[MAX_IP_RANGE_LENGTH];
|
||||
};
|
||||
struct {
|
||||
/* Source Ip Address Range */
|
||||
ULONG ulIpv6Addr[MAX_IP_RANGE_LENGTH * 4];
|
||||
/* Source Ip Mask Address Range */
|
||||
ULONG ulIpv6Mask[MAX_IP_RANGE_LENGTH * 4];
|
||||
};
|
||||
struct {
|
||||
UCHAR ucIpv4Address[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS];
|
||||
UCHAR ucIpv4Mask[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS];
|
||||
};
|
||||
struct {
|
||||
UCHAR ucIpv6Address[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES];
|
||||
UCHAR ucIpv6Mask[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES];
|
||||
};
|
||||
};
|
||||
|
||||
struct bcm_hdr_suppression_contextinfo {
|
||||
/* Intermediate buffer to accumulate pkt Header for PHS */
|
||||
UCHAR ucaHdrSuppressionInBuf[MAX_PHS_LENGTHS];
|
||||
/* Intermediate buffer containing pkt Header after PHS */
|
||||
UCHAR ucaHdrSuppressionOutBuf[MAX_PHS_LENGTHS + PHSI_LEN];
|
||||
};
|
||||
|
||||
struct bcm_classifier_rule {
|
||||
ULONG ulSFID;
|
||||
UCHAR ucReserved[2];
|
||||
B_UINT16 uiClassifierRuleIndex;
|
||||
bool bUsed;
|
||||
USHORT usVCID_Value;
|
||||
/* This field detemines the Classifier Priority */
|
||||
B_UINT8 u8ClassifierRulePriority;
|
||||
union u_ip_address stSrcIpAddress;
|
||||
UCHAR ucIPSourceAddressLength; /* Ip Source Address Length */
|
||||
|
||||
union u_ip_address stDestIpAddress;
|
||||
/* Ip Destination Address Length */
|
||||
UCHAR ucIPDestinationAddressLength;
|
||||
UCHAR ucIPTypeOfServiceLength; /* Type of service Length */
|
||||
UCHAR ucTosLow; /* Tos Low */
|
||||
UCHAR ucTosHigh; /* Tos High */
|
||||
UCHAR ucTosMask; /* Tos Mask */
|
||||
|
||||
UCHAR ucProtocolLength; /* protocol Length */
|
||||
UCHAR ucProtocol[MAX_PROTOCOL_LENGTH]; /* protocol Length */
|
||||
USHORT usSrcPortRangeLo[MAX_PORT_RANGE];
|
||||
USHORT usSrcPortRangeHi[MAX_PORT_RANGE];
|
||||
UCHAR ucSrcPortRangeLength;
|
||||
|
||||
USHORT usDestPortRangeLo[MAX_PORT_RANGE];
|
||||
USHORT usDestPortRangeHi[MAX_PORT_RANGE];
|
||||
UCHAR ucDestPortRangeLength;
|
||||
|
||||
bool bProtocolValid;
|
||||
bool bTOSValid;
|
||||
bool bDestIpValid;
|
||||
bool bSrcIpValid;
|
||||
|
||||
/* For IPv6 Addressing */
|
||||
UCHAR ucDirection;
|
||||
bool bIpv6Protocol;
|
||||
UINT32 u32PHSRuleID;
|
||||
struct bcm_phs_rule sPhsRule;
|
||||
UCHAR u8AssociatedPHSI;
|
||||
|
||||
/* Classification fields for ETH CS */
|
||||
UCHAR ucEthCSSrcMACLen;
|
||||
UCHAR au8EThCSSrcMAC[MAC_ADDRESS_SIZE];
|
||||
UCHAR au8EThCSSrcMACMask[MAC_ADDRESS_SIZE];
|
||||
UCHAR ucEthCSDestMACLen;
|
||||
UCHAR au8EThCSDestMAC[MAC_ADDRESS_SIZE];
|
||||
UCHAR au8EThCSDestMACMask[MAC_ADDRESS_SIZE];
|
||||
UCHAR ucEtherTypeLen;
|
||||
UCHAR au8EthCSEtherType[NUM_ETHERTYPE_BYTES];
|
||||
UCHAR usUserPriority[2];
|
||||
USHORT usVLANID;
|
||||
USHORT usValidityBitMap;
|
||||
};
|
||||
|
||||
struct bcm_fragmented_packet_info {
|
||||
bool bUsed;
|
||||
ULONG ulSrcIpAddress;
|
||||
USHORT usIpIdentification;
|
||||
struct bcm_classifier_rule *pstMatchedClassifierEntry;
|
||||
bool bOutOfOrderFragment;
|
||||
};
|
||||
|
||||
struct bcm_packet_info {
|
||||
/* classification extension Rule */
|
||||
ULONG ulSFID;
|
||||
USHORT usVCID_Value;
|
||||
UINT uiThreshold;
|
||||
/* This field determines the priority of the SF Queues */
|
||||
B_UINT8 u8TrafficPriority;
|
||||
|
||||
bool bValid;
|
||||
bool bActive;
|
||||
bool bActivateRequestSent;
|
||||
|
||||
B_UINT8 u8QueueType; /* BE or rtPS */
|
||||
|
||||
/* maximum size of the bucket for the queue */
|
||||
UINT uiMaxBucketSize;
|
||||
UINT uiCurrentQueueDepthOnTarget;
|
||||
UINT uiCurrentBytesOnHost;
|
||||
UINT uiCurrentPacketsOnHost;
|
||||
UINT uiDroppedCountBytes;
|
||||
UINT uiDroppedCountPackets;
|
||||
UINT uiSentBytes;
|
||||
UINT uiSentPackets;
|
||||
UINT uiCurrentDrainRate;
|
||||
UINT uiThisPeriodSentBytes;
|
||||
LARGE_INTEGER liDrainCalculated;
|
||||
UINT uiCurrentTokenCount;
|
||||
LARGE_INTEGER liLastUpdateTokenAt;
|
||||
UINT uiMaxAllowedRate;
|
||||
UINT NumOfPacketsSent;
|
||||
UCHAR ucDirection;
|
||||
USHORT usCID;
|
||||
struct bcm_mibs_parameters stMibsExtServiceFlowTable;
|
||||
UINT uiCurrentRxRate;
|
||||
UINT uiThisPeriodRxBytes;
|
||||
UINT uiTotalRxBytes;
|
||||
UINT uiTotalTxBytes;
|
||||
UINT uiPendedLast;
|
||||
UCHAR ucIpVersion;
|
||||
|
||||
union {
|
||||
struct {
|
||||
struct sk_buff *FirstTxQueue;
|
||||
struct sk_buff *LastTxQueue;
|
||||
};
|
||||
struct {
|
||||
struct sk_buff *ControlHead;
|
||||
struct sk_buff *ControlTail;
|
||||
};
|
||||
};
|
||||
|
||||
bool bProtocolValid;
|
||||
bool bTOSValid;
|
||||
bool bDestIpValid;
|
||||
bool bSrcIpValid;
|
||||
|
||||
bool bActiveSet;
|
||||
bool bAdmittedSet;
|
||||
bool bAuthorizedSet;
|
||||
bool bClassifierPriority;
|
||||
UCHAR ucServiceClassName[MAX_CLASS_NAME_LENGTH];
|
||||
bool bHeaderSuppressionEnabled;
|
||||
spinlock_t SFQueueLock;
|
||||
void *pstSFIndication;
|
||||
struct timeval stLastUpdateTokenAt;
|
||||
atomic_t uiPerSFTxResourceCount;
|
||||
UINT uiMaxLatency;
|
||||
UCHAR bIPCSSupport;
|
||||
UCHAR bEthCSSupport;
|
||||
};
|
||||
|
||||
struct bcm_tarang_data {
|
||||
struct bcm_tarang_data *next;
|
||||
struct bcm_mini_adapter *Adapter;
|
||||
struct sk_buff *RxAppControlHead;
|
||||
struct sk_buff *RxAppControlTail;
|
||||
int AppCtrlQueueLen;
|
||||
bool MacTracingEnabled;
|
||||
bool bApplicationToExit;
|
||||
struct bcm_mibs_dropped_cntrl_msg stDroppedAppCntrlMsgs;
|
||||
ULONG RxCntrlMsgBitMask;
|
||||
};
|
||||
|
||||
struct bcm_targetdsx_buffer {
|
||||
ULONG ulTargetDsxBuffer;
|
||||
B_UINT16 tid;
|
||||
bool valid;
|
||||
};
|
||||
|
||||
typedef int (*FP_FLASH_WRITE)(struct bcm_mini_adapter *, UINT, PVOID);
|
||||
|
||||
typedef int (*FP_FLASH_WRITE_STATUS)(struct bcm_mini_adapter *, UINT, PVOID);
|
||||
|
||||
/*
|
||||
* Driver adapter data structure
|
||||
*/
|
||||
struct bcm_mini_adapter {
|
||||
struct bcm_mini_adapter *next;
|
||||
struct net_device *dev;
|
||||
u32 msg_enable;
|
||||
CHAR *caDsxReqResp;
|
||||
atomic_t ApplicationRunning;
|
||||
bool AppCtrlQueueOverFlow;
|
||||
atomic_t CurrentApplicationCount;
|
||||
atomic_t RegisteredApplicationCount;
|
||||
bool LinkUpStatus;
|
||||
bool TimerActive;
|
||||
u32 StatisticsPointer;
|
||||
struct sk_buff *RxControlHead;
|
||||
struct sk_buff *RxControlTail;
|
||||
struct semaphore RxAppControlQueuelock;
|
||||
struct semaphore fw_download_sema;
|
||||
struct bcm_tarang_data *pTarangs;
|
||||
spinlock_t control_queue_lock;
|
||||
wait_queue_head_t process_read_wait_queue;
|
||||
|
||||
/* the pointer to the first packet we have queued in send
|
||||
* deserialized miniport support variables
|
||||
*/
|
||||
atomic_t TotalPacketCount;
|
||||
atomic_t TxPktAvail;
|
||||
|
||||
/* this to keep track of the Tx and Rx MailBox Registers. */
|
||||
atomic_t CurrNumFreeTxDesc;
|
||||
/* to keep track the no of byte received */
|
||||
USHORT PrevNumRecvDescs;
|
||||
USHORT CurrNumRecvDescs;
|
||||
UINT u32TotalDSD;
|
||||
struct bcm_packet_info PackInfo[NO_OF_QUEUES];
|
||||
struct bcm_classifier_rule astClassifierTable[MAX_CLASSIFIERS];
|
||||
bool TransferMode;
|
||||
|
||||
/*************** qos ******************/
|
||||
bool bETHCSEnabled;
|
||||
ULONG BEBucketSize;
|
||||
ULONG rtPSBucketSize;
|
||||
UCHAR LinkStatus;
|
||||
bool AutoLinkUp;
|
||||
bool AutoSyncup;
|
||||
|
||||
int major;
|
||||
int minor;
|
||||
wait_queue_head_t tx_packet_wait_queue;
|
||||
wait_queue_head_t process_rx_cntrlpkt;
|
||||
atomic_t process_waiting;
|
||||
bool fw_download_done;
|
||||
|
||||
char *txctlpacket[MAX_CNTRL_PKTS];
|
||||
atomic_t cntrlpktCnt;
|
||||
atomic_t index_app_read_cntrlpkt;
|
||||
atomic_t index_wr_txcntrlpkt;
|
||||
atomic_t index_rd_txcntrlpkt;
|
||||
UINT index_datpkt;
|
||||
struct semaphore rdmwrmsync;
|
||||
|
||||
struct bcm_targetdsx_buffer astTargetDsxBuffer[MAX_TARGET_DSX_BUFFERS];
|
||||
ULONG ulFreeTargetBufferCnt;
|
||||
ULONG ulCurrentTargetBuffer;
|
||||
ULONG ulTotalTargetBuffersAvailable;
|
||||
unsigned long chip_id;
|
||||
wait_queue_head_t lowpower_mode_wait_queue;
|
||||
bool bFlashBoot;
|
||||
bool bBinDownloaded;
|
||||
bool bCfgDownloaded;
|
||||
bool bSyncUpRequestSent;
|
||||
USHORT usBestEffortQueueIndex;
|
||||
wait_queue_head_t ioctl_fw_dnld_wait_queue;
|
||||
bool waiting_to_fw_download_done;
|
||||
pid_t fw_download_process_pid;
|
||||
struct bcm_target_params *pstargetparams;
|
||||
bool device_removed;
|
||||
bool DeviceAccess;
|
||||
bool bIsAutoCorrectEnabled;
|
||||
bool bDDRInitDone;
|
||||
int DDRSetting;
|
||||
ULONG ulPowerSaveMode;
|
||||
spinlock_t txtransmitlock;
|
||||
B_UINT8 txtransmit_running;
|
||||
/* Thread for control packet handling */
|
||||
struct task_struct *control_packet_handler;
|
||||
/* thread for transmitting packets. */
|
||||
struct task_struct *transmit_packet_thread;
|
||||
|
||||
/* LED Related Structures */
|
||||
struct bcm_led_info LEDInfo;
|
||||
|
||||
/* Driver State for LED Blinking */
|
||||
enum bcm_led_events DriverState;
|
||||
/* Interface Specific */
|
||||
PVOID pvInterfaceAdapter;
|
||||
int (*bcm_file_download)(PVOID,
|
||||
struct file *,
|
||||
unsigned int);
|
||||
int (*bcm_file_readback_from_chip)(PVOID,
|
||||
struct file *,
|
||||
unsigned int);
|
||||
int (*interface_rdm)(PVOID,
|
||||
UINT,
|
||||
PVOID,
|
||||
int);
|
||||
int (*interface_wrm)(PVOID,
|
||||
UINT,
|
||||
PVOID,
|
||||
int);
|
||||
int (*interface_transmit)(PVOID, PVOID , UINT);
|
||||
bool IdleMode;
|
||||
bool bDregRequestSentInIdleMode;
|
||||
bool bTriedToWakeUpFromlowPowerMode;
|
||||
bool bShutStatus;
|
||||
bool bWakeUpDevice;
|
||||
unsigned int usIdleModePattern;
|
||||
/* BOOLEAN bTriedToWakeUpFromShutdown; */
|
||||
bool bLinkDownRequested;
|
||||
int downloadDDR;
|
||||
struct bcm_phs_extension stBCMPhsContext;
|
||||
struct bcm_hdr_suppression_contextinfo stPhsTxContextInfo;
|
||||
uint8_t ucaPHSPktRestoreBuf[2048];
|
||||
uint8_t bPHSEnabled;
|
||||
bool AutoFirmDld;
|
||||
bool bMipsConfig;
|
||||
bool bDPLLConfig;
|
||||
UINT32 aTxPktSizeHist[MIBS_MAX_HIST_ENTRIES];
|
||||
UINT32 aRxPktSizeHist[MIBS_MAX_HIST_ENTRIES];
|
||||
struct bcm_fragmented_packet_info
|
||||
astFragmentedPktClassifierTable[MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES];
|
||||
atomic_t uiMBupdate;
|
||||
UINT32 PmuMode;
|
||||
enum bcm_nvm_type eNVMType;
|
||||
UINT uiSectorSize;
|
||||
UINT uiSectorSizeInCFG;
|
||||
bool bSectorSizeOverride;
|
||||
bool bStatusWrite;
|
||||
UINT uiNVMDSDSize;
|
||||
UINT uiVendorExtnFlag;
|
||||
/* it will always represent chosen DSD at any point of time.
|
||||
* Generally it is Active DSD but in case of NVM RD/WR it
|
||||
* might be different.
|
||||
*/
|
||||
UINT ulFlashCalStart;
|
||||
ULONG ulFlashControlSectionStart;
|
||||
ULONG ulFlashWriteSize;
|
||||
ULONG ulFlashID;
|
||||
FP_FLASH_WRITE fpFlashWrite;
|
||||
FP_FLASH_WRITE_STATUS fpFlashWriteWithStatusCheck;
|
||||
|
||||
struct semaphore NVMRdmWrmLock;
|
||||
struct device *pstCreatedClassDevice;
|
||||
|
||||
/* BOOLEAN InterfaceUpStatus; */
|
||||
struct bcm_flash2x_cs_info *psFlash2xCSInfo;
|
||||
struct bcm_flash_cs_info *psFlashCSInfo;
|
||||
struct bcm_flash2x_vendor_info *psFlash2xVendorInfo;
|
||||
UINT uiFlashBaseAdd; /* Flash start address */
|
||||
/* Active ISO offset chosen before f/w download */
|
||||
UINT uiActiveISOOffset;
|
||||
enum bcm_flash2x_section_val eActiveISO; /* Active ISO section val */
|
||||
/* Active DSD val chosen before f/w download */
|
||||
enum bcm_flash2x_section_val eActiveDSD;
|
||||
/* For accessing Active DSD chosen before f/w download */
|
||||
UINT uiActiveDSDOffsetAtFwDld;
|
||||
UINT uiFlashLayoutMajorVersion;
|
||||
UINT uiFlashLayoutMinorVersion;
|
||||
bool bAllDSDWriteAllow;
|
||||
bool bSigCorrupted;
|
||||
/* this should be set who so ever want to change the Headers.
|
||||
* after Write it should be reset immediately.
|
||||
*/
|
||||
bool bHeaderChangeAllowed;
|
||||
int SelectedChip;
|
||||
bool bEndPointHalted;
|
||||
/* while bFlashRawRead will be true, Driver
|
||||
* ignore map lay out and consider flash as of without any map.
|
||||
*/
|
||||
bool bFlashRawRead;
|
||||
bool bPreparingForLowPowerMode;
|
||||
bool bDoSuspend;
|
||||
UINT syscfgBefFwDld;
|
||||
bool StopAllXaction;
|
||||
/* Used to Support extended CAPI requirements from */
|
||||
UINT32 liTimeSinceLastNetEntry;
|
||||
struct semaphore LowPowerModeSync;
|
||||
ULONG liDrainCalculated;
|
||||
UINT gpioBitMap;
|
||||
struct bcm_debug_state stDebugState;
|
||||
};
|
||||
|
||||
#define GET_BCM_ADAPTER(net_dev) netdev_priv(net_dev)
|
||||
|
||||
struct bcm_eth_header {
|
||||
UCHAR au8DestinationAddress[6];
|
||||
UCHAR au8SourceAddress[6];
|
||||
USHORT u16Etype;
|
||||
} __packed;
|
||||
|
||||
struct bcm_firmware_info {
|
||||
void __user *pvMappedFirmwareAddress;
|
||||
ULONG u32FirmwareLength;
|
||||
ULONG u32StartingAddress;
|
||||
} __packed;
|
||||
|
||||
/* holds the value of net_device structure.. */
|
||||
extern struct net_device *gblpnetdev;
|
||||
|
||||
struct bcm_ddr_setting {
|
||||
UINT ulRegAddress;
|
||||
UINT ulRegValue;
|
||||
};
|
||||
int InitAdapter(struct bcm_mini_adapter *psAdapter);
|
||||
|
||||
/* =====================================================================
|
||||
* Beceem vendor request codes for EP0
|
||||
* =====================================================================
|
||||
*/
|
||||
|
||||
#define BCM_REQUEST_READ 0x2
|
||||
#define BCM_REQUEST_WRITE 0x1
|
||||
#define EP2_MPS_REG 0x0F0110A0
|
||||
#define EP2_MPS 0x40
|
||||
|
||||
#define EP2_CFG_REG 0x0F0110A8
|
||||
#define EP2_CFG_INT 0x27
|
||||
#define EP2_CFG_BULK 0x25
|
||||
|
||||
#define EP4_MPS_REG 0x0F0110F0
|
||||
#define EP4_MPS 0x8C
|
||||
|
||||
#define EP4_CFG_REG 0x0F0110F8
|
||||
|
||||
#define ISO_MPS_REG 0x0F0110C8
|
||||
#define ISO_MPS 0x00000000
|
||||
|
||||
#define EP1 0
|
||||
#define EP2 1
|
||||
#define EP3 2
|
||||
#define EP4 3
|
||||
#define EP5 4
|
||||
#define EP6 5
|
||||
|
||||
enum bcm_einterface_setting {
|
||||
DEFAULT_SETTING_0 = 0,
|
||||
ALTERNATE_SETTING_1 = 1,
|
||||
};
|
||||
|
||||
#endif /* __ADAPTER_H__ */
|
File diff suppressed because it is too large
Load Diff
|
@ -1,240 +0,0 @@
|
|||
#include "headers.h"
|
||||
|
||||
struct net_device *gblpnetdev;
|
||||
|
||||
static INT bcm_open(struct net_device *dev)
|
||||
{
|
||||
struct bcm_mini_adapter *ad = GET_BCM_ADAPTER(dev);
|
||||
|
||||
if (ad->fw_download_done == false) {
|
||||
pr_notice(PFX "%s: link up failed (download in progress)\n",
|
||||
dev->name);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
if (netif_msg_ifup(ad))
|
||||
pr_info(PFX "%s: enabling interface\n", dev->name);
|
||||
|
||||
if (ad->LinkUpStatus) {
|
||||
if (netif_msg_link(ad))
|
||||
pr_info(PFX "%s: link up\n", dev->name);
|
||||
|
||||
netif_carrier_on(ad->dev);
|
||||
netif_start_queue(ad->dev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INT bcm_close(struct net_device *dev)
|
||||
{
|
||||
struct bcm_mini_adapter *ad = GET_BCM_ADAPTER(dev);
|
||||
|
||||
if (netif_msg_ifdown(ad))
|
||||
pr_info(PFX "%s: disabling interface\n", dev->name);
|
||||
|
||||
netif_carrier_off(dev);
|
||||
netif_stop_queue(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u16 bcm_select_queue(struct net_device *dev, struct sk_buff *skb,
|
||||
void *accel_priv, select_queue_fallback_t fallback)
|
||||
{
|
||||
return ClassifyPacket(netdev_priv(dev), skb);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* Function - bcm_transmit()
|
||||
*
|
||||
* Description - This is the main transmit function for our virtual
|
||||
* interface(eth0). It handles the ARP packets. It
|
||||
* clones this packet and then Queue it to a suitable
|
||||
* Queue. Then calls the transmit_packet().
|
||||
*
|
||||
* Parameter - skb - Pointer to the socket buffer structure
|
||||
* dev - Pointer to the virtual net device structure
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
static netdev_tx_t bcm_transmit(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct bcm_mini_adapter *ad = GET_BCM_ADAPTER(dev);
|
||||
u16 qindex = skb_get_queue_mapping(skb);
|
||||
|
||||
|
||||
if (ad->device_removed || !ad->LinkUpStatus)
|
||||
goto drop;
|
||||
|
||||
if (ad->TransferMode != IP_PACKET_ONLY_MODE)
|
||||
goto drop;
|
||||
|
||||
if (INVALID_QUEUE_INDEX == qindex)
|
||||
goto drop;
|
||||
|
||||
if (ad->PackInfo[qindex].uiCurrentPacketsOnHost >=
|
||||
SF_MAX_ALLOWED_PACKETS_TO_BACKUP)
|
||||
return NETDEV_TX_BUSY;
|
||||
|
||||
/* Now Enqueue the packet */
|
||||
if (netif_msg_tx_queued(ad))
|
||||
pr_info(PFX "%s: enqueueing packet to queue %d\n",
|
||||
dev->name, qindex);
|
||||
|
||||
spin_lock(&ad->PackInfo[qindex].SFQueueLock);
|
||||
ad->PackInfo[qindex].uiCurrentBytesOnHost += skb->len;
|
||||
ad->PackInfo[qindex].uiCurrentPacketsOnHost++;
|
||||
|
||||
*((B_UINT32 *) skb->cb + SKB_CB_LATENCY_OFFSET) = jiffies;
|
||||
ENQUEUEPACKET(ad->PackInfo[qindex].FirstTxQueue,
|
||||
ad->PackInfo[qindex].LastTxQueue, skb);
|
||||
atomic_inc(&ad->TotalPacketCount);
|
||||
spin_unlock(&ad->PackInfo[qindex].SFQueueLock);
|
||||
|
||||
/* FIXME - this is racy and incorrect, replace with work queue */
|
||||
if (!atomic_read(&ad->TxPktAvail)) {
|
||||
atomic_set(&ad->TxPktAvail, 1);
|
||||
wake_up(&ad->tx_packet_wait_queue);
|
||||
}
|
||||
return NETDEV_TX_OK;
|
||||
|
||||
drop:
|
||||
dev_kfree_skb(skb);
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ingroup init_functions
|
||||
Register other driver entry points with the kernel
|
||||
*/
|
||||
static const struct net_device_ops bcmNetDevOps = {
|
||||
.ndo_open = bcm_open,
|
||||
.ndo_stop = bcm_close,
|
||||
.ndo_start_xmit = bcm_transmit,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_select_queue = bcm_select_queue,
|
||||
};
|
||||
|
||||
static struct device_type wimax_type = {
|
||||
.name = "wimax",
|
||||
};
|
||||
|
||||
static int bcm_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
{
|
||||
cmd->supported = 0;
|
||||
cmd->advertising = 0;
|
||||
cmd->speed = SPEED_10000;
|
||||
cmd->duplex = DUPLEX_FULL;
|
||||
cmd->port = PORT_TP;
|
||||
cmd->phy_address = 0;
|
||||
cmd->transceiver = XCVR_INTERNAL;
|
||||
cmd->autoneg = AUTONEG_DISABLE;
|
||||
cmd->maxtxpkt = 0;
|
||||
cmd->maxrxpkt = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bcm_get_drvinfo(struct net_device *dev,
|
||||
struct ethtool_drvinfo *info)
|
||||
{
|
||||
struct bcm_mini_adapter *ad = GET_BCM_ADAPTER(dev);
|
||||
struct bcm_interface_adapter *intf_ad = ad->pvInterfaceAdapter;
|
||||
struct usb_device *udev = interface_to_usbdev(intf_ad->interface);
|
||||
|
||||
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
|
||||
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
|
||||
snprintf(info->fw_version, sizeof(info->fw_version), "%u.%u",
|
||||
ad->uiFlashLayoutMajorVersion,
|
||||
ad->uiFlashLayoutMinorVersion);
|
||||
|
||||
usb_make_path(udev, info->bus_info, sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
static u32 bcm_get_link(struct net_device *dev)
|
||||
{
|
||||
struct bcm_mini_adapter *ad = GET_BCM_ADAPTER(dev);
|
||||
|
||||
return ad->LinkUpStatus;
|
||||
}
|
||||
|
||||
static u32 bcm_get_msglevel(struct net_device *dev)
|
||||
{
|
||||
struct bcm_mini_adapter *ad = GET_BCM_ADAPTER(dev);
|
||||
|
||||
return ad->msg_enable;
|
||||
}
|
||||
|
||||
static void bcm_set_msglevel(struct net_device *dev, u32 level)
|
||||
{
|
||||
struct bcm_mini_adapter *ad = GET_BCM_ADAPTER(dev);
|
||||
|
||||
ad->msg_enable = level;
|
||||
}
|
||||
|
||||
static const struct ethtool_ops bcm_ethtool_ops = {
|
||||
.get_settings = bcm_get_settings,
|
||||
.get_drvinfo = bcm_get_drvinfo,
|
||||
.get_link = bcm_get_link,
|
||||
.get_msglevel = bcm_get_msglevel,
|
||||
.set_msglevel = bcm_set_msglevel,
|
||||
};
|
||||
|
||||
int register_networkdev(struct bcm_mini_adapter *ad)
|
||||
{
|
||||
struct net_device *net = ad->dev;
|
||||
struct bcm_interface_adapter *intf_ad = ad->pvInterfaceAdapter;
|
||||
struct usb_interface *udev = intf_ad->interface;
|
||||
struct usb_device *xdev = intf_ad->udev;
|
||||
|
||||
int result;
|
||||
|
||||
net->netdev_ops = &bcmNetDevOps;
|
||||
net->ethtool_ops = &bcm_ethtool_ops;
|
||||
net->mtu = MTU_SIZE; /* 1400 Bytes */
|
||||
net->tx_queue_len = TX_QLEN;
|
||||
net->flags |= IFF_NOARP;
|
||||
|
||||
netif_carrier_off(net);
|
||||
|
||||
SET_NETDEV_DEVTYPE(net, &wimax_type);
|
||||
|
||||
/* Read the MAC Address from EEPROM */
|
||||
result = ReadMacAddressFromNVM(ad);
|
||||
if (result != STATUS_SUCCESS) {
|
||||
dev_err(&udev->dev,
|
||||
PFX "Error in Reading the mac Address: %d", result);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
result = register_netdev(net);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
gblpnetdev = ad->dev;
|
||||
|
||||
if (netif_msg_probe(ad))
|
||||
dev_info(&udev->dev, PFX "%s: register usb-%s-%s %pM\n",
|
||||
net->name, xdev->bus->bus_name, xdev->devpath,
|
||||
net->dev_addr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void unregister_networkdev(struct bcm_mini_adapter *ad)
|
||||
{
|
||||
struct net_device *net = ad->dev;
|
||||
struct bcm_interface_adapter *intf_ad = ad->pvInterfaceAdapter;
|
||||
struct usb_interface *udev = intf_ad->interface;
|
||||
struct usb_device *xdev = intf_ad->udev;
|
||||
|
||||
if (netif_msg_probe(ad))
|
||||
dev_info(&udev->dev, PFX "%s: unregister usb-%s%s\n",
|
||||
net->name, xdev->bus->bus_name, xdev->devpath);
|
||||
|
||||
unregister_netdev(ad->dev);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,62 +0,0 @@
|
|||
/***************************************************************************
|
||||
* (c) Beceem Communications Inc.
|
||||
* All Rights Reserved
|
||||
*
|
||||
* file : CmHost.h
|
||||
* author: Rajeev Tirumala
|
||||
* date : September 8 , 2006
|
||||
* brief : Definitions for Connection Management Requests structure
|
||||
* which we will use to setup our connection structures.Its high
|
||||
* time we had a header file for CmHost.cpp to isolate the way
|
||||
* f/w sends DSx messages and the way we interpret them in code.
|
||||
* Revision History
|
||||
*
|
||||
* Date Author Version Description
|
||||
* 08-Sep-06 Rajeev 0.1 Created
|
||||
***************************************************************************/
|
||||
#ifndef _CM_HOST_H
|
||||
#define _CM_HOST_H
|
||||
|
||||
#pragma once
|
||||
#pragma pack(push, 4)
|
||||
|
||||
#define DSX_MESSAGE_EXCHANGE_BUFFER 0xBF60AC84 /* This contains the pointer */
|
||||
#define DSX_MESSAGE_EXCHANGE_BUFFER_SIZE 72000 /* 24 K Bytes */
|
||||
|
||||
struct bcm_add_indication_alt {
|
||||
u8 u8Type;
|
||||
u8 u8Direction;
|
||||
u16 u16TID;
|
||||
u16 u16CID;
|
||||
u16 u16VCID;
|
||||
struct bcm_connect_mgr_params sfAuthorizedSet;
|
||||
struct bcm_connect_mgr_params sfAdmittedSet;
|
||||
struct bcm_connect_mgr_params sfActiveSet;
|
||||
u8 u8CC; /* < Confirmation Code */
|
||||
u8 u8Padd;
|
||||
u16 u16Padd;
|
||||
};
|
||||
|
||||
struct bcm_change_indication {
|
||||
u8 u8Type;
|
||||
u8 u8Direction;
|
||||
u16 u16TID;
|
||||
u16 u16CID;
|
||||
u16 u16VCID;
|
||||
struct bcm_connect_mgr_params sfAuthorizedSet;
|
||||
struct bcm_connect_mgr_params sfAdmittedSet;
|
||||
struct bcm_connect_mgr_params sfActiveSet;
|
||||
u8 u8CC; /* < Confirmation Code */
|
||||
u8 u8Padd;
|
||||
u16 u16Padd;
|
||||
};
|
||||
|
||||
unsigned long StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, void *pvBuffer, unsigned int *puBufferLength);
|
||||
int AllocAdapterDsxBuffer(struct bcm_mini_adapter *Adapter);
|
||||
int FreeAdapterDsxBuffer(struct bcm_mini_adapter *Adapter);
|
||||
unsigned long SetUpTargetDsxBuffers(struct bcm_mini_adapter *Adapter);
|
||||
bool CmControlResponseMessage(struct bcm_mini_adapter *Adapter, void *pvBuffer);
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,9 +0,0 @@
|
|||
#ifndef _DDR_INIT_H_
|
||||
#define _DDR_INIT_H_
|
||||
|
||||
|
||||
|
||||
int ddr_init(struct bcm_mini_adapter *psAdapter);
|
||||
int download_ddr_settings(struct bcm_mini_adapter *psAdapter);
|
||||
|
||||
#endif
|
|
@ -1,242 +0,0 @@
|
|||
/*
|
||||
* Debug.h
|
||||
*
|
||||
* Dynamic (runtime) debug framework implementation.
|
||||
* -kaiwan.
|
||||
*/
|
||||
#ifndef _DEBUG_H
|
||||
#define _DEBUG_H
|
||||
#include <linux/string.h>
|
||||
#define NONE 0xFFFF
|
||||
|
||||
/* TYPE and SUBTYPE
|
||||
* Define valid TYPE (or category or code-path, however you like to think of it)
|
||||
* and SUBTYPE s.
|
||||
* Type and SubType are treated as bitmasks.
|
||||
*/
|
||||
#define DBG_TYPE_INITEXIT (1 << 0) /* 1 */
|
||||
#define DBG_TYPE_TX (1 << 1) /* 2 */
|
||||
#define DBG_TYPE_RX (1 << 2) /* 4 */
|
||||
#define DBG_TYPE_OTHERS (1 << 3) /* 8 */
|
||||
#define NUMTYPES 4
|
||||
|
||||
/* -SUBTYPEs for TX : TYPE is DBG_TYPE_TX -----//
|
||||
* Transmit.c ,Arp.c, LeakyBucket.c, And Qos.c
|
||||
* total 17 macros
|
||||
*/
|
||||
/* Transmit.c */
|
||||
#define TX 1
|
||||
#define MP_SEND (TX << 0)
|
||||
#define NEXT_SEND (TX << 1)
|
||||
#define TX_FIFO (TX << 2)
|
||||
#define TX_CONTROL (TX << 3)
|
||||
|
||||
/* Arp.c */
|
||||
#define IP_ADDR (TX << 4)
|
||||
#define ARP_REQ (TX << 5)
|
||||
#define ARP_RESP (TX << 6)
|
||||
|
||||
/* Leakybucket.c */
|
||||
#define TOKEN_COUNTS (TX << 8)
|
||||
#define CHECK_TOKENS (TX << 9)
|
||||
#define TX_PACKETS (TX << 10)
|
||||
#define TIMER (TX << 11)
|
||||
|
||||
/* Qos.c */
|
||||
#define QOS TX
|
||||
#define QUEUE_INDEX (QOS << 12)
|
||||
#define IPV4_DBG (QOS << 13)
|
||||
#define IPV6_DBG (QOS << 14)
|
||||
#define PRUNE_QUEUE (QOS << 15)
|
||||
#define SEND_QUEUE (QOS << 16)
|
||||
|
||||
/* TX_Misc */
|
||||
#define TX_OSAL_DBG (TX << 17)
|
||||
|
||||
/* --SUBTYPEs for ------INIT & EXIT---------------------
|
||||
* ------------ TYPE is DBG_TYPE_INITEXIT -----//
|
||||
* DriverEntry.c, bcmfwup.c, ChipDetectTask.c, HaltnReset.c, InterfaceDDR.c
|
||||
*/
|
||||
#define MP 1
|
||||
#define DRV_ENTRY (MP << 0)
|
||||
#define MP_INIT (MP << 1)
|
||||
#define READ_REG (MP << 3)
|
||||
#define DISPATCH (MP << 2)
|
||||
#define CLAIM_ADAP (MP << 4)
|
||||
#define REG_IO_PORT (MP << 5)
|
||||
#define INIT_DISP (MP << 6)
|
||||
#define RX_INIT (MP << 7)
|
||||
|
||||
/* -SUBTYPEs for --RX----------------------------------
|
||||
* ------------RX : TYPE is DBG_TYPE_RX -----//
|
||||
* Receive.c
|
||||
*/
|
||||
#define RX 1
|
||||
#define RX_DPC (RX << 0)
|
||||
#define RX_CTRL (RX << 3)
|
||||
#define RX_DATA (RX << 4)
|
||||
#define MP_RETURN (RX << 1)
|
||||
#define LINK_MSG (RX << 2)
|
||||
|
||||
/* -SUBTYPEs for ----OTHER ROUTINES------------------
|
||||
* ------------OTHERS : TYPE is DBG_TYPE_OTHER -----//
|
||||
* HaltnReset,CheckForHang,PnP,Misc,CmHost
|
||||
* total 12 macros
|
||||
*/
|
||||
#define OTHERS 1
|
||||
#define ISR OTHERS
|
||||
#define MP_DPC (ISR << 0)
|
||||
|
||||
/* HaltnReset.c */
|
||||
#define HALT OTHERS
|
||||
#define MP_HALT (HALT << 1)
|
||||
#define CHECK_HANG (HALT << 2)
|
||||
#define MP_RESET (HALT << 3)
|
||||
#define MP_SHUTDOWN (HALT << 4)
|
||||
|
||||
/* pnp.c */
|
||||
#define PNP OTHERS
|
||||
#define MP_PNP (PNP << 5)
|
||||
|
||||
/* Misc.c */
|
||||
#define MISC OTHERS
|
||||
#define DUMP_INFO (MISC << 6)
|
||||
#define CLASSIFY (MISC << 7)
|
||||
#define LINK_UP_MSG (MISC << 8)
|
||||
#define CP_CTRL_PKT (MISC << 9)
|
||||
#define DUMP_CONTROL (MISC << 10)
|
||||
#define LED_DUMP_INFO (MISC << 11)
|
||||
|
||||
/* CmHost.c */
|
||||
#define CMHOST OTHERS
|
||||
#define SERIAL (OTHERS << 12)
|
||||
#define IDLE_MODE (OTHERS << 13)
|
||||
#define WRM (OTHERS << 14)
|
||||
#define RDM (OTHERS << 15)
|
||||
|
||||
/* TODO - put PHS_SEND in Tx PHS_RECEIVE in Rx path ? */
|
||||
#define PHS_SEND (OTHERS << 16)
|
||||
#define PHS_RECEIVE (OTHERS << 17)
|
||||
#define PHS_MODULE (OTHERS << 18)
|
||||
|
||||
#define INTF_INIT (OTHERS << 19)
|
||||
#define INTF_ERR (OTHERS << 20)
|
||||
#define INTF_WARN (OTHERS << 21)
|
||||
#define INTF_NORM (OTHERS << 22)
|
||||
|
||||
#define IRP_COMPLETION (OTHERS << 23)
|
||||
#define SF_DESCRIPTOR_CNTS (OTHERS << 24)
|
||||
#define PHS_DISPATCH (OTHERS << 25)
|
||||
#define OSAL_DBG (OTHERS << 26)
|
||||
#define NVM_RW (OTHERS << 27)
|
||||
|
||||
#define HOST_MIBS (OTHERS << 28)
|
||||
#define CONN_MSG (CMHOST << 29)
|
||||
|
||||
/* Debug level
|
||||
* We have 8 debug levels, in (numerical) increasing order of verbosity.
|
||||
* IMP: Currently implementing ONLY DBG_LVL_ALL , i.e. , all debug prints will
|
||||
* appear (of course, iff global debug flag is ON and we match the Type and SubType).
|
||||
* Finer granularity debug levels are currently not in use, although the feature exists.
|
||||
*
|
||||
* Another way to say this:
|
||||
* All the debug prints currently have 'debug_level' set to DBG_LVL_ALL .
|
||||
* You can compile-time change that to any of the below, if you wish to. However, as of now, there's
|
||||
* no dynamic facility to have the userspace 'TestApp' set debug_level. Slated for future expansion.
|
||||
*/
|
||||
#define BCM_ALL 7
|
||||
#define BCM_LOW 6
|
||||
#define BCM_PRINT 5
|
||||
#define BCM_NORMAL 4
|
||||
#define BCM_MEDIUM 3
|
||||
#define BCM_SCREAM 2
|
||||
#define BCM_ERR 1
|
||||
/* Not meant for developer in debug prints.
|
||||
* To be used to disable all prints by setting the DBG_LVL_CURR to this value
|
||||
*/
|
||||
#define BCM_NONE 0
|
||||
|
||||
/* The current driver logging level.
|
||||
* Everything at this level and (numerically) lower (meaning higher prio)
|
||||
* is logged.
|
||||
* Replace 'BCM_ALL' in the DBG_LVL_CURR macro with the logging level desired.
|
||||
* For eg. to set the logging level to 'errors only' use:
|
||||
* #define DBG_LVL_CURR (BCM_ERR)
|
||||
*/
|
||||
|
||||
#define DBG_LVL_CURR (BCM_ALL)
|
||||
#define DBG_LVL_ALL BCM_ALL
|
||||
|
||||
/* ---Userspace mapping of Debug State.
|
||||
* Delibrately matches that of the Windows driver..
|
||||
* The TestApp's ioctl passes this struct to us.
|
||||
*/
|
||||
struct bcm_user_debug_state {
|
||||
unsigned int Subtype, Type;
|
||||
unsigned int OnOff;
|
||||
/* unsigned int debug_level; future expansion */
|
||||
} __packed;
|
||||
|
||||
/* ---Kernel-space mapping of Debug State */
|
||||
struct bcm_debug_state {
|
||||
unsigned int type;
|
||||
/* A bitmap of 32 bits for Subtype per Type.
|
||||
* Valid indexes in 'subtype' array are *only* 1,2,4 and 8,
|
||||
* corresponding to valid Type values. Hence we use the 'Type' field
|
||||
* as the index value, ignoring the array entries 0,3,5,6,7 !
|
||||
*/
|
||||
unsigned int subtype[(NUMTYPES*2)+1];
|
||||
unsigned int debug_level;
|
||||
};
|
||||
/* Instantiated in the Adapter structure
|
||||
* We'll reuse the debug level parameter to include a bit (the MSB) to indicate whether or not
|
||||
* we want the function's name printed.
|
||||
*/
|
||||
#define DBG_NO_FUNC_PRINT (1 << 31)
|
||||
#define DBG_LVL_BITMASK 0xFF
|
||||
|
||||
/* --- Only for direct printk's; "hidden" to API. */
|
||||
#define DBG_TYPE_PRINTK 3
|
||||
|
||||
#define BCM_DEBUG_PRINT(Adapter, Type, SubType, dbg_level, string, args...) \
|
||||
do { \
|
||||
if (DBG_TYPE_PRINTK == Type) \
|
||||
pr_info("%s:" string, __func__, ##args); \
|
||||
else if (Adapter && \
|
||||
(dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level && \
|
||||
(Type & Adapter->stDebugState.type) && \
|
||||
(SubType & Adapter->stDebugState.subtype[Type])) { \
|
||||
if (dbg_level & DBG_NO_FUNC_PRINT) \
|
||||
pr_debug("%s:\n", string); \
|
||||
else \
|
||||
pr_debug("%s:\n" string, __func__, ##args); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define BCM_DEBUG_PRINT_BUFFER(Adapter, Type, SubType, dbg_level, buffer, bufferlen) \
|
||||
do { \
|
||||
if (DBG_TYPE_PRINTK == Type || \
|
||||
(Adapter && \
|
||||
(dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level && \
|
||||
(Type & Adapter->stDebugState.type) && \
|
||||
(SubType & Adapter->stDebugState.subtype[Type]))) { \
|
||||
pr_debug("%s:\n", __func__); \
|
||||
print_hex_dump(KERN_DEBUG, " ", DUMP_PREFIX_OFFSET, \
|
||||
16, 1, buffer, bufferlen, false); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define BCM_SHOW_DEBUG_BITMAP(Adapter) do { \
|
||||
int i; \
|
||||
for (i = 0; i < (NUMTYPES * 2) + 1; i++) { \
|
||||
if ((i == 1) || (i == 2) || (i == 4) || (i == 8)) { \
|
||||
/* CAUTION! Forcefully turn on ALL debug paths and subpaths! \
|
||||
* Adapter->stDebugState.subtype[i] = 0xffffffff; \
|
||||
*/ \
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "subtype[%d] = 0x%08x\n", \
|
||||
i, Adapter->stDebugState.subtype[i]); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
|
@ -1,241 +0,0 @@
|
|||
/**
|
||||
* @file HandleControlPacket.c
|
||||
* This file contains the routines to deal with
|
||||
* sending and receiving of control packets.
|
||||
*/
|
||||
#include "headers.h"
|
||||
|
||||
/**
|
||||
* When a control packet is received, analyze the
|
||||
* "status" and call appropriate response function.
|
||||
* Enqueue the control packet for Application.
|
||||
* @return None
|
||||
*/
|
||||
static VOID handle_rx_control_packet(struct bcm_mini_adapter *Adapter,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct bcm_tarang_data *pTarang = NULL;
|
||||
bool HighPriorityMessage = false;
|
||||
struct sk_buff *newPacket = NULL;
|
||||
CHAR cntrl_msg_mask_bit = 0;
|
||||
bool drop_pkt_flag = TRUE;
|
||||
USHORT usStatus = *(PUSHORT)(skb->data);
|
||||
|
||||
if (netif_msg_pktdata(Adapter))
|
||||
print_hex_dump(KERN_DEBUG, PFX "rx control: ", DUMP_PREFIX_NONE,
|
||||
16, 1, skb->data, skb->len, 0);
|
||||
|
||||
switch (usStatus) {
|
||||
case CM_RESPONSES: /* 0xA0 */
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT,
|
||||
DBG_LVL_ALL,
|
||||
"MAC Version Seems to be Non Multi-Classifier, rejected by Driver");
|
||||
HighPriorityMessage = TRUE;
|
||||
break;
|
||||
case CM_CONTROL_NEWDSX_MULTICLASSIFIER_RESP:
|
||||
HighPriorityMessage = TRUE;
|
||||
if (Adapter->LinkStatus == LINKUP_DONE)
|
||||
CmControlResponseMessage(Adapter,
|
||||
(skb->data + sizeof(USHORT)));
|
||||
break;
|
||||
case LINK_CONTROL_RESP: /* 0xA2 */
|
||||
case STATUS_RSP: /* 0xA1 */
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT,
|
||||
DBG_LVL_ALL, "LINK_CONTROL_RESP");
|
||||
HighPriorityMessage = TRUE;
|
||||
LinkControlResponseMessage(Adapter,
|
||||
(skb->data + sizeof(USHORT)));
|
||||
break;
|
||||
case STATS_POINTER_RESP: /* 0xA6 */
|
||||
HighPriorityMessage = TRUE;
|
||||
StatisticsResponse(Adapter, (skb->data + sizeof(USHORT)));
|
||||
break;
|
||||
case IDLE_MODE_STATUS: /* 0xA3 */
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT,
|
||||
DBG_LVL_ALL,
|
||||
"IDLE_MODE_STATUS Type Message Got from F/W");
|
||||
InterfaceIdleModeRespond(Adapter, (PUINT)(skb->data +
|
||||
sizeof(USHORT)));
|
||||
HighPriorityMessage = TRUE;
|
||||
break;
|
||||
|
||||
case AUTH_SS_HOST_MSG:
|
||||
HighPriorityMessage = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT,
|
||||
DBG_LVL_ALL, "Got Default Response");
|
||||
/* Let the Application Deal with This Packet */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Queue The Control Packet to The Application Queues */
|
||||
down(&Adapter->RxAppControlQueuelock);
|
||||
|
||||
for (pTarang = Adapter->pTarangs; pTarang; pTarang = pTarang->next) {
|
||||
if (Adapter->device_removed)
|
||||
break;
|
||||
|
||||
drop_pkt_flag = TRUE;
|
||||
/*
|
||||
* There are cntrl msg from A0 to AC. It has been mapped to 0 to
|
||||
* C bit in the cntrl mask.
|
||||
* Also, by default AD to BF has been masked to the rest of the
|
||||
* bits... which wil be ON by default.
|
||||
* if mask bit is enable to particular pkt status, send it out
|
||||
* to app else stop it.
|
||||
*/
|
||||
cntrl_msg_mask_bit = (usStatus & 0x1F);
|
||||
/*
|
||||
* printk("\ninew msg mask bit which is disable in mask:%X",
|
||||
* cntrl_msg_mask_bit);
|
||||
*/
|
||||
if (pTarang->RxCntrlMsgBitMask & (1 << cntrl_msg_mask_bit))
|
||||
drop_pkt_flag = false;
|
||||
|
||||
if ((drop_pkt_flag == TRUE) ||
|
||||
(pTarang->AppCtrlQueueLen > MAX_APP_QUEUE_LEN)
|
||||
|| ((pTarang->AppCtrlQueueLen >
|
||||
MAX_APP_QUEUE_LEN / 2) &&
|
||||
(HighPriorityMessage == false))) {
|
||||
/*
|
||||
* Assumption:-
|
||||
* 1. every tarang manages it own dropped pkt
|
||||
* statitistics
|
||||
* 2. Total packet dropped per tarang will be equal to
|
||||
* the sum of all types of dropped pkt by that
|
||||
* tarang only.
|
||||
*/
|
||||
struct bcm_mibs_dropped_cntrl_msg *msg =
|
||||
&pTarang->stDroppedAppCntrlMsgs;
|
||||
switch (*(PUSHORT)skb->data) {
|
||||
case CM_RESPONSES:
|
||||
msg->cm_responses++;
|
||||
break;
|
||||
case CM_CONTROL_NEWDSX_MULTICLASSIFIER_RESP:
|
||||
msg->cm_control_newdsx_multiclassifier_resp++;
|
||||
break;
|
||||
case LINK_CONTROL_RESP:
|
||||
msg->link_control_resp++;
|
||||
break;
|
||||
case STATUS_RSP:
|
||||
msg->status_rsp++;
|
||||
break;
|
||||
case STATS_POINTER_RESP:
|
||||
msg->stats_pointer_resp++;
|
||||
break;
|
||||
case IDLE_MODE_STATUS:
|
||||
msg->idle_mode_status++;
|
||||
break;
|
||||
case AUTH_SS_HOST_MSG:
|
||||
msg->auth_ss_host_msg++;
|
||||
break;
|
||||
default:
|
||||
msg->low_priority_message++;
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
newPacket = skb_clone(skb, GFP_KERNEL);
|
||||
if (!newPacket)
|
||||
break;
|
||||
ENQUEUEPACKET(pTarang->RxAppControlHead,
|
||||
pTarang->RxAppControlTail, newPacket);
|
||||
pTarang->AppCtrlQueueLen++;
|
||||
}
|
||||
up(&Adapter->RxAppControlQueuelock);
|
||||
wake_up(&Adapter->process_read_wait_queue);
|
||||
dev_kfree_skb(skb);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL,
|
||||
"After wake_up_interruptible");
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup ctrl_pkt_functions
|
||||
* Thread to handle control pkt reception
|
||||
*/
|
||||
|
||||
/* pointer to adapter object*/
|
||||
int control_packet_handler(struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
struct sk_buff *ctrl_packet = NULL;
|
||||
unsigned long flags = 0;
|
||||
/* struct timeval tv; */
|
||||
/* int *puiBuffer = NULL; */
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL,
|
||||
"Entering to make thread wait on control packet event!");
|
||||
while (1) {
|
||||
wait_event_interruptible(Adapter->process_rx_cntrlpkt,
|
||||
atomic_read(&Adapter->cntrlpktCnt) ||
|
||||
Adapter->bWakeUpDevice ||
|
||||
kthread_should_stop());
|
||||
|
||||
|
||||
if (kthread_should_stop()) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT,
|
||||
DBG_LVL_ALL, "Exiting\n");
|
||||
return 0;
|
||||
}
|
||||
if (TRUE == Adapter->bWakeUpDevice) {
|
||||
Adapter->bWakeUpDevice = false;
|
||||
if ((false == Adapter->bTriedToWakeUpFromlowPowerMode)
|
||||
&& ((TRUE == Adapter->IdleMode) ||
|
||||
(TRUE == Adapter->bShutStatus))) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
CP_CTRL_PKT, DBG_LVL_ALL,
|
||||
"Calling InterfaceAbortIdlemode\n");
|
||||
/*
|
||||
* Adapter->bTriedToWakeUpFromlowPowerMode
|
||||
* = TRUE;
|
||||
*/
|
||||
InterfaceIdleModeWakeup(Adapter);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
while (atomic_read(&Adapter->cntrlpktCnt)) {
|
||||
spin_lock_irqsave(&Adapter->control_queue_lock, flags);
|
||||
ctrl_packet = Adapter->RxControlHead;
|
||||
if (ctrl_packet) {
|
||||
DEQUEUEPACKET(Adapter->RxControlHead,
|
||||
Adapter->RxControlTail);
|
||||
/* Adapter->RxControlHead=ctrl_packet->next; */
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&Adapter->control_queue_lock,
|
||||
flags);
|
||||
handle_rx_control_packet(Adapter, ctrl_packet);
|
||||
atomic_dec(&Adapter->cntrlpktCnt);
|
||||
}
|
||||
|
||||
SetUpTargetDsxBuffers(Adapter);
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
INT flushAllAppQ(void)
|
||||
{
|
||||
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
|
||||
struct bcm_tarang_data *pTarang = NULL;
|
||||
struct sk_buff *PacketToDrop = NULL;
|
||||
|
||||
for (pTarang = Adapter->pTarangs; pTarang; pTarang = pTarang->next) {
|
||||
while (pTarang->RxAppControlHead != NULL) {
|
||||
PacketToDrop = pTarang->RxAppControlHead;
|
||||
DEQUEUEPACKET(pTarang->RxAppControlHead,
|
||||
pTarang->RxAppControlTail);
|
||||
dev_kfree_skb(PacketToDrop);
|
||||
}
|
||||
pTarang->AppCtrlQueueLen = 0;
|
||||
/* dropped contrl packet statistics also should be reset. */
|
||||
memset((PVOID)&pTarang->stDroppedAppCntrlMsgs, 0,
|
||||
sizeof(struct bcm_mibs_dropped_cntrl_msg));
|
||||
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,192 +0,0 @@
|
|||
#ifndef _HOST_MIBSINTERFACE_H
|
||||
#define _HOST_MIBSINTERFACE_H
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Beceem Communications Pvt. Ltd
|
||||
* File Name: HostMIBSInterface.h
|
||||
* Abstract: This file contains DS used by the Host to update the Host
|
||||
* statistics used for the MIBS.
|
||||
*/
|
||||
|
||||
#define MIBS_MAX_CLASSIFIERS 100
|
||||
#define MIBS_MAX_PHSRULES 100
|
||||
#define MIBS_MAX_SERVICEFLOWS 17
|
||||
#define MIBS_MAX_IP_RANGE_LENGTH 4
|
||||
#define MIBS_MAX_PORT_RANGE 4
|
||||
#define MIBS_MAX_PROTOCOL_LENGTH 32
|
||||
#define MIBS_MAX_PHS_LENGTHS 255
|
||||
#define MIBS_IPV6_ADDRESS_SIZEINBYTES 0x10
|
||||
#define MIBS_IP_LENGTH_OF_ADDRESS 4
|
||||
#define MIBS_MAX_HIST_ENTRIES 12
|
||||
#define MIBS_PKTSIZEHIST_RANGE 128
|
||||
|
||||
union bcm_mibs_ip_addr {
|
||||
struct {
|
||||
/* Source Ip Address Range */
|
||||
unsigned long ulIpv4Addr[MIBS_MAX_IP_RANGE_LENGTH];
|
||||
/* Source Ip Mask Address Range */
|
||||
unsigned long ulIpv4Mask[MIBS_MAX_IP_RANGE_LENGTH];
|
||||
};
|
||||
struct {
|
||||
/* Source Ip Address Range */
|
||||
unsigned long ulIpv6Addr[MIBS_MAX_IP_RANGE_LENGTH * 4];
|
||||
/* Source Ip Mask Address Range */
|
||||
unsigned long ulIpv6Mask[MIBS_MAX_IP_RANGE_LENGTH * 4];
|
||||
};
|
||||
struct {
|
||||
unsigned char ucIpv4Address[MIBS_MAX_IP_RANGE_LENGTH * MIBS_IP_LENGTH_OF_ADDRESS];
|
||||
unsigned char ucIpv4Mask[MIBS_MAX_IP_RANGE_LENGTH * MIBS_IP_LENGTH_OF_ADDRESS];
|
||||
};
|
||||
struct {
|
||||
unsigned char ucIpv6Address[MIBS_MAX_IP_RANGE_LENGTH * MIBS_IPV6_ADDRESS_SIZEINBYTES];
|
||||
unsigned char ucIpv6Mask[MIBS_MAX_IP_RANGE_LENGTH * MIBS_IPV6_ADDRESS_SIZEINBYTES];
|
||||
};
|
||||
};
|
||||
|
||||
struct bcm_mibs_host_info {
|
||||
u64 GoodTransmits;
|
||||
u64 GoodReceives;
|
||||
/* this to keep track of the Tx and Rx MailBox Registers. */
|
||||
unsigned long NumDesUsed;
|
||||
unsigned long CurrNumFreeDesc;
|
||||
unsigned long PrevNumFreeDesc;
|
||||
/* to keep track the no of byte received */
|
||||
unsigned long PrevNumRcevBytes;
|
||||
unsigned long CurrNumRcevBytes;
|
||||
/* QOS Related */
|
||||
unsigned long BEBucketSize;
|
||||
unsigned long rtPSBucketSize;
|
||||
unsigned long LastTxQueueIndex;
|
||||
bool TxOutofDescriptors;
|
||||
bool TimerActive;
|
||||
u32 u32TotalDSD;
|
||||
u32 aTxPktSizeHist[MIBS_MAX_HIST_ENTRIES];
|
||||
u32 aRxPktSizeHist[MIBS_MAX_HIST_ENTRIES];
|
||||
};
|
||||
|
||||
struct bcm_mibs_classifier_rule {
|
||||
unsigned long ulSFID;
|
||||
unsigned char ucReserved[2];
|
||||
u16 uiClassifierRuleIndex;
|
||||
bool bUsed;
|
||||
unsigned short usVCID_Value;
|
||||
u8 u8ClassifierRulePriority;
|
||||
union bcm_mibs_ip_addr stSrcIpAddress;
|
||||
/* IP Source Address Length */
|
||||
unsigned char ucIPSourceAddressLength;
|
||||
union bcm_mibs_ip_addr stDestIpAddress;
|
||||
/* IP Destination Address Length */
|
||||
unsigned char ucIPDestinationAddressLength;
|
||||
unsigned char ucIPTypeOfServiceLength;
|
||||
unsigned char ucTosLow;
|
||||
unsigned char ucTosHigh;
|
||||
unsigned char ucTosMask;
|
||||
unsigned char ucProtocolLength;
|
||||
unsigned char ucProtocol[MIBS_MAX_PROTOCOL_LENGTH];
|
||||
unsigned short usSrcPortRangeLo[MIBS_MAX_PORT_RANGE];
|
||||
unsigned short usSrcPortRangeHi[MIBS_MAX_PORT_RANGE];
|
||||
unsigned char ucSrcPortRangeLength;
|
||||
unsigned short usDestPortRangeLo[MIBS_MAX_PORT_RANGE];
|
||||
unsigned short usDestPortRangeHi[MIBS_MAX_PORT_RANGE];
|
||||
unsigned char ucDestPortRangeLength;
|
||||
bool bProtocolValid;
|
||||
bool bTOSValid;
|
||||
bool bDestIpValid;
|
||||
bool bSrcIpValid;
|
||||
unsigned char ucDirection;
|
||||
bool bIpv6Protocol;
|
||||
u32 u32PHSRuleID;
|
||||
};
|
||||
|
||||
struct bcm_mibs_phs_rule {
|
||||
unsigned long ulSFID;
|
||||
u8 u8PHSI;
|
||||
u8 u8PHSFLength;
|
||||
u8 u8PHSF[MIBS_MAX_PHS_LENGTHS];
|
||||
u8 u8PHSMLength;
|
||||
u8 u8PHSM[MIBS_MAX_PHS_LENGTHS];
|
||||
u8 u8PHSS;
|
||||
u8 u8PHSV;
|
||||
u8 reserved[5];
|
||||
long PHSModifiedBytes;
|
||||
unsigned long PHSModifiedNumPackets;
|
||||
unsigned long PHSErrorNumPackets;
|
||||
};
|
||||
|
||||
struct bcm_mibs_parameters {
|
||||
u32 wmanIfSfid;
|
||||
u32 wmanIfCmnCpsSfState;
|
||||
u32 wmanIfCmnCpsMaxSustainedRate;
|
||||
u32 wmanIfCmnCpsMaxTrafficBurst;
|
||||
u32 wmanIfCmnCpsMinReservedRate;
|
||||
u32 wmanIfCmnCpsToleratedJitter;
|
||||
u32 wmanIfCmnCpsMaxLatency;
|
||||
u32 wmanIfCmnCpsFixedVsVariableSduInd;
|
||||
u32 wmanIfCmnCpsSduSize;
|
||||
u32 wmanIfCmnCpsSfSchedulingType;
|
||||
u32 wmanIfCmnCpsArqEnable;
|
||||
u32 wmanIfCmnCpsArqWindowSize;
|
||||
u32 wmanIfCmnCpsArqBlockLifetime;
|
||||
u32 wmanIfCmnCpsArqSyncLossTimeout;
|
||||
u32 wmanIfCmnCpsArqDeliverInOrder;
|
||||
u32 wmanIfCmnCpsArqRxPurgeTimeout;
|
||||
u32 wmanIfCmnCpsArqBlockSize;
|
||||
u32 wmanIfCmnCpsMinRsvdTolerableRate;
|
||||
u32 wmanIfCmnCpsReqTxPolicy;
|
||||
u32 wmanIfCmnSfCsSpecification;
|
||||
u32 wmanIfCmnCpsTargetSaid;
|
||||
};
|
||||
|
||||
struct bcm_mibs_table {
|
||||
unsigned long ulSFID;
|
||||
unsigned short usVCID_Value;
|
||||
unsigned int uiThreshold;
|
||||
u8 u8TrafficPriority;
|
||||
bool bValid;
|
||||
bool bActive;
|
||||
bool bActivateRequestSent;
|
||||
u8 u8QueueType;
|
||||
unsigned int uiMaxBucketSize;
|
||||
unsigned int uiCurrentQueueDepthOnTarget;
|
||||
unsigned int uiCurrentBytesOnHost;
|
||||
unsigned int uiCurrentPacketsOnHost;
|
||||
unsigned int uiDroppedCountBytes;
|
||||
unsigned int uiDroppedCountPackets;
|
||||
unsigned int uiSentBytes;
|
||||
unsigned int uiSentPackets;
|
||||
unsigned int uiCurrentDrainRate;
|
||||
unsigned int uiThisPeriodSentBytes;
|
||||
u64 liDrainCalculated;
|
||||
unsigned int uiCurrentTokenCount;
|
||||
u64 liLastUpdateTokenAt;
|
||||
unsigned int uiMaxAllowedRate;
|
||||
unsigned int NumOfPacketsSent;
|
||||
unsigned char ucDirection;
|
||||
unsigned short usCID;
|
||||
struct bcm_mibs_parameters stMibsExtServiceFlowTable;
|
||||
unsigned int uiCurrentRxRate;
|
||||
unsigned int uiThisPeriodRxBytes;
|
||||
unsigned int uiTotalRxBytes;
|
||||
unsigned int uiTotalTxBytes;
|
||||
};
|
||||
|
||||
struct bcm_mibs_dropped_cntrl_msg {
|
||||
unsigned long cm_responses;
|
||||
unsigned long cm_control_newdsx_multiclassifier_resp;
|
||||
unsigned long link_control_resp;
|
||||
unsigned long status_rsp;
|
||||
unsigned long stats_pointer_resp;
|
||||
unsigned long idle_mode_status;
|
||||
unsigned long auth_ss_host_msg;
|
||||
unsigned long low_priority_message;
|
||||
};
|
||||
|
||||
struct bcm_host_stats_mibs {
|
||||
struct bcm_mibs_host_info stHostInfo;
|
||||
struct bcm_mibs_classifier_rule astClassifierTable[MIBS_MAX_CLASSIFIERS];
|
||||
struct bcm_mibs_table astSFtable[MIBS_MAX_SERVICEFLOWS];
|
||||
struct bcm_mibs_phs_rule astPhsRulesTable[MIBS_MAX_PHSRULES];
|
||||
struct bcm_mibs_dropped_cntrl_msg stDroppedAppCntrlMsgs;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,476 +0,0 @@
|
|||
#include "headers.h"
|
||||
|
||||
static bool MatchSrcIpv6Address(struct bcm_classifier_rule *pstClassifierRule,
|
||||
struct bcm_ipv6_hdr *pstIpv6Header);
|
||||
static bool MatchDestIpv6Address(struct bcm_classifier_rule *pstClassifierRule,
|
||||
struct bcm_ipv6_hdr *pstIpv6Header);
|
||||
static VOID DumpIpv6Header(struct bcm_ipv6_hdr *pstIpv6Header);
|
||||
|
||||
static UCHAR *GetNextIPV6ChainedHeader(UCHAR **ppucPayload,
|
||||
UCHAR *pucNextHeader, bool *bParseDone, USHORT *pusPayloadLength)
|
||||
{
|
||||
UCHAR *pucRetHeaderPtr = NULL;
|
||||
UCHAR *pucPayloadPtr = NULL;
|
||||
USHORT usNextHeaderOffset = 0;
|
||||
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
|
||||
|
||||
if ((ppucPayload == NULL) || (*pusPayloadLength == 0) ||
|
||||
(*bParseDone)) {
|
||||
*bParseDone = TRUE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pucRetHeaderPtr = *ppucPayload;
|
||||
pucPayloadPtr = *ppucPayload;
|
||||
|
||||
if (!pucRetHeaderPtr || !pucPayloadPtr) {
|
||||
*bParseDone = TRUE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get the Nextt Header Type */
|
||||
*bParseDone = false;
|
||||
|
||||
|
||||
switch (*pucNextHeader) {
|
||||
case IPV6HDR_TYPE_HOPBYHOP:
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL, "\nIPv6 HopByHop Header");
|
||||
usNextHeaderOffset += sizeof(struct bcm_ipv6_options_hdr);
|
||||
break;
|
||||
|
||||
case IPV6HDR_TYPE_ROUTING:
|
||||
{
|
||||
struct bcm_ipv6_routing_hdr *pstIpv6RoutingHeader;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL, "\nIPv6 Routing Header");
|
||||
pstIpv6RoutingHeader =
|
||||
(struct bcm_ipv6_routing_hdr *)pucPayloadPtr;
|
||||
usNextHeaderOffset += sizeof(struct bcm_ipv6_routing_hdr);
|
||||
usNextHeaderOffset += pstIpv6RoutingHeader->ucNumAddresses *
|
||||
IPV6_ADDRESS_SIZEINBYTES;
|
||||
}
|
||||
break;
|
||||
|
||||
case IPV6HDR_TYPE_FRAGMENTATION:
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL,
|
||||
"\nIPv6 Fragmentation Header");
|
||||
usNextHeaderOffset += sizeof(struct bcm_ipv6_fragment_hdr);
|
||||
break;
|
||||
|
||||
case IPV6HDR_TYPE_DESTOPTS:
|
||||
{
|
||||
struct bcm_ipv6_dest_options_hdr *pstIpv6DestOptsHdr =
|
||||
(struct bcm_ipv6_dest_options_hdr *)pucPayloadPtr;
|
||||
int nTotalOptions = pstIpv6DestOptsHdr->ucHdrExtLen;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL,
|
||||
"\nIPv6 DestOpts Header Header");
|
||||
usNextHeaderOffset += sizeof(struct bcm_ipv6_dest_options_hdr);
|
||||
usNextHeaderOffset += nTotalOptions *
|
||||
IPV6_DESTOPTS_HDR_OPTIONSIZE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case IPV6HDR_TYPE_AUTHENTICATION:
|
||||
{
|
||||
struct bcm_ipv6_authentication_hdr *pstIpv6AuthHdr =
|
||||
(struct bcm_ipv6_authentication_hdr *)pucPayloadPtr;
|
||||
int nHdrLen = pstIpv6AuthHdr->ucLength;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL,
|
||||
"\nIPv6 Authentication Header");
|
||||
usNextHeaderOffset += nHdrLen * 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case IPV6HDR_TYPE_ENCRYPTEDSECURITYPAYLOAD:
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL,
|
||||
"\nIPv6 Encrypted Security Payload Header");
|
||||
*bParseDone = TRUE;
|
||||
break;
|
||||
|
||||
case IPV6_ICMP_HDR_TYPE:
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL, "\nICMP Header");
|
||||
*bParseDone = TRUE;
|
||||
break;
|
||||
|
||||
case TCP_HEADER_TYPE:
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL, "\nTCP Header");
|
||||
*bParseDone = TRUE;
|
||||
break;
|
||||
|
||||
case UDP_HEADER_TYPE:
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL, "\nUDP Header");
|
||||
*bParseDone = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
*bParseDone = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (*bParseDone == false) {
|
||||
if (*pusPayloadLength <= usNextHeaderOffset) {
|
||||
*bParseDone = TRUE;
|
||||
} else {
|
||||
*pucNextHeader = *pucPayloadPtr;
|
||||
pucPayloadPtr += usNextHeaderOffset;
|
||||
(*pusPayloadLength) -= usNextHeaderOffset;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*ppucPayload = pucPayloadPtr;
|
||||
return pucRetHeaderPtr;
|
||||
}
|
||||
|
||||
|
||||
static UCHAR GetIpv6ProtocolPorts(UCHAR *pucPayload, USHORT *pusSrcPort,
|
||||
USHORT *pusDestPort, USHORT usPayloadLength, UCHAR ucNextHeader)
|
||||
{
|
||||
UCHAR *pIpv6HdrScanContext = pucPayload;
|
||||
bool bDone = false;
|
||||
UCHAR ucHeaderType = 0;
|
||||
UCHAR *pucNextHeader = NULL;
|
||||
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
|
||||
|
||||
if (!pucPayload || (usPayloadLength == 0))
|
||||
return 0;
|
||||
|
||||
*pusSrcPort = *pusDestPort = 0;
|
||||
ucHeaderType = ucNextHeader;
|
||||
while (!bDone) {
|
||||
pucNextHeader = GetNextIPV6ChainedHeader(&pIpv6HdrScanContext,
|
||||
&ucHeaderType,
|
||||
&bDone,
|
||||
&usPayloadLength);
|
||||
if (bDone) {
|
||||
if ((ucHeaderType == TCP_HEADER_TYPE) ||
|
||||
(ucHeaderType == UDP_HEADER_TYPE)) {
|
||||
*pusSrcPort = *((PUSHORT)(pucNextHeader));
|
||||
*pusDestPort = *((PUSHORT)(pucNextHeader+2));
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL,
|
||||
"\nProtocol Ports - Src Port :0x%x Dest Port : 0x%x",
|
||||
ntohs(*pusSrcPort),
|
||||
ntohs(*pusDestPort));
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
return ucHeaderType;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Arg 1 struct bcm_mini_adapter *Adapter is a pointer ot the driver control
|
||||
* structure
|
||||
* Arg 2 PVOID pcIpHeader is a pointer to the IP header of the packet
|
||||
*/
|
||||
USHORT IpVersion6(struct bcm_mini_adapter *Adapter, PVOID pcIpHeader,
|
||||
struct bcm_classifier_rule *pstClassifierRule)
|
||||
{
|
||||
USHORT ushDestPort = 0;
|
||||
USHORT ushSrcPort = 0;
|
||||
UCHAR ucNextProtocolAboveIP = 0;
|
||||
struct bcm_ipv6_hdr *pstIpv6Header = NULL;
|
||||
bool bClassificationSucceed = false;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL, "IpVersion6 ==========>\n");
|
||||
|
||||
pstIpv6Header = pcIpHeader;
|
||||
|
||||
DumpIpv6Header(pstIpv6Header);
|
||||
|
||||
/*
|
||||
* Try to get the next higher layer protocol
|
||||
* and the Ports Nos if TCP or UDP
|
||||
*/
|
||||
ucNextProtocolAboveIP = GetIpv6ProtocolPorts((UCHAR *)(pcIpHeader +
|
||||
sizeof(struct bcm_ipv6_hdr)),
|
||||
&ushSrcPort,
|
||||
&ushDestPort,
|
||||
pstIpv6Header->usPayloadLength,
|
||||
pstIpv6Header->ucNextHeader);
|
||||
|
||||
do {
|
||||
if (pstClassifierRule->ucDirection == 0) {
|
||||
/*
|
||||
* cannot be processed for classification.
|
||||
* it is a down link connection
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
if (!pstClassifierRule->bIpv6Protocol) {
|
||||
/*
|
||||
* We are looking for Ipv6 Classifiers
|
||||
* Lets ignore this classifier and try the next one
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
bClassificationSucceed = MatchSrcIpv6Address(pstClassifierRule,
|
||||
pstIpv6Header);
|
||||
if (!bClassificationSucceed)
|
||||
break;
|
||||
|
||||
bClassificationSucceed = MatchDestIpv6Address(pstClassifierRule,
|
||||
pstIpv6Header);
|
||||
if (!bClassificationSucceed)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Match the protocol type.
|
||||
* For IPv6 the next protocol at end of
|
||||
* Chain of IPv6 prot headers
|
||||
*/
|
||||
bClassificationSucceed = MatchProtocol(pstClassifierRule,
|
||||
ucNextProtocolAboveIP);
|
||||
if (!bClassificationSucceed)
|
||||
break;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL, "\nIPv6 Protocol Matched");
|
||||
|
||||
if ((ucNextProtocolAboveIP == TCP_HEADER_TYPE) ||
|
||||
(ucNextProtocolAboveIP == UDP_HEADER_TYPE)) {
|
||||
/* Match Src Port */
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL, "\nIPv6 Source Port:%x\n",
|
||||
ntohs(ushSrcPort));
|
||||
bClassificationSucceed = MatchSrcPort(pstClassifierRule,
|
||||
ntohs(ushSrcPort));
|
||||
if (!bClassificationSucceed)
|
||||
break;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL, "\nIPv6 Src Port Matched");
|
||||
|
||||
/* Match Dest Port */
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL,
|
||||
"\nIPv6 Destination Port:%x\n",
|
||||
ntohs(ushDestPort));
|
||||
bClassificationSucceed = MatchDestPort(pstClassifierRule,
|
||||
ntohs(ushDestPort));
|
||||
if (!bClassificationSucceed)
|
||||
break;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL,
|
||||
"\nIPv6 Dest Port Matched");
|
||||
}
|
||||
} while (0);
|
||||
|
||||
if (bClassificationSucceed == TRUE) {
|
||||
INT iMatchedSFQueueIndex = 0;
|
||||
|
||||
iMatchedSFQueueIndex = SearchSfid(Adapter,
|
||||
pstClassifierRule->ulSFID);
|
||||
if ((iMatchedSFQueueIndex >= NO_OF_QUEUES) ||
|
||||
(Adapter->PackInfo[iMatchedSFQueueIndex].bActive == false))
|
||||
bClassificationSucceed = false;
|
||||
}
|
||||
|
||||
return bClassificationSucceed;
|
||||
}
|
||||
|
||||
|
||||
static bool MatchSrcIpv6Address(struct bcm_classifier_rule *pstClassifierRule,
|
||||
struct bcm_ipv6_hdr *pstIpv6Header)
|
||||
{
|
||||
UINT uiLoopIndex = 0;
|
||||
UINT uiIpv6AddIndex = 0;
|
||||
UINT uiIpv6AddrNoLongWords = 4;
|
||||
ULONG aulSrcIP[4];
|
||||
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
|
||||
union u_ip_address *src_addr = &pstClassifierRule->stSrcIpAddress;
|
||||
|
||||
/*
|
||||
* This is the no. of Src Addresses ie Range of IP Addresses contained
|
||||
* in the classifier rule for which we need to match
|
||||
*/
|
||||
UINT uiCountIPSrcAddresses =
|
||||
(UINT)pstClassifierRule->ucIPSourceAddressLength;
|
||||
|
||||
|
||||
if (uiCountIPSrcAddresses == 0)
|
||||
return TRUE;
|
||||
|
||||
|
||||
/* First Convert the Ip Address in the packet to Host Endian order */
|
||||
for (uiIpv6AddIndex = 0;
|
||||
uiIpv6AddIndex < uiIpv6AddrNoLongWords;
|
||||
uiIpv6AddIndex++)
|
||||
aulSrcIP[uiIpv6AddIndex] =
|
||||
ntohl(pstIpv6Header->ulSrcIpAddress[uiIpv6AddIndex]);
|
||||
|
||||
for (uiLoopIndex = 0;
|
||||
uiLoopIndex < uiCountIPSrcAddresses;
|
||||
uiLoopIndex += uiIpv6AddrNoLongWords) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
"\n Src Ipv6 Address In Received Packet :\n ");
|
||||
DumpIpv6Address(aulSrcIP);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
"\n Src Ipv6 Mask In Classifier Rule:\n");
|
||||
DumpIpv6Address(&src_addr->ulIpv6Mask[uiLoopIndex]);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
"\n Src Ipv6 Address In Classifier Rule :\n");
|
||||
DumpIpv6Address(&src_addr->ulIpv6Addr[uiLoopIndex]);
|
||||
|
||||
for (uiIpv6AddIndex = 0;
|
||||
uiIpv6AddIndex < uiIpv6AddrNoLongWords;
|
||||
uiIpv6AddIndex++) {
|
||||
if ((src_addr->ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] &
|
||||
aulSrcIP[uiIpv6AddIndex]) !=
|
||||
src_addr->ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) {
|
||||
/*
|
||||
* Match failed for current Ipv6 Address
|
||||
* Try next Ipv6 Address
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
if (uiIpv6AddIndex == uiIpv6AddrNoLongWords-1) {
|
||||
/* Match Found */
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL,
|
||||
"Ipv6 Src Ip Address Matched\n");
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool MatchDestIpv6Address(struct bcm_classifier_rule *pstClassifierRule,
|
||||
struct bcm_ipv6_hdr *pstIpv6Header)
|
||||
{
|
||||
UINT uiLoopIndex = 0;
|
||||
UINT uiIpv6AddIndex = 0;
|
||||
UINT uiIpv6AddrNoLongWords = 4;
|
||||
ULONG aulDestIP[4];
|
||||
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
|
||||
union u_ip_address *dest_addr = &pstClassifierRule->stDestIpAddress;
|
||||
|
||||
/*
|
||||
* This is the no. of Destination Addresses
|
||||
* ie Range of IP Addresses contained in the classifier rule
|
||||
* for which we need to match
|
||||
*/
|
||||
UINT uiCountIPDestinationAddresses =
|
||||
(UINT)pstClassifierRule->ucIPDestinationAddressLength;
|
||||
|
||||
if (uiCountIPDestinationAddresses == 0)
|
||||
return TRUE;
|
||||
|
||||
|
||||
/* First Convert the Ip Address in the packet to Host Endian order */
|
||||
for (uiIpv6AddIndex = 0;
|
||||
uiIpv6AddIndex < uiIpv6AddrNoLongWords;
|
||||
uiIpv6AddIndex++)
|
||||
aulDestIP[uiIpv6AddIndex] =
|
||||
ntohl(pstIpv6Header->ulDestIpAddress[uiIpv6AddIndex]);
|
||||
|
||||
for (uiLoopIndex = 0;
|
||||
uiLoopIndex < uiCountIPDestinationAddresses;
|
||||
uiLoopIndex += uiIpv6AddrNoLongWords) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
"\n Destination Ipv6 Address In Received Packet :\n ");
|
||||
DumpIpv6Address(aulDestIP);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
"\n Destination Ipv6 Mask In Classifier Rule :\n");
|
||||
DumpIpv6Address(&dest_addr->ulIpv6Mask[uiLoopIndex]);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
"\n Destination Ipv6 Address In Classifier Rule :\n");
|
||||
DumpIpv6Address(&dest_addr->ulIpv6Addr[uiLoopIndex]);
|
||||
|
||||
for (uiIpv6AddIndex = 0;
|
||||
uiIpv6AddIndex < uiIpv6AddrNoLongWords;
|
||||
uiIpv6AddIndex++) {
|
||||
if ((dest_addr->ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] &
|
||||
aulDestIP[uiIpv6AddIndex]) !=
|
||||
dest_addr->ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) {
|
||||
/*
|
||||
* Match failed for current Ipv6 Address.
|
||||
* Try next Ipv6 Address
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
if (uiIpv6AddIndex == uiIpv6AddrNoLongWords-1) {
|
||||
/* Match Found */
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
|
||||
DBG_LVL_ALL,
|
||||
"Ipv6 Destination Ip Address Matched\n");
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
VOID DumpIpv6Address(ULONG *puIpv6Address)
|
||||
{
|
||||
UINT uiIpv6AddrNoLongWords = 4;
|
||||
UINT uiIpv6AddIndex = 0;
|
||||
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
|
||||
|
||||
for (uiIpv6AddIndex = 0;
|
||||
uiIpv6AddIndex < uiIpv6AddrNoLongWords;
|
||||
uiIpv6AddIndex++) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
":%lx", puIpv6Address[uiIpv6AddIndex]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static VOID DumpIpv6Header(struct bcm_ipv6_hdr *pstIpv6Header)
|
||||
{
|
||||
UCHAR ucVersion;
|
||||
UCHAR ucPrio;
|
||||
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
"----Ipv6 Header---");
|
||||
ucVersion = pstIpv6Header->ucVersionPrio & 0xf0;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
"Version : %x\n", ucVersion);
|
||||
ucPrio = pstIpv6Header->ucVersionPrio & 0x0f;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
"Priority : %x\n", ucPrio);
|
||||
/*
|
||||
* BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
* "Flow Label : %x\n",(pstIpv6Header->ucVersionPrio &0xf0);
|
||||
*/
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
"Payload Length : %x\n",
|
||||
ntohs(pstIpv6Header->usPayloadLength));
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
"Next Header : %x\n", pstIpv6Header->ucNextHeader);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
"Hop Limit : %x\n", pstIpv6Header->ucHopLimit);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
"Src Address :\n");
|
||||
DumpIpv6Address(pstIpv6Header->ulSrcIpAddress);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
"Dest Address :\n");
|
||||
DumpIpv6Address(pstIpv6Header->ulDestIpAddress);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
|
||||
"----Ipv6 Header End---");
|
||||
|
||||
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
#ifndef _IPV6_PROTOCOL_DEFINES_
|
||||
#define _IPV6_PROTOCOL_DEFINES_
|
||||
|
||||
#define IPV6HDR_TYPE_HOPBYHOP 0x0
|
||||
#define IPV6HDR_TYPE_ROUTING 0x2B
|
||||
#define IPV6HDR_TYPE_FRAGMENTATION 0x2C
|
||||
#define IPV6HDR_TYPE_DESTOPTS 0x3c
|
||||
#define IPV6HDR_TYPE_AUTHENTICATION 0x33
|
||||
#define IPV6HDR_TYPE_ENCRYPTEDSECURITYPAYLOAD 0x34
|
||||
#define MASK_IPV6_CS_SPEC 0x2
|
||||
|
||||
#define TCP_HEADER_TYPE 0x6
|
||||
#define UDP_HEADER_TYPE 0x11
|
||||
#define IPV6_ICMP_HDR_TYPE 0x2
|
||||
#define IPV6_FLOWLABEL_BITOFFSET 9
|
||||
|
||||
#define IPV6_MAX_CHAINEDHDR_BUFFBYTES 0x64
|
||||
/*
|
||||
* Size of Dest Options field of Destinations Options Header
|
||||
* in bytes.
|
||||
*/
|
||||
#define IPV6_DESTOPTS_HDR_OPTIONSIZE 0x8
|
||||
|
||||
struct bcm_ipv6_hdr {
|
||||
unsigned char ucVersionPrio;
|
||||
unsigned char aucFlowLabel[3];
|
||||
unsigned short usPayloadLength;
|
||||
unsigned char ucNextHeader;
|
||||
unsigned char ucHopLimit;
|
||||
unsigned long ulSrcIpAddress[4];
|
||||
unsigned long ulDestIpAddress[4];
|
||||
};
|
||||
|
||||
struct bcm_ipv6_routing_hdr {
|
||||
unsigned char ucNextHeader;
|
||||
unsigned char ucRoutingType;
|
||||
unsigned char ucNumAddresses;
|
||||
unsigned char ucNextAddress;
|
||||
unsigned long ulReserved;
|
||||
};
|
||||
|
||||
struct bcm_ipv6_fragment_hdr {
|
||||
unsigned char ucNextHeader;
|
||||
unsigned char ucReserved;
|
||||
unsigned short usFragmentOffset;
|
||||
unsigned long ulIdentification;
|
||||
};
|
||||
|
||||
struct bcm_ipv6_dest_options_hdr {
|
||||
unsigned char ucNextHeader;
|
||||
unsigned char ucHdrExtLen;
|
||||
unsigned char ucDestOptions[6];
|
||||
};
|
||||
|
||||
struct bcm_ipv6_options_hdr {
|
||||
unsigned char ucNextHeader;
|
||||
unsigned char ucMisc[3];
|
||||
unsigned long ulJumboPayloadLen;
|
||||
};
|
||||
|
||||
struct bcm_ipv6_authentication_hdr {
|
||||
unsigned char ucNextHeader;
|
||||
unsigned char ucLength;
|
||||
unsigned short usReserved;
|
||||
unsigned long ulSecurityParametersIndex;
|
||||
};
|
||||
|
||||
enum bcm_ipaddr_context {
|
||||
eSrcIpAddress,
|
||||
eDestIpAddress
|
||||
};
|
||||
|
||||
/* Function Prototypes */
|
||||
|
||||
unsigned short IpVersion6(struct bcm_mini_adapter *Adapter, /* < Pointer to the driver control structure */
|
||||
void *pcIpHeader, /* <Pointer to the IP Hdr of the packet */
|
||||
struct bcm_classifier_rule *pstClassifierRule);
|
||||
|
||||
void DumpIpv6Address(unsigned long *puIpv6Address);
|
||||
|
||||
extern bool MatchSrcPort(struct bcm_classifier_rule *pstClassifierRule, unsigned short ushSrcPort);
|
||||
extern bool MatchDestPort(struct bcm_classifier_rule *pstClassifierRule, unsigned short ushSrcPort);
|
||||
extern bool MatchProtocol(struct bcm_classifier_rule *pstClassifierRule, unsigned char ucProtocol);
|
||||
|
||||
#endif
|
|
@ -1,79 +0,0 @@
|
|||
#ifndef _INTERFACE_ADAPTER_H
|
||||
#define _INTERFACE_ADAPTER_H
|
||||
|
||||
struct bcm_bulk_endpoint_in {
|
||||
char *bulk_in_buffer;
|
||||
size_t bulk_in_size;
|
||||
unsigned char bulk_in_endpointAddr;
|
||||
unsigned int bulk_in_pipe;
|
||||
};
|
||||
|
||||
struct bcm_bulk_endpoint_out {
|
||||
unsigned char bulk_out_buffer;
|
||||
size_t bulk_out_size;
|
||||
unsigned char bulk_out_endpointAddr;
|
||||
unsigned int bulk_out_pipe;
|
||||
/* this is used when int out endpoint is used as bulk out end point */
|
||||
unsigned char int_out_interval;
|
||||
};
|
||||
|
||||
struct bcm_intr_endpoint_in {
|
||||
char *int_in_buffer;
|
||||
size_t int_in_size;
|
||||
unsigned char int_in_endpointAddr;
|
||||
unsigned char int_in_interval;
|
||||
unsigned int int_in_pipe;
|
||||
};
|
||||
|
||||
struct bcm_intr_endpoint_out {
|
||||
char *int_out_buffer;
|
||||
size_t int_out_size;
|
||||
unsigned char int_out_endpointAddr;
|
||||
unsigned char int_out_interval;
|
||||
unsigned int int_out_pipe;
|
||||
};
|
||||
|
||||
struct bcm_usb_tcb {
|
||||
struct urb *urb;
|
||||
void *psIntfAdapter;
|
||||
bool bUsed;
|
||||
};
|
||||
|
||||
struct bcm_usb_rcb {
|
||||
struct urb *urb;
|
||||
void *psIntfAdapter;
|
||||
bool bUsed;
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the interface specific Sub-Adapter
|
||||
* Structure.
|
||||
*/
|
||||
struct bcm_interface_adapter {
|
||||
struct usb_device *udev;
|
||||
struct usb_interface *interface;
|
||||
/* Bulk endpoint in info */
|
||||
struct bcm_bulk_endpoint_in sBulkIn;
|
||||
/* Bulk endpoint out info */
|
||||
struct bcm_bulk_endpoint_out sBulkOut;
|
||||
/* Interrupt endpoint in info */
|
||||
struct bcm_intr_endpoint_in sIntrIn;
|
||||
/* Interrupt endpoint out info */
|
||||
struct bcm_intr_endpoint_out sIntrOut;
|
||||
unsigned long ulInterruptData[2];
|
||||
struct urb *psInterruptUrb;
|
||||
struct bcm_usb_tcb asUsbTcb[MAXIMUM_USB_TCB];
|
||||
struct bcm_usb_rcb asUsbRcb[MAXIMUM_USB_RCB];
|
||||
atomic_t uNumTcbUsed;
|
||||
atomic_t uCurrTcb;
|
||||
atomic_t uNumRcbUsed;
|
||||
atomic_t uCurrRcb;
|
||||
struct bcm_mini_adapter *psAdapter;
|
||||
bool bFlashBoot;
|
||||
bool bHighSpeedDevice;
|
||||
bool bSuspended;
|
||||
bool bPreparingForBusSuspend;
|
||||
struct work_struct usbSuspendWork;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,317 +0,0 @@
|
|||
#include "headers.h"
|
||||
|
||||
int InterfaceFileDownload(PVOID arg, struct file *flp, unsigned int on_chip_loc)
|
||||
{
|
||||
/* unsigned int reg = 0; */
|
||||
mm_segment_t oldfs = {0};
|
||||
int errno = 0, len = 0; /* ,is_config_file = 0 */
|
||||
loff_t pos = 0;
|
||||
struct bcm_interface_adapter *psIntfAdapter = arg;
|
||||
/* struct bcm_mini_adapter *Adapter = psIntfAdapter->psAdapter; */
|
||||
char *buff = kmalloc(MAX_TRANSFER_CTRL_BYTE_USB, GFP_KERNEL);
|
||||
|
||||
if (!buff)
|
||||
return -ENOMEM;
|
||||
|
||||
while (1) {
|
||||
oldfs = get_fs();
|
||||
set_fs(get_ds());
|
||||
len = vfs_read(flp, (void __force __user *)buff,
|
||||
MAX_TRANSFER_CTRL_BYTE_USB, &pos);
|
||||
set_fs(oldfs);
|
||||
if (len <= 0) {
|
||||
if (len < 0)
|
||||
errno = len;
|
||||
else
|
||||
errno = 0;
|
||||
break;
|
||||
}
|
||||
/* BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_INITEXIT, MP_INIT,
|
||||
* DBG_LVL_ALL, buff,
|
||||
* MAX_TRANSFER_CTRL_BYTE_USB);
|
||||
*/
|
||||
errno = InterfaceWRM(psIntfAdapter, on_chip_loc, buff, len);
|
||||
if (errno)
|
||||
break;
|
||||
on_chip_loc += MAX_TRANSFER_CTRL_BYTE_USB;
|
||||
}
|
||||
|
||||
kfree(buff);
|
||||
return errno;
|
||||
}
|
||||
|
||||
int InterfaceFileReadbackFromChip(PVOID arg, struct file *flp,
|
||||
unsigned int on_chip_loc)
|
||||
{
|
||||
char *buff, *buff_readback;
|
||||
unsigned int reg = 0;
|
||||
mm_segment_t oldfs = {0};
|
||||
int errno = 0, len = 0, is_config_file = 0;
|
||||
loff_t pos = 0;
|
||||
static int fw_down;
|
||||
INT Status = STATUS_SUCCESS;
|
||||
struct bcm_interface_adapter *psIntfAdapter = arg;
|
||||
int bytes;
|
||||
|
||||
buff = kzalloc(MAX_TRANSFER_CTRL_BYTE_USB, GFP_DMA);
|
||||
buff_readback = kzalloc(MAX_TRANSFER_CTRL_BYTE_USB , GFP_DMA);
|
||||
if (!buff || !buff_readback) {
|
||||
kfree(buff);
|
||||
kfree(buff_readback);
|
||||
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
is_config_file = (on_chip_loc == CONFIG_BEGIN_ADDR) ? 1 : 0;
|
||||
|
||||
while (1) {
|
||||
oldfs = get_fs();
|
||||
set_fs(get_ds());
|
||||
len = vfs_read(flp, (void __force __user *)buff,
|
||||
MAX_TRANSFER_CTRL_BYTE_USB, &pos);
|
||||
set_fs(oldfs);
|
||||
fw_down++;
|
||||
|
||||
if (len <= 0) {
|
||||
if (len < 0)
|
||||
errno = len;
|
||||
else
|
||||
errno = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
bytes = InterfaceRDM(psIntfAdapter, on_chip_loc,
|
||||
buff_readback, len);
|
||||
if (bytes < 0) {
|
||||
Status = bytes;
|
||||
goto exit;
|
||||
}
|
||||
reg++;
|
||||
if ((len-sizeof(unsigned int)) < 4) {
|
||||
if (memcmp(buff_readback, buff, len)) {
|
||||
Status = -EIO;
|
||||
goto exit;
|
||||
}
|
||||
} else {
|
||||
len -= 4;
|
||||
|
||||
while (len) {
|
||||
if (*(unsigned int *)&buff_readback[len] !=
|
||||
*(unsigned int *)&buff[len]) {
|
||||
Status = -EIO;
|
||||
goto exit;
|
||||
}
|
||||
len -= 4;
|
||||
}
|
||||
}
|
||||
on_chip_loc += MAX_TRANSFER_CTRL_BYTE_USB;
|
||||
} /* End of while(1) */
|
||||
|
||||
exit:
|
||||
kfree(buff);
|
||||
kfree(buff_readback);
|
||||
return Status;
|
||||
}
|
||||
|
||||
static int bcm_download_config_file(struct bcm_mini_adapter *Adapter,
|
||||
struct bcm_firmware_info *psFwInfo)
|
||||
{
|
||||
int retval = STATUS_SUCCESS;
|
||||
B_UINT32 value = 0;
|
||||
|
||||
if (Adapter->pstargetparams == NULL) {
|
||||
Adapter->pstargetparams =
|
||||
kmalloc(sizeof(struct bcm_target_params), GFP_KERNEL);
|
||||
if (Adapter->pstargetparams == NULL)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (psFwInfo->u32FirmwareLength != sizeof(struct bcm_target_params))
|
||||
return -EIO;
|
||||
|
||||
retval = copy_from_user(Adapter->pstargetparams,
|
||||
psFwInfo->pvMappedFirmwareAddress,
|
||||
psFwInfo->u32FirmwareLength);
|
||||
if (retval) {
|
||||
kfree(Adapter->pstargetparams);
|
||||
Adapter->pstargetparams = NULL;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
/* Parse the structure and then Download the Firmware */
|
||||
beceem_parse_target_struct(Adapter);
|
||||
|
||||
/* Initializing the NVM. */
|
||||
BcmInitNVM(Adapter);
|
||||
retval = InitLedSettings(Adapter);
|
||||
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
if (Adapter->LEDInfo.led_thread_running &
|
||||
BCM_LED_THREAD_RUNNING_ACTIVELY) {
|
||||
Adapter->LEDInfo.bLedInitDone = false;
|
||||
Adapter->DriverState = DRIVER_INIT;
|
||||
wake_up(&Adapter->LEDInfo.notify_led_event);
|
||||
}
|
||||
|
||||
if (Adapter->LEDInfo.led_thread_running &
|
||||
BCM_LED_THREAD_RUNNING_ACTIVELY) {
|
||||
Adapter->DriverState = FW_DOWNLOAD;
|
||||
wake_up(&Adapter->LEDInfo.notify_led_event);
|
||||
}
|
||||
|
||||
/* Initialize the DDR Controller */
|
||||
retval = ddr_init(Adapter);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
value = 0;
|
||||
wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC - 4,
|
||||
&value, sizeof(value));
|
||||
wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC - 8,
|
||||
&value, sizeof(value));
|
||||
|
||||
if (Adapter->eNVMType == NVM_FLASH) {
|
||||
retval = PropagateCalParamsFromFlashToMemory(Adapter);
|
||||
if (retval)
|
||||
return retval;
|
||||
}
|
||||
|
||||
retval = buffDnldVerify(Adapter, (PUCHAR)Adapter->pstargetparams,
|
||||
sizeof(struct bcm_target_params), CONFIG_BEGIN_ADDR);
|
||||
|
||||
if (retval)
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT,
|
||||
MP_INIT, DBG_LVL_ALL,
|
||||
"configuration file not downloaded properly");
|
||||
else
|
||||
Adapter->bCfgDownloaded = TRUE;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int bcm_ioctl_fw_download(struct bcm_mini_adapter *Adapter,
|
||||
struct bcm_firmware_info *psFwInfo)
|
||||
{
|
||||
int retval = STATUS_SUCCESS;
|
||||
PUCHAR buff = NULL;
|
||||
|
||||
/* Config File is needed for the Driver to download the Config file and
|
||||
* Firmware. Check for the Config file to be first to be sent from the
|
||||
* Application
|
||||
*/
|
||||
atomic_set(&Adapter->uiMBupdate, false);
|
||||
if (!Adapter->bCfgDownloaded &&
|
||||
psFwInfo->u32StartingAddress != CONFIG_BEGIN_ADDR) {
|
||||
/* Can't Download Firmware. */
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* If Config File, Finish the DDR Settings and then Download CFG File */
|
||||
if (psFwInfo->u32StartingAddress == CONFIG_BEGIN_ADDR) {
|
||||
retval = bcm_download_config_file(Adapter, psFwInfo);
|
||||
} else {
|
||||
buff = kzalloc(psFwInfo->u32FirmwareLength, GFP_KERNEL);
|
||||
if (buff == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
retval = copy_from_user(buff,
|
||||
psFwInfo->pvMappedFirmwareAddress,
|
||||
psFwInfo->u32FirmwareLength);
|
||||
if (retval != STATUS_SUCCESS) {
|
||||
retval = -EFAULT;
|
||||
goto error;
|
||||
}
|
||||
|
||||
retval = buffDnldVerify(Adapter,
|
||||
buff,
|
||||
psFwInfo->u32FirmwareLength,
|
||||
psFwInfo->u32StartingAddress);
|
||||
|
||||
if (retval != STATUS_SUCCESS)
|
||||
goto error;
|
||||
}
|
||||
|
||||
error:
|
||||
kfree(buff);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static INT buffDnld(struct bcm_mini_adapter *Adapter,
|
||||
PUCHAR mappedbuffer, UINT u32FirmwareLength,
|
||||
ULONG u32StartingAddress)
|
||||
{
|
||||
unsigned int len = 0;
|
||||
int retval = STATUS_SUCCESS;
|
||||
|
||||
len = u32FirmwareLength;
|
||||
|
||||
while (u32FirmwareLength) {
|
||||
len = MIN_VAL(u32FirmwareLength, MAX_TRANSFER_CTRL_BYTE_USB);
|
||||
retval = wrm(Adapter, u32StartingAddress, mappedbuffer, len);
|
||||
|
||||
if (retval)
|
||||
break;
|
||||
u32StartingAddress += len;
|
||||
u32FirmwareLength -= len;
|
||||
mappedbuffer += len;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
static INT buffRdbkVerify(struct bcm_mini_adapter *Adapter,
|
||||
PUCHAR mappedbuffer, UINT u32FirmwareLength,
|
||||
ULONG u32StartingAddress)
|
||||
{
|
||||
UINT len = u32FirmwareLength;
|
||||
INT retval = STATUS_SUCCESS;
|
||||
PUCHAR readbackbuff = kzalloc(MAX_TRANSFER_CTRL_BYTE_USB, GFP_KERNEL);
|
||||
int bytes;
|
||||
|
||||
if (NULL == readbackbuff)
|
||||
return -ENOMEM;
|
||||
|
||||
while (u32FirmwareLength && !retval) {
|
||||
len = MIN_VAL(u32FirmwareLength, MAX_TRANSFER_CTRL_BYTE_USB);
|
||||
bytes = rdm(Adapter, u32StartingAddress, readbackbuff, len);
|
||||
|
||||
if (bytes < 0) {
|
||||
retval = bytes;
|
||||
break;
|
||||
}
|
||||
|
||||
if (memcmp(readbackbuff, mappedbuffer, len) != 0) {
|
||||
pr_err("%s() failed. The firmware doesn't match what was written",
|
||||
__func__);
|
||||
retval = -EIO;
|
||||
}
|
||||
|
||||
u32StartingAddress += len;
|
||||
u32FirmwareLength -= len;
|
||||
mappedbuffer += len;
|
||||
|
||||
} /* end of while (u32FirmwareLength && !retval) */
|
||||
kfree(readbackbuff);
|
||||
return retval;
|
||||
}
|
||||
|
||||
INT buffDnldVerify(struct bcm_mini_adapter *Adapter,
|
||||
unsigned char *mappedbuffer,
|
||||
unsigned int u32FirmwareLength,
|
||||
unsigned long u32StartingAddress)
|
||||
{
|
||||
INT status = STATUS_SUCCESS;
|
||||
|
||||
status = buffDnld(Adapter, mappedbuffer,
|
||||
u32FirmwareLength, u32StartingAddress);
|
||||
if (status != STATUS_SUCCESS)
|
||||
goto error;
|
||||
|
||||
status = buffRdbkVerify(Adapter, mappedbuffer,
|
||||
u32FirmwareLength, u32StartingAddress);
|
||||
if (status != STATUS_SUCCESS)
|
||||
goto error;
|
||||
error:
|
||||
return status;
|
||||
}
|
|
@ -1,274 +0,0 @@
|
|||
#include "headers.h"
|
||||
|
||||
/*
|
||||
Function: InterfaceIdleModeWakeup
|
||||
|
||||
Description: This is the hardware specific Function for
|
||||
waking up HW device from Idle mode.
|
||||
A software abort pattern is written to the
|
||||
device to wake it and necessary power state
|
||||
transitions from host are performed here.
|
||||
|
||||
Input parameters: IN struct bcm_mini_adapter *Adapter
|
||||
- Miniport Adapter Context
|
||||
|
||||
Return: BCM_STATUS_SUCCESS - If Wakeup of the HW Interface
|
||||
was successful.
|
||||
Other - If an error occurred.
|
||||
*/
|
||||
|
||||
/*
|
||||
Function: InterfaceIdleModeRespond
|
||||
|
||||
Description: This is the hardware specific Function for
|
||||
responding to Idle mode request from target.
|
||||
Necessary power state transitions from host for
|
||||
idle mode or other device specific initializations
|
||||
are performed here.
|
||||
|
||||
Input parameters: IN struct bcm_mini_adapter * Adapter
|
||||
- Miniport Adapter Context
|
||||
|
||||
Return: BCM_STATUS_SUCCESS - If Idle mode response related
|
||||
HW configuration was successful.
|
||||
Other - If an error occurred.
|
||||
*/
|
||||
|
||||
/*
|
||||
"dmem bfc02f00 100" tells how many time device went in Idle mode.
|
||||
this value will be at address bfc02fa4.just before value d0ea1dle.
|
||||
|
||||
Set time value by writing at bfc02f98 7d0
|
||||
|
||||
checking the Ack timer expire on kannon by running command
|
||||
d qcslog .. if it shows e means host has not send response
|
||||
to f/w with in 200 ms. Response should be
|
||||
send to f/w with in 200 ms after the Idle/Shutdown req issued
|
||||
|
||||
*/
|
||||
|
||||
|
||||
int InterfaceIdleModeRespond(struct bcm_mini_adapter *Adapter,
|
||||
unsigned int *puiBuffer)
|
||||
{
|
||||
int status = STATUS_SUCCESS;
|
||||
unsigned int uiRegRead = 0;
|
||||
int bytes;
|
||||
|
||||
if (ntohl(*puiBuffer) == GO_TO_IDLE_MODE_PAYLOAD) {
|
||||
if (ntohl(*(puiBuffer+1)) == 0) {
|
||||
|
||||
status = wrmalt(Adapter, SW_ABORT_IDLEMODE_LOC,
|
||||
&uiRegRead, sizeof(uiRegRead));
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
if (Adapter->ulPowerSaveMode ==
|
||||
DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING) {
|
||||
uiRegRead = 0x00000000;
|
||||
status = wrmalt(Adapter,
|
||||
DEBUG_INTERRUPT_GENERATOR_REGISTOR,
|
||||
&uiRegRead, sizeof(uiRegRead));
|
||||
if (status)
|
||||
return status;
|
||||
}
|
||||
/* Below Register should not br read in case of
|
||||
* Manual and Protocol Idle mode */
|
||||
else if (Adapter->ulPowerSaveMode !=
|
||||
DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE) {
|
||||
/* clear on read Register */
|
||||
bytes = rdmalt(Adapter, DEVICE_INT_OUT_EP_REG0,
|
||||
&uiRegRead, sizeof(uiRegRead));
|
||||
if (bytes < 0) {
|
||||
status = bytes;
|
||||
return status;
|
||||
}
|
||||
/* clear on read Register */
|
||||
bytes = rdmalt(Adapter, DEVICE_INT_OUT_EP_REG1,
|
||||
&uiRegRead, sizeof(uiRegRead));
|
||||
if (bytes < 0) {
|
||||
status = bytes;
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set Idle Mode Flag to False and
|
||||
* Clear IdleMode reg. */
|
||||
Adapter->IdleMode = false;
|
||||
Adapter->bTriedToWakeUpFromlowPowerMode = false;
|
||||
|
||||
wake_up(&Adapter->lowpower_mode_wait_queue);
|
||||
|
||||
} else {
|
||||
if (TRUE == Adapter->IdleMode)
|
||||
return status;
|
||||
|
||||
uiRegRead = 0;
|
||||
|
||||
if (Adapter->chip_id == BCS220_2 ||
|
||||
Adapter->chip_id == BCS220_2BC ||
|
||||
Adapter->chip_id == BCS250_BC ||
|
||||
Adapter->chip_id == BCS220_3) {
|
||||
|
||||
bytes = rdmalt(Adapter, HPM_CONFIG_MSW,
|
||||
&uiRegRead, sizeof(uiRegRead));
|
||||
if (bytes < 0) {
|
||||
status = bytes;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
uiRegRead |= (1<<17);
|
||||
|
||||
status = wrmalt(Adapter, HPM_CONFIG_MSW,
|
||||
&uiRegRead, sizeof(uiRegRead));
|
||||
if (status)
|
||||
return status;
|
||||
}
|
||||
SendIdleModeResponse(Adapter);
|
||||
}
|
||||
} else if (ntohl(*puiBuffer) == IDLE_MODE_SF_UPDATE_MSG) {
|
||||
OverrideServiceFlowParams(Adapter, puiBuffer);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
static int InterfaceAbortIdlemode(struct bcm_mini_adapter *Adapter,
|
||||
unsigned int Pattern)
|
||||
{
|
||||
int status = STATUS_SUCCESS;
|
||||
unsigned int value;
|
||||
unsigned int chip_id;
|
||||
unsigned long timeout = 0, itr = 0;
|
||||
|
||||
int lenwritten = 0;
|
||||
unsigned char aucAbortPattern[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF};
|
||||
struct bcm_interface_adapter *psInterfaceAdapter =
|
||||
Adapter->pvInterfaceAdapter;
|
||||
|
||||
/* Abort Bus suspend if its already suspended */
|
||||
if ((TRUE == psInterfaceAdapter->bSuspended) &&
|
||||
(TRUE == Adapter->bDoSuspend))
|
||||
status = usb_autopm_get_interface(
|
||||
psInterfaceAdapter->interface);
|
||||
|
||||
if ((Adapter->ulPowerSaveMode ==
|
||||
DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING) ||
|
||||
(Adapter->ulPowerSaveMode ==
|
||||
DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE)) {
|
||||
/* write the SW abort pattern. */
|
||||
status = wrmalt(Adapter, SW_ABORT_IDLEMODE_LOC,
|
||||
&Pattern, sizeof(Pattern));
|
||||
if (status)
|
||||
return status;
|
||||
}
|
||||
|
||||
if (Adapter->ulPowerSaveMode ==
|
||||
DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING) {
|
||||
value = 0x80000000;
|
||||
status = wrmalt(Adapter,
|
||||
DEBUG_INTERRUPT_GENERATOR_REGISTOR,
|
||||
&value, sizeof(value));
|
||||
if (status)
|
||||
return status;
|
||||
} else if (Adapter->ulPowerSaveMode !=
|
||||
DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE) {
|
||||
/*
|
||||
* Get a Interrupt Out URB and send 8 Bytes Down
|
||||
* To be Done in Thread Context.
|
||||
* Not using Asynchronous Mechanism.
|
||||
*/
|
||||
status = usb_interrupt_msg(psInterfaceAdapter->udev,
|
||||
usb_sndintpipe(psInterfaceAdapter->udev,
|
||||
psInterfaceAdapter->sIntrOut.int_out_endpointAddr),
|
||||
aucAbortPattern,
|
||||
8,
|
||||
&lenwritten,
|
||||
5000);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
IDLE_MODE, DBG_LVL_ALL,
|
||||
"NOB Sent down :%d", lenwritten);
|
||||
|
||||
/* mdelay(25); */
|
||||
|
||||
timeout = jiffies + msecs_to_jiffies(50);
|
||||
while (time_after(timeout, jiffies)) {
|
||||
itr++;
|
||||
rdmalt(Adapter, CHIP_ID_REG, &chip_id, sizeof(UINT));
|
||||
if (0xbece3200 == (chip_id&~(0xF0)))
|
||||
chip_id = chip_id&~(0xF0);
|
||||
if (chip_id == Adapter->chip_id)
|
||||
break;
|
||||
}
|
||||
if (time_before(timeout, jiffies))
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
IDLE_MODE, DBG_LVL_ALL,
|
||||
"Not able to read chip-id even after 25 msec");
|
||||
else
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
IDLE_MODE, DBG_LVL_ALL,
|
||||
"Number of completed iteration to read chip-id :%lu", itr);
|
||||
|
||||
status = wrmalt(Adapter, SW_ABORT_IDLEMODE_LOC,
|
||||
&Pattern, sizeof(status));
|
||||
if (status)
|
||||
return status;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
int InterfaceIdleModeWakeup(struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
if (Adapter->bTriedToWakeUpFromlowPowerMode) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
IDLE_MODE, DBG_LVL_ALL,
|
||||
"Wake up already attempted.. ignoring\n");
|
||||
} else {
|
||||
Adapter->bTriedToWakeUpFromlowPowerMode = TRUE;
|
||||
InterfaceAbortIdlemode(Adapter, Adapter->usIdleModePattern);
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void InterfaceHandleShutdownModeWakeup(struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
unsigned int uiRegVal = 0;
|
||||
INT Status = 0;
|
||||
int bytes;
|
||||
|
||||
if (Adapter->ulPowerSaveMode ==
|
||||
DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING) {
|
||||
/* clear idlemode interrupt. */
|
||||
uiRegVal = 0;
|
||||
Status = wrmalt(Adapter,
|
||||
DEBUG_INTERRUPT_GENERATOR_REGISTOR,
|
||||
&uiRegVal, sizeof(uiRegVal));
|
||||
if (Status)
|
||||
return;
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
/* clear Interrupt EP registers. */
|
||||
bytes = rdmalt(Adapter,
|
||||
DEVICE_INT_OUT_EP_REG0,
|
||||
&uiRegVal, sizeof(uiRegVal));
|
||||
if (bytes < 0) {
|
||||
Status = bytes;
|
||||
return;
|
||||
}
|
||||
|
||||
bytes = rdmalt(Adapter,
|
||||
DEVICE_INT_OUT_EP_REG1,
|
||||
&uiRegVal, sizeof(uiRegVal));
|
||||
if (bytes < 0) {
|
||||
Status = bytes;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef _INTERFACE_IDLEMODE_H
|
||||
#define _INTERFACE_IDLEMODE_H
|
||||
|
||||
INT InterfaceIdleModeWakeup(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
INT InterfaceIdleModeRespond(struct bcm_mini_adapter *Adapter,
|
||||
unsigned int *puiBuffer);
|
||||
|
||||
VOID InterfaceWriteIdleModeWakePattern(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
INT InterfaceWakeUp(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
VOID InterfaceHandleShutdownModeWakeup(struct bcm_mini_adapter *Adapter);
|
||||
#endif
|
||||
|
|
@ -1,729 +0,0 @@
|
|||
#include "headers.h"
|
||||
#include <linux/usb/ch9.h>
|
||||
static struct usb_device_id InterfaceUsbtable[] = {
|
||||
{ USB_DEVICE(BCM_USB_VENDOR_ID_T3, BCM_USB_PRODUCT_ID_T3) },
|
||||
{ USB_DEVICE(BCM_USB_VENDOR_ID_T3, BCM_USB_PRODUCT_ID_T3B) },
|
||||
{ USB_DEVICE(BCM_USB_VENDOR_ID_T3, BCM_USB_PRODUCT_ID_T3L) },
|
||||
{ USB_DEVICE(BCM_USB_VENDOR_ID_T3, BCM_USB_PRODUCT_ID_SYM) },
|
||||
{ USB_DEVICE(BCM_USB_VENDOR_ID_ZTE, BCM_USB_PRODUCT_ID_226) },
|
||||
{ USB_DEVICE(BCM_USB_VENDOR_ID_FOXCONN, BCM_USB_PRODUCT_ID_1901) },
|
||||
{ USB_DEVICE(BCM_USB_VENDOR_ID_ZTE, BCM_USB_PRODUCT_ID_ZTE_TU25) },
|
||||
{ USB_DEVICE(BCM_USB_VENDOR_ID_ZTE, BCM_USB_PRODUCT_ID_ZTE_226) },
|
||||
{ USB_DEVICE(BCM_USB_VENDOR_ID_ZTE, BCM_USB_PRODUCT_ID_ZTE_326) },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(usb, InterfaceUsbtable);
|
||||
|
||||
static int debug = -1;
|
||||
module_param(debug, int, 0600);
|
||||
MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
|
||||
|
||||
static const u32 default_msg =
|
||||
NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK
|
||||
| NETIF_MSG_TIMER | NETIF_MSG_TX_ERR | NETIF_MSG_RX_ERR
|
||||
| NETIF_MSG_IFUP | NETIF_MSG_IFDOWN;
|
||||
|
||||
static int InterfaceAdapterInit(struct bcm_interface_adapter *Adapter);
|
||||
|
||||
static void InterfaceAdapterFree(struct bcm_interface_adapter *psIntfAdapter)
|
||||
{
|
||||
int i = 0;
|
||||
struct bcm_mini_adapter *ps_ad = psIntfAdapter->psAdapter;
|
||||
|
||||
/* Wake up the wait_queue... */
|
||||
if (ps_ad->LEDInfo.led_thread_running &
|
||||
BCM_LED_THREAD_RUNNING_ACTIVELY) {
|
||||
ps_ad->DriverState = DRIVER_HALT;
|
||||
wake_up(&ps_ad->LEDInfo.notify_led_event);
|
||||
}
|
||||
reset_card_proc(ps_ad);
|
||||
|
||||
/*
|
||||
* worst case time taken by the RDM/WRM will be 5 sec. will check after
|
||||
* every 100 ms to accertain the device is not being accessed. After
|
||||
* this No RDM/WRM should be made.
|
||||
*/
|
||||
while (ps_ad->DeviceAccess) {
|
||||
BCM_DEBUG_PRINT(ps_ad, DBG_TYPE_INITEXIT, DRV_ENTRY,
|
||||
DBG_LVL_ALL, "Device is being accessed.\n");
|
||||
msleep(100);
|
||||
}
|
||||
/* Free interrupt URB */
|
||||
/* ps_ad->device_removed = TRUE; */
|
||||
usb_free_urb(psIntfAdapter->psInterruptUrb);
|
||||
|
||||
/* Free transmit URBs */
|
||||
for (i = 0; i < MAXIMUM_USB_TCB; i++) {
|
||||
if (psIntfAdapter->asUsbTcb[i].urb != NULL) {
|
||||
usb_free_urb(psIntfAdapter->asUsbTcb[i].urb);
|
||||
psIntfAdapter->asUsbTcb[i].urb = NULL;
|
||||
}
|
||||
}
|
||||
/* Free receive URB and buffers */
|
||||
for (i = 0; i < MAXIMUM_USB_RCB; i++) {
|
||||
if (psIntfAdapter->asUsbRcb[i].urb != NULL) {
|
||||
kfree(psIntfAdapter->asUsbRcb[i].urb->transfer_buffer);
|
||||
usb_free_urb(psIntfAdapter->asUsbRcb[i].urb);
|
||||
psIntfAdapter->asUsbRcb[i].urb = NULL;
|
||||
}
|
||||
}
|
||||
AdapterFree(ps_ad);
|
||||
}
|
||||
|
||||
static void ConfigureEndPointTypesThroughEEPROM(
|
||||
struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
u32 ulReg;
|
||||
int bytes;
|
||||
struct bcm_interface_adapter *interfaceAdapter;
|
||||
|
||||
/* Program EP2 MAX_PKT_SIZE */
|
||||
ulReg = ntohl(EP2_MPS_REG);
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x128, 4, TRUE);
|
||||
ulReg = ntohl(EP2_MPS);
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x12C, 4, TRUE);
|
||||
|
||||
ulReg = ntohl(EP2_CFG_REG);
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x132, 4, TRUE);
|
||||
interfaceAdapter =
|
||||
(struct bcm_interface_adapter *)(Adapter->pvInterfaceAdapter);
|
||||
if (interfaceAdapter->bHighSpeedDevice) {
|
||||
ulReg = ntohl(EP2_CFG_INT);
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x136, 4, TRUE);
|
||||
} else {
|
||||
/* USE BULK EP as TX in FS mode. */
|
||||
ulReg = ntohl(EP2_CFG_BULK);
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x136, 4, TRUE);
|
||||
}
|
||||
|
||||
/* Program EP4 MAX_PKT_SIZE. */
|
||||
ulReg = ntohl(EP4_MPS_REG);
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x13C, 4, TRUE);
|
||||
ulReg = ntohl(EP4_MPS);
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x140, 4, TRUE);
|
||||
|
||||
/* Program TX EP as interrupt(Alternate Setting) */
|
||||
bytes = rdmalt(Adapter, 0x0F0110F8, &ulReg, sizeof(u32));
|
||||
if (bytes < 0) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, DRV_ENTRY,
|
||||
DBG_LVL_ALL, "reading of Tx EP failed\n");
|
||||
return;
|
||||
}
|
||||
ulReg |= 0x6;
|
||||
|
||||
ulReg = ntohl(ulReg);
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1CC, 4, TRUE);
|
||||
|
||||
ulReg = ntohl(EP4_CFG_REG);
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1C8, 4, TRUE);
|
||||
/* Program ISOCHRONOUS EP size to zero. */
|
||||
ulReg = ntohl(ISO_MPS_REG);
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1D2, 4, TRUE);
|
||||
ulReg = ntohl(ISO_MPS);
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1D6, 4, TRUE);
|
||||
|
||||
/*
|
||||
* Update EEPROM Version.
|
||||
* Read 4 bytes from 508 and modify 511 and 510.
|
||||
*/
|
||||
ReadBeceemEEPROM(Adapter, 0x1FC, &ulReg);
|
||||
ulReg &= 0x0101FFFF;
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1FC, 4, TRUE);
|
||||
|
||||
/*
|
||||
* Update length field if required.
|
||||
* Also make the string NULL terminated.
|
||||
*/
|
||||
|
||||
ReadBeceemEEPROM(Adapter, 0xA8, &ulReg);
|
||||
if ((ulReg&0x00FF0000)>>16 > 0x30) {
|
||||
ulReg = (ulReg&0xFF00FFFF)|(0x30<<16);
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0xA8, 4, TRUE);
|
||||
}
|
||||
ReadBeceemEEPROM(Adapter, 0x148, &ulReg);
|
||||
if ((ulReg&0x00FF0000)>>16 > 0x30) {
|
||||
ulReg = (ulReg&0xFF00FFFF)|(0x30<<16);
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x148, 4, TRUE);
|
||||
}
|
||||
ulReg = 0;
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x122, 4, TRUE);
|
||||
ulReg = 0;
|
||||
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1C2, 4, TRUE);
|
||||
}
|
||||
|
||||
static int usbbcm_device_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
struct usb_device *udev = interface_to_usbdev(intf);
|
||||
int retval;
|
||||
struct bcm_mini_adapter *psAdapter;
|
||||
struct bcm_interface_adapter *psIntfAdapter;
|
||||
struct net_device *ndev;
|
||||
|
||||
/* Reserve one extra queue for the bit-bucket */
|
||||
ndev = alloc_etherdev_mq(sizeof(struct bcm_mini_adapter),
|
||||
NO_OF_QUEUES + 1);
|
||||
if (ndev == NULL) {
|
||||
dev_err(&udev->dev, DRV_NAME ": no memory for device\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
SET_NETDEV_DEV(ndev, &intf->dev);
|
||||
|
||||
psAdapter = netdev_priv(ndev);
|
||||
psAdapter->dev = ndev;
|
||||
psAdapter->msg_enable = netif_msg_init(debug, default_msg);
|
||||
|
||||
/* Init default driver debug state */
|
||||
|
||||
psAdapter->stDebugState.debug_level = DBG_LVL_CURR;
|
||||
psAdapter->stDebugState.type = DBG_TYPE_INITEXIT;
|
||||
|
||||
/*
|
||||
* Technically, one can start using BCM_DEBUG_PRINT after this point.
|
||||
* However, realize that by default the Type/Subtype bitmaps are all
|
||||
* zero now; so no prints will actually appear until the TestApp turns
|
||||
* on debug paths via the ioctl(); so practically speaking, in early
|
||||
* init, no logging happens.
|
||||
*
|
||||
* A solution (used below): we explicitly set the bitmaps to 1 for
|
||||
* Type=DBG_TYPE_INITEXIT and ALL subtype's of the same. Now all bcm
|
||||
* debug statements get logged, enabling debug during early init.
|
||||
* Further, we turn this OFF once init_module() completes.
|
||||
*/
|
||||
|
||||
psAdapter->stDebugState.subtype[DBG_TYPE_INITEXIT] = 0xff;
|
||||
BCM_SHOW_DEBUG_BITMAP(psAdapter);
|
||||
|
||||
retval = InitAdapter(psAdapter);
|
||||
if (retval) {
|
||||
dev_err(&udev->dev, DRV_NAME ": InitAdapter Failed\n");
|
||||
AdapterFree(psAdapter);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Allocate interface adapter structure */
|
||||
psIntfAdapter = kzalloc(sizeof(struct bcm_interface_adapter),
|
||||
GFP_KERNEL);
|
||||
if (psIntfAdapter == NULL) {
|
||||
AdapterFree(psAdapter);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
psAdapter->pvInterfaceAdapter = psIntfAdapter;
|
||||
psIntfAdapter->psAdapter = psAdapter;
|
||||
|
||||
/* Store usb interface in Interface Adapter */
|
||||
psIntfAdapter->interface = intf;
|
||||
usb_set_intfdata(intf, psIntfAdapter);
|
||||
|
||||
BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL,
|
||||
"psIntfAdapter 0x%p\n", psIntfAdapter);
|
||||
retval = InterfaceAdapterInit(psIntfAdapter);
|
||||
if (retval) {
|
||||
/* If the Firmware/Cfg File is not present
|
||||
* then return success, let the application
|
||||
* download the files.
|
||||
*/
|
||||
if (-ENOENT == retval) {
|
||||
BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY,
|
||||
DBG_LVL_ALL,
|
||||
"File Not Found. Use app to download.\n");
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY,
|
||||
DBG_LVL_ALL, "InterfaceAdapterInit failed.\n");
|
||||
usb_set_intfdata(intf, NULL);
|
||||
udev = interface_to_usbdev(intf);
|
||||
usb_put_dev(udev);
|
||||
InterfaceAdapterFree(psIntfAdapter);
|
||||
return retval;
|
||||
}
|
||||
if (psAdapter->chip_id > T3) {
|
||||
uint32_t uiNackZeroLengthInt = 4;
|
||||
|
||||
retval =
|
||||
wrmalt(psAdapter, DISABLE_USB_ZERO_LEN_INT,
|
||||
&uiNackZeroLengthInt,
|
||||
sizeof(uiNackZeroLengthInt));
|
||||
if (retval)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Check whether the USB-Device Supports remote Wake-Up */
|
||||
if (USB_CONFIG_ATT_WAKEUP & udev->actconfig->desc.bmAttributes) {
|
||||
/* If Suspend then only support dynamic suspend */
|
||||
if (psAdapter->bDoSuspend) {
|
||||
#ifdef CONFIG_PM
|
||||
pm_runtime_set_autosuspend_delay(&udev->dev, 0);
|
||||
intf->needs_remote_wakeup = 1;
|
||||
usb_enable_autosuspend(udev);
|
||||
device_init_wakeup(&intf->dev, 1);
|
||||
INIT_WORK(&psIntfAdapter->usbSuspendWork,
|
||||
putUsbSuspend);
|
||||
BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, DRV_ENTRY,
|
||||
DBG_LVL_ALL,
|
||||
"Enabling USB Auto-Suspend\n");
|
||||
#endif
|
||||
} else {
|
||||
intf->needs_remote_wakeup = 0;
|
||||
usb_disable_autosuspend(udev);
|
||||
}
|
||||
}
|
||||
|
||||
psAdapter->stDebugState.subtype[DBG_TYPE_INITEXIT] = 0x0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void usbbcm_disconnect(struct usb_interface *intf)
|
||||
{
|
||||
struct bcm_interface_adapter *psIntfAdapter = usb_get_intfdata(intf);
|
||||
struct bcm_mini_adapter *psAdapter;
|
||||
struct usb_device *udev = interface_to_usbdev(intf);
|
||||
|
||||
if (psIntfAdapter == NULL)
|
||||
return;
|
||||
|
||||
psAdapter = psIntfAdapter->psAdapter;
|
||||
netif_device_detach(psAdapter->dev);
|
||||
|
||||
if (psAdapter->bDoSuspend)
|
||||
intf->needs_remote_wakeup = 0;
|
||||
|
||||
psAdapter->device_removed = TRUE;
|
||||
usb_set_intfdata(intf, NULL);
|
||||
InterfaceAdapterFree(psIntfAdapter);
|
||||
usb_put_dev(udev);
|
||||
}
|
||||
|
||||
static int AllocUsbCb(struct bcm_interface_adapter *psIntfAdapter)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < MAXIMUM_USB_TCB; i++) {
|
||||
psIntfAdapter->asUsbTcb[i].urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
|
||||
if (psIntfAdapter->asUsbTcb[i].urb == NULL) {
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,
|
||||
DBG_TYPE_PRINTK, 0, 0,
|
||||
"Can't allocate Tx urb for index %d\n",
|
||||
i);
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXIMUM_USB_RCB; i++) {
|
||||
psIntfAdapter->asUsbRcb[i].urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
|
||||
if (psIntfAdapter->asUsbRcb[i].urb == NULL) {
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,
|
||||
DBG_TYPE_PRINTK, 0, 0,
|
||||
"Can't allocate Rx urb for index %d\n",
|
||||
i);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
psIntfAdapter->asUsbRcb[i].urb->transfer_buffer =
|
||||
kmalloc(MAX_DATA_BUFFER_SIZE, GFP_KERNEL);
|
||||
|
||||
if (psIntfAdapter->asUsbRcb[i].urb->transfer_buffer == NULL) {
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,
|
||||
DBG_TYPE_PRINTK, 0, 0,
|
||||
"Can't allocate Rx buffer for index %d\n",
|
||||
i);
|
||||
return -ENOMEM;
|
||||
}
|
||||
psIntfAdapter->asUsbRcb[i].urb->transfer_buffer_length =
|
||||
MAX_DATA_BUFFER_SIZE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int device_run(struct bcm_interface_adapter *psIntfAdapter)
|
||||
{
|
||||
int value = 0;
|
||||
UINT status = STATUS_SUCCESS;
|
||||
struct bcm_mini_adapter *psAd = psIntfAdapter->psAdapter;
|
||||
|
||||
status = InitCardAndDownloadFirmware(psAd);
|
||||
if (status != STATUS_SUCCESS) {
|
||||
pr_err(DRV_NAME "InitCardAndDownloadFirmware failed.\n");
|
||||
return status;
|
||||
}
|
||||
if (psAd->fw_download_done) {
|
||||
if (StartInterruptUrb(psIntfAdapter)) {
|
||||
BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY,
|
||||
DBG_LVL_ALL,
|
||||
"Cannot send interrupt in URB\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* now register the cntrl interface. after downloading the f/w
|
||||
* waiting for 5 sec to get the mailbox interrupt.
|
||||
*/
|
||||
psAd->waiting_to_fw_download_done = false;
|
||||
value = wait_event_timeout(psAd->ioctl_fw_dnld_wait_queue,
|
||||
psAd->waiting_to_fw_download_done,
|
||||
5 * HZ);
|
||||
|
||||
if (value == 0)
|
||||
pr_err(DRV_NAME ": Timeout waiting for mailbox interrupt.\n");
|
||||
|
||||
if (register_control_device_interface(psAd) < 0) {
|
||||
pr_err(DRV_NAME ": Register Control Device failed.\n");
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int select_alternate_setting_for_highspeed_modem(
|
||||
struct bcm_interface_adapter *psIntfAdapter,
|
||||
struct usb_endpoint_descriptor **endpoint,
|
||||
const struct usb_host_interface *iface_desc,
|
||||
int *usedIntOutForBulkTransfer)
|
||||
{
|
||||
int retval = 0;
|
||||
struct bcm_mini_adapter *psAd = psIntfAdapter->psAdapter;
|
||||
|
||||
/* selecting alternate setting one as a default setting
|
||||
* for High Speed modem. */
|
||||
if (psIntfAdapter->bHighSpeedDevice)
|
||||
retval = usb_set_interface(psIntfAdapter->udev,
|
||||
DEFAULT_SETTING_0,
|
||||
ALTERNATE_SETTING_1);
|
||||
BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL,
|
||||
"BCM16 is applicable on this dongle\n");
|
||||
if (retval || !psIntfAdapter->bHighSpeedDevice) {
|
||||
*usedIntOutForBulkTransfer = EP2;
|
||||
*endpoint = &iface_desc->endpoint[EP2].desc;
|
||||
BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL,
|
||||
"Interface altsetting failed or modem is configured to Full Speed, hence will work on default setting 0\n");
|
||||
/*
|
||||
* If Modem is high speed device EP2 should be
|
||||
* INT OUT End point
|
||||
*
|
||||
* If Mode is FS then EP2 should be bulk end
|
||||
* point
|
||||
*/
|
||||
if ((psIntfAdapter->bHighSpeedDevice &&
|
||||
!usb_endpoint_is_int_out(*endpoint)) ||
|
||||
(!psIntfAdapter->bHighSpeedDevice &&
|
||||
!usb_endpoint_is_bulk_out(*endpoint))) {
|
||||
BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY,
|
||||
DBG_LVL_ALL,
|
||||
"Configuring the EEPROM\n");
|
||||
/* change the EP2, EP4 to INT OUT end point */
|
||||
ConfigureEndPointTypesThroughEEPROM(
|
||||
psAd);
|
||||
|
||||
/*
|
||||
* It resets the device and if any thing
|
||||
* gets changed in USB descriptor it
|
||||
* will show fail and re-enumerate the
|
||||
* device
|
||||
*/
|
||||
retval = usb_reset_device(psIntfAdapter->udev);
|
||||
if (retval) {
|
||||
BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
|
||||
DRV_ENTRY, DBG_LVL_ALL,
|
||||
"reset failed. Re-enumerating the device.\n");
|
||||
return retval;
|
||||
}
|
||||
|
||||
}
|
||||
if (!psIntfAdapter->bHighSpeedDevice &&
|
||||
usb_endpoint_is_bulk_out(*endpoint)) {
|
||||
/*
|
||||
* Once BULK is selected in FS mode.
|
||||
* Revert it back to INT.
|
||||
* Else USB_IF will fail.
|
||||
*/
|
||||
UINT _uiData = ntohl(EP2_CFG_INT);
|
||||
|
||||
BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY,
|
||||
DBG_LVL_ALL,
|
||||
"Reverting Bulk to INT as it is in Full Speed mode.\n");
|
||||
BeceemEEPROMBulkWrite(psAd, (PUCHAR) & _uiData, 0x136,
|
||||
4, TRUE);
|
||||
}
|
||||
} else {
|
||||
*usedIntOutForBulkTransfer = EP4;
|
||||
*endpoint = &iface_desc->endpoint[EP4].desc;
|
||||
BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL,
|
||||
"Choosing AltSetting as a default setting.\n");
|
||||
if (!usb_endpoint_is_int_out(*endpoint)) {
|
||||
BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY,
|
||||
DBG_LVL_ALL,
|
||||
"Dongle does not have BCM16 Fix.\n");
|
||||
/*
|
||||
* change the EP2, EP4 to INT OUT end point and use EP4
|
||||
* in altsetting
|
||||
*/
|
||||
ConfigureEndPointTypesThroughEEPROM(psAd);
|
||||
|
||||
/*
|
||||
* It resets the device and if any thing
|
||||
* gets changed in USB descriptor it
|
||||
* will show fail and re-enumerate the
|
||||
* device
|
||||
*/
|
||||
retval = usb_reset_device(psIntfAdapter->udev);
|
||||
if (retval) {
|
||||
BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
|
||||
DRV_ENTRY, DBG_LVL_ALL,
|
||||
"reset failed. Re-enumerating the device.\n");
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter)
|
||||
{
|
||||
struct usb_host_interface *iface_desc;
|
||||
struct usb_endpoint_descriptor *endpoint;
|
||||
size_t buffer_size;
|
||||
unsigned long value;
|
||||
int retval = 0;
|
||||
int usedIntOutForBulkTransfer = 0;
|
||||
bool bBcm16 = false;
|
||||
UINT uiData = 0;
|
||||
int bytes;
|
||||
struct bcm_mini_adapter *psAd = psIntfAdapter->psAdapter;
|
||||
|
||||
/* Store the usb dev into interface adapter */
|
||||
psIntfAdapter->udev =
|
||||
usb_get_dev(interface_to_usbdev(psIntfAdapter->interface));
|
||||
|
||||
psIntfAdapter->bHighSpeedDevice =
|
||||
(psIntfAdapter->udev->speed == USB_SPEED_HIGH);
|
||||
psAd->interface_rdm = BcmRDM;
|
||||
psAd->interface_wrm = BcmWRM;
|
||||
|
||||
bytes = rdmalt(psAd, CHIP_ID_REG, (u32 *) &(psAd->chip_id),
|
||||
sizeof(u32));
|
||||
if (bytes < 0) {
|
||||
retval = bytes;
|
||||
BCM_DEBUG_PRINT(psAd, DBG_TYPE_PRINTK, 0, 0,
|
||||
"CHIP ID Read Failed\n");
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (0xbece3200 == (psAd->chip_id & ~(0xF0)))
|
||||
psAd->chip_id &= ~0xF0;
|
||||
|
||||
dev_info(&psIntfAdapter->udev->dev, "RDM Chip ID 0x%lx\n",
|
||||
psAd->chip_id);
|
||||
|
||||
iface_desc = psIntfAdapter->interface->cur_altsetting;
|
||||
|
||||
if (psAd->chip_id == T3B) {
|
||||
/* T3B device will have EEPROM, check if EEPROM is proper and
|
||||
* BCM16 can be done or not. */
|
||||
BeceemEEPROMBulkRead(psAd, &uiData, 0x0, 4);
|
||||
if (uiData == BECM)
|
||||
bBcm16 = TRUE;
|
||||
|
||||
dev_info(&psIntfAdapter->udev->dev,
|
||||
"number of alternate setting %d\n",
|
||||
psIntfAdapter->interface->num_altsetting);
|
||||
|
||||
if (bBcm16 == TRUE) {
|
||||
retval = select_alternate_setting_for_highspeed_modem(
|
||||
psIntfAdapter, &endpoint, iface_desc,
|
||||
&usedIntOutForBulkTransfer);
|
||||
if (retval)
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
iface_desc = psIntfAdapter->interface->cur_altsetting;
|
||||
|
||||
for (value = 0; value < iface_desc->desc.bNumEndpoints; ++value) {
|
||||
endpoint = &iface_desc->endpoint[value].desc;
|
||||
|
||||
if (!psIntfAdapter->sBulkIn.bulk_in_endpointAddr &&
|
||||
usb_endpoint_is_bulk_in(endpoint)) {
|
||||
buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
|
||||
psIntfAdapter->sBulkIn.bulk_in_size = buffer_size;
|
||||
psIntfAdapter->sBulkIn.bulk_in_endpointAddr =
|
||||
endpoint->bEndpointAddress;
|
||||
psIntfAdapter->sBulkIn.bulk_in_pipe = usb_rcvbulkpipe(
|
||||
psIntfAdapter->udev,
|
||||
psIntfAdapter->sBulkIn.bulk_in_endpointAddr);
|
||||
}
|
||||
|
||||
if (!psIntfAdapter->sBulkOut.bulk_out_endpointAddr &&
|
||||
usb_endpoint_is_bulk_out(endpoint)) {
|
||||
psIntfAdapter->sBulkOut.bulk_out_endpointAddr =
|
||||
endpoint->bEndpointAddress;
|
||||
psIntfAdapter->sBulkOut.bulk_out_pipe = usb_sndbulkpipe(
|
||||
psIntfAdapter->udev,
|
||||
psIntfAdapter->sBulkOut.bulk_out_endpointAddr);
|
||||
}
|
||||
|
||||
if (!psIntfAdapter->sIntrIn.int_in_endpointAddr &&
|
||||
usb_endpoint_is_int_in(endpoint)) {
|
||||
buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
|
||||
psIntfAdapter->sIntrIn.int_in_size = buffer_size;
|
||||
psIntfAdapter->sIntrIn.int_in_endpointAddr =
|
||||
endpoint->bEndpointAddress;
|
||||
psIntfAdapter->sIntrIn.int_in_interval =
|
||||
endpoint->bInterval;
|
||||
psIntfAdapter->sIntrIn.int_in_buffer =
|
||||
kmalloc(buffer_size, GFP_KERNEL);
|
||||
if (!psIntfAdapter->sIntrIn.int_in_buffer)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!psIntfAdapter->sIntrOut.int_out_endpointAddr &&
|
||||
usb_endpoint_is_int_out(endpoint)) {
|
||||
if (!psIntfAdapter->sBulkOut.bulk_out_endpointAddr &&
|
||||
(psAd->chip_id == T3B) &&
|
||||
(value == usedIntOutForBulkTransfer)) {
|
||||
/*
|
||||
* use first intout end point as a bulk out end
|
||||
* point
|
||||
*/
|
||||
buffer_size =
|
||||
le16_to_cpu(endpoint->wMaxPacketSize);
|
||||
psIntfAdapter->sBulkOut.bulk_out_size =
|
||||
buffer_size;
|
||||
psIntfAdapter->sBulkOut.bulk_out_endpointAddr =
|
||||
endpoint->bEndpointAddress;
|
||||
psIntfAdapter->sBulkOut.bulk_out_pipe =
|
||||
usb_sndintpipe(psIntfAdapter->udev,
|
||||
psIntfAdapter->sBulkOut
|
||||
.bulk_out_endpointAddr);
|
||||
psIntfAdapter->sBulkOut.int_out_interval =
|
||||
endpoint->bInterval;
|
||||
} else if (value == EP6) {
|
||||
buffer_size =
|
||||
le16_to_cpu(endpoint->wMaxPacketSize);
|
||||
psIntfAdapter->sIntrOut.int_out_size =
|
||||
buffer_size;
|
||||
psIntfAdapter->sIntrOut.int_out_endpointAddr =
|
||||
endpoint->bEndpointAddress;
|
||||
psIntfAdapter->sIntrOut.int_out_interval =
|
||||
endpoint->bInterval;
|
||||
psIntfAdapter->sIntrOut.int_out_buffer =
|
||||
kmalloc(buffer_size, GFP_KERNEL);
|
||||
if (!psIntfAdapter->sIntrOut.int_out_buffer)
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
usb_set_intfdata(psIntfAdapter->interface, psIntfAdapter);
|
||||
|
||||
psAd->bcm_file_download = InterfaceFileDownload;
|
||||
psAd->bcm_file_readback_from_chip = InterfaceFileReadbackFromChip;
|
||||
psAd->interface_transmit = InterfaceTransmitPacket;
|
||||
|
||||
retval = CreateInterruptUrb(psIntfAdapter);
|
||||
|
||||
if (retval) {
|
||||
BCM_DEBUG_PRINT(psAd, DBG_TYPE_PRINTK, 0, 0,
|
||||
"Cannot create interrupt urb\n");
|
||||
return retval;
|
||||
}
|
||||
|
||||
retval = AllocUsbCb(psIntfAdapter);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
return device_run(psIntfAdapter);
|
||||
}
|
||||
|
||||
static int InterfaceSuspend(struct usb_interface *intf, pm_message_t message)
|
||||
{
|
||||
struct bcm_interface_adapter *psIntfAdapter = usb_get_intfdata(intf);
|
||||
|
||||
psIntfAdapter->bSuspended = TRUE;
|
||||
|
||||
if (psIntfAdapter->bPreparingForBusSuspend) {
|
||||
psIntfAdapter->bPreparingForBusSuspend = false;
|
||||
|
||||
if (psIntfAdapter->psAdapter->LinkStatus == LINKUP_DONE) {
|
||||
psIntfAdapter->psAdapter->IdleMode = TRUE;
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,
|
||||
DBG_TYPE_INITEXIT, DRV_ENTRY,
|
||||
DBG_LVL_ALL,
|
||||
"Host Entered in PMU Idle Mode.\n");
|
||||
} else {
|
||||
psIntfAdapter->psAdapter->bShutStatus = TRUE;
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,
|
||||
DBG_TYPE_INITEXIT, DRV_ENTRY,
|
||||
DBG_LVL_ALL,
|
||||
"Host Entered in PMU Shutdown Mode.\n");
|
||||
}
|
||||
}
|
||||
psIntfAdapter->psAdapter->bPreparingForLowPowerMode = false;
|
||||
|
||||
/* Signaling the control pkt path */
|
||||
wake_up(&psIntfAdapter->psAdapter->lowpower_mode_wait_queue);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int InterfaceResume(struct usb_interface *intf)
|
||||
{
|
||||
struct bcm_interface_adapter *psIntfAdapter = usb_get_intfdata(intf);
|
||||
|
||||
mdelay(100);
|
||||
psIntfAdapter->bSuspended = false;
|
||||
|
||||
StartInterruptUrb(psIntfAdapter);
|
||||
InterfaceRx(psIntfAdapter);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct usb_driver usbbcm_driver = {
|
||||
.name = "usbbcm",
|
||||
.probe = usbbcm_device_probe,
|
||||
.disconnect = usbbcm_disconnect,
|
||||
.suspend = InterfaceSuspend,
|
||||
.resume = InterfaceResume,
|
||||
.id_table = InterfaceUsbtable,
|
||||
.supports_autosuspend = 1,
|
||||
};
|
||||
|
||||
struct class *bcm_class;
|
||||
|
||||
static __init int bcm_init(void)
|
||||
{
|
||||
int retval;
|
||||
|
||||
pr_info("%s: %s, %s\n", DRV_NAME, DRV_DESCRIPTION, DRV_VERSION);
|
||||
pr_info("%s\n", DRV_COPYRIGHT);
|
||||
|
||||
bcm_class = class_create(THIS_MODULE, DRV_NAME);
|
||||
if (IS_ERR(bcm_class)) {
|
||||
pr_err(DRV_NAME ": could not create class\n");
|
||||
return PTR_ERR(bcm_class);
|
||||
}
|
||||
|
||||
retval = usb_register(&usbbcm_driver);
|
||||
if (retval < 0) {
|
||||
pr_err(DRV_NAME ": could not register usb driver\n");
|
||||
class_destroy(bcm_class);
|
||||
return retval;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __exit void bcm_exit(void)
|
||||
{
|
||||
usb_deregister(&usbbcm_driver);
|
||||
class_destroy(bcm_class);
|
||||
}
|
||||
|
||||
module_init(bcm_init);
|
||||
module_exit(bcm_exit);
|
||||
|
||||
MODULE_DESCRIPTION(DRV_DESCRIPTION);
|
||||
MODULE_VERSION(DRV_VERSION);
|
||||
MODULE_LICENSE("GPL");
|
|
@ -1,26 +0,0 @@
|
|||
#ifndef _INTERFACE_INIT_H
|
||||
#define _INTERFACE_INIT_H
|
||||
|
||||
#define BCM_USB_VENDOR_ID_T3 0x198f
|
||||
#define BCM_USB_VENDOR_ID_FOXCONN 0x0489
|
||||
#define BCM_USB_VENDOR_ID_ZTE 0x19d2
|
||||
|
||||
#define BCM_USB_PRODUCT_ID_T3 0x0300
|
||||
#define BCM_USB_PRODUCT_ID_T3B 0x0210
|
||||
#define BCM_USB_PRODUCT_ID_T3L 0x0220
|
||||
#define BCM_USB_PRODUCT_ID_SYM 0x15E
|
||||
#define BCM_USB_PRODUCT_ID_1901 0xe017
|
||||
#define BCM_USB_PRODUCT_ID_226 0x0132 /* not sure if this is valid */
|
||||
#define BCM_USB_PRODUCT_ID_ZTE_226 0x172
|
||||
#define BCM_USB_PRODUCT_ID_ZTE_326 0x173 /* ZTE AX326 */
|
||||
#define BCM_USB_PRODUCT_ID_ZTE_TU25 0x0007
|
||||
|
||||
#define BCM_USB_MINOR_BASE 192
|
||||
|
||||
int InterfaceInitialize(void);
|
||||
|
||||
int InterfaceExit(void);
|
||||
|
||||
int usbbcm_worker_thread(struct bcm_interface_adapter *psIntfAdapter);
|
||||
|
||||
#endif
|
|
@ -1,190 +0,0 @@
|
|||
#include "headers.h"
|
||||
|
||||
|
||||
static void read_int_callback(struct urb *urb/*, struct pt_regs *regs*/)
|
||||
{
|
||||
int status = urb->status;
|
||||
struct bcm_interface_adapter *psIntfAdapter =
|
||||
(struct bcm_interface_adapter *)urb->context;
|
||||
struct bcm_mini_adapter *Adapter = psIntfAdapter->psAdapter;
|
||||
|
||||
if (netif_msg_intr(Adapter))
|
||||
pr_info(PFX "%s: interrupt status %d\n",
|
||||
Adapter->dev->name, status);
|
||||
|
||||
if (Adapter->device_removed) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT,
|
||||
DBG_LVL_ALL, "Device has Got Removed.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((Adapter->bPreparingForLowPowerMode && Adapter->bDoSuspend) ||
|
||||
psIntfAdapter->bSuspended ||
|
||||
psIntfAdapter->bPreparingForBusSuspend) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT,
|
||||
DBG_LVL_ALL,
|
||||
"Interrupt call back is called while suspending the device");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (status) {
|
||||
/* success */
|
||||
case STATUS_SUCCESS:
|
||||
if (urb->actual_length) {
|
||||
|
||||
if (psIntfAdapter->ulInterruptData[1] & 0xFF) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
INTF_INIT, DBG_LVL_ALL,
|
||||
"Got USIM interrupt");
|
||||
}
|
||||
|
||||
if (psIntfAdapter->ulInterruptData[1] & 0xFF00) {
|
||||
atomic_set(&Adapter->CurrNumFreeTxDesc,
|
||||
(psIntfAdapter->ulInterruptData[1] &
|
||||
0xFF00) >> 8);
|
||||
atomic_set(&Adapter->uiMBupdate, TRUE);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
INTF_INIT, DBG_LVL_ALL,
|
||||
"TX mailbox contains %d",
|
||||
atomic_read(&Adapter->CurrNumFreeTxDesc));
|
||||
}
|
||||
if (psIntfAdapter->ulInterruptData[1] >> 16) {
|
||||
Adapter->CurrNumRecvDescs =
|
||||
(psIntfAdapter->ulInterruptData[1] >> 16);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
INTF_INIT, DBG_LVL_ALL,
|
||||
"RX mailbox contains %d",
|
||||
Adapter->CurrNumRecvDescs);
|
||||
InterfaceRx(psIntfAdapter);
|
||||
}
|
||||
if (Adapter->fw_download_done &&
|
||||
!Adapter->downloadDDR &&
|
||||
atomic_read(&Adapter->CurrNumFreeTxDesc)) {
|
||||
|
||||
psIntfAdapter->psAdapter->downloadDDR += 1;
|
||||
wake_up(&Adapter->tx_packet_wait_queue);
|
||||
}
|
||||
if (!Adapter->waiting_to_fw_download_done) {
|
||||
Adapter->waiting_to_fw_download_done = TRUE;
|
||||
wake_up(&Adapter->ioctl_fw_dnld_wait_queue);
|
||||
}
|
||||
if (!atomic_read(&Adapter->TxPktAvail)) {
|
||||
atomic_set(&Adapter->TxPktAvail, 1);
|
||||
wake_up(&Adapter->tx_packet_wait_queue);
|
||||
}
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT,
|
||||
DBG_LVL_ALL, "Firing interrupt in URB");
|
||||
}
|
||||
break;
|
||||
case -ENOENT:
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT,
|
||||
DBG_LVL_ALL, "URB has got disconnected....");
|
||||
return;
|
||||
case -EINPROGRESS:
|
||||
/*
|
||||
* This situation may happened when URBunlink is used. for
|
||||
* detail check usb_unlink_urb documentation.
|
||||
*/
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT,
|
||||
DBG_LVL_ALL,
|
||||
"Impossibe condition has occurred... something very bad is going on");
|
||||
break;
|
||||
/* return; */
|
||||
case -EPIPE:
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT,
|
||||
DBG_LVL_ALL,
|
||||
"Interrupt IN endPoint has got halted/stalled...need to clear this");
|
||||
Adapter->bEndPointHalted = TRUE;
|
||||
wake_up(&Adapter->tx_packet_wait_queue);
|
||||
urb->status = STATUS_SUCCESS;
|
||||
return;
|
||||
/* software-driven interface shutdown */
|
||||
case -ECONNRESET: /* URB got unlinked */
|
||||
case -ESHUTDOWN: /* hardware gone. this is the serious problem */
|
||||
/*
|
||||
* Occurs only when something happens with the
|
||||
* host controller device
|
||||
*/
|
||||
case -ENODEV: /* Device got removed */
|
||||
case -EINVAL:
|
||||
/*
|
||||
* Some thing very bad happened with the URB. No
|
||||
* description is available.
|
||||
*/
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT,
|
||||
DBG_LVL_ALL, "interrupt urb error %d", status);
|
||||
urb->status = STATUS_SUCCESS;
|
||||
break;
|
||||
/* return; */
|
||||
default:
|
||||
/*
|
||||
* This is required to check what is the defaults conditions
|
||||
* when it occurs..
|
||||
*/
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL,
|
||||
"GOT DEFAULT INTERRUPT URB STATUS :%d..Please Analyze it...",
|
||||
status);
|
||||
break;
|
||||
}
|
||||
|
||||
StartInterruptUrb(psIntfAdapter);
|
||||
|
||||
|
||||
}
|
||||
|
||||
int CreateInterruptUrb(struct bcm_interface_adapter *psIntfAdapter)
|
||||
{
|
||||
psIntfAdapter->psInterruptUrb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!psIntfAdapter->psInterruptUrb) {
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS,
|
||||
INTF_INIT, DBG_LVL_ALL,
|
||||
"Cannot allocate interrupt urb");
|
||||
return -ENOMEM;
|
||||
}
|
||||
psIntfAdapter->psInterruptUrb->transfer_buffer =
|
||||
psIntfAdapter->ulInterruptData;
|
||||
psIntfAdapter->psInterruptUrb->transfer_buffer_length =
|
||||
sizeof(psIntfAdapter->ulInterruptData);
|
||||
|
||||
psIntfAdapter->sIntrIn.int_in_pipe = usb_rcvintpipe(psIntfAdapter->udev,
|
||||
psIntfAdapter->sIntrIn.int_in_endpointAddr);
|
||||
|
||||
usb_fill_int_urb(psIntfAdapter->psInterruptUrb, psIntfAdapter->udev,
|
||||
psIntfAdapter->sIntrIn.int_in_pipe,
|
||||
psIntfAdapter->psInterruptUrb->transfer_buffer,
|
||||
psIntfAdapter->psInterruptUrb->transfer_buffer_length,
|
||||
read_int_callback, psIntfAdapter,
|
||||
psIntfAdapter->sIntrIn.int_in_interval);
|
||||
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, INTF_INIT,
|
||||
DBG_LVL_ALL, "Interrupt Interval: %d\n",
|
||||
psIntfAdapter->sIntrIn.int_in_interval);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
INT StartInterruptUrb(struct bcm_interface_adapter *psIntfAdapter)
|
||||
{
|
||||
INT status = 0;
|
||||
|
||||
if (!(psIntfAdapter->psAdapter->device_removed ||
|
||||
psIntfAdapter->psAdapter->bEndPointHalted ||
|
||||
psIntfAdapter->bSuspended ||
|
||||
psIntfAdapter->bPreparingForBusSuspend ||
|
||||
psIntfAdapter->psAdapter->StopAllXaction)) {
|
||||
status =
|
||||
usb_submit_urb(psIntfAdapter->psInterruptUrb, GFP_ATOMIC);
|
||||
if (status) {
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,
|
||||
DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL,
|
||||
"Cannot send inturb %d\n", status);
|
||||
if (status == -EPIPE) {
|
||||
psIntfAdapter->psAdapter->bEndPointHalted =
|
||||
TRUE;
|
||||
wake_up(&psIntfAdapter->psAdapter->tx_packet_wait_queue);
|
||||
}
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef _INTERFACE_ISR_H
|
||||
#define _INTERFACE_ISR_H
|
||||
|
||||
int CreateInterruptUrb(struct bcm_interface_adapter *psIntfAdapter);
|
||||
|
||||
|
||||
INT StartInterruptUrb(struct bcm_interface_adapter *psIntfAdapter);
|
||||
|
||||
|
||||
VOID InterfaceEnableInterrupt(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
VOID InterfaceDisableInterrupt(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
#ifndef _INTERFACE_MACROS_H
|
||||
#define _INTERFACE_MACROS_H
|
||||
|
||||
#define BCM_USB_MAX_READ_LENGTH 2048
|
||||
|
||||
#define MAXIMUM_USB_TCB 128
|
||||
#define MAXIMUM_USB_RCB 128
|
||||
|
||||
#define MAX_BUFFERS_PER_QUEUE 256
|
||||
|
||||
#define MAX_DATA_BUFFER_SIZE 2048
|
||||
|
||||
/* Num of Asynchronous reads pending */
|
||||
#define NUM_RX_DESC 64
|
||||
|
||||
#define SYS_CFG 0x0F000C00
|
||||
|
||||
#endif
|
|
@ -1,246 +0,0 @@
|
|||
#include "headers.h"
|
||||
|
||||
static int adapter_err_occurred(const struct bcm_interface_adapter *ad)
|
||||
{
|
||||
if (ad->psAdapter->device_removed == TRUE) {
|
||||
BCM_DEBUG_PRINT(ad->psAdapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"Device got removed");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if ((ad->psAdapter->StopAllXaction == TRUE) &&
|
||||
(ad->psAdapter->chip_id >= T3LPB)) {
|
||||
BCM_DEBUG_PRINT(ad->psAdapter, DBG_TYPE_OTHERS, RDM,
|
||||
DBG_LVL_ALL,
|
||||
"Currently Xaction is not allowed on the bus");
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
if (ad->bSuspended == TRUE || ad->bPreparingForBusSuspend == TRUE) {
|
||||
BCM_DEBUG_PRINT(ad->psAdapter, DBG_TYPE_OTHERS, RDM,
|
||||
DBG_LVL_ALL,
|
||||
"Bus is in suspended states hence RDM not allowed..");
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter,
|
||||
unsigned int addr,
|
||||
void *buff,
|
||||
int len)
|
||||
{
|
||||
int bytes;
|
||||
int err = 0;
|
||||
|
||||
if (!psIntfAdapter)
|
||||
return -EINVAL;
|
||||
|
||||
err = adapter_err_occurred(psIntfAdapter);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
psIntfAdapter->psAdapter->DeviceAccess = TRUE;
|
||||
|
||||
bytes = usb_control_msg(psIntfAdapter->udev,
|
||||
usb_rcvctrlpipe(psIntfAdapter->udev, 0),
|
||||
0x02,
|
||||
0xC2,
|
||||
(addr & 0xFFFF),
|
||||
((addr >> 16) & 0xFFFF),
|
||||
buff,
|
||||
len,
|
||||
5000);
|
||||
|
||||
if (-ENODEV == bytes)
|
||||
psIntfAdapter->psAdapter->device_removed = TRUE;
|
||||
|
||||
if (bytes < 0)
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM,
|
||||
DBG_LVL_ALL, "RDM failed status :%d", bytes);
|
||||
else
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM,
|
||||
DBG_LVL_ALL, "RDM sent %d", bytes);
|
||||
|
||||
psIntfAdapter->psAdapter->DeviceAccess = false;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
int InterfaceWRM(struct bcm_interface_adapter *psIntfAdapter,
|
||||
unsigned int addr,
|
||||
void *buff,
|
||||
int len)
|
||||
{
|
||||
int retval = 0;
|
||||
int err = 0;
|
||||
|
||||
if (!psIntfAdapter)
|
||||
return -EINVAL;
|
||||
|
||||
err = adapter_err_occurred(psIntfAdapter);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
psIntfAdapter->psAdapter->DeviceAccess = TRUE;
|
||||
|
||||
retval = usb_control_msg(psIntfAdapter->udev,
|
||||
usb_sndctrlpipe(psIntfAdapter->udev, 0),
|
||||
0x01,
|
||||
0x42,
|
||||
(addr & 0xFFFF),
|
||||
((addr >> 16) & 0xFFFF),
|
||||
buff,
|
||||
len,
|
||||
5000);
|
||||
|
||||
if (-ENODEV == retval)
|
||||
psIntfAdapter->psAdapter->device_removed = TRUE;
|
||||
|
||||
if (retval < 0) {
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM,
|
||||
DBG_LVL_ALL, "WRM failed status :%d", retval);
|
||||
psIntfAdapter->psAdapter->DeviceAccess = false;
|
||||
return retval;
|
||||
}
|
||||
psIntfAdapter->psAdapter->DeviceAccess = false;
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM,
|
||||
DBG_LVL_ALL, "WRM sent %d", retval);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
int BcmRDM(void *arg,
|
||||
unsigned int addr,
|
||||
void *buff,
|
||||
int len)
|
||||
{
|
||||
return InterfaceRDM((struct bcm_interface_adapter *)arg, addr, buff,
|
||||
len);
|
||||
}
|
||||
|
||||
int BcmWRM(void *arg,
|
||||
unsigned int addr,
|
||||
void *buff,
|
||||
int len)
|
||||
{
|
||||
return InterfaceWRM((struct bcm_interface_adapter *)arg, addr, buff,
|
||||
len);
|
||||
}
|
||||
|
||||
int Bcm_clear_halt_of_endpoints(struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
struct bcm_interface_adapter *psIntfAdapter =
|
||||
(struct bcm_interface_adapter *)(Adapter->pvInterfaceAdapter);
|
||||
int status = STATUS_SUCCESS;
|
||||
|
||||
/*
|
||||
* usb_clear_halt - tells device to clear endpoint halt/stall condition
|
||||
* @dev: device whose endpoint is halted
|
||||
* @pipe: endpoint "pipe" being cleared
|
||||
* @ Context: !in_interrupt ()
|
||||
*
|
||||
* usb_clear_halt is the synchrnous call and returns 0 on success else
|
||||
* returns with error code.
|
||||
* This is used to clear halt conditions for bulk and interrupt
|
||||
* endpoints only.
|
||||
* Control and isochronous endpoints never halts.
|
||||
*
|
||||
* Any URBs queued for such an endpoint should normally be unlinked by
|
||||
* the driver before clearing the halt condition.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Killing all the submitted urbs to different end points. */
|
||||
Bcm_kill_all_URBs(psIntfAdapter);
|
||||
|
||||
/* clear the halted/stalled state for every end point */
|
||||
status = usb_clear_halt(psIntfAdapter->udev,
|
||||
psIntfAdapter->sIntrIn.int_in_pipe);
|
||||
if (status != STATUS_SUCCESS)
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT,
|
||||
DBG_LVL_ALL,
|
||||
"Unable to Clear Halt of Interrupt IN end point. :%d ",
|
||||
status);
|
||||
|
||||
status = usb_clear_halt(psIntfAdapter->udev,
|
||||
psIntfAdapter->sBulkIn.bulk_in_pipe);
|
||||
if (status != STATUS_SUCCESS)
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT,
|
||||
DBG_LVL_ALL,
|
||||
"Unable to Clear Halt of Bulk IN end point. :%d ",
|
||||
status);
|
||||
|
||||
status = usb_clear_halt(psIntfAdapter->udev,
|
||||
psIntfAdapter->sBulkOut.bulk_out_pipe);
|
||||
if (status != STATUS_SUCCESS)
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT,
|
||||
DBG_LVL_ALL,
|
||||
"Unable to Clear Halt of Bulk OUT end point. :%d ",
|
||||
status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
void Bcm_kill_all_URBs(struct bcm_interface_adapter *psIntfAdapter)
|
||||
{
|
||||
struct urb *tempUrb = NULL;
|
||||
unsigned int i;
|
||||
|
||||
/*
|
||||
* usb_kill_urb - cancel a transfer request and wait for it to finish
|
||||
* @urb: pointer to URB describing a previously submitted request,
|
||||
* returns nothing as it is void returned API.
|
||||
*
|
||||
* This routine cancels an in-progress request. It is guaranteed that
|
||||
* upon return all completion handlers will have finished and the URB
|
||||
* will be totally idle and available for reuse
|
||||
*
|
||||
* This routine may not be used in an interrupt context (such as a
|
||||
* bottom half or a completion handler), or when holding a spinlock, or
|
||||
* in other situations where the caller can't schedule().
|
||||
*
|
||||
*/
|
||||
|
||||
/* Cancel submitted Interrupt-URB's */
|
||||
if (psIntfAdapter->psInterruptUrb) {
|
||||
if (psIntfAdapter->psInterruptUrb->status == -EINPROGRESS)
|
||||
usb_kill_urb(psIntfAdapter->psInterruptUrb);
|
||||
}
|
||||
|
||||
/* Cancel All submitted TX URB's */
|
||||
for (i = 0; i < MAXIMUM_USB_TCB; i++) {
|
||||
tempUrb = psIntfAdapter->asUsbTcb[i].urb;
|
||||
if (tempUrb) {
|
||||
if (tempUrb->status == -EINPROGRESS)
|
||||
usb_kill_urb(tempUrb);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXIMUM_USB_RCB; i++) {
|
||||
tempUrb = psIntfAdapter->asUsbRcb[i].urb;
|
||||
if (tempUrb) {
|
||||
if (tempUrb->status == -EINPROGRESS)
|
||||
usb_kill_urb(tempUrb);
|
||||
}
|
||||
}
|
||||
|
||||
atomic_set(&psIntfAdapter->uNumTcbUsed, 0);
|
||||
atomic_set(&psIntfAdapter->uCurrTcb, 0);
|
||||
|
||||
atomic_set(&psIntfAdapter->uNumRcbUsed, 0);
|
||||
atomic_set(&psIntfAdapter->uCurrRcb, 0);
|
||||
}
|
||||
|
||||
void putUsbSuspend(struct work_struct *work)
|
||||
{
|
||||
struct bcm_interface_adapter *psIntfAdapter = NULL;
|
||||
struct usb_interface *intf = NULL;
|
||||
|
||||
psIntfAdapter = container_of(work, struct bcm_interface_adapter,
|
||||
usbSuspendWork);
|
||||
intf = psIntfAdapter->interface;
|
||||
|
||||
if (psIntfAdapter->bSuspended == false)
|
||||
usb_autopm_put_interface(intf);
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
#ifndef __INTERFACE_MISC_H
|
||||
#define __INTERFACE_MISC_H
|
||||
|
||||
INT
|
||||
InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter,
|
||||
UINT addr,
|
||||
PVOID buff,
|
||||
INT len);
|
||||
|
||||
INT
|
||||
InterfaceWRM(struct bcm_interface_adapter *psIntfAdapter,
|
||||
UINT addr,
|
||||
PVOID buff,
|
||||
INT len);
|
||||
|
||||
|
||||
int InterfaceFileDownload(PVOID psIntfAdapter,
|
||||
struct file *flp,
|
||||
unsigned int on_chip_loc);
|
||||
|
||||
int InterfaceFileReadbackFromChip(PVOID psIntfAdapter,
|
||||
struct file *flp,
|
||||
unsigned int on_chip_loc);
|
||||
|
||||
|
||||
int BcmRDM(PVOID arg,
|
||||
UINT addr,
|
||||
PVOID buff,
|
||||
INT len);
|
||||
|
||||
int BcmWRM(PVOID arg,
|
||||
UINT addr,
|
||||
PVOID buff,
|
||||
INT len);
|
||||
|
||||
INT Bcm_clear_halt_of_endpoints(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
VOID Bcm_kill_all_URBs(struct bcm_interface_adapter *psIntfAdapter);
|
||||
|
||||
#define DISABLE_USB_ZERO_LEN_INT 0x0F011878
|
||||
|
||||
#endif /* __INTERFACE_MISC_H */
|
|
@ -1,289 +0,0 @@
|
|||
#include "headers.h"
|
||||
|
||||
static void handle_control_packet(struct bcm_interface_adapter *interface,
|
||||
struct bcm_mini_adapter *ad,
|
||||
struct bcm_leader *leader,
|
||||
struct sk_buff *skb,
|
||||
struct urb *urb)
|
||||
{
|
||||
BCM_DEBUG_PRINT(interface->psAdapter, DBG_TYPE_RX, RX_CTRL, DBG_LVL_ALL,
|
||||
"Received control pkt...");
|
||||
*(PUSHORT)skb->data = leader->Status;
|
||||
memcpy(skb->data+sizeof(USHORT), urb->transfer_buffer +
|
||||
(sizeof(struct bcm_leader)), leader->PLength);
|
||||
skb->len = leader->PLength + sizeof(USHORT);
|
||||
|
||||
spin_lock(&ad->control_queue_lock);
|
||||
ENQUEUEPACKET(ad->RxControlHead, ad->RxControlTail, skb);
|
||||
spin_unlock(&ad->control_queue_lock);
|
||||
|
||||
atomic_inc(&ad->cntrlpktCnt);
|
||||
wake_up(&ad->process_rx_cntrlpkt);
|
||||
}
|
||||
|
||||
static void format_eth_hdr_to_stack(struct bcm_interface_adapter *interface,
|
||||
struct bcm_mini_adapter *ad,
|
||||
struct bcm_leader *p_leader,
|
||||
struct sk_buff *skb,
|
||||
struct urb *urb,
|
||||
UINT ui_index,
|
||||
int queue_index,
|
||||
bool b_header_supression_endabled)
|
||||
{
|
||||
/*
|
||||
* Data Packet, Format a proper Ethernet Header
|
||||
* and give it to the stack
|
||||
*/
|
||||
BCM_DEBUG_PRINT(interface->psAdapter, DBG_TYPE_RX, RX_DATA,
|
||||
DBG_LVL_ALL, "Received Data pkt...");
|
||||
skb_reserve(skb, 2 + SKB_RESERVE_PHS_BYTES);
|
||||
memcpy(skb->data+ETH_HLEN, (PUCHAR)urb->transfer_buffer +
|
||||
sizeof(struct bcm_leader), p_leader->PLength);
|
||||
skb->dev = ad->dev;
|
||||
|
||||
/* currently skb->len has extra ETH_HLEN bytes in the beginning */
|
||||
skb_put(skb, p_leader->PLength + ETH_HLEN);
|
||||
ad->PackInfo[queue_index].uiTotalRxBytes += p_leader->PLength;
|
||||
ad->PackInfo[queue_index].uiThisPeriodRxBytes += p_leader->PLength;
|
||||
BCM_DEBUG_PRINT(interface->psAdapter, DBG_TYPE_RX, RX_DATA,
|
||||
DBG_LVL_ALL, "Received Data pkt of len :0x%X",
|
||||
p_leader->PLength);
|
||||
|
||||
if (netif_running(ad->dev)) {
|
||||
/* Moving ahead by ETH_HLEN to the data ptr as received from FW */
|
||||
skb_pull(skb, ETH_HLEN);
|
||||
PHSReceive(ad, p_leader->Vcid, skb, &skb->len,
|
||||
NULL, b_header_supression_endabled);
|
||||
|
||||
if (!ad->PackInfo[queue_index].bEthCSSupport) {
|
||||
skb_push(skb, ETH_HLEN);
|
||||
|
||||
memcpy(skb->data, skb->dev->dev_addr, 6);
|
||||
memcpy(skb->data+6, skb->dev->dev_addr, 6);
|
||||
(*(skb->data+11))++;
|
||||
*(skb->data+12) = 0x08;
|
||||
*(skb->data+13) = 0x00;
|
||||
p_leader->PLength += ETH_HLEN;
|
||||
}
|
||||
|
||||
skb->protocol = eth_type_trans(skb, ad->dev);
|
||||
netif_rx(skb);
|
||||
} else {
|
||||
BCM_DEBUG_PRINT(interface->psAdapter, DBG_TYPE_RX,
|
||||
RX_DATA, DBG_LVL_ALL,
|
||||
"i/f not up hance freeing SKB...");
|
||||
dev_kfree_skb(skb);
|
||||
}
|
||||
|
||||
++ad->dev->stats.rx_packets;
|
||||
ad->dev->stats.rx_bytes += p_leader->PLength;
|
||||
|
||||
for (ui_index = 0; ui_index < MIBS_MAX_HIST_ENTRIES; ui_index++) {
|
||||
if ((p_leader->PLength <=
|
||||
MIBS_PKTSIZEHIST_RANGE*(ui_index+1)) &&
|
||||
(p_leader->PLength > MIBS_PKTSIZEHIST_RANGE*(ui_index)))
|
||||
|
||||
ad->aRxPktSizeHist[ui_index]++;
|
||||
}
|
||||
}
|
||||
|
||||
static int SearchVcid(struct bcm_mini_adapter *Adapter, unsigned short usVcid)
|
||||
{
|
||||
int iIndex = 0;
|
||||
|
||||
for (iIndex = (NO_OF_QUEUES-1); iIndex >= 0; iIndex--)
|
||||
if (Adapter->PackInfo[iIndex].usVCID_Value == usVcid)
|
||||
return iIndex;
|
||||
return NO_OF_QUEUES+1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static struct bcm_usb_rcb *
|
||||
GetBulkInRcb(struct bcm_interface_adapter *psIntfAdapter)
|
||||
{
|
||||
struct bcm_usb_rcb *pRcb = NULL;
|
||||
UINT index = 0;
|
||||
|
||||
if ((atomic_read(&psIntfAdapter->uNumRcbUsed) < MAXIMUM_USB_RCB) &&
|
||||
(psIntfAdapter->psAdapter->StopAllXaction == false)) {
|
||||
index = atomic_read(&psIntfAdapter->uCurrRcb);
|
||||
pRcb = &psIntfAdapter->asUsbRcb[index];
|
||||
pRcb->bUsed = TRUE;
|
||||
pRcb->psIntfAdapter = psIntfAdapter;
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_RX, RX_DPC,
|
||||
DBG_LVL_ALL, "Got Rx desc %d used %d", index,
|
||||
atomic_read(&psIntfAdapter->uNumRcbUsed));
|
||||
index = (index + 1) % MAXIMUM_USB_RCB;
|
||||
atomic_set(&psIntfAdapter->uCurrRcb, index);
|
||||
atomic_inc(&psIntfAdapter->uNumRcbUsed);
|
||||
}
|
||||
return pRcb;
|
||||
}
|
||||
|
||||
/*this is receive call back - when pkt available for receive (BULK IN- end point)*/
|
||||
static void read_bulk_callback(struct urb *urb)
|
||||
{
|
||||
struct sk_buff *skb = NULL;
|
||||
bool bHeaderSupressionEnabled = false;
|
||||
int QueueIndex = NO_OF_QUEUES + 1;
|
||||
UINT uiIndex = 0;
|
||||
struct bcm_usb_rcb *pRcb = (struct bcm_usb_rcb *)urb->context;
|
||||
struct bcm_interface_adapter *psIntfAdapter = pRcb->psIntfAdapter;
|
||||
struct bcm_mini_adapter *Adapter = psIntfAdapter->psAdapter;
|
||||
struct bcm_leader *pLeader = urb->transfer_buffer;
|
||||
|
||||
if (unlikely(netif_msg_rx_status(Adapter)))
|
||||
pr_info(PFX "%s: rx urb status %d length %d\n",
|
||||
Adapter->dev->name, urb->status, urb->actual_length);
|
||||
|
||||
if ((Adapter->device_removed == TRUE) ||
|
||||
(TRUE == Adapter->bEndPointHalted) ||
|
||||
(0 == urb->actual_length)) {
|
||||
pRcb->bUsed = false;
|
||||
atomic_dec(&psIntfAdapter->uNumRcbUsed);
|
||||
return;
|
||||
}
|
||||
|
||||
if (urb->status != STATUS_SUCCESS) {
|
||||
if (urb->status == -EPIPE) {
|
||||
Adapter->bEndPointHalted = TRUE;
|
||||
wake_up(&Adapter->tx_packet_wait_queue);
|
||||
} else {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC,
|
||||
DBG_LVL_ALL,
|
||||
"Rx URB has got cancelled. status :%d",
|
||||
urb->status);
|
||||
}
|
||||
pRcb->bUsed = false;
|
||||
atomic_dec(&psIntfAdapter->uNumRcbUsed);
|
||||
urb->status = STATUS_SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Adapter->bDoSuspend && (Adapter->bPreparingForLowPowerMode)) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL,
|
||||
"device is going in low power mode while PMU option selected..hence rx packet should not be process");
|
||||
return;
|
||||
}
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL,
|
||||
"Read back done len %d\n", pLeader->PLength);
|
||||
if (!pLeader->PLength) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL,
|
||||
"Leader Length 0");
|
||||
atomic_dec(&psIntfAdapter->uNumRcbUsed);
|
||||
return;
|
||||
}
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL,
|
||||
"Leader Status:0x%hX, Length:0x%hX, VCID:0x%hX",
|
||||
pLeader->Status, pLeader->PLength, pLeader->Vcid);
|
||||
if (MAX_CNTL_PKT_SIZE < pLeader->PLength) {
|
||||
if (netif_msg_rx_err(Adapter))
|
||||
pr_info(PFX "%s: corrupted leader length...%d\n",
|
||||
Adapter->dev->name, pLeader->PLength);
|
||||
++Adapter->dev->stats.rx_dropped;
|
||||
atomic_dec(&psIntfAdapter->uNumRcbUsed);
|
||||
return;
|
||||
}
|
||||
|
||||
QueueIndex = SearchVcid(Adapter, pLeader->Vcid);
|
||||
if (QueueIndex < NO_OF_QUEUES) {
|
||||
bHeaderSupressionEnabled =
|
||||
Adapter->PackInfo[QueueIndex].bHeaderSuppressionEnabled;
|
||||
bHeaderSupressionEnabled =
|
||||
bHeaderSupressionEnabled & Adapter->bPHSEnabled;
|
||||
}
|
||||
|
||||
skb = dev_alloc_skb(pLeader->PLength + SKB_RESERVE_PHS_BYTES +
|
||||
SKB_RESERVE_ETHERNET_HEADER);
|
||||
if (!skb) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"NO SKBUFF!!! Dropping the Packet");
|
||||
atomic_dec(&psIntfAdapter->uNumRcbUsed);
|
||||
return;
|
||||
}
|
||||
/* If it is a control Packet, then call handle_bcm_packet ()*/
|
||||
if ((ntohs(pLeader->Vcid) == VCID_CONTROL_PACKET) ||
|
||||
(!(pLeader->Status >= 0x20 && pLeader->Status <= 0x3F))) {
|
||||
handle_control_packet(psIntfAdapter, Adapter, pLeader, skb,
|
||||
urb);
|
||||
} else {
|
||||
format_eth_hdr_to_stack(psIntfAdapter, Adapter, pLeader, skb,
|
||||
urb, uiIndex, QueueIndex,
|
||||
bHeaderSupressionEnabled);
|
||||
}
|
||||
Adapter->PrevNumRecvDescs++;
|
||||
pRcb->bUsed = false;
|
||||
atomic_dec(&psIntfAdapter->uNumRcbUsed);
|
||||
}
|
||||
|
||||
static int ReceiveRcb(struct bcm_interface_adapter *psIntfAdapter,
|
||||
struct bcm_usb_rcb *pRcb)
|
||||
{
|
||||
struct urb *urb = pRcb->urb;
|
||||
int retval = 0;
|
||||
|
||||
usb_fill_bulk_urb(urb, psIntfAdapter->udev,
|
||||
usb_rcvbulkpipe(psIntfAdapter->udev,
|
||||
psIntfAdapter->sBulkIn.bulk_in_endpointAddr),
|
||||
urb->transfer_buffer,
|
||||
BCM_USB_MAX_READ_LENGTH,
|
||||
read_bulk_callback, pRcb);
|
||||
|
||||
if (false == psIntfAdapter->psAdapter->device_removed &&
|
||||
false == psIntfAdapter->psAdapter->bEndPointHalted &&
|
||||
false == psIntfAdapter->bSuspended &&
|
||||
false == psIntfAdapter->bPreparingForBusSuspend) {
|
||||
retval = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (retval) {
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_RX,
|
||||
RX_DPC, DBG_LVL_ALL,
|
||||
"failed submitting read urb, error %d",
|
||||
retval);
|
||||
/* if this return value is because of pipe halt. need to clear this. */
|
||||
if (retval == -EPIPE) {
|
||||
psIntfAdapter->psAdapter->bEndPointHalted = TRUE;
|
||||
wake_up(&psIntfAdapter->psAdapter->tx_packet_wait_queue);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
Function: InterfaceRx
|
||||
|
||||
Description: This is the hardware specific Function for Receiving
|
||||
data packet/control packets from the device.
|
||||
|
||||
Input parameters: IN struct bcm_mini_adapter *Adapter - Miniport Adapter Context
|
||||
|
||||
|
||||
|
||||
Return: TRUE - If Rx was successful.
|
||||
Other - If an error occurred.
|
||||
*/
|
||||
|
||||
bool InterfaceRx(struct bcm_interface_adapter *psIntfAdapter)
|
||||
{
|
||||
USHORT RxDescCount = NUM_RX_DESC -
|
||||
atomic_read(&psIntfAdapter->uNumRcbUsed);
|
||||
|
||||
struct bcm_usb_rcb *pRcb = NULL;
|
||||
|
||||
while (RxDescCount) {
|
||||
pRcb = GetBulkInRcb(psIntfAdapter);
|
||||
if (pRcb == NULL) {
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,
|
||||
DBG_TYPE_PRINTK, 0, 0,
|
||||
"Unable to get Rcb pointer");
|
||||
return false;
|
||||
}
|
||||
ReceiveRcb(psIntfAdapter, pRcb);
|
||||
RxDescCount--;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef _INTERFACE_RX_H
|
||||
#define _INTERFACE_RX_H
|
||||
|
||||
bool InterfaceRx(struct bcm_interface_adapter *Adapter);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,213 +0,0 @@
|
|||
#include "headers.h"
|
||||
|
||||
static void prepare_low_power_mode(struct urb *urb,
|
||||
struct bcm_interface_adapter *interface,
|
||||
struct bcm_mini_adapter *ps_adapter,
|
||||
struct bcm_mini_adapter *ad,
|
||||
struct bcm_link_request *p_control_msg,
|
||||
bool *b_power_down_msg)
|
||||
{
|
||||
if (((p_control_msg->szData[0] == GO_TO_IDLE_MODE_PAYLOAD) &&
|
||||
(p_control_msg->szData[1] == TARGET_CAN_GO_TO_IDLE_MODE))) {
|
||||
|
||||
*b_power_down_msg = TRUE;
|
||||
/*
|
||||
* This covers the bus err while Idle Request msg
|
||||
* sent down.
|
||||
*/
|
||||
if (urb->status != STATUS_SUCCESS) {
|
||||
ps_adapter->bPreparingForLowPowerMode = false;
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_TX, NEXT_SEND,
|
||||
DBG_LVL_ALL,
|
||||
"Idle Mode Request msg failed to reach to Modem");
|
||||
/* Signalling the cntrl pkt path in Ioctl */
|
||||
wake_up(&ps_adapter->lowpower_mode_wait_queue);
|
||||
StartInterruptUrb(interface);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ps_adapter->bDoSuspend == false) {
|
||||
ps_adapter->IdleMode = TRUE;
|
||||
/* since going in Idle mode completed hence making this var false */
|
||||
ps_adapter->bPreparingForLowPowerMode = false;
|
||||
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_TX, NEXT_SEND,
|
||||
DBG_LVL_ALL,
|
||||
"Host Entered in Idle Mode State...");
|
||||
/* Signalling the cntrl pkt path in Ioctl*/
|
||||
wake_up(&ps_adapter->lowpower_mode_wait_queue);
|
||||
}
|
||||
|
||||
} else if ((p_control_msg->Leader.Status == LINK_UP_CONTROL_REQ) &&
|
||||
(p_control_msg->szData[0] == LINK_UP_ACK) &&
|
||||
(p_control_msg->szData[1] == LINK_SHUTDOWN_REQ_FROM_FIRMWARE) &&
|
||||
(p_control_msg->szData[2] == SHUTDOWN_ACK_FROM_DRIVER)) {
|
||||
/*
|
||||
* This covers the bus err while shutdown Request
|
||||
* msg sent down.
|
||||
*/
|
||||
if (urb->status != STATUS_SUCCESS) {
|
||||
ps_adapter->bPreparingForLowPowerMode = false;
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_TX, NEXT_SEND,
|
||||
DBG_LVL_ALL,
|
||||
"Shutdown Request Msg failed to reach to Modem");
|
||||
/* Signalling the cntrl pkt path in Ioctl */
|
||||
wake_up(&ps_adapter->lowpower_mode_wait_queue);
|
||||
StartInterruptUrb(interface);
|
||||
return;
|
||||
}
|
||||
|
||||
*b_power_down_msg = TRUE;
|
||||
if (ps_adapter->bDoSuspend == false) {
|
||||
ps_adapter->bShutStatus = TRUE;
|
||||
/*
|
||||
* since going in shutdown mode completed hence
|
||||
* making this var false
|
||||
*/
|
||||
ps_adapter->bPreparingForLowPowerMode = false;
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_TX, NEXT_SEND,
|
||||
DBG_LVL_ALL,
|
||||
"Host Entered in shutdown Mode State...");
|
||||
/* Signalling the cntrl pkt path in Ioctl */
|
||||
wake_up(&ps_adapter->lowpower_mode_wait_queue);
|
||||
}
|
||||
}
|
||||
|
||||
if (ps_adapter->bDoSuspend && *b_power_down_msg) {
|
||||
/* issuing bus suspend request */
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL,
|
||||
"Issuing the Bus suspend request to USB stack");
|
||||
interface->bPreparingForBusSuspend = TRUE;
|
||||
schedule_work(&interface->usbSuspendWork);
|
||||
}
|
||||
}
|
||||
|
||||
/*this is transmit call-back(BULK OUT)*/
|
||||
static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/)
|
||||
{
|
||||
struct bcm_usb_tcb *pTcb = (struct bcm_usb_tcb *)urb->context;
|
||||
struct bcm_interface_adapter *psIntfAdapter = pTcb->psIntfAdapter;
|
||||
struct bcm_link_request *pControlMsg =
|
||||
(struct bcm_link_request *)urb->transfer_buffer;
|
||||
struct bcm_mini_adapter *psAdapter = psIntfAdapter->psAdapter;
|
||||
bool bpowerDownMsg = false;
|
||||
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
|
||||
|
||||
if (unlikely(netif_msg_tx_done(Adapter)))
|
||||
pr_info(PFX "%s: transmit status %d\n", Adapter->dev->name,
|
||||
urb->status);
|
||||
|
||||
if (urb->status != STATUS_SUCCESS) {
|
||||
if (urb->status == -EPIPE) {
|
||||
psIntfAdapter->psAdapter->bEndPointHalted = TRUE;
|
||||
wake_up(&psIntfAdapter->psAdapter->tx_packet_wait_queue);
|
||||
} else {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND,
|
||||
DBG_LVL_ALL,
|
||||
"Tx URB has got cancelled. status :%d",
|
||||
urb->status);
|
||||
}
|
||||
}
|
||||
|
||||
pTcb->bUsed = false;
|
||||
atomic_dec(&psIntfAdapter->uNumTcbUsed);
|
||||
|
||||
if (TRUE == psAdapter->bPreparingForLowPowerMode) {
|
||||
prepare_low_power_mode(urb, psIntfAdapter, psAdapter, Adapter,
|
||||
pControlMsg, &bpowerDownMsg);
|
||||
}
|
||||
|
||||
usb_free_coherent(urb->dev, urb->transfer_buffer_length,
|
||||
urb->transfer_buffer, urb->transfer_dma);
|
||||
}
|
||||
|
||||
|
||||
static struct bcm_usb_tcb *GetBulkOutTcb(struct bcm_interface_adapter *psIntfAdapter)
|
||||
{
|
||||
struct bcm_usb_tcb *pTcb = NULL;
|
||||
UINT index = 0;
|
||||
|
||||
if ((atomic_read(&psIntfAdapter->uNumTcbUsed) < MAXIMUM_USB_TCB) &&
|
||||
(psIntfAdapter->psAdapter->StopAllXaction == false)) {
|
||||
index = atomic_read(&psIntfAdapter->uCurrTcb);
|
||||
pTcb = &psIntfAdapter->asUsbTcb[index];
|
||||
pTcb->bUsed = TRUE;
|
||||
pTcb->psIntfAdapter = psIntfAdapter;
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_TX,
|
||||
NEXT_SEND, DBG_LVL_ALL,
|
||||
"Got Tx desc %d used %d",
|
||||
index,
|
||||
atomic_read(&psIntfAdapter->uNumTcbUsed));
|
||||
index = (index + 1) % MAXIMUM_USB_TCB;
|
||||
atomic_set(&psIntfAdapter->uCurrTcb, index);
|
||||
atomic_inc(&psIntfAdapter->uNumTcbUsed);
|
||||
}
|
||||
return pTcb;
|
||||
}
|
||||
|
||||
static int TransmitTcb(struct bcm_interface_adapter *psIntfAdapter,
|
||||
struct bcm_usb_tcb *pTcb, PVOID data, int len)
|
||||
{
|
||||
|
||||
struct urb *urb = pTcb->urb;
|
||||
int retval = 0;
|
||||
|
||||
urb->transfer_buffer = usb_alloc_coherent(psIntfAdapter->udev, len,
|
||||
GFP_ATOMIC, &urb->transfer_dma);
|
||||
if (!urb->transfer_buffer) {
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"Error allocating memory\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
memcpy(urb->transfer_buffer, data, len);
|
||||
urb->transfer_buffer_length = len;
|
||||
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_TX, NEXT_SEND,
|
||||
DBG_LVL_ALL, "Sending Bulk out packet\n");
|
||||
/* For T3B,INT OUT end point will be used as bulk out end point */
|
||||
if ((psIntfAdapter->psAdapter->chip_id == T3B) &&
|
||||
(psIntfAdapter->bHighSpeedDevice == TRUE)) {
|
||||
usb_fill_int_urb(urb, psIntfAdapter->udev,
|
||||
psIntfAdapter->sBulkOut.bulk_out_pipe,
|
||||
urb->transfer_buffer, len, write_bulk_callback, pTcb,
|
||||
psIntfAdapter->sBulkOut.int_out_interval);
|
||||
} else {
|
||||
usb_fill_bulk_urb(urb, psIntfAdapter->udev,
|
||||
psIntfAdapter->sBulkOut.bulk_out_pipe,
|
||||
urb->transfer_buffer, len, write_bulk_callback, pTcb);
|
||||
}
|
||||
urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; /* For DMA transfer */
|
||||
|
||||
if (false == psIntfAdapter->psAdapter->device_removed &&
|
||||
false == psIntfAdapter->psAdapter->bEndPointHalted &&
|
||||
false == psIntfAdapter->bSuspended &&
|
||||
false == psIntfAdapter->bPreparingForBusSuspend) {
|
||||
retval = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (retval) {
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_TX,
|
||||
NEXT_SEND, DBG_LVL_ALL,
|
||||
"failed submitting write urb, error %d",
|
||||
retval);
|
||||
if (retval == -EPIPE) {
|
||||
psIntfAdapter->psAdapter->bEndPointHalted = TRUE;
|
||||
wake_up(&psIntfAdapter->psAdapter->tx_packet_wait_queue);
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
int InterfaceTransmitPacket(PVOID arg, PVOID data, UINT len)
|
||||
{
|
||||
struct bcm_usb_tcb *pTcb = NULL;
|
||||
struct bcm_interface_adapter *psIntfAdapter = arg;
|
||||
|
||||
pTcb = GetBulkOutTcb(psIntfAdapter);
|
||||
if (pTcb == NULL) {
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"No URB to transmit packet, dropping packet");
|
||||
return -EFAULT;
|
||||
}
|
||||
return TransmitTcb(psIntfAdapter, pTcb, data, len);
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef _INTERFACE_TX_H
|
||||
#define _INTERFACE_TX_H
|
||||
|
||||
INT InterfaceTransmitPacket(PVOID arg, PVOID data, UINT len);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,226 +0,0 @@
|
|||
#ifndef _IOCTL_H_
|
||||
#define _IOCTL_H_
|
||||
|
||||
struct bcm_rdm_buffer {
|
||||
unsigned long Register;
|
||||
unsigned long Length;
|
||||
} __packed;
|
||||
|
||||
struct bcm_wrm_buffer {
|
||||
unsigned long Register;
|
||||
unsigned long Length;
|
||||
unsigned char Data[4];
|
||||
} __packed;
|
||||
|
||||
struct bcm_ioctl_buffer {
|
||||
void __user *InputBuffer;
|
||||
unsigned long InputLength;
|
||||
void __user *OutputBuffer;
|
||||
unsigned long OutputLength;
|
||||
} __packed;
|
||||
|
||||
struct bcm_gpio_info {
|
||||
unsigned int uiGpioNumber; /* valid numbers 0-15 */
|
||||
unsigned int uiGpioValue; /* 1 set ; 0 not set */
|
||||
} __packed;
|
||||
|
||||
struct bcm_user_thread_req {
|
||||
/* 0->Inactivate LED thread. */
|
||||
/* 1->Activate the LED thread */
|
||||
unsigned int ThreadState;
|
||||
} __packed;
|
||||
|
||||
#define LED_THREAD_ACTIVATION_REQ 1
|
||||
#define BCM_IOCTL 'k'
|
||||
#define IOCTL_SEND_CONTROL_MESSAGE _IOW(BCM_IOCTL, 0x801, int)
|
||||
#define IOCTL_BCM_REGISTER_WRITE _IOW(BCM_IOCTL, 0x802, int)
|
||||
#define IOCTL_BCM_REGISTER_READ _IOR(BCM_IOCTL, 0x803, int)
|
||||
#define IOCTL_BCM_COMMON_MEMORY_WRITE _IOW(BCM_IOCTL, 0x804, int)
|
||||
#define IOCTL_BCM_COMMON_MEMORY_READ _IOR(BCM_IOCTL, 0x805, int)
|
||||
#define IOCTL_GET_CONTROL_MESSAGE _IOR(BCM_IOCTL, 0x806, int)
|
||||
#define IOCTL_BCM_FIRMWARE_DOWNLOAD _IOW(BCM_IOCTL, 0x807, int)
|
||||
#define IOCTL_BCM_SET_SEND_VCID _IOW(BCM_IOCTL, 0x808, int)
|
||||
#define IOCTL_BCM_SWITCH_TRANSFER_MODE _IOW(BCM_IOCTL, 0x809, int)
|
||||
#define IOCTL_LINK_REQ _IOW(BCM_IOCTL, 0x80A, int)
|
||||
#define IOCTL_RSSI_LEVEL_REQ _IOW(BCM_IOCTL, 0x80B, int)
|
||||
#define IOCTL_IDLE_REQ _IOW(BCM_IOCTL, 0x80C, int)
|
||||
#define IOCTL_SS_INFO_REQ _IOW(BCM_IOCTL, 0x80D, int)
|
||||
#define IOCTL_GET_STATISTICS_POINTER _IOW(BCM_IOCTL, 0x80E, int)
|
||||
#define IOCTL_CM_REQUEST _IOW(BCM_IOCTL, 0x80F, int)
|
||||
#define IOCTL_INIT_PARAM_REQ _IOW(BCM_IOCTL, 0x810, int)
|
||||
#define IOCTL_MAC_ADDR_REQ _IOW(BCM_IOCTL, 0x811, int)
|
||||
#define IOCTL_MAC_ADDR_RESP _IOWR(BCM_IOCTL, 0x812, int)
|
||||
#define IOCTL_CLASSIFICATION_RULE _IOW(BCM_IOCTL, 0x813, char)
|
||||
#define IOCTL_CLOSE_NOTIFICATION _IO(BCM_IOCTL, 0x814)
|
||||
#define IOCTL_LINK_UP _IO(BCM_IOCTL, 0x815)
|
||||
#define IOCTL_LINK_DOWN _IO(BCM_IOCTL, 0x816, struct bcm_ioctl_buffer)
|
||||
#define IOCTL_CHIP_RESET _IO(BCM_IOCTL, 0x816)
|
||||
#define IOCTL_CINR_LEVEL_REQ _IOW(BCM_IOCTL, 0x817, char)
|
||||
#define IOCTL_WTM_CONTROL_REQ _IOW(BCM_IOCTL, 0x817, char)
|
||||
#define IOCTL_BE_BUCKET_SIZE _IOW(BCM_IOCTL, 0x818, unsigned long)
|
||||
#define IOCTL_RTPS_BUCKET_SIZE _IOW(BCM_IOCTL, 0x819, unsigned long)
|
||||
#define IOCTL_QOS_THRESHOLD _IOW(BCM_IOCTL, 0x820, unsigned long)
|
||||
#define IOCTL_DUMP_PACKET_INFO _IO(BCM_IOCTL, 0x821)
|
||||
#define IOCTL_GET_PACK_INFO _IOR(BCM_IOCTL, 0x823, int)
|
||||
#define IOCTL_BCM_GET_DRIVER_VERSION _IOR(BCM_IOCTL, 0x829, int)
|
||||
#define IOCTL_BCM_GET_CURRENT_STATUS _IOW(BCM_IOCTL, 0x828, int)
|
||||
#define IOCTL_BCM_GPIO_SET_REQUEST _IOW(BCM_IOCTL, 0x82A, int)
|
||||
#define IOCTL_BCM_GPIO_STATUS_REQUEST _IOW(BCM_IOCTL, 0x82b, int)
|
||||
#define IOCTL_BCM_GET_DSX_INDICATION _IOR(BCM_IOCTL, 0x854, int)
|
||||
#define IOCTL_BCM_BUFFER_DOWNLOAD_START _IOW(BCM_IOCTL, 0x855, int)
|
||||
#define IOCTL_BCM_BUFFER_DOWNLOAD _IOW(BCM_IOCTL, 0x856, int)
|
||||
#define IOCTL_BCM_BUFFER_DOWNLOAD_STOP _IOW(BCM_IOCTL, 0x857, int)
|
||||
#define IOCTL_BCM_REGISTER_WRITE_PRIVATE _IOW(BCM_IOCTL, 0x826, char)
|
||||
#define IOCTL_BCM_REGISTER_READ_PRIVATE _IOW(BCM_IOCTL, 0x827, char)
|
||||
#define IOCTL_BCM_SET_DEBUG _IOW(BCM_IOCTL, 0x824, struct bcm_ioctl_buffer)
|
||||
#define IOCTL_BCM_EEPROM_REGISTER_WRITE _IOW(BCM_IOCTL, 0x858, int)
|
||||
#define IOCTL_BCM_EEPROM_REGISTER_READ _IOR(BCM_IOCTL, 0x859, int)
|
||||
#define IOCTL_BCM_WAKE_UP_DEVICE_FROM_IDLE _IOR(BCM_IOCTL, 0x860, int)
|
||||
#define IOCTL_BCM_SET_MAC_TRACING _IOW(BCM_IOCTL, 0x82c, int)
|
||||
#define IOCTL_BCM_GET_HOST_MIBS _IOW(BCM_IOCTL, 0x853, int)
|
||||
#define IOCTL_BCM_NVM_READ _IOR(BCM_IOCTL, 0x861, int)
|
||||
#define IOCTL_BCM_NVM_WRITE _IOW(BCM_IOCTL, 0x862, int)
|
||||
#define IOCTL_BCM_GET_NVM_SIZE _IOR(BCM_IOCTL, 0x863, int)
|
||||
#define IOCTL_BCM_CAL_INIT _IOR(BCM_IOCTL, 0x864, int)
|
||||
#define IOCTL_BCM_BULK_WRM _IOW(BCM_IOCTL, 0x90B, int)
|
||||
#define IOCTL_BCM_FLASH2X_SECTION_READ _IOR(BCM_IOCTL, 0x865, int)
|
||||
#define IOCTL_BCM_FLASH2X_SECTION_WRITE _IOW(BCM_IOCTL, 0x866, int)
|
||||
#define IOCTL_BCM_GET_FLASH2X_SECTION_BITMAP _IOR(BCM_IOCTL, 0x867, int)
|
||||
#define IOCTL_BCM_SET_ACTIVE_SECTION _IOW(BCM_IOCTL, 0x868, int)
|
||||
#define IOCTL_BCM_IDENTIFY_ACTIVE_SECTION _IO(BCM_IOCTL, 0x869)
|
||||
#define IOCTL_BCM_COPY_SECTION _IOW(BCM_IOCTL, 0x870, int)
|
||||
#define IOCTL_BCM_GET_FLASH_CS_INFO _IOR(BCM_IOCTL, 0x871, int)
|
||||
#define IOCTL_BCM_SELECT_DSD _IOW(BCM_IOCTL, 0x872, int)
|
||||
#define IOCTL_BCM_NVM_RAW_READ _IOR(BCM_IOCTL, 0x875, int)
|
||||
#define IOCTL_BCM_CNTRLMSG_MASK _IOW(BCM_IOCTL, 0x874, int)
|
||||
#define IOCTL_BCM_GET_DEVICE_DRIVER_INFO _IOR(BCM_IOCTL, 0x877, int)
|
||||
#define IOCTL_BCM_TIME_SINCE_NET_ENTRY _IOR(BCM_IOCTL, 0x876, int)
|
||||
#define BCM_LED_THREAD_STATE_CHANGE_REQ _IOW(BCM_IOCTL, 0x878, int)
|
||||
#define IOCTL_BCM_GPIO_MULTI_REQUEST _IOW(BCM_IOCTL, 0x82D, struct bcm_ioctl_buffer)
|
||||
#define IOCTL_BCM_GPIO_MODE_REQUEST _IOW(BCM_IOCTL, 0x82E, struct bcm_ioctl_buffer)
|
||||
|
||||
enum bcm_interface_type {
|
||||
BCM_MII,
|
||||
BCM_CARDBUS,
|
||||
BCM_USB,
|
||||
BCM_SDIO,
|
||||
BCM_PCMCIA
|
||||
};
|
||||
|
||||
struct bcm_driver_info {
|
||||
enum bcm_nvm_type u32NVMType;
|
||||
unsigned int MaxRDMBufferSize;
|
||||
enum bcm_interface_type u32InterfaceType;
|
||||
unsigned int u32DSDStartOffset;
|
||||
unsigned int u32RxAlignmentCorrection;
|
||||
unsigned int u32Reserved[10];
|
||||
};
|
||||
|
||||
struct bcm_nvm_readwrite {
|
||||
void __user *pBuffer;
|
||||
uint32_t uiOffset;
|
||||
uint32_t uiNumBytes;
|
||||
bool bVerify;
|
||||
};
|
||||
|
||||
struct bcm_bulk_wrm_buffer {
|
||||
unsigned long Register;
|
||||
unsigned long SwapEndian;
|
||||
unsigned long Values[1];
|
||||
};
|
||||
|
||||
enum bcm_flash2x_section_val {
|
||||
NO_SECTION_VAL = 0, /* no section chosen when absolute offset is given for RD/WR */
|
||||
ISO_IMAGE1,
|
||||
ISO_IMAGE2,
|
||||
DSD0,
|
||||
DSD1,
|
||||
DSD2,
|
||||
VSA0,
|
||||
VSA1,
|
||||
VSA2,
|
||||
SCSI,
|
||||
CONTROL_SECTION,
|
||||
ISO_IMAGE1_PART2,
|
||||
ISO_IMAGE1_PART3,
|
||||
ISO_IMAGE2_PART2,
|
||||
ISO_IMAGE2_PART3,
|
||||
TOTAL_SECTIONS
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure used for READ/WRITE Flash Map2.x
|
||||
*/
|
||||
struct bcm_flash2x_readwrite {
|
||||
enum bcm_flash2x_section_val Section; /* section to be read/written */
|
||||
u32 offset; /* offset within section. */
|
||||
u32 numOfBytes; /* number of bytes from the offset */
|
||||
u32 bVerify;
|
||||
void __user *pDataBuff; /* buffer for reading/writing */
|
||||
};
|
||||
|
||||
/*
|
||||
* This structure is used for coping one section to other.
|
||||
* there are two ways to copy one section to other.
|
||||
* it NOB =0, complete section will be copied on to other.
|
||||
* if NOB !=0, only NOB will be copied from the given offset.
|
||||
*/
|
||||
|
||||
struct bcm_flash2x_copy_section {
|
||||
enum bcm_flash2x_section_val SrcSection;
|
||||
enum bcm_flash2x_section_val DstSection;
|
||||
u32 offset;
|
||||
u32 numOfBytes;
|
||||
};
|
||||
|
||||
/*
|
||||
* This section provide the complete bitmap of the Flash.
|
||||
* using this map lib/APP will issue read/write command.
|
||||
* Fields are defined as :
|
||||
* Bit [0] = section is present //1:present, 0: Not present
|
||||
* Bit [1] = section is valid //1: valid, 0: not valid
|
||||
* Bit [2] = Section is R/W //0: RW, 1: RO
|
||||
* Bit [3] = Section is Active or not 1 means Active, 0->inactive
|
||||
* Bit [7...3] = Reserved
|
||||
*/
|
||||
|
||||
struct bcm_flash2x_bitmap {
|
||||
unsigned char ISO_IMAGE1;
|
||||
unsigned char ISO_IMAGE2;
|
||||
unsigned char DSD0;
|
||||
unsigned char DSD1;
|
||||
unsigned char DSD2;
|
||||
unsigned char VSA0;
|
||||
unsigned char VSA1;
|
||||
unsigned char VSA2;
|
||||
unsigned char SCSI;
|
||||
unsigned char CONTROL_SECTION;
|
||||
/* Reserved for future use */
|
||||
unsigned char Reserved0;
|
||||
unsigned char Reserved1;
|
||||
unsigned char Reserved2;
|
||||
};
|
||||
|
||||
struct bcm_time_elapsed {
|
||||
u64 ul64TimeElapsedSinceNetEntry;
|
||||
u32 uiReserved[4];
|
||||
};
|
||||
|
||||
enum {
|
||||
WIMAX_IDX = 0, /* To access WiMAX chip GPIO's for GPIO_MULTI_INFO or GPIO_MULTI_MODE */
|
||||
HOST_IDX, /* To access Host chip GPIO's for GPIO_MULTI_INFO or GPIO_MULTI_MODE */
|
||||
MAX_IDX
|
||||
};
|
||||
|
||||
struct bcm_gpio_multi_info {
|
||||
unsigned int uiGPIOCommand; /* 1 for set and 0 for get */
|
||||
unsigned int uiGPIOMask; /* set the corresponding bit to 1 to access GPIO */
|
||||
unsigned int uiGPIOValue; /* 0 or 1; value to be set when command is 1. */
|
||||
} __packed;
|
||||
|
||||
struct bcm_gpio_multi_mode {
|
||||
unsigned int uiGPIOMode; /* 1 for OUT mode, 0 for IN mode */
|
||||
unsigned int uiGPIOMask; /* GPIO mask to set mode */
|
||||
} __packed;
|
||||
|
||||
#endif
|
|
@ -1,6 +0,0 @@
|
|||
config BCM_WIMAX
|
||||
tristate "Beceem BCS200/BCS220-3 and BCSM250 wimax support"
|
||||
depends on USB && NET
|
||||
help
|
||||
This is an experimental driver for the Beceem WIMAX chipset used
|
||||
by Sprint 4G.
|
|
@ -1,363 +0,0 @@
|
|||
/**********************************************************************
|
||||
* LEAKYBUCKET.C
|
||||
* This file contains the routines related to Leaky Bucket Algorithm.
|
||||
***********************************************************************/
|
||||
#include "headers.h"
|
||||
|
||||
/**
|
||||
* UpdateTokenCount() - Calculates the token count for each channel
|
||||
* and updates the same in Adapter structure
|
||||
* @Adapter: Pointer to the Adapter structure.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
static VOID UpdateTokenCount(register struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
ULONG liCurrentTime;
|
||||
INT i = 0;
|
||||
struct timeval tv;
|
||||
struct bcm_packet_info *curr_pi;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL,
|
||||
"=====>\n");
|
||||
if (NULL == Adapter) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS,
|
||||
DBG_LVL_ALL, "Adapter found NULL!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
do_gettimeofday(&tv);
|
||||
for (i = 0; i < NO_OF_QUEUES; i++) {
|
||||
curr_pi = &Adapter->PackInfo[i];
|
||||
|
||||
if (TRUE == curr_pi->bValid && (1 == curr_pi->ucDirection)) {
|
||||
liCurrentTime = ((tv.tv_sec -
|
||||
curr_pi->stLastUpdateTokenAt.tv_sec)*1000 +
|
||||
(tv.tv_usec - curr_pi->stLastUpdateTokenAt.tv_usec) /
|
||||
1000);
|
||||
if (0 != liCurrentTime) {
|
||||
curr_pi->uiCurrentTokenCount += (ULONG)
|
||||
((curr_pi->uiMaxAllowedRate) *
|
||||
((ULONG)((liCurrentTime)))/1000);
|
||||
memcpy(&curr_pi->stLastUpdateTokenAt, &tv,
|
||||
sizeof(struct timeval));
|
||||
curr_pi->liLastUpdateTokenAt = liCurrentTime;
|
||||
if (curr_pi->uiCurrentTokenCount >=
|
||||
curr_pi->uiMaxBucketSize) {
|
||||
curr_pi->uiCurrentTokenCount =
|
||||
curr_pi->uiMaxBucketSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL,
|
||||
"<=====\n");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IsPacketAllowedForFlow() - This function checks whether the given
|
||||
* packet from the specified queue can be allowed for transmission by
|
||||
* checking the token count.
|
||||
* @Adapter: Pointer to the Adpater structure.
|
||||
* @iQIndex: The queue Identifier.
|
||||
* @ulPacketLength: Number of bytes to be transmitted.
|
||||
*
|
||||
* Returns: The number of bytes allowed for transmission.
|
||||
*/
|
||||
static ULONG GetSFTokenCount(struct bcm_mini_adapter *Adapter, struct bcm_packet_info *psSF)
|
||||
{
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL,
|
||||
"IsPacketAllowedForFlow ===>");
|
||||
|
||||
/* Validate the parameters */
|
||||
if (NULL == Adapter || (psSF < Adapter->PackInfo &&
|
||||
(uintptr_t)psSF > (uintptr_t) &Adapter->PackInfo[HiPriority])) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL,
|
||||
"IPAFF: Got wrong Parameters:Adapter: %p, QIndex: %zd\n",
|
||||
Adapter, (psSF-Adapter->PackInfo));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (false != psSF->bValid && psSF->ucDirection) {
|
||||
if (0 != psSF->uiCurrentTokenCount) {
|
||||
return psSF->uiCurrentTokenCount;
|
||||
}
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS,
|
||||
DBG_LVL_ALL,
|
||||
"Not enough tokens in queue %zd Available %u\n",
|
||||
psSF-Adapter->PackInfo, psSF->uiCurrentTokenCount);
|
||||
psSF->uiPendedLast = 1;
|
||||
} else {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL,
|
||||
"IPAFF: Queue %zd not valid\n",
|
||||
psSF-Adapter->PackInfo);
|
||||
}
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL,
|
||||
"IsPacketAllowedForFlow <===");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ingroup tx_functions
|
||||
This function despatches packet from the specified queue.
|
||||
@return Zero(success) or Negative value(failure)
|
||||
*/
|
||||
static INT SendPacketFromQueue(struct bcm_mini_adapter *Adapter,/**<Logical Adapter*/
|
||||
struct bcm_packet_info *psSF, /**<Queue identifier*/
|
||||
struct sk_buff *Packet) /**<Pointer to the packet to be sent*/
|
||||
{
|
||||
INT Status = STATUS_FAILURE;
|
||||
UINT uiIndex = 0, PktLen = 0;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, SEND_QUEUE, DBG_LVL_ALL,
|
||||
"=====>");
|
||||
if (!Adapter || !Packet || !psSF) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, SEND_QUEUE, DBG_LVL_ALL,
|
||||
"Got NULL Adapter or Packet");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (psSF->liDrainCalculated == 0)
|
||||
psSF->liDrainCalculated = jiffies;
|
||||
/* send the packet to the fifo.. */
|
||||
PktLen = Packet->len;
|
||||
Status = SetupNextSend(Adapter, Packet, psSF->usVCID_Value);
|
||||
if (Status == 0) {
|
||||
for (uiIndex = 0; uiIndex < MIBS_MAX_HIST_ENTRIES; uiIndex++) {
|
||||
if ((PktLen <= MIBS_PKTSIZEHIST_RANGE*(uiIndex+1)) &&
|
||||
(PktLen > MIBS_PKTSIZEHIST_RANGE*(uiIndex)))
|
||||
Adapter->aTxPktSizeHist[uiIndex]++;
|
||||
}
|
||||
}
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, SEND_QUEUE, DBG_LVL_ALL,
|
||||
"<=====");
|
||||
return Status;
|
||||
}
|
||||
|
||||
static void get_data_packet(struct bcm_mini_adapter *ad,
|
||||
struct bcm_packet_info *ps_sf)
|
||||
{
|
||||
int packet_len;
|
||||
struct sk_buff *qpacket;
|
||||
|
||||
if (!ps_sf->ucDirection)
|
||||
return;
|
||||
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL,
|
||||
"UpdateTokenCount ");
|
||||
if (ad->IdleMode || ad->bPreparingForLowPowerMode)
|
||||
return; /* in idle mode */
|
||||
|
||||
/* Check for Free Descriptors */
|
||||
if (atomic_read(&ad->CurrNumFreeTxDesc) <=
|
||||
MINIMUM_PENDING_DESCRIPTORS) {
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL,
|
||||
" No Free Tx Descriptor(%d) is available for Data pkt..",
|
||||
atomic_read(&ad->CurrNumFreeTxDesc));
|
||||
return;
|
||||
}
|
||||
|
||||
spin_lock_bh(&ps_sf->SFQueueLock);
|
||||
qpacket = ps_sf->FirstTxQueue;
|
||||
|
||||
if (qpacket) {
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL,
|
||||
"Dequeuing Data Packet");
|
||||
|
||||
if (ps_sf->bEthCSSupport)
|
||||
packet_len = qpacket->len;
|
||||
else
|
||||
packet_len = qpacket->len - ETH_HLEN;
|
||||
|
||||
packet_len <<= 3;
|
||||
if (packet_len <= GetSFTokenCount(ad, ps_sf)) {
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_TX, TX_PACKETS,
|
||||
DBG_LVL_ALL, "Allowed bytes %d",
|
||||
(packet_len >> 3));
|
||||
|
||||
DEQUEUEPACKET(ps_sf->FirstTxQueue, ps_sf->LastTxQueue);
|
||||
ps_sf->uiCurrentBytesOnHost -= (qpacket->len);
|
||||
ps_sf->uiCurrentPacketsOnHost--;
|
||||
atomic_dec(&ad->TotalPacketCount);
|
||||
spin_unlock_bh(&ps_sf->SFQueueLock);
|
||||
|
||||
SendPacketFromQueue(ad, ps_sf, qpacket);
|
||||
ps_sf->uiPendedLast = false;
|
||||
} else {
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_TX, TX_PACKETS,
|
||||
DBG_LVL_ALL, "For Queue: %zd\n",
|
||||
ps_sf - ad->PackInfo);
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_TX, TX_PACKETS,
|
||||
DBG_LVL_ALL,
|
||||
"\nAvailable Tokens = %d required = %d\n",
|
||||
ps_sf->uiCurrentTokenCount,
|
||||
packet_len);
|
||||
/*
|
||||
this part indicates that because of
|
||||
non-availability of the tokens
|
||||
pkt has not been send out hence setting the
|
||||
pending flag indicating the host to send it out
|
||||
first next iteration.
|
||||
*/
|
||||
ps_sf->uiPendedLast = TRUE;
|
||||
spin_unlock_bh(&ps_sf->SFQueueLock);
|
||||
}
|
||||
} else {
|
||||
spin_unlock_bh(&ps_sf->SFQueueLock);
|
||||
}
|
||||
}
|
||||
|
||||
static void send_control_packet(struct bcm_mini_adapter *ad,
|
||||
struct bcm_packet_info *ps_sf)
|
||||
{
|
||||
char *ctrl_packet = NULL;
|
||||
INT status = 0;
|
||||
|
||||
if ((atomic_read(&ad->CurrNumFreeTxDesc) > 0) &&
|
||||
(atomic_read(&ad->index_rd_txcntrlpkt) !=
|
||||
atomic_read(&ad->index_wr_txcntrlpkt))) {
|
||||
ctrl_packet = ad->txctlpacket
|
||||
[(atomic_read(&ad->index_rd_txcntrlpkt)%MAX_CNTRL_PKTS)];
|
||||
if (ctrl_packet) {
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_TX, TX_PACKETS,
|
||||
DBG_LVL_ALL,
|
||||
"Sending Control packet");
|
||||
status = SendControlPacket(ad, ctrl_packet);
|
||||
if (STATUS_SUCCESS == status) {
|
||||
spin_lock_bh(&ps_sf->SFQueueLock);
|
||||
ps_sf->NumOfPacketsSent++;
|
||||
ps_sf->uiSentBytes += ((struct bcm_leader *)ctrl_packet)->PLength;
|
||||
ps_sf->uiSentPackets++;
|
||||
atomic_dec(&ad->TotalPacketCount);
|
||||
ps_sf->uiCurrentBytesOnHost -= ((struct bcm_leader *)ctrl_packet)->PLength;
|
||||
ps_sf->uiCurrentPacketsOnHost--;
|
||||
atomic_inc(&ad->index_rd_txcntrlpkt);
|
||||
spin_unlock_bh(&ps_sf->SFQueueLock);
|
||||
} else {
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_TX, TX_PACKETS,
|
||||
DBG_LVL_ALL,
|
||||
"SendControlPacket Failed\n");
|
||||
}
|
||||
} else {
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_TX, TX_PACKETS,
|
||||
DBG_LVL_ALL,
|
||||
" Control Pkt is not available, Indexing is wrong....");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CheckAndSendPacketFromIndex() - This function dequeues the
|
||||
* data/control packet from the specified queue for transmission.
|
||||
* @Adapter: Pointer to the driver control structure.
|
||||
* @iQIndex: The queue Identifier.
|
||||
*
|
||||
* Returns: None.
|
||||
*/
|
||||
static VOID CheckAndSendPacketFromIndex(struct bcm_mini_adapter *Adapter,
|
||||
struct bcm_packet_info *psSF)
|
||||
{
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL,
|
||||
"%zd ====>", (psSF-Adapter->PackInfo));
|
||||
if ((psSF != &Adapter->PackInfo[HiPriority]) &&
|
||||
Adapter->LinkUpStatus &&
|
||||
atomic_read(&psSF->uiPerSFTxResourceCount)) { /* Get data packet */
|
||||
|
||||
get_data_packet(Adapter, psSF);
|
||||
} else {
|
||||
send_control_packet(Adapter, psSF);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* transmit_packets() - This function transmits the packets from
|
||||
* different queues, if free descriptors are available on target.
|
||||
* @Adapter: Pointer to the Adapter structure.
|
||||
*
|
||||
* Returns: None.
|
||||
*/
|
||||
VOID transmit_packets(struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
UINT uiPrevTotalCount = 0;
|
||||
int iIndex = 0;
|
||||
|
||||
bool exit_flag = TRUE;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL,
|
||||
"=====>");
|
||||
|
||||
if (NULL == Adapter) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL,
|
||||
"Got NULL Adapter");
|
||||
return;
|
||||
}
|
||||
if (Adapter->device_removed == TRUE) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL,
|
||||
"Device removed");
|
||||
return;
|
||||
}
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL,
|
||||
"\nUpdateTokenCount ====>\n");
|
||||
|
||||
UpdateTokenCount(Adapter);
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL,
|
||||
"\nPruneQueueAllSF ====>\n");
|
||||
|
||||
PruneQueueAllSF(Adapter);
|
||||
|
||||
uiPrevTotalCount = atomic_read(&Adapter->TotalPacketCount);
|
||||
|
||||
for (iIndex = HiPriority; iIndex >= 0; iIndex--) {
|
||||
if (!uiPrevTotalCount || (TRUE == Adapter->device_removed))
|
||||
break;
|
||||
|
||||
if (Adapter->PackInfo[iIndex].bValid &&
|
||||
Adapter->PackInfo[iIndex].uiPendedLast &&
|
||||
Adapter->PackInfo[iIndex].uiCurrentBytesOnHost) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS,
|
||||
DBG_LVL_ALL,
|
||||
"Calling CheckAndSendPacketFromIndex..");
|
||||
CheckAndSendPacketFromIndex(Adapter,
|
||||
&Adapter->PackInfo[iIndex]);
|
||||
uiPrevTotalCount--;
|
||||
}
|
||||
}
|
||||
|
||||
while (uiPrevTotalCount > 0 && !Adapter->device_removed) {
|
||||
exit_flag = TRUE;
|
||||
/* second iteration to parse non-pending queues */
|
||||
for (iIndex = HiPriority; iIndex >= 0; iIndex--) {
|
||||
if (!uiPrevTotalCount ||
|
||||
(TRUE == Adapter->device_removed))
|
||||
break;
|
||||
|
||||
if (Adapter->PackInfo[iIndex].bValid &&
|
||||
Adapter->PackInfo[iIndex].uiCurrentBytesOnHost &&
|
||||
!Adapter->PackInfo[iIndex].uiPendedLast) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX,
|
||||
TX_PACKETS, DBG_LVL_ALL,
|
||||
"Calling CheckAndSendPacketFromIndex..");
|
||||
CheckAndSendPacketFromIndex(Adapter, &Adapter->PackInfo[iIndex]);
|
||||
uiPrevTotalCount--;
|
||||
exit_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Adapter->IdleMode || Adapter->bPreparingForLowPowerMode) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS,
|
||||
DBG_LVL_ALL, "In Idle Mode\n");
|
||||
break;
|
||||
}
|
||||
if (exit_flag == TRUE)
|
||||
break;
|
||||
} /* end of inner while loop */
|
||||
|
||||
update_per_cid_rx(Adapter);
|
||||
Adapter->txtransmit_running = 0;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL,
|
||||
"<======");
|
||||
}
|
|
@ -1,352 +0,0 @@
|
|||
/*************************************
|
||||
* Macros.h
|
||||
**************************************/
|
||||
#ifndef __MACROS_H__
|
||||
#define __MACROS_H__
|
||||
|
||||
#define TX_TIMER_PERIOD 10 /*10 msec*/
|
||||
#define MAX_CLASSIFIERS 100
|
||||
#define MAX_TARGET_DSX_BUFFERS 24
|
||||
|
||||
#define MAX_CNTRL_PKTS 100
|
||||
#define MAX_DATA_PKTS 200
|
||||
#define MAX_ETH_SIZE 1536
|
||||
#define MAX_CNTL_PKT_SIZE 2048
|
||||
|
||||
#define MTU_SIZE 1400
|
||||
#define TX_QLEN 5
|
||||
|
||||
#define MAC_ADDR_REGISTER 0xbf60d000
|
||||
|
||||
|
||||
/* Quality of Service */
|
||||
#define NO_OF_QUEUES 17
|
||||
#define HiPriority (NO_OF_QUEUES-1)
|
||||
#define LowPriority 0
|
||||
#define BE 2
|
||||
#define rtPS 4
|
||||
#define ERTPS 5
|
||||
#define UGS 6
|
||||
|
||||
#define BE_BUCKET_SIZE (1024*1024*100) /* 32kb */
|
||||
#define rtPS_BUCKET_SIZE (1024*1024*100) /* 8kb */
|
||||
#define MAX_ALLOWED_RATE (1024*1024*100)
|
||||
#define TX_PACKET_THRESHOLD 10
|
||||
#define XSECONDS (1*HZ)
|
||||
#define DSC_ACTIVATE_REQUEST 248
|
||||
#define QUEUE_DEPTH_OFFSET 0x1fc01000
|
||||
#define MAX_DEVICE_DESC_SIZE 2040
|
||||
#define MAX_CTRL_QUEUE_LEN 100
|
||||
#define MAX_APP_QUEUE_LEN 200
|
||||
#define MAX_LATENCY_ALLOWED 0xFFFFFFFF
|
||||
#define DEFAULT_UG_INTERVAL 250
|
||||
#define DEFAULT_UGI_FACTOR 4
|
||||
|
||||
#define DEFAULT_PERSFCOUNT 60
|
||||
#define MAX_CONNECTIONS 10
|
||||
#define MAX_CLASS_NAME_LENGTH 32
|
||||
|
||||
#define ETH_LENGTH_OF_ADDRESS 6
|
||||
#define MAX_MULTICAST_ADDRESSES 32
|
||||
#define IP_LENGTH_OF_ADDRESS 4
|
||||
|
||||
#define IP_PACKET_ONLY_MODE 0
|
||||
#define ETH_PACKET_TUNNELING_MODE 1
|
||||
|
||||
/* Link Request */
|
||||
#define SET_MAC_ADDRESS_REQUEST 0
|
||||
#define SYNC_UP_REQUEST 1
|
||||
#define SYNCED_UP 2
|
||||
#define LINK_UP_REQUEST 3
|
||||
#define LINK_CONNECTED 4
|
||||
#define SYNC_UP_NOTIFICATION 2
|
||||
#define LINK_UP_NOTIFICATION 4
|
||||
|
||||
|
||||
#define LINK_NET_ENTRY 0x0002
|
||||
#define HMC_STATUS 0x0004
|
||||
#define LINK_UP_CONTROL_REQ 0x83
|
||||
|
||||
#define STATS_POINTER_REQ_STATUS 0x86
|
||||
#define NETWORK_ENTRY_REQ_PAYLOAD 198
|
||||
#define LINK_DOWN_REQ_PAYLOAD 226
|
||||
#define SYNC_UP_REQ_PAYLOAD 228
|
||||
#define STATISTICS_POINTER_REQ 237
|
||||
#define LINK_UP_REQ_PAYLOAD 245
|
||||
#define LINK_UP_ACK 246
|
||||
|
||||
#define STATS_MSG_SIZE 4
|
||||
#define INDEX_TO_DATA 4
|
||||
|
||||
#define GO_TO_IDLE_MODE_PAYLOAD 210
|
||||
#define COME_UP_FROM_IDLE_MODE_PAYLOAD 211
|
||||
#define IDLE_MODE_SF_UPDATE_MSG 187
|
||||
|
||||
#define SKB_RESERVE_ETHERNET_HEADER 16
|
||||
#define SKB_RESERVE_PHS_BYTES 32
|
||||
|
||||
#define IP_PACKET_ONLY_MODE 0
|
||||
#define ETH_PACKET_TUNNELING_MODE 1
|
||||
|
||||
#define ETH_CS_802_3 1
|
||||
#define ETH_CS_802_1Q_VLAN 3
|
||||
#define IPV4_CS 1
|
||||
#define IPV6_CS 2
|
||||
#define ETH_CS_MASK 0x3f
|
||||
|
||||
/** \brief Validity bit maps for TLVs in packet classification rule */
|
||||
|
||||
#define PKT_CLASSIFICATION_USER_PRIORITY_VALID 0
|
||||
#define PKT_CLASSIFICATION_VLANID_VALID 1
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(_a, _b) ((_a) < (_b) ? (_a) : (_b))
|
||||
#endif
|
||||
|
||||
|
||||
/*Leader related terms */
|
||||
#define LEADER_STATUS 0x00
|
||||
#define LEADER_STATUS_TCP_ACK 0x1
|
||||
#define LEADER_SIZE sizeof(struct bcm_leader)
|
||||
#define MAC_ADDR_REQ_SIZE sizeof(struct bcm_packettosend)
|
||||
#define SS_INFO_REQ_SIZE sizeof(struct bcm_packettosend)
|
||||
#define CM_REQUEST_SIZE (LEADER_SIZE + sizeof(stLocalSFChangeRequest))
|
||||
#define IDLE_REQ_SIZE sizeof(struct bcm_packettosend)
|
||||
|
||||
|
||||
#define MAX_TRANSFER_CTRL_BYTE_USB (2*1024)
|
||||
|
||||
#define GET_MAILBOX1_REG_REQUEST 0x87
|
||||
#define GET_MAILBOX1_REG_RESPONSE 0x67
|
||||
#define VCID_CONTROL_PACKET 0x00
|
||||
|
||||
#define TRANSMIT_NETWORK_DATA 0x00
|
||||
#define RECEIVED_NETWORK_DATA 0x20
|
||||
|
||||
#define CM_RESPONSES 0xA0
|
||||
#define STATUS_RSP 0xA1
|
||||
#define LINK_CONTROL_RESP 0xA2
|
||||
#define IDLE_MODE_STATUS 0xA3
|
||||
#define STATS_POINTER_RESP 0xA6
|
||||
#define MGMT_MSG_INFO_SW_STATUS 0xA7
|
||||
#define AUTH_SS_HOST_MSG 0xA8
|
||||
|
||||
#define CM_DSA_ACK_PAYLOAD 247
|
||||
#define CM_DSC_ACK_PAYLOAD 248
|
||||
#define CM_DSD_ACK_PAYLOAD 249
|
||||
#define CM_DSDEACTVATE 250
|
||||
#define TOTAL_MASKED_ADDRESS_IN_BYTES 32
|
||||
|
||||
#define MAC_REQ 0
|
||||
#define LINK_RESP 1
|
||||
#define RSSI_INDICATION 2
|
||||
|
||||
#define SS_INFO 4
|
||||
#define STATISTICS_INFO 5
|
||||
#define CM_INDICATION 6
|
||||
#define PARAM_RESP 7
|
||||
#define BUFFER_1K 1024
|
||||
#define BUFFER_2K (BUFFER_1K*2)
|
||||
#define BUFFER_4K (BUFFER_2K*2)
|
||||
#define BUFFER_8K (BUFFER_4K*2)
|
||||
#define BUFFER_16K (BUFFER_8K*2)
|
||||
#define DOWNLINK_DIR 0
|
||||
#define UPLINK_DIR 1
|
||||
|
||||
#define BCM_SIGNATURE "BECEEM"
|
||||
|
||||
|
||||
#define GPIO_OUTPUT_REGISTER 0x0F00003C
|
||||
#define BCM_GPIO_OUTPUT_SET_REG 0x0F000040
|
||||
#define BCM_GPIO_OUTPUT_CLR_REG 0x0F000044
|
||||
#define GPIO_MODE_REGISTER 0x0F000034
|
||||
#define GPIO_PIN_STATE_REGISTER 0x0F000038
|
||||
|
||||
struct bcm_link_state {
|
||||
unsigned char ucLinkStatus;
|
||||
unsigned char bIdleMode;
|
||||
unsigned char bShutdownMode;
|
||||
};
|
||||
|
||||
enum enLinkStatus {
|
||||
WAIT_FOR_SYNC = 1,
|
||||
PHY_SYNC_ACHIVED = 2,
|
||||
LINKUP_IN_PROGRESS = 3,
|
||||
LINKUP_DONE = 4,
|
||||
DREG_RECEIVED = 5,
|
||||
LINK_STATUS_RESET_RECEIVED = 6,
|
||||
PERIODIC_WAKE_UP_NOTIFICATION_FRM_FW = 7,
|
||||
LINK_SHUTDOWN_REQ_FROM_FIRMWARE = 8,
|
||||
COMPLETE_WAKE_UP_NOTIFICATION_FRM_FW = 9
|
||||
};
|
||||
|
||||
enum bcm_phs_dsc_action {
|
||||
eAddPHSRule = 0,
|
||||
eSetPHSRule,
|
||||
eDeletePHSRule,
|
||||
eDeleteAllPHSRules
|
||||
};
|
||||
|
||||
#define CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ 0x89 /* Host to Mac */
|
||||
#define CM_CONTROL_NEWDSX_MULTICLASSIFIER_RESP 0xA9 /* Mac to Host */
|
||||
#define MASK_DISABLE_HEADER_SUPPRESSION 0x10 /* 0b000010000 */
|
||||
#define MINIMUM_PENDING_DESCRIPTORS 5
|
||||
|
||||
#define SHUTDOWN_HOSTINITIATED_REQUESTPAYLOAD 0xCC
|
||||
#define SHUTDOWN_ACK_FROM_DRIVER 0x1
|
||||
#define SHUTDOWN_NACK_FROM_DRIVER 0x2
|
||||
|
||||
#define LINK_SYNC_UP_SUBTYPE 0x0001
|
||||
#define LINK_SYNC_DOWN_SUBTYPE 0x0001
|
||||
|
||||
|
||||
|
||||
#define CONT_MODE 1
|
||||
#define SINGLE_DESCRIPTOR 1
|
||||
|
||||
|
||||
#define DESCRIPTOR_LENGTH 0x30
|
||||
#define FIRMWARE_DESCS_ADDRESS 0x1F100000
|
||||
|
||||
|
||||
#define CLOCK_RESET_CNTRL_REG_1 0x0F00000C
|
||||
#define CLOCK_RESET_CNTRL_REG_2 0x0F000840
|
||||
|
||||
|
||||
|
||||
#define TX_DESCRIPTOR_HEAD_REGISTER 0x0F010034
|
||||
#define RX_DESCRIPTOR_HEAD_REGISTER 0x0F010094
|
||||
|
||||
#define STATISTICS_BEGIN_ADDR 0xbf60f02c
|
||||
|
||||
#define MAX_PENDING_CTRL_PACKET (MAX_CTRL_QUEUE_LEN-10)
|
||||
|
||||
#define WIMAX_MAX_MTU (MTU_SIZE + ETH_HLEN)
|
||||
#define AUTO_LINKUP_ENABLE 0x2
|
||||
#define AUTO_SYNC_DISABLE 0x1
|
||||
#define AUTO_FIRM_DOWNLOAD 0x1
|
||||
#define SETTLE_DOWN_TIME 50
|
||||
|
||||
#define HOST_BUS_SUSPEND_BIT 16
|
||||
|
||||
#define IDLE_MESSAGE 0x81
|
||||
|
||||
#define MIPS_CLOCK_133MHz 1
|
||||
|
||||
#define TARGET_CAN_GO_TO_IDLE_MODE 2
|
||||
#define TARGET_CAN_NOT_GO_TO_IDLE_MODE 3
|
||||
#define IDLE_MODE_PAYLOAD_LENGTH 8
|
||||
|
||||
#define IP_HEADER(Buffer) ((IPHeaderFormat *)(Buffer))
|
||||
#define IPV4 4
|
||||
#define IP_VERSION(byte) (((byte&0xF0)>>4))
|
||||
|
||||
#define SET_MAC_ADDRESS 193
|
||||
#define SET_MAC_ADDRESS_RESPONSE 236
|
||||
|
||||
#define IDLE_MODE_WAKEUP_PATTERN 0xd0ea1d1e
|
||||
#define IDLE_MODE_WAKEUP_NOTIFIER_ADDRESS 0x1FC02FA8
|
||||
#define IDLE_MODE_MAX_RETRY_COUNT 1000
|
||||
|
||||
#define CONFIG_BEGIN_ADDR 0xBF60B000
|
||||
|
||||
#define FIRMWARE_BEGIN_ADDR 0xBFC00000
|
||||
|
||||
#define INVALID_QUEUE_INDEX NO_OF_QUEUES
|
||||
|
||||
#define INVALID_PID ((pid_t)-1)
|
||||
#define DDR_80_MHZ 0
|
||||
#define DDR_100_MHZ 1
|
||||
#define DDR_120_MHZ 2 /* Additional Frequency for T3LP */
|
||||
#define DDR_133_MHZ 3
|
||||
#define DDR_140_MHZ 4 /* Not Used (Reserved for future) */
|
||||
#define DDR_160_MHZ 5 /* Additional Frequency for T3LP */
|
||||
#define DDR_180_MHZ 6 /* Not Used (Reserved for future) */
|
||||
#define DDR_200_MHZ 7 /* Not Used (Reserved for future) */
|
||||
|
||||
#define MIPS_200_MHZ 0
|
||||
#define MIPS_160_MHZ 1
|
||||
|
||||
#define PLL_800_MHZ 0
|
||||
#define PLL_266_MHZ 1
|
||||
|
||||
#define DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING 0
|
||||
#define DEVICE_POWERSAVE_MODE_AS_PMU_CLOCK_GATING 1
|
||||
#define DEVICE_POWERSAVE_MODE_AS_PMU_SHUTDOWN 2
|
||||
#define DEVICE_POWERSAVE_MODE_AS_RESERVED 3
|
||||
#define DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE 4
|
||||
|
||||
|
||||
#define EEPROM_REJECT_REG_1 0x0f003018
|
||||
#define EEPROM_REJECT_REG_2 0x0f00301c
|
||||
#define EEPROM_REJECT_REG_3 0x0f003008
|
||||
#define EEPROM_REJECT_REG_4 0x0f003020
|
||||
#define EEPROM_REJECT_MASK 0x0fffffff
|
||||
#define VSG_MODE 0x3
|
||||
|
||||
/* Idle Mode Related Registers */
|
||||
#define DEBUG_INTERRUPT_GENERATOR_REGISTOR 0x0F00007C
|
||||
#define SW_ABORT_IDLEMODE_LOC 0x0FF01FFC
|
||||
|
||||
#define SW_ABORT_IDLEMODE_PATTERN 0xd0ea1d1e
|
||||
#define DEVICE_INT_OUT_EP_REG0 0x0F011870
|
||||
#define DEVICE_INT_OUT_EP_REG1 0x0F011874
|
||||
|
||||
#define BIN_FILE "/lib/firmware/macxvi200.bin"
|
||||
#define CFG_FILE "/lib/firmware/macxvi.cfg"
|
||||
#define SF_MAX_ALLOWED_PACKETS_TO_BACKUP 128
|
||||
#define MIN_VAL(x, y) ((x) < (y) ? (x) : (y))
|
||||
#define MAC_ADDRESS_SIZE 6
|
||||
#define EEPROM_COMMAND_Q_REG 0x0F003018
|
||||
#define EEPROM_READ_DATA_Q_REG 0x0F003020
|
||||
#define CHIP_ID_REG 0x0F000000
|
||||
#define GPIO_MODE_REG 0x0F000034
|
||||
#define GPIO_OUTPUT_REG 0x0F00003C
|
||||
#define WIMAX_MAX_ALLOWED_RATE (1024*1024*50)
|
||||
|
||||
#define T3 0xbece0300
|
||||
#define TARGET_SFID_TXDESC_MAP_LOC 0xBFFFF400
|
||||
|
||||
#define RWM_READ 0
|
||||
#define RWM_WRITE 1
|
||||
|
||||
#define T3LPB 0xbece3300
|
||||
#define BCS220_2 0xbece3311
|
||||
#define BCS220_2BC 0xBECE3310
|
||||
#define BCS250_BC 0xbece3301
|
||||
#define BCS220_3 0xbece3321
|
||||
|
||||
|
||||
#define HPM_CONFIG_LDO145 0x0F000D54
|
||||
#define HPM_CONFIG_MSW 0x0F000D58
|
||||
|
||||
#define T3B 0xbece0310
|
||||
enum bcm_nvm_type {
|
||||
NVM_AUTODETECT = 0,
|
||||
NVM_EEPROM,
|
||||
NVM_FLASH,
|
||||
NVM_UNKNOWN
|
||||
};
|
||||
|
||||
enum bcm_pmu_modes {
|
||||
HYBRID_MODE_7C = 0,
|
||||
INTERNAL_MODE_6 = 1,
|
||||
HYBRID_MODE_6 = 2
|
||||
};
|
||||
|
||||
#define MAX_RDM_WRM_RETIRES 1
|
||||
|
||||
enum eAbortPattern {
|
||||
ABORT_SHUTDOWN_MODE = 1,
|
||||
ABORT_IDLE_REG = 1,
|
||||
ABORT_IDLE_MODE = 2,
|
||||
ABORT_IDLE_SYNCDOWN = 3
|
||||
};
|
||||
|
||||
|
||||
/* Offsets used by driver in skb cb variable */
|
||||
#define SKB_CB_CLASSIFICATION_OFFSET 0
|
||||
#define SKB_CB_LATENCY_OFFSET 1
|
||||
#define SKB_CB_TCPACK_OFFSET 2
|
||||
|
||||
#endif /* __MACROS_H__ */
|
|
@ -1,12 +0,0 @@
|
|||
#
|
||||
# Makefile for Beceem USB Wimax card
|
||||
#
|
||||
|
||||
obj-$(CONFIG_BCM_WIMAX) += bcm_wimax.o
|
||||
|
||||
bcm_wimax-y := InterfaceDld.o InterfaceIdleMode.o InterfaceInit.o InterfaceRx.o \
|
||||
InterfaceIsr.o InterfaceMisc.o InterfaceTx.o \
|
||||
CmHost.o IPv6Protocol.o Qos.o Transmit.o\
|
||||
Bcmnet.o DDRInit.o HandleControlPacket.o\
|
||||
LeakyBucket.o Misc.o sort.o Bcmchar.o hostmibs.o PHSModule.o\
|
||||
led_control.o nvm.o vendorspecificextn.o
|
File diff suppressed because it is too large
Load Diff
|
@ -1,94 +0,0 @@
|
|||
#ifndef BCM_PHS_DEFINES_H
|
||||
#define BCM_PHS_DEFINES_H
|
||||
|
||||
#define PHS_INVALID_TABLE_INDEX 0xffffffff
|
||||
#define PHS_MEM_TAG "_SHP"
|
||||
|
||||
/* PHS Defines */
|
||||
#define STATUS_PHS_COMPRESSED 0xa1
|
||||
#define STATUS_PHS_NOCOMPRESSION 0xa2
|
||||
#define APPLY_PHS 1
|
||||
#define MAX_NO_BIT 7
|
||||
#define ZERO_PHSI 0
|
||||
#define VERIFY 0
|
||||
#define SIZE_MULTIPLE_32 4
|
||||
#define UNCOMPRESSED_PACKET 0
|
||||
#define DYNAMIC 0
|
||||
#define SUPPRESS 0x80
|
||||
#define NO_CLASSIFIER_MATCH 0
|
||||
#define SEND_PACKET_UNCOMPRESSED 0
|
||||
#define PHSI_IS_ZERO 0
|
||||
#define PHSI_LEN 1
|
||||
#define ERROR_LEN 0
|
||||
#define PHS_BUFFER_SIZE 1532
|
||||
#define MAX_PHSRULE_PER_SF 20
|
||||
#define MAX_SERVICEFLOWS 17
|
||||
|
||||
/* PHS Error Defines */
|
||||
#define PHS_SUCCESS 0
|
||||
#define ERR_PHS_INVALID_DEVICE_EXETENSION 0x800
|
||||
#define ERR_PHS_INVALID_PHS_RULE 0x801
|
||||
#define ERR_PHS_RULE_ALREADY_EXISTS 0x802
|
||||
#define ERR_SF_MATCH_FAIL 0x803
|
||||
#define ERR_INVALID_CLASSIFIERTABLE_FOR_SF 0x804
|
||||
#define ERR_SFTABLE_FULL 0x805
|
||||
#define ERR_CLSASSIFIER_TABLE_FULL 0x806
|
||||
#define ERR_PHSRULE_MEMALLOC_FAIL 0x807
|
||||
#define ERR_CLSID_MATCH_FAIL 0x808
|
||||
#define ERR_PHSRULE_MATCH_FAIL 0x809
|
||||
|
||||
struct bcm_phs_rule {
|
||||
u8 u8PHSI;
|
||||
u8 u8PHSFLength;
|
||||
u8 u8PHSF[MAX_PHS_LENGTHS];
|
||||
u8 u8PHSMLength;
|
||||
u8 u8PHSM[MAX_PHS_LENGTHS];
|
||||
u8 u8PHSS;
|
||||
u8 u8PHSV;
|
||||
u8 u8RefCnt;
|
||||
u8 bUnclassifiedPHSRule;
|
||||
u8 u8Reserved[3];
|
||||
long PHSModifiedBytes;
|
||||
unsigned long PHSModifiedNumPackets;
|
||||
unsigned long PHSErrorNumPackets;
|
||||
};
|
||||
|
||||
enum bcm_phs_classifier_context {
|
||||
eActiveClassifierRuleContext,
|
||||
eOldClassifierRuleContext
|
||||
};
|
||||
|
||||
struct bcm_phs_classifier_entry {
|
||||
u8 bUsed;
|
||||
u16 uiClassifierRuleId;
|
||||
u8 u8PHSI;
|
||||
struct bcm_phs_rule *pstPhsRule;
|
||||
u8 bUnclassifiedPHSRule;
|
||||
};
|
||||
|
||||
struct bcm_phs_classifier_table {
|
||||
u16 uiTotalClassifiers;
|
||||
struct bcm_phs_classifier_entry stActivePhsRulesList[MAX_PHSRULE_PER_SF];
|
||||
struct bcm_phs_classifier_entry stOldPhsRulesList[MAX_PHSRULE_PER_SF];
|
||||
u16 uiOldestPhsRuleIndex;
|
||||
};
|
||||
|
||||
struct bcm_phs_entry {
|
||||
u8 bUsed;
|
||||
u16 uiVcid;
|
||||
struct bcm_phs_classifier_table *pstClassifierTable;
|
||||
};
|
||||
|
||||
struct bcm_phs_table {
|
||||
u16 uiTotalServiceFlows;
|
||||
struct bcm_phs_entry stSFList[MAX_SERVICEFLOWS];
|
||||
};
|
||||
|
||||
struct bcm_phs_extension {
|
||||
/* PHS Specific data */
|
||||
struct bcm_phs_table *pstServiceFlowPhsRulesTable;
|
||||
void *CompressedTxBuffer;
|
||||
void *UnCompressedRxBuffer;
|
||||
};
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,59 +0,0 @@
|
|||
#ifndef BCM_MINIPORT_PHSMODULE_H
|
||||
#define BCM_MINIPORT_PHSMODULE_H
|
||||
|
||||
int PHSTransmit(struct bcm_mini_adapter *Adapter,
|
||||
struct sk_buff **pPacket,
|
||||
USHORT Vcid,
|
||||
B_UINT16 uiClassifierRuleID,
|
||||
bool bHeaderSuppressionEnabled,
|
||||
PUINT PacketLen,
|
||||
UCHAR bEthCSSupport);
|
||||
|
||||
int PHSReceive(struct bcm_mini_adapter *Adapter,
|
||||
USHORT usVcid,
|
||||
struct sk_buff *packet,
|
||||
UINT *punPacketLen,
|
||||
UCHAR *pucEthernetHdr,
|
||||
UINT
|
||||
);
|
||||
|
||||
|
||||
void DumpDataPacketHeader(PUCHAR pPkt);
|
||||
|
||||
void DumpFullPacket(UCHAR *pBuf, UINT nPktLen);
|
||||
|
||||
void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension);
|
||||
|
||||
|
||||
int phs_init(struct bcm_phs_extension *pPhsdeviceExtension,
|
||||
struct bcm_mini_adapter *Adapter);
|
||||
|
||||
int PhsCleanup(struct bcm_phs_extension *pPHSDeviceExt);
|
||||
|
||||
/* Utility Functions */
|
||||
ULONG PhsUpdateClassifierRule(void *pvContext,
|
||||
B_UINT16 uiVcid,
|
||||
B_UINT16 uiClsId,
|
||||
struct bcm_phs_rule *psPhsRule,
|
||||
B_UINT8 u8AssociatedPHSI);
|
||||
|
||||
ULONG PhsDeletePHSRule(void *pvContext, B_UINT16 uiVcid, B_UINT8 u8PHSI);
|
||||
|
||||
ULONG PhsDeleteClassifierRule(void *pvContext,
|
||||
B_UINT16 uiVcid,
|
||||
B_UINT16 uiClsId);
|
||||
|
||||
ULONG PhsDeleteSFRules(void *pvContext, B_UINT16 uiVcid);
|
||||
|
||||
|
||||
bool ValidatePHSRule(struct bcm_phs_rule *psPhsRule);
|
||||
|
||||
UINT GetServiceFlowEntry(struct bcm_phs_table *psServiceFlowTable,
|
||||
B_UINT16 uiVcid,
|
||||
struct bcm_phs_entry **ppstServiceFlowEntry);
|
||||
|
||||
|
||||
void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension);
|
||||
|
||||
|
||||
#endif
|
|
@ -1,128 +0,0 @@
|
|||
/************************************
|
||||
* Protocol.h
|
||||
*************************************/
|
||||
#ifndef __PROTOCOL_H__
|
||||
#define __PROTOCOL_H__
|
||||
|
||||
#define IPV4 4
|
||||
#define IPV6 6
|
||||
|
||||
struct ArpHeader {
|
||||
struct arphdr arp;
|
||||
unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */
|
||||
unsigned char ar_sip[4]; /* sender IP address */
|
||||
unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
|
||||
unsigned char ar_tip[4]; /* target IP address */
|
||||
};
|
||||
|
||||
struct bcm_transport_header {
|
||||
union {
|
||||
struct udphdr uhdr;
|
||||
struct tcphdr thdr;
|
||||
};
|
||||
} __packed;
|
||||
|
||||
enum bcm_ip_frame_type {
|
||||
eNonIPPacket,
|
||||
eIPv4Packet,
|
||||
eIPv6Packet
|
||||
};
|
||||
|
||||
enum bcm_eth_frame_type {
|
||||
eEthUnsupportedFrame,
|
||||
eEth802LLCFrame,
|
||||
eEth802LLCSNAPFrame,
|
||||
eEth802QVLANFrame,
|
||||
eEthOtherFrame
|
||||
};
|
||||
|
||||
struct bcm_eth_packet_info {
|
||||
enum bcm_ip_frame_type eNwpktIPFrameType;
|
||||
enum bcm_eth_frame_type eNwpktEthFrameType;
|
||||
unsigned short usEtherType;
|
||||
unsigned char ucDSAP;
|
||||
};
|
||||
|
||||
struct bcm_eth_q_frame {
|
||||
struct bcm_eth_header EThHdr;
|
||||
unsigned short UserPriority:3;
|
||||
unsigned short CFI:1;
|
||||
unsigned short VLANID:12;
|
||||
unsigned short EthType;
|
||||
} __packed;
|
||||
|
||||
struct bcm_eth_llc_frame {
|
||||
struct bcm_eth_header EThHdr;
|
||||
unsigned char DSAP;
|
||||
unsigned char SSAP;
|
||||
unsigned char Control;
|
||||
} __packed;
|
||||
|
||||
struct bcm_eth_llc_snap_frame {
|
||||
struct bcm_eth_header EThHdr;
|
||||
unsigned char DSAP;
|
||||
unsigned char SSAP;
|
||||
unsigned char Control;
|
||||
unsigned char OUI[3];
|
||||
unsigned short usEtherType;
|
||||
} __packed;
|
||||
|
||||
struct bcm_ethernet2_frame {
|
||||
struct bcm_eth_header EThHdr;
|
||||
} __packed;
|
||||
|
||||
#define ETHERNET_FRAMETYPE_IPV4 ntohs(0x0800)
|
||||
#define ETHERNET_FRAMETYPE_IPV6 ntohs(0x86dd)
|
||||
#define ETHERNET_FRAMETYPE_802QVLAN ntohs(0x8100)
|
||||
|
||||
/* Per SF CS Specification Encodings */
|
||||
enum bcm_spec_encoding {
|
||||
eCSSpecUnspecified = 0,
|
||||
eCSPacketIPV4,
|
||||
eCSPacketIPV6,
|
||||
eCS802_3PacketEthernet,
|
||||
eCS802_1QPacketVLAN,
|
||||
eCSPacketIPV4Over802_3Ethernet,
|
||||
eCSPacketIPV6Over802_3Ethernet,
|
||||
eCSPacketIPV4Over802_1QVLAN,
|
||||
eCSPacketIPV6Over802_1QVLAN,
|
||||
eCSPacketUnsupported
|
||||
};
|
||||
|
||||
#define IP6_HEADER_LEN 40
|
||||
#define IP_VERSION(byte) (((byte&0xF0)>>4))
|
||||
|
||||
#define MAC_ADDRESS_SIZE 6
|
||||
#define ETH_AND_IP_HEADER_LEN (14 + 20)
|
||||
#define L4_SRC_PORT_LEN 2
|
||||
#define L4_DEST_PORT_LEN 2
|
||||
#define CTRL_PKT_LEN (8 + ETH_AND_IP_HEADER_LEN)
|
||||
|
||||
#define ETH_ARP_FRAME 0x806
|
||||
#define ETH_IPV4_FRAME 0x800
|
||||
#define ETH_IPV6_FRAME 0x86DD
|
||||
#define UDP 0x11
|
||||
#define TCP 0x06
|
||||
|
||||
#define ARP_OP_REQUEST 0x01
|
||||
#define ARP_OP_REPLY 0x02
|
||||
#define ARP_PKT_SIZE 60
|
||||
|
||||
/* This is the format for the TCP packet header */
|
||||
struct bcm_tcp_header {
|
||||
unsigned short usSrcPort;
|
||||
unsigned short usDestPort;
|
||||
unsigned long ulSeqNumber;
|
||||
unsigned long ulAckNumber;
|
||||
unsigned char HeaderLength;
|
||||
unsigned char ucFlags;
|
||||
unsigned short usWindowsSize;
|
||||
unsigned short usChkSum;
|
||||
unsigned short usUrgetPtr;
|
||||
};
|
||||
|
||||
#define TCP_HEADER_LEN sizeof(struct bcm_tcp_header)
|
||||
#define TCP_ACK 0x10 /* Bit 4 in tcpflags field. */
|
||||
#define GET_TCP_HEADER_LEN(byte) ((byte&0xF0)>>4)
|
||||
|
||||
#endif /* __PROTOCOL_H__ */
|
|
@ -1,217 +0,0 @@
|
|||
#ifndef _PROTOTYPES_H_
|
||||
#define _PROTOTYPES_H_
|
||||
|
||||
VOID LinkControlResponseMessage(struct bcm_mini_adapter *Adapter, PUCHAR pucBuffer);
|
||||
|
||||
VOID StatisticsResponse(struct bcm_mini_adapter *Adapter, PVOID pvBuffer);
|
||||
|
||||
VOID IdleModeResponse(struct bcm_mini_adapter *Adapter, PUINT puiBuffer);
|
||||
|
||||
int control_packet_handler(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
VOID DeleteAllClassifiersForSF(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIndex);
|
||||
|
||||
VOID flush_all_queues(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
int register_control_device_interface(struct bcm_mini_adapter *ps_adapter);
|
||||
|
||||
void unregister_control_device_interface(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
INT CopyBufferToControlPacket(struct bcm_mini_adapter *Adapter,/**<Logical Adapter*/
|
||||
PVOID ioBuffer/**<Control Packet Buffer*/
|
||||
);
|
||||
|
||||
VOID SortPackInfo(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
VOID SortClassifiers(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
VOID flush_all_queues(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
VOID PruneQueueAllSF(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
INT SearchSfid(struct bcm_mini_adapter *Adapter, UINT uiSfid);
|
||||
|
||||
USHORT ClassifyPacket(struct bcm_mini_adapter *Adapter, struct sk_buff *skb);
|
||||
|
||||
bool MatchSrcPort(struct bcm_classifier_rule *pstClassifierRule, USHORT ushSrcPort);
|
||||
|
||||
bool MatchDestPort(struct bcm_classifier_rule *pstClassifierRule, USHORT ushSrcPort);
|
||||
|
||||
bool MatchProtocol(struct bcm_classifier_rule *pstClassifierRule, UCHAR ucProtocol);
|
||||
|
||||
INT SetupNextSend(struct bcm_mini_adapter *Adapter, /**<Logical Adapter*/
|
||||
struct sk_buff *Packet, /**<data buffer*/
|
||||
USHORT Vcid);
|
||||
|
||||
VOID LinkMessage(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
VOID transmit_packets(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
INT SendControlPacket(struct bcm_mini_adapter *Adapter, /**<Logical Adapter*/
|
||||
char *pControlPacket/**<Control Packet*/
|
||||
);
|
||||
|
||||
int register_networkdev(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
void unregister_networkdev(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
INT AllocAdapterDsxBuffer(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
VOID AdapterFree(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
INT FreeAdapterDsxBuffer(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
int tx_pkt_handler(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
int reset_card_proc(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
int run_card_proc(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
int InitCardAndDownloadFirmware(struct bcm_mini_adapter *ps_adapter);
|
||||
|
||||
INT ReadMacAddressFromNVM(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
int register_control_device_interface(struct bcm_mini_adapter *ps_adapter);
|
||||
|
||||
void DumpPackInfo(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
int rdm(struct bcm_mini_adapter *Adapter, UINT uiAddress, PCHAR pucBuff, size_t size);
|
||||
|
||||
int wrm(struct bcm_mini_adapter *Adapter, UINT uiAddress, PCHAR pucBuff, size_t size);
|
||||
|
||||
int wrmalt(struct bcm_mini_adapter *Adapter, UINT uiAddress, unsigned int *pucBuff, size_t sSize);
|
||||
|
||||
int rdmalt(struct bcm_mini_adapter *Adapter, UINT uiAddress, unsigned int *pucBuff, size_t sSize);
|
||||
|
||||
int get_dsx_sf_data_to_application(struct bcm_mini_adapter *Adapter, UINT uiSFId, void __user *user_buffer);
|
||||
|
||||
void SendIdleModeResponse(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
int ProcessGetHostMibs(struct bcm_mini_adapter *Adapter, struct bcm_host_stats_mibs *buf);
|
||||
|
||||
void GetDroppedAppCntrlPktMibs(struct bcm_host_stats_mibs *ioBuffer, struct bcm_tarang_data *pTarang);
|
||||
|
||||
void beceem_parse_target_struct(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
int bcm_ioctl_fw_download(struct bcm_mini_adapter *Adapter, struct bcm_firmware_info *psFwInfo);
|
||||
|
||||
void CopyMIBSExtendedSFParameters(struct bcm_mini_adapter *Adapter,
|
||||
struct bcm_connect_mgr_params *psfLocalSet, UINT uiSearchRuleIndex);
|
||||
|
||||
VOID ResetCounters(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
int InitLedSettings(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
struct bcm_classifier_rule *GetFragIPClsEntry(struct bcm_mini_adapter *Adapter, USHORT usIpIdentification, ULONG SrcIP);
|
||||
|
||||
void AddFragIPClsEntry(struct bcm_mini_adapter *Adapter, struct bcm_fragmented_packet_info *psFragPktInfo);
|
||||
|
||||
void DelFragIPClsEntry(struct bcm_mini_adapter *Adapter, USHORT usIpIdentification, ULONG SrcIp);
|
||||
|
||||
void update_per_cid_rx(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
void update_per_sf_desc_cnts(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
void ClearTargetDSXBuffer(struct bcm_mini_adapter *Adapter, B_UINT16 TID, bool bFreeAll);
|
||||
|
||||
void flush_queue(struct bcm_mini_adapter *Adapter, UINT iQIndex);
|
||||
|
||||
INT flushAllAppQ(VOID);
|
||||
|
||||
INT BeceemEEPROMBulkRead(
|
||||
struct bcm_mini_adapter *Adapter,
|
||||
PUINT pBuffer,
|
||||
UINT uiOffset,
|
||||
UINT uiNumBytes);
|
||||
|
||||
INT WriteBeceemEEPROM(struct bcm_mini_adapter *Adapter, UINT uiEEPROMOffset, UINT uiData);
|
||||
|
||||
INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
INT BeceemEEPROMBulkWrite(
|
||||
struct bcm_mini_adapter *Adapter,
|
||||
PUCHAR pBuffer,
|
||||
UINT uiOffset,
|
||||
UINT uiNumBytes,
|
||||
bool bVerify);
|
||||
|
||||
INT ReadBeceemEEPROM(struct bcm_mini_adapter *Adapter, UINT dwAddress, UINT *pdwData);
|
||||
|
||||
INT BeceemNVMRead(
|
||||
struct bcm_mini_adapter *Adapter,
|
||||
PUINT pBuffer,
|
||||
UINT uiOffset,
|
||||
UINT uiNumBytes);
|
||||
|
||||
INT BeceemNVMWrite(
|
||||
struct bcm_mini_adapter *Adapter,
|
||||
PUINT pBuffer,
|
||||
UINT uiOffset,
|
||||
UINT uiNumBytes,
|
||||
bool bVerify);
|
||||
|
||||
INT BcmInitNVM(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
INT BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter, UINT uiSectorSize);
|
||||
|
||||
bool IsSectionExistInFlash(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_section_val section);
|
||||
|
||||
INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, struct bcm_flash2x_bitmap *psFlash2xBitMap);
|
||||
|
||||
INT BcmFlash2xBulkWrite(
|
||||
struct bcm_mini_adapter *Adapter,
|
||||
PUINT pBuffer,
|
||||
enum bcm_flash2x_section_val eFlashSectionVal,
|
||||
UINT uiOffset,
|
||||
UINT uiNumBytes,
|
||||
UINT bVerify);
|
||||
|
||||
INT BcmFlash2xBulkRead(
|
||||
struct bcm_mini_adapter *Adapter,
|
||||
PUINT pBuffer,
|
||||
enum bcm_flash2x_section_val eFlashSectionVal,
|
||||
UINT uiOffsetWithinSectionVal,
|
||||
UINT uiNumBytes);
|
||||
|
||||
INT BcmGetSectionValStartOffset(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_section_val eFlashSectionVal);
|
||||
|
||||
INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_section_val eFlash2xSectVal);
|
||||
|
||||
INT BcmAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter);
|
||||
|
||||
INT BcmDeAllocFlashCSStructure(struct bcm_mini_adapter *psAdapter);
|
||||
|
||||
INT BcmCopyISO(struct bcm_mini_adapter *Adapter, struct bcm_flash2x_copy_section sCopySectStrut);
|
||||
|
||||
INT BcmFlash2xCorruptSig(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_section_val eFlash2xSectionVal);
|
||||
|
||||
INT BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, enum bcm_flash2x_section_val eFlashSectionVal);
|
||||
|
||||
INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, struct bcm_flash2x_readwrite *psFlash2xReadWrite);
|
||||
|
||||
INT IsFlash2x(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
INT BcmCopySection(struct bcm_mini_adapter *Adapter,
|
||||
enum bcm_flash2x_section_val SrcSection,
|
||||
enum bcm_flash2x_section_val DstSection,
|
||||
UINT offset,
|
||||
UINT numOfBytes);
|
||||
|
||||
bool IsNonCDLessDevice(struct bcm_mini_adapter *Adapter);
|
||||
|
||||
VOID OverrideServiceFlowParams(struct bcm_mini_adapter *Adapter, PUINT puiBuffer);
|
||||
|
||||
int wrmaltWithLock(struct bcm_mini_adapter *Adapter, UINT uiAddress, unsigned int *pucBuff, size_t sSize);
|
||||
|
||||
int rdmaltWithLock(struct bcm_mini_adapter *Adapter, UINT uiAddress, unsigned int *pucBuff, size_t sSize);
|
||||
|
||||
int wrmWithLock(struct bcm_mini_adapter *Adapter, UINT uiAddress, PCHAR pucBuff, size_t size);
|
||||
|
||||
INT buffDnldVerify(struct bcm_mini_adapter *Adapter, unsigned char *mappedbuffer, unsigned int u32FirmwareLength,
|
||||
unsigned long u32StartingAddress);
|
||||
|
||||
VOID putUsbSuspend(struct work_struct *work);
|
||||
|
||||
bool IsReqGpioIsLedInNVM(struct bcm_mini_adapter *Adapter, UINT gpios);
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,29 +0,0 @@
|
|||
/*************************************
|
||||
* Queue.h
|
||||
**************************************/
|
||||
#ifndef __QUEUE_H__
|
||||
#define __QUEUE_H__
|
||||
|
||||
|
||||
|
||||
#define ENQUEUEPACKET(_Head, _Tail, _Packet) \
|
||||
do { \
|
||||
if (!_Head) { \
|
||||
_Head = _Packet; \
|
||||
} \
|
||||
else { \
|
||||
(_Tail)->next = _Packet; \
|
||||
} \
|
||||
(_Packet)->next = NULL; \
|
||||
_Tail = _Packet; \
|
||||
} while (0)
|
||||
#define DEQUEUEPACKET(Head, Tail) \
|
||||
do { \
|
||||
if (Head) { \
|
||||
if (!Head->next) { \
|
||||
Tail = NULL; \
|
||||
} \
|
||||
Head = Head->next; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif /* __QUEUE_H__ */
|
|
@ -1,26 +0,0 @@
|
|||
This driver is barely functional in its current state.
|
||||
|
||||
Kevin McKinney(klmckinney1@gmail.com) and Matthias Beyer(mail@beyermatthias.de)
|
||||
are currently maintaining/cleaning up this driver. Please copy us on all
|
||||
patches. More maintainers are aways welcomed.
|
||||
|
||||
BIG:
|
||||
- existing API is (/dev/tarang) should be replaced
|
||||
Is it possible to use same API as Intel Wimax stack and
|
||||
have same user level components.
|
||||
- Qos and queue model is non-standard and inflexible.
|
||||
Use existing TC Qos?
|
||||
|
||||
TODO:
|
||||
- support more than one board - eliminate global variables
|
||||
- remove developer debug BCM_DEBUG() macros
|
||||
add a limited number of messages through netif_msg()
|
||||
- fix non-standard kernel style
|
||||
- checkpatch warnings
|
||||
- use request firmware
|
||||
- fix use of file I/O to load config with better API
|
||||
- merge some files together?
|
||||
- cleanup/eliminate debug messages
|
||||
|
||||
|
||||
|
|
@ -1,271 +0,0 @@
|
|||
/**
|
||||
* @file Transmit.c
|
||||
* @defgroup tx_functions Transmission
|
||||
* @section Queueing
|
||||
* @dot
|
||||
* digraph transmit1 {
|
||||
* node[shape=box]
|
||||
* edge[weight=5;color=red]
|
||||
*
|
||||
* bcm_transmit->GetPacketQueueIndex[label="IP Packet"]
|
||||
* GetPacketQueueIndex->IpVersion4[label="IPV4"]
|
||||
* GetPacketQueueIndex->IpVersion6[label="IPV6"]
|
||||
* }
|
||||
*
|
||||
* @enddot
|
||||
*
|
||||
* @section De-Queueing
|
||||
* @dot
|
||||
* digraph transmit2 {
|
||||
* node[shape=box]
|
||||
* edge[weight=5;color=red]
|
||||
* interrupt_service_thread->transmit_packets
|
||||
* tx_pkt_hdler->transmit_packets
|
||||
* transmit_packets->CheckAndSendPacketFromIndex
|
||||
* transmit_packets->UpdateTokenCount
|
||||
* CheckAndSendPacketFromIndex->PruneQueue
|
||||
* CheckAndSendPacketFromIndex->IsPacketAllowedForFlow
|
||||
* CheckAndSendPacketFromIndex->SendControlPacket[label="control pkt"]
|
||||
* SendControlPacket->bcm_cmd53
|
||||
* CheckAndSendPacketFromIndex->SendPacketFromQueue[label="data pkt"]
|
||||
* SendPacketFromQueue->SetupNextSend->bcm_cmd53
|
||||
* }
|
||||
* @enddot
|
||||
*/
|
||||
|
||||
#include "headers.h"
|
||||
|
||||
/**
|
||||
* @ingroup ctrl_pkt_functions
|
||||
* This function dispatches control packet to the h/w interface
|
||||
* @return zero(success) or -ve value(failure)
|
||||
*/
|
||||
int SendControlPacket(struct bcm_mini_adapter *Adapter, char *pControlPacket)
|
||||
{
|
||||
struct bcm_leader *PLeader = (struct bcm_leader *)pControlPacket;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Tx");
|
||||
if (!pControlPacket || !Adapter) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL,
|
||||
"Got NULL Control Packet or Adapter");
|
||||
return STATUS_FAILURE;
|
||||
}
|
||||
if ((atomic_read(&Adapter->CurrNumFreeTxDesc) <
|
||||
((PLeader->PLength-1)/MAX_DEVICE_DESC_SIZE)+1)) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL,
|
||||
"NO FREE DESCRIPTORS TO SEND CONTROL PACKET");
|
||||
return STATUS_FAILURE;
|
||||
}
|
||||
|
||||
/* Update the netdevice statistics */
|
||||
/* Dump Packet */
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL,
|
||||
"Leader Status: %x", PLeader->Status);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL,
|
||||
"Leader VCID: %x", PLeader->Vcid);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL,
|
||||
"Leader Length: %x", PLeader->PLength);
|
||||
if (Adapter->device_removed)
|
||||
return 0;
|
||||
|
||||
if (netif_msg_pktdata(Adapter))
|
||||
print_hex_dump(KERN_DEBUG, PFX "tx control: ", DUMP_PREFIX_NONE,
|
||||
16, 1, pControlPacket,
|
||||
PLeader->PLength + LEADER_SIZE, 0);
|
||||
|
||||
Adapter->interface_transmit(Adapter->pvInterfaceAdapter,
|
||||
pControlPacket,
|
||||
(PLeader->PLength + LEADER_SIZE));
|
||||
|
||||
atomic_dec(&Adapter->CurrNumFreeTxDesc);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL,
|
||||
"<=========");
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup tx_functions
|
||||
* This function despatches the IP packets with the given vcid
|
||||
* to the target via the host h/w interface.
|
||||
* @return zero(success) or -ve value(failure)
|
||||
*/
|
||||
int SetupNextSend(struct bcm_mini_adapter *Adapter,
|
||||
struct sk_buff *Packet, USHORT Vcid)
|
||||
{
|
||||
int status = 0;
|
||||
bool bHeaderSupressionEnabled = false;
|
||||
B_UINT16 uiClassifierRuleID;
|
||||
u16 QueueIndex = skb_get_queue_mapping(Packet);
|
||||
struct bcm_packet_info *curr_packet_info =
|
||||
&Adapter->PackInfo[QueueIndex];
|
||||
struct bcm_leader Leader = {0};
|
||||
|
||||
if (Packet->len > MAX_DEVICE_DESC_SIZE) {
|
||||
status = STATUS_FAILURE;
|
||||
goto errExit;
|
||||
}
|
||||
|
||||
/* Get the Classifier Rule ID */
|
||||
uiClassifierRuleID = *((UINT32 *) (Packet->cb) +
|
||||
SKB_CB_CLASSIFICATION_OFFSET);
|
||||
|
||||
bHeaderSupressionEnabled = curr_packet_info->bHeaderSuppressionEnabled &
|
||||
Adapter->bPHSEnabled;
|
||||
|
||||
if (Adapter->device_removed) {
|
||||
status = STATUS_FAILURE;
|
||||
goto errExit;
|
||||
}
|
||||
|
||||
status = PHSTransmit(Adapter, &Packet, Vcid, uiClassifierRuleID,
|
||||
bHeaderSupressionEnabled,
|
||||
(UINT *)&Packet->len,
|
||||
curr_packet_info->bEthCSSupport);
|
||||
|
||||
if (status != STATUS_SUCCESS) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL,
|
||||
"PHS Transmit failed..\n");
|
||||
goto errExit;
|
||||
}
|
||||
|
||||
Leader.Vcid = Vcid;
|
||||
|
||||
if (TCP_ACK == *((UINT32 *) (Packet->cb) + SKB_CB_TCPACK_OFFSET))
|
||||
Leader.Status = LEADER_STATUS_TCP_ACK;
|
||||
else
|
||||
Leader.Status = LEADER_STATUS;
|
||||
|
||||
if (curr_packet_info->bEthCSSupport) {
|
||||
Leader.PLength = Packet->len;
|
||||
if (skb_headroom(Packet) < LEADER_SIZE) {
|
||||
status = skb_cow(Packet, LEADER_SIZE);
|
||||
if (status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND,
|
||||
DBG_LVL_ALL,
|
||||
"bcm_transmit : Failed To Increase headRoom\n");
|
||||
goto errExit;
|
||||
}
|
||||
}
|
||||
skb_push(Packet, LEADER_SIZE);
|
||||
memcpy(Packet->data, &Leader, LEADER_SIZE);
|
||||
} else {
|
||||
Leader.PLength = Packet->len - ETH_HLEN;
|
||||
memcpy((struct bcm_leader *)skb_pull(Packet,
|
||||
(ETH_HLEN - LEADER_SIZE)),
|
||||
&Leader,
|
||||
LEADER_SIZE);
|
||||
}
|
||||
|
||||
status = Adapter->interface_transmit(Adapter->pvInterfaceAdapter,
|
||||
Packet->data,
|
||||
(Leader.PLength + LEADER_SIZE));
|
||||
if (status) {
|
||||
++Adapter->dev->stats.tx_errors;
|
||||
if (netif_msg_tx_err(Adapter))
|
||||
pr_info(PFX "%s: transmit error %d\n",
|
||||
Adapter->dev->name,
|
||||
status);
|
||||
} else {
|
||||
struct net_device_stats *netstats = &Adapter->dev->stats;
|
||||
|
||||
curr_packet_info->uiTotalTxBytes += Leader.PLength;
|
||||
|
||||
netstats->tx_bytes += Leader.PLength;
|
||||
++netstats->tx_packets;
|
||||
|
||||
curr_packet_info->uiCurrentTokenCount -= Leader.PLength << 3;
|
||||
curr_packet_info->uiSentBytes += (Packet->len);
|
||||
curr_packet_info->uiSentPackets++;
|
||||
curr_packet_info->NumOfPacketsSent++;
|
||||
|
||||
atomic_dec(&curr_packet_info->uiPerSFTxResourceCount);
|
||||
curr_packet_info->uiThisPeriodSentBytes += Leader.PLength;
|
||||
}
|
||||
|
||||
atomic_dec(&Adapter->CurrNumFreeTxDesc);
|
||||
|
||||
errExit:
|
||||
dev_kfree_skb(Packet);
|
||||
return status;
|
||||
}
|
||||
|
||||
static int tx_pending(struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
return (atomic_read(&Adapter->TxPktAvail)
|
||||
&& MINIMUM_PENDING_DESCRIPTORS <
|
||||
atomic_read(&Adapter->CurrNumFreeTxDesc))
|
||||
|| Adapter->device_removed || (1 == Adapter->downloadDDR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup tx_functions
|
||||
* Transmit thread
|
||||
*/
|
||||
int tx_pkt_handler(struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
while (!kthread_should_stop()) {
|
||||
/* FIXME - the timeout looks like workaround
|
||||
* for racey usage of TxPktAvail
|
||||
*/
|
||||
if (Adapter->LinkUpStatus)
|
||||
wait_event_timeout(Adapter->tx_packet_wait_queue,
|
||||
tx_pending(Adapter),
|
||||
msecs_to_jiffies(10));
|
||||
else
|
||||
wait_event_interruptible(Adapter->tx_packet_wait_queue,
|
||||
tx_pending(Adapter));
|
||||
|
||||
if (Adapter->device_removed)
|
||||
break;
|
||||
|
||||
if (Adapter->downloadDDR == 1) {
|
||||
Adapter->downloadDDR += 1;
|
||||
status = download_ddr_settings(Adapter);
|
||||
if (status)
|
||||
pr_err(PFX "DDR DOWNLOAD FAILED! %d\n", status);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Check end point for halt/stall. */
|
||||
if (Adapter->bEndPointHalted == TRUE) {
|
||||
Bcm_clear_halt_of_endpoints(Adapter);
|
||||
Adapter->bEndPointHalted = false;
|
||||
StartInterruptUrb((struct bcm_interface_adapter *)
|
||||
(Adapter->pvInterfaceAdapter));
|
||||
}
|
||||
|
||||
if (Adapter->LinkUpStatus && !Adapter->IdleMode) {
|
||||
if (atomic_read(&Adapter->TotalPacketCount))
|
||||
update_per_sf_desc_cnts(Adapter);
|
||||
}
|
||||
|
||||
if (atomic_read(&Adapter->CurrNumFreeTxDesc) &&
|
||||
Adapter->LinkStatus == SYNC_UP_REQUEST &&
|
||||
!Adapter->bSyncUpRequestSent) {
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS,
|
||||
DBG_LVL_ALL, "Calling LinkMessage");
|
||||
LinkMessage(Adapter);
|
||||
}
|
||||
|
||||
if ((Adapter->IdleMode || Adapter->bShutStatus) &&
|
||||
atomic_read(&Adapter->TotalPacketCount)) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX,
|
||||
TX_PACKETS, DBG_LVL_ALL,
|
||||
"Device in Low Power mode...waking up");
|
||||
Adapter->usIdleModePattern = ABORT_IDLE_MODE;
|
||||
Adapter->bWakeUpDevice = TRUE;
|
||||
wake_up(&Adapter->process_rx_cntrlpkt);
|
||||
}
|
||||
|
||||
transmit_packets(Adapter);
|
||||
atomic_set(&Adapter->TxPktAvail, 0);
|
||||
}
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL,
|
||||
"Exiting the tx thread..\n");
|
||||
Adapter->transmit_packet_thread = NULL;
|
||||
return 0;
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/****************************
|
||||
* Typedefs.h
|
||||
****************************/
|
||||
#ifndef __TYPEDEFS_H__
|
||||
#define __TYPEDEFS_H__
|
||||
#define STATUS_SUCCESS 0
|
||||
#define STATUS_FAILURE -1
|
||||
|
||||
|
||||
#define TRUE 1
|
||||
|
||||
|
||||
typedef char CHAR;
|
||||
typedef int INT;
|
||||
typedef short SHORT;
|
||||
typedef long LONG;
|
||||
typedef void VOID;
|
||||
|
||||
typedef unsigned char UCHAR;
|
||||
typedef unsigned char B_UINT8;
|
||||
typedef unsigned short USHORT;
|
||||
typedef unsigned short B_UINT16;
|
||||
typedef unsigned int UINT;
|
||||
typedef unsigned int B_UINT32;
|
||||
typedef unsigned long ULONG;
|
||||
typedef unsigned long DWORD;
|
||||
|
||||
typedef char *PCHAR;
|
||||
typedef short *PSHORT;
|
||||
typedef int *PINT;
|
||||
typedef long *PLONG;
|
||||
typedef void *PVOID;
|
||||
|
||||
typedef unsigned char *PUCHAR;
|
||||
typedef unsigned short *PUSHORT;
|
||||
typedef unsigned int *PUINT;
|
||||
typedef unsigned long *PULONG;
|
||||
typedef unsigned long long ULONG64;
|
||||
typedef unsigned long long LARGE_INTEGER;
|
||||
typedef unsigned int UINT32;
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __TYPEDEFS_H__ */
|
||||
|
|
@ -1,311 +0,0 @@
|
|||
#ifndef CNTRL_SIGNALING_INTERFACE_
|
||||
#define CNTRL_SIGNALING_INTERFACE_
|
||||
|
||||
#define DSA_REQ 11
|
||||
#define DSA_RSP 12
|
||||
#define DSA_ACK 13
|
||||
#define DSC_REQ 14
|
||||
#define DSC_RSP 15
|
||||
#define DSC_ACK 16
|
||||
#define DSD_REQ 17
|
||||
#define DSD_RSP 18
|
||||
#define DSD_ACK 19
|
||||
#define MAX_CLASSIFIERS_IN_SF 4
|
||||
|
||||
#define MAX_STRING_LEN 20
|
||||
#define MAX_PHS_LENGTHS 255
|
||||
#define VENDOR_PHS_PARAM_LENGTH 10
|
||||
#define MAX_NUM_ACTIVE_BS 10
|
||||
#define AUTH_TOKEN_LENGTH 10
|
||||
#define NUM_HARQ_CHANNELS 16 /* Changed from 10 to 16 to accommodate all HARQ channels */
|
||||
#define VENDOR_CLASSIFIER_PARAM_LENGTH 1 /* Changed the size to 1 byte since we dnt use it */
|
||||
#define VENDOR_SPECIF_QOS_PARAM 1
|
||||
#define VENDOR_PHS_PARAM_LENGTH 10
|
||||
#define MBS_CONTENTS_ID_LENGTH 10
|
||||
#define GLOBAL_SF_CLASSNAME_LENGTH 6
|
||||
|
||||
#define TYPE_OF_SERVICE_LENGTH 3
|
||||
#define IP_MASKED_SRC_ADDRESS_LENGTH 32
|
||||
#define IP_MASKED_DEST_ADDRESS_LENGTH 32
|
||||
#define PROTOCOL_SRC_PORT_RANGE_LENGTH 4
|
||||
#define PROTOCOL_DEST_PORT_RANGE_LENGTH 4
|
||||
#define ETHERNET_DEST_MAC_ADDR_LENGTH 12
|
||||
#define ETHERNET_SRC_MAC_ADDR_LENGTH 12
|
||||
#define NUM_ETHERTYPE_BYTES 3
|
||||
#define NUM_IPV6_FLOWLABLE_BYTES 3
|
||||
|
||||
struct bcm_packet_class_rules {
|
||||
/* 16bit UserPriority Of The Service Flow */
|
||||
u16 u16UserPriority;
|
||||
/* 16bit VLANID Of The Service Flow */
|
||||
u16 u16VLANID;
|
||||
/* 16bit Packet Classification RuleIndex Of The Service Flow */
|
||||
u16 u16PacketClassificationRuleIndex;
|
||||
/* 8bit Classifier Rule Priority Of The Service Flow */
|
||||
u8 u8ClassifierRulePriority;
|
||||
/* Length of IP TypeOfService field */
|
||||
u8 u8IPTypeOfServiceLength;
|
||||
/* 3bytes IP TypeOfService */
|
||||
u8 u8IPTypeOfService[TYPE_OF_SERVICE_LENGTH];
|
||||
/* Protocol used in classification of Service Flow */
|
||||
u8 u8Protocol;
|
||||
/* Length of IP Masked Source Address */
|
||||
u8 u8IPMaskedSourceAddressLength;
|
||||
/* IP Masked Source Address used in classification for the Service Flow */
|
||||
u8 u8IPMaskedSourceAddress[IP_MASKED_SRC_ADDRESS_LENGTH];
|
||||
/* Length of IP Destination Address */
|
||||
u8 u8IPDestinationAddressLength;
|
||||
/* IP Destination Address used in classification for the Service Flow */
|
||||
u8 u8IPDestinationAddress[IP_MASKED_DEST_ADDRESS_LENGTH];
|
||||
/* Length of Protocol Source Port Range */
|
||||
u8 u8ProtocolSourcePortRangeLength;
|
||||
/* Protocol Source Port Range used in the Service Flow */
|
||||
u8 u8ProtocolSourcePortRange[PROTOCOL_SRC_PORT_RANGE_LENGTH];
|
||||
/* Length of Protocol Dest Port Range */
|
||||
u8 u8ProtocolDestPortRangeLength;
|
||||
/* Protocol Dest Port Range used in the Service Flow */
|
||||
u8 u8ProtocolDestPortRange[PROTOCOL_DEST_PORT_RANGE_LENGTH];
|
||||
/* Length of Ethernet Destination MAC Address */
|
||||
u8 u8EthernetDestMacAddressLength;
|
||||
/* Ethernet Destination MAC Address used in classification of the Service Flow */
|
||||
u8 u8EthernetDestMacAddress[ETHERNET_DEST_MAC_ADDR_LENGTH];
|
||||
/* Length of Ethernet Source MAC Address */
|
||||
u8 u8EthernetSourceMACAddressLength;
|
||||
/* Ethernet Source MAC Address used in classification of the Service Flow */
|
||||
u8 u8EthernetSourceMACAddress[ETHERNET_SRC_MAC_ADDR_LENGTH];
|
||||
/* Length of Ethertype */
|
||||
u8 u8EthertypeLength;
|
||||
/* 3bytes Ethertype Of The Service Flow */
|
||||
u8 u8Ethertype[NUM_ETHERTYPE_BYTES];
|
||||
/* 8bit Associated PHSI Of The Service Flow */
|
||||
u8 u8AssociatedPHSI;
|
||||
/* Length of Vendor Specific Classifier Param length Of The Service Flow */
|
||||
u8 u8VendorSpecificClassifierParamLength;
|
||||
/* Vendor Specific Classifier Param Of The Service Flow */
|
||||
u8 u8VendorSpecificClassifierParam[VENDOR_CLASSIFIER_PARAM_LENGTH];
|
||||
/* Length Of IPv6 Flow Lable of the Service Flow */
|
||||
u8 u8IPv6FlowLableLength;
|
||||
/* IPv6 Flow Lable Of The Service Flow */
|
||||
u8 u8IPv6FlowLable[NUM_IPV6_FLOWLABLE_BYTES];
|
||||
/* Action associated with the classifier rule */
|
||||
u8 u8ClassifierActionRule;
|
||||
u16 u16ValidityBitMap;
|
||||
};
|
||||
|
||||
struct bcm_phs_rules {
|
||||
/* 8bit PHS Index Of The Service Flow */
|
||||
u8 u8PHSI;
|
||||
/* PHSF Length Of The Service Flow */
|
||||
u8 u8PHSFLength;
|
||||
/* String of bytes containing header information to be suppressed by the sending CS and reconstructed by the receiving CS */
|
||||
u8 u8PHSF[MAX_PHS_LENGTHS];
|
||||
/* PHSM Length Of The Service Flow */
|
||||
u8 u8PHSMLength;
|
||||
/* PHS Mask for the SF */
|
||||
u8 u8PHSM[MAX_PHS_LENGTHS];
|
||||
/* 8bit Total number of bytes to be suppressed for the Service Flow */
|
||||
u8 u8PHSS;
|
||||
/* 8bit Indicates whether or not Packet Header contents need to be verified prior to suppression */
|
||||
u8 u8PHSV;
|
||||
/* Vendor Specific PHS param Length Of The Service Flow */
|
||||
u8 u8VendorSpecificPHSParamsLength;
|
||||
/* Vendor Specific PHS param Of The Service Flow */
|
||||
u8 u8VendorSpecificPHSParams[VENDOR_PHS_PARAM_LENGTH];
|
||||
u8 u8Padding[2];
|
||||
};
|
||||
|
||||
struct bcm_convergence_types {
|
||||
/* 8bit Phs Classfier Action Of The Service Flow */
|
||||
u8 u8ClassfierDSCAction;
|
||||
/* 8bit Phs DSC Action Of The Service Flow */
|
||||
u8 u8PhsDSCAction;
|
||||
/* 16bit Padding */
|
||||
u8 u8Padding[2];
|
||||
/* Packet classification rules structure */
|
||||
struct bcm_packet_class_rules cCPacketClassificationRule;
|
||||
/* Payload header suppression rules structure */
|
||||
struct bcm_phs_rules cPhsRule;
|
||||
};
|
||||
|
||||
struct bcm_connect_mgr_params {
|
||||
/* 32bitSFID Of The Service Flow */
|
||||
u32 u32SFID;
|
||||
/* 32bit Maximum Sustained Traffic Rate of the Service Flow */
|
||||
u32 u32MaxSustainedTrafficRate;
|
||||
/* 32bit Maximum Traffic Burst allowed for the Service Flow */
|
||||
u32 u32MaxTrafficBurst;
|
||||
/* 32bit Minimum Reserved Traffic Rate of the Service Flow */
|
||||
u32 u32MinReservedTrafficRate;
|
||||
/* 32bit Tolerated Jitter of the Service Flow */
|
||||
u32 u32ToleratedJitter;
|
||||
/* 32bit Maximum Latency of the Service Flow */
|
||||
u32 u32MaximumLatency;
|
||||
/* 16bitCID Of The Service Flow */
|
||||
u16 u16CID;
|
||||
/* 16bit SAID on which the service flow being set up shall be mapped */
|
||||
u16 u16TargetSAID;
|
||||
/* 16bit ARQ window size negotiated */
|
||||
u16 u16ARQWindowSize;
|
||||
/* 16bit Total Tx delay incl sending, receiving & processing delays */
|
||||
u16 u16ARQRetryTxTimeOut;
|
||||
/* 16bit Total Rx delay incl sending, receiving & processing delays */
|
||||
u16 u16ARQRetryRxTimeOut;
|
||||
/* 16bit ARQ block lifetime */
|
||||
u16 u16ARQBlockLifeTime;
|
||||
/* 16bit ARQ Sync loss timeout */
|
||||
u16 u16ARQSyncLossTimeOut;
|
||||
/* 16bit ARQ Purge timeout */
|
||||
u16 u16ARQRxPurgeTimeOut;
|
||||
/* TODO::Remove this once we move to a new CORR2 driver
|
||||
* brief Size of an ARQ block
|
||||
*/
|
||||
u16 u16ARQBlockSize;
|
||||
/* #endif */
|
||||
/* 16bit Nominal interval b/w consecutive SDU arrivals at MAC SAP */
|
||||
u16 u16SDUInterArrivalTime;
|
||||
/* 16bit Specifies the time base for rate measurement */
|
||||
u16 u16TimeBase;
|
||||
/* 16bit Interval b/w Successive Grant oppurtunities */
|
||||
u16 u16UnsolicitedGrantInterval;
|
||||
/* 16bit Interval b/w Successive Polling grant oppurtunities */
|
||||
u16 u16UnsolicitedPollingInterval;
|
||||
/* internal var to get the overhead */
|
||||
u16 u16MacOverhead;
|
||||
/* MBS contents Identifier */
|
||||
u16 u16MBSContentsID[MBS_CONTENTS_ID_LENGTH];
|
||||
/* MBS contents Identifier length */
|
||||
u8 u8MBSContentsIDLength;
|
||||
/* ServiceClassName Length Of The Service Flow */
|
||||
u8 u8ServiceClassNameLength;
|
||||
/* 32bytes ServiceClassName Of The Service Flow */
|
||||
u8 u8ServiceClassName[32];
|
||||
/* 8bit Indicates whether or not MBS service is requested for this Serivce Flow */
|
||||
u8 u8MBSService;
|
||||
/* 8bit QOS Parameter Set specifies proper application of QoS parameters to Provisioned, Admitted and Active sets */
|
||||
u8 u8QosParamSet;
|
||||
/* 8bit Traffic Priority Of the Service Flow */
|
||||
u8 u8TrafficPriority;
|
||||
/* 8bit Uplink Grant Scheduling Type of The Service Flow */
|
||||
u8 u8ServiceFlowSchedulingType;
|
||||
/* 8bit Request transmission Policy of the Service Flow */
|
||||
u8 u8RequesttransmissionPolicy;
|
||||
/* 8bit Specifies whether SDUs for this Service flow are of FixedLength or Variable length */
|
||||
u8 u8FixedLengthVSVariableLengthSDUIndicator;
|
||||
/* 8bit Length of the SDU for a fixed length SDU service flow */
|
||||
u8 u8SDUSize;
|
||||
/* 8bit Indicates whether or not ARQ is requested for this connection */
|
||||
u8 u8ARQEnable;
|
||||
/* < 8bit Indicates whether or not data has tobe delivered in order to higher layer */
|
||||
u8 u8ARQDeliverInOrder;
|
||||
/* 8bit Receiver ARQ ACK processing time */
|
||||
u8 u8RxARQAckProcessingTime;
|
||||
/* 8bit Convergence Sublayer Specification Of The Service Flow */
|
||||
u8 u8CSSpecification;
|
||||
/* 8 bit Type of data delivery service */
|
||||
u8 u8TypeOfDataDeliveryService;
|
||||
/* 8bit Specifies whether a service flow may generate Paging */
|
||||
u8 u8PagingPreference;
|
||||
/* 8bit Indicates the MBS Zone through which the connection or virtual connection is valid */
|
||||
u8 u8MBSZoneIdentifierassignment;
|
||||
/* 8bit Specifies whether traffic on SF should generate MOB_TRF_IND to MS in sleep mode */
|
||||
u8 u8TrafficIndicationPreference;
|
||||
/* 8bit Speciifes the length of predefined Global QoS parameter set encoding for this SF */
|
||||
u8 u8GlobalServicesClassNameLength;
|
||||
/* 6 byte Speciifes the predefined Global QoS parameter set encoding for this SF */
|
||||
u8 u8GlobalServicesClassName[GLOBAL_SF_CLASSNAME_LENGTH];
|
||||
/* 8bit Indicates whether or not SN feedback is enabled for the conn */
|
||||
u8 u8SNFeedbackEnabled;
|
||||
/* Indicates the size of the Fragment Sequence Number for the connection */
|
||||
u8 u8FSNSize;
|
||||
/* 8bit Number of CIDs in active BS list */
|
||||
u8 u8CIDAllocation4activeBSsLength;
|
||||
/* CIDs of BS in the active list */
|
||||
u8 u8CIDAllocation4activeBSs[MAX_NUM_ACTIVE_BS];
|
||||
/* Specifies if PDU extended subheader should be applied on every PDU on this conn */
|
||||
u8 u8PDUSNExtendedSubheader4HarqReordering;
|
||||
/* 8bit Specifies whether the connection uses HARQ or not */
|
||||
u8 u8HARQServiceFlows;
|
||||
/* Specifies the length of Authorization token */
|
||||
u8 u8AuthTokenLength;
|
||||
/* Specifies the Authorization token */
|
||||
u8 u8AuthToken[AUTH_TOKEN_LENGTH];
|
||||
/* specifes Number of HARQ channels used to carry data length */
|
||||
u8 u8HarqChannelMappingLength;
|
||||
/* specifes HARQ channels used to carry data */
|
||||
u8 u8HARQChannelMapping[NUM_HARQ_CHANNELS];
|
||||
/* 8bit Length of Vendor Specific QoS Params */
|
||||
u8 u8VendorSpecificQoSParamLength;
|
||||
/* 1byte Vendor Specific QoS Param Of The Service Flow */
|
||||
u8 u8VendorSpecificQoSParam[VENDOR_SPECIF_QOS_PARAM];
|
||||
/* indicates total classifiers in the SF */
|
||||
u8 u8TotalClassifiers; /* < Total number of valid classifiers */
|
||||
u8 bValid; /* < Validity flag */
|
||||
u8 u8Padding; /* < Padding byte */
|
||||
/*
|
||||
* Structure for Convergence SubLayer Types with a maximum of 4 classifiers
|
||||
*/
|
||||
struct bcm_convergence_types cConvergenceSLTypes[MAX_CLASSIFIERS_IN_SF];
|
||||
};
|
||||
|
||||
struct bcm_add_request {
|
||||
u8 u8Type; /* < Type */
|
||||
u8 eConnectionDir; /* < Connection direction */
|
||||
/* brief 16 bit TID */
|
||||
u16 u16TID; /* < 16bit TID */
|
||||
/* brief 16bitCID */
|
||||
u16 u16CID; /* < 16bit CID */
|
||||
/* brief 16bitVCID */
|
||||
u16 u16VCID; /* < 16bit VCID */
|
||||
struct bcm_connect_mgr_params *psfParameterSet; /* < connection manager parameters */
|
||||
};
|
||||
|
||||
struct bcm_add_indication {
|
||||
u8 u8Type; /* < Type */
|
||||
u8 eConnectionDir; /* < Connection Direction */
|
||||
/* brief 16 bit TID */
|
||||
u16 u16TID; /* < TID */
|
||||
/* brief 16bitCID */
|
||||
u16 u16CID; /* < 16bitCID */
|
||||
/* brief 16bitVCID */
|
||||
u16 u16VCID; /* < 16bitVCID */
|
||||
struct bcm_connect_mgr_params *psfAuthorizedSet; /* Authorized set of connection manager parameters */
|
||||
struct bcm_connect_mgr_params *psfAdmittedSet; /* Admitted set of connection manager parameters */
|
||||
struct bcm_connect_mgr_params *psfActiveSet; /* Activeset of connection manager parameters */
|
||||
u8 u8CC; /* <Confirmation Code */
|
||||
u8 u8Padd; /* < 8-bit Padding */
|
||||
u16 u16Padd; /* < 16 bit Padding */
|
||||
};
|
||||
|
||||
struct bcm_del_request {
|
||||
u8 u8Type; /* < Type */
|
||||
u8 u8Padding; /* < Padding byte */
|
||||
u16 u16TID; /* < TID */
|
||||
/* brief 32bitSFID */
|
||||
u32 u32SFID; /* < SFID */
|
||||
};
|
||||
|
||||
struct bcm_del_indication {
|
||||
u8 u8Type; /* < Type */
|
||||
u8 u8Padding; /* < Padding */
|
||||
u16 u16TID; /* < TID */
|
||||
/* brief 16bitCID */
|
||||
u16 u16CID; /* < CID */
|
||||
/* brief 16bitVCID */
|
||||
u16 u16VCID; /* < VCID */
|
||||
/* brief 32bitSFID */
|
||||
u32 u32SFID; /* < SFID */
|
||||
/* brief 8bit Confirmation code */
|
||||
u8 u8ConfirmationCode; /* < Confirmation code */
|
||||
u8 u8Padding1[3]; /* < 3 byte Padding */
|
||||
};
|
||||
|
||||
struct bcm_stim_sfhostnotify {
|
||||
u32 SFID; /* SFID of the service flow */
|
||||
u16 newCID; /* the new/changed CID */
|
||||
u16 VCID; /* Get new Vcid if the flow has been made active in CID update TLV, but was inactive earlier or the orig vcid */
|
||||
u8 RetainSF; /* Indication to Host if the SF is to be retained or deleted; if TRUE-retain else delete */
|
||||
u8 QoSParamSet; /* QoS paramset of the retained SF */
|
||||
u16 u16reserved; /* For byte alignment */
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,78 +0,0 @@
|
|||
|
||||
/*******************************************************************
|
||||
* Headers.h
|
||||
*******************************************************************/
|
||||
#ifndef __HEADERS_H__
|
||||
#define __HEADERS_H__
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/socket.h>
|
||||
#include <linux/netfilter.h>
|
||||
#include <linux/netfilter_ipv4.h>
|
||||
#include <linux/if_arp.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/file.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/stat.h>
|
||||
#include <linux/fcntl.h>
|
||||
#include <linux/unistd.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/udp.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <net/ip.h>
|
||||
|
||||
#include "Typedefs.h"
|
||||
#include "Macros.h"
|
||||
#include "HostMIBSInterface.h"
|
||||
#include "cntrl_SignalingInterface.h"
|
||||
#include "PHSDefines.h"
|
||||
#include "led_control.h"
|
||||
#include "Ioctl.h"
|
||||
#include "nvm.h"
|
||||
#include "target_params.h"
|
||||
#include "Adapter.h"
|
||||
#include "CmHost.h"
|
||||
#include "DDRInit.h"
|
||||
#include "Debug.h"
|
||||
#include "IPv6ProtocolHdr.h"
|
||||
#include "PHSModule.h"
|
||||
#include "Protocol.h"
|
||||
#include "Prototypes.h"
|
||||
#include "Queue.h"
|
||||
#include "vendorspecificextn.h"
|
||||
|
||||
#include "InterfaceMacros.h"
|
||||
#include "InterfaceAdapter.h"
|
||||
#include "InterfaceIsr.h"
|
||||
#include "InterfaceMisc.h"
|
||||
#include "InterfaceRx.h"
|
||||
#include "InterfaceTx.h"
|
||||
#include "InterfaceIdleMode.h"
|
||||
#include "InterfaceInit.h"
|
||||
|
||||
#define DRV_NAME "beceem"
|
||||
#define DEV_NAME "tarang"
|
||||
#define DRV_DESCRIPTION "Beceem Communications Inc. WiMAX driver"
|
||||
#define DRV_COPYRIGHT "Copyright 2010. Beceem Communications Inc"
|
||||
#define DRV_VERSION "5.2.45"
|
||||
#define PFX DRV_NAME " "
|
||||
|
||||
extern struct class *bcm_class;
|
||||
|
||||
#endif
|
|
@ -1,164 +0,0 @@
|
|||
/*
|
||||
* File Name: hostmibs.c
|
||||
*
|
||||
* Author: Beceem Communications Pvt. Ltd
|
||||
*
|
||||
* Abstract: This file contains the routines to copy the statistics used by
|
||||
* the driver to the Host MIBS structure and giving the same to Application.
|
||||
*/
|
||||
|
||||
#include "headers.h"
|
||||
|
||||
INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter,
|
||||
struct bcm_host_stats_mibs *pstHostMibs)
|
||||
{
|
||||
struct bcm_phs_entry *pstServiceFlowEntry = NULL;
|
||||
struct bcm_phs_rule *pstPhsRule = NULL;
|
||||
struct bcm_phs_classifier_table *pstClassifierTable = NULL;
|
||||
struct bcm_phs_classifier_entry *pstClassifierRule = NULL;
|
||||
struct bcm_phs_extension *pDeviceExtension = &Adapter->stBCMPhsContext;
|
||||
struct bcm_mibs_host_info *host_info;
|
||||
UINT nClassifierIndex = 0;
|
||||
UINT nPhsTableIndex = 0;
|
||||
UINT nSfIndex = 0;
|
||||
UINT uiIndex = 0;
|
||||
|
||||
if (pDeviceExtension == NULL) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, HOST_MIBS,
|
||||
DBG_LVL_ALL, "Invalid Device Extension\n");
|
||||
return STATUS_FAILURE;
|
||||
}
|
||||
|
||||
/* Copy the classifier Table */
|
||||
for (nClassifierIndex = 0; nClassifierIndex < MAX_CLASSIFIERS;
|
||||
nClassifierIndex++) {
|
||||
if (Adapter->astClassifierTable[nClassifierIndex].bUsed == TRUE)
|
||||
memcpy(&pstHostMibs->astClassifierTable[nClassifierIndex],
|
||||
&Adapter->astClassifierTable[nClassifierIndex],
|
||||
sizeof(struct bcm_mibs_classifier_rule));
|
||||
}
|
||||
|
||||
/* Copy the SF Table */
|
||||
for (nSfIndex = 0; nSfIndex < NO_OF_QUEUES; nSfIndex++) {
|
||||
if (Adapter->PackInfo[nSfIndex].bValid) {
|
||||
memcpy(&pstHostMibs->astSFtable[nSfIndex],
|
||||
&Adapter->PackInfo[nSfIndex],
|
||||
sizeof(struct bcm_mibs_table));
|
||||
} else {
|
||||
/* If index in not valid,
|
||||
* don't process this for the PHS table.
|
||||
* Go For the next entry.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Retrieve the SFID Entry Index for requested Service Flow */
|
||||
if (PHS_INVALID_TABLE_INDEX ==
|
||||
GetServiceFlowEntry(pDeviceExtension->
|
||||
pstServiceFlowPhsRulesTable,
|
||||
Adapter->PackInfo[nSfIndex].
|
||||
usVCID_Value, &pstServiceFlowEntry))
|
||||
|
||||
continue;
|
||||
|
||||
pstClassifierTable = pstServiceFlowEntry->pstClassifierTable;
|
||||
|
||||
for (uiIndex = 0; uiIndex < MAX_PHSRULE_PER_SF; uiIndex++) {
|
||||
pstClassifierRule = &pstClassifierTable->stActivePhsRulesList[uiIndex];
|
||||
|
||||
if (pstClassifierRule->bUsed) {
|
||||
pstPhsRule = pstClassifierRule->pstPhsRule;
|
||||
|
||||
pstHostMibs->astPhsRulesTable[nPhsTableIndex].
|
||||
ulSFID = Adapter->PackInfo[nSfIndex].ulSFID;
|
||||
|
||||
memcpy(&pstHostMibs->astPhsRulesTable[nPhsTableIndex].u8PHSI,
|
||||
&pstPhsRule->u8PHSI,
|
||||
sizeof(struct bcm_phs_rule));
|
||||
nPhsTableIndex++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Copy other Host Statistics parameters */
|
||||
host_info = &pstHostMibs->stHostInfo;
|
||||
host_info->GoodTransmits = Adapter->dev->stats.tx_packets;
|
||||
host_info->GoodReceives = Adapter->dev->stats.rx_packets;
|
||||
host_info->CurrNumFreeDesc = atomic_read(&Adapter->CurrNumFreeTxDesc);
|
||||
host_info->BEBucketSize = Adapter->BEBucketSize;
|
||||
host_info->rtPSBucketSize = Adapter->rtPSBucketSize;
|
||||
host_info->TimerActive = Adapter->TimerActive;
|
||||
host_info->u32TotalDSD = Adapter->u32TotalDSD;
|
||||
|
||||
memcpy(host_info->aTxPktSizeHist, Adapter->aTxPktSizeHist,
|
||||
sizeof(UINT32) * MIBS_MAX_HIST_ENTRIES);
|
||||
memcpy(host_info->aRxPktSizeHist, Adapter->aRxPktSizeHist,
|
||||
sizeof(UINT32) * MIBS_MAX_HIST_ENTRIES);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
VOID GetDroppedAppCntrlPktMibs(struct bcm_host_stats_mibs *pstHostMibs,
|
||||
struct bcm_tarang_data *pTarang)
|
||||
{
|
||||
memcpy(&(pstHostMibs->stDroppedAppCntrlMsgs),
|
||||
&(pTarang->stDroppedAppCntrlMsgs),
|
||||
sizeof(struct bcm_mibs_dropped_cntrl_msg));
|
||||
}
|
||||
|
||||
VOID CopyMIBSExtendedSFParameters(struct bcm_mini_adapter *Adapter,
|
||||
struct bcm_connect_mgr_params *psfLocalSet,
|
||||
UINT uiSearchRuleIndex)
|
||||
{
|
||||
struct bcm_mibs_parameters *t =
|
||||
&Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable;
|
||||
|
||||
t->wmanIfSfid = psfLocalSet->u32SFID;
|
||||
t->wmanIfCmnCpsMaxSustainedRate =
|
||||
psfLocalSet->u32MaxSustainedTrafficRate;
|
||||
t->wmanIfCmnCpsMaxTrafficBurst = psfLocalSet->u32MaxTrafficBurst;
|
||||
t->wmanIfCmnCpsMinReservedRate = psfLocalSet->u32MinReservedTrafficRate;
|
||||
t->wmanIfCmnCpsToleratedJitter = psfLocalSet->u32ToleratedJitter;
|
||||
t->wmanIfCmnCpsMaxLatency = psfLocalSet->u32MaximumLatency;
|
||||
t->wmanIfCmnCpsFixedVsVariableSduInd =
|
||||
psfLocalSet->u8FixedLengthVSVariableLengthSDUIndicator;
|
||||
t->wmanIfCmnCpsFixedVsVariableSduInd =
|
||||
ntohl(t->wmanIfCmnCpsFixedVsVariableSduInd);
|
||||
t->wmanIfCmnCpsSduSize = psfLocalSet->u8SDUSize;
|
||||
t->wmanIfCmnCpsSduSize = ntohl(t->wmanIfCmnCpsSduSize);
|
||||
t->wmanIfCmnCpsSfSchedulingType =
|
||||
psfLocalSet->u8ServiceFlowSchedulingType;
|
||||
t->wmanIfCmnCpsSfSchedulingType =
|
||||
ntohl(t->wmanIfCmnCpsSfSchedulingType);
|
||||
t->wmanIfCmnCpsArqEnable = psfLocalSet->u8ARQEnable;
|
||||
t->wmanIfCmnCpsArqEnable = ntohl(t->wmanIfCmnCpsArqEnable);
|
||||
t->wmanIfCmnCpsArqWindowSize = ntohs(psfLocalSet->u16ARQWindowSize);
|
||||
t->wmanIfCmnCpsArqWindowSize = ntohl(t->wmanIfCmnCpsArqWindowSize);
|
||||
t->wmanIfCmnCpsArqBlockLifetime =
|
||||
ntohs(psfLocalSet->u16ARQBlockLifeTime);
|
||||
t->wmanIfCmnCpsArqBlockLifetime =
|
||||
ntohl(t->wmanIfCmnCpsArqBlockLifetime);
|
||||
t->wmanIfCmnCpsArqSyncLossTimeout =
|
||||
ntohs(psfLocalSet->u16ARQSyncLossTimeOut);
|
||||
t->wmanIfCmnCpsArqSyncLossTimeout =
|
||||
ntohl(t->wmanIfCmnCpsArqSyncLossTimeout);
|
||||
t->wmanIfCmnCpsArqDeliverInOrder = psfLocalSet->u8ARQDeliverInOrder;
|
||||
t->wmanIfCmnCpsArqDeliverInOrder =
|
||||
ntohl(t->wmanIfCmnCpsArqDeliverInOrder);
|
||||
t->wmanIfCmnCpsArqRxPurgeTimeout =
|
||||
ntohs(psfLocalSet->u16ARQRxPurgeTimeOut);
|
||||
t->wmanIfCmnCpsArqRxPurgeTimeout =
|
||||
ntohl(t->wmanIfCmnCpsArqRxPurgeTimeout);
|
||||
t->wmanIfCmnCpsArqBlockSize = ntohs(psfLocalSet->u16ARQBlockSize);
|
||||
t->wmanIfCmnCpsArqBlockSize = ntohl(t->wmanIfCmnCpsArqBlockSize);
|
||||
t->wmanIfCmnCpsReqTxPolicy = psfLocalSet->u8RequesttransmissionPolicy;
|
||||
t->wmanIfCmnCpsReqTxPolicy = ntohl(t->wmanIfCmnCpsReqTxPolicy);
|
||||
t->wmanIfCmnSfCsSpecification = psfLocalSet->u8CSSpecification;
|
||||
t->wmanIfCmnSfCsSpecification = ntohl(t->wmanIfCmnSfCsSpecification);
|
||||
t->wmanIfCmnCpsTargetSaid = ntohs(psfLocalSet->u16TargetSAID);
|
||||
t->wmanIfCmnCpsTargetSaid = ntohl(t->wmanIfCmnCpsTargetSaid);
|
||||
|
||||
}
|
|
@ -1,951 +0,0 @@
|
|||
#include "headers.h"
|
||||
|
||||
#define STATUS_IMAGE_CHECKSUM_MISMATCH -199
|
||||
#define EVENT_SIGNALED 1
|
||||
|
||||
static B_UINT16 CFG_CalculateChecksum(B_UINT8 *pu8Buffer, B_UINT32 u32Size)
|
||||
{
|
||||
B_UINT16 u16CheckSum = 0;
|
||||
|
||||
while (u32Size--) {
|
||||
u16CheckSum += (B_UINT8)~(*pu8Buffer);
|
||||
pu8Buffer++;
|
||||
}
|
||||
return u16CheckSum;
|
||||
}
|
||||
|
||||
bool IsReqGpioIsLedInNVM(struct bcm_mini_adapter *Adapter, UINT gpios)
|
||||
{
|
||||
INT Status;
|
||||
|
||||
Status = (Adapter->gpioBitMap & gpios) ^ gpios;
|
||||
if (Status)
|
||||
return false;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT LED_Blink(struct bcm_mini_adapter *Adapter,
|
||||
UINT GPIO_Num,
|
||||
UCHAR uiLedIndex,
|
||||
ULONG timeout,
|
||||
INT num_of_time,
|
||||
enum bcm_led_events currdriverstate)
|
||||
{
|
||||
int Status = STATUS_SUCCESS;
|
||||
bool bInfinite = false;
|
||||
|
||||
/* Check if num_of_time is -ve. If yes, blink led in infinite loop */
|
||||
if (num_of_time < 0) {
|
||||
bInfinite = TRUE;
|
||||
num_of_time = 1;
|
||||
}
|
||||
while (num_of_time) {
|
||||
if (currdriverstate == Adapter->DriverState)
|
||||
TURN_ON_LED(Adapter, GPIO_Num, uiLedIndex);
|
||||
|
||||
/* Wait for timeout after setting on the LED */
|
||||
Status = wait_event_interruptible_timeout(
|
||||
Adapter->LEDInfo.notify_led_event,
|
||||
currdriverstate != Adapter->DriverState ||
|
||||
kthread_should_stop(),
|
||||
msecs_to_jiffies(timeout));
|
||||
|
||||
if (kthread_should_stop()) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO,
|
||||
DBG_LVL_ALL,
|
||||
"Led thread got signal to exit..hence exiting");
|
||||
Adapter->LEDInfo.led_thread_running =
|
||||
BCM_LED_THREAD_DISABLED;
|
||||
TURN_OFF_LED(Adapter, GPIO_Num, uiLedIndex);
|
||||
Status = EVENT_SIGNALED;
|
||||
break;
|
||||
}
|
||||
if (Status) {
|
||||
TURN_OFF_LED(Adapter, GPIO_Num, uiLedIndex);
|
||||
Status = EVENT_SIGNALED;
|
||||
break;
|
||||
}
|
||||
|
||||
TURN_OFF_LED(Adapter, GPIO_Num, uiLedIndex);
|
||||
Status = wait_event_interruptible_timeout(
|
||||
Adapter->LEDInfo.notify_led_event,
|
||||
currdriverstate != Adapter->DriverState ||
|
||||
kthread_should_stop(),
|
||||
msecs_to_jiffies(timeout));
|
||||
if (bInfinite == false)
|
||||
num_of_time--;
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
static INT ScaleRateofTransfer(ULONG rate)
|
||||
{
|
||||
if (rate <= 3)
|
||||
return rate;
|
||||
else if ((rate > 3) && (rate <= 100))
|
||||
return 5;
|
||||
else if ((rate > 100) && (rate <= 200))
|
||||
return 6;
|
||||
else if ((rate > 200) && (rate <= 300))
|
||||
return 7;
|
||||
else if ((rate > 300) && (rate <= 400))
|
||||
return 8;
|
||||
else if ((rate > 400) && (rate <= 500))
|
||||
return 9;
|
||||
else if ((rate > 500) && (rate <= 600))
|
||||
return 10;
|
||||
return MAX_NUM_OF_BLINKS;
|
||||
}
|
||||
|
||||
static INT blink_in_normal_bandwidth(struct bcm_mini_adapter *ad,
|
||||
INT *time,
|
||||
INT *time_tx,
|
||||
INT *time_rx,
|
||||
UCHAR GPIO_Num_tx,
|
||||
UCHAR uiTxLedIndex,
|
||||
UCHAR GPIO_Num_rx,
|
||||
UCHAR uiRxLedIndex,
|
||||
enum bcm_led_events currdriverstate,
|
||||
ulong *timeout)
|
||||
{
|
||||
/*
|
||||
* Assign minimum number of blinks of
|
||||
* either Tx or Rx.
|
||||
*/
|
||||
*time = (*time_tx > *time_rx ? *time_rx : *time_tx);
|
||||
|
||||
if (*time > 0) {
|
||||
/* Blink both Tx and Rx LEDs */
|
||||
if ((LED_Blink(ad, 1 << GPIO_Num_tx, uiTxLedIndex, *timeout,
|
||||
*time, currdriverstate) == EVENT_SIGNALED) ||
|
||||
(LED_Blink(ad, 1 << GPIO_Num_rx, uiRxLedIndex, *timeout,
|
||||
*time, currdriverstate) == EVENT_SIGNALED))
|
||||
return EVENT_SIGNALED;
|
||||
}
|
||||
|
||||
if (*time == *time_tx) {
|
||||
/* Blink pending rate of Rx */
|
||||
if (LED_Blink(ad, (1 << GPIO_Num_rx), uiRxLedIndex, *timeout,
|
||||
*time_rx - *time,
|
||||
currdriverstate) == EVENT_SIGNALED)
|
||||
return EVENT_SIGNALED;
|
||||
|
||||
*time = *time_rx;
|
||||
} else {
|
||||
/* Blink pending rate of Tx */
|
||||
if (LED_Blink(ad, 1 << GPIO_Num_tx, uiTxLedIndex, *timeout,
|
||||
*time_tx - *time,
|
||||
currdriverstate) == EVENT_SIGNALED)
|
||||
return EVENT_SIGNALED;
|
||||
|
||||
*time = *time_tx;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INT LED_Proportional_Blink(struct bcm_mini_adapter *Adapter,
|
||||
UCHAR GPIO_Num_tx,
|
||||
UCHAR uiTxLedIndex,
|
||||
UCHAR GPIO_Num_rx,
|
||||
UCHAR uiRxLedIndex,
|
||||
enum bcm_led_events currdriverstate)
|
||||
{
|
||||
/* Initial values of TX and RX packets */
|
||||
ULONG64 Initial_num_of_packts_tx = 0, Initial_num_of_packts_rx = 0;
|
||||
/* values of TX and RX packets after 1 sec */
|
||||
ULONG64 Final_num_of_packts_tx = 0, Final_num_of_packts_rx = 0;
|
||||
/* Rate of transfer of Tx and Rx in 1 sec */
|
||||
ULONG64 rate_of_transfer_tx = 0, rate_of_transfer_rx = 0;
|
||||
int Status = STATUS_SUCCESS;
|
||||
INT num_of_time = 0, num_of_time_tx = 0, num_of_time_rx = 0;
|
||||
UINT remDelay = 0;
|
||||
/* UINT GPIO_num = DISABLE_GPIO_NUM; */
|
||||
ulong timeout = 0;
|
||||
|
||||
/* Read initial value of packets sent/received */
|
||||
Initial_num_of_packts_tx = Adapter->dev->stats.tx_packets;
|
||||
Initial_num_of_packts_rx = Adapter->dev->stats.rx_packets;
|
||||
|
||||
/* Scale the rate of transfer to no of blinks. */
|
||||
num_of_time_tx = ScaleRateofTransfer((ULONG)rate_of_transfer_tx);
|
||||
num_of_time_rx = ScaleRateofTransfer((ULONG)rate_of_transfer_rx);
|
||||
|
||||
while ((Adapter->device_removed == false)) {
|
||||
timeout = 50;
|
||||
|
||||
if (EVENT_SIGNALED == blink_in_normal_bandwidth(Adapter,
|
||||
&num_of_time,
|
||||
&num_of_time_tx,
|
||||
&num_of_time_rx,
|
||||
GPIO_Num_tx,
|
||||
uiTxLedIndex,
|
||||
GPIO_Num_rx,
|
||||
uiRxLedIndex,
|
||||
currdriverstate,
|
||||
&timeout))
|
||||
return EVENT_SIGNALED;
|
||||
|
||||
|
||||
/*
|
||||
* If Tx/Rx rate is less than maximum blinks per second,
|
||||
* wait till delay completes to 1 second
|
||||
*/
|
||||
remDelay = MAX_NUM_OF_BLINKS - num_of_time;
|
||||
if (remDelay > 0) {
|
||||
timeout = 100 * remDelay;
|
||||
Status = wait_event_interruptible_timeout(
|
||||
Adapter->LEDInfo.notify_led_event,
|
||||
currdriverstate != Adapter->DriverState
|
||||
|| kthread_should_stop(),
|
||||
msecs_to_jiffies(timeout));
|
||||
|
||||
if (kthread_should_stop()) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
LED_DUMP_INFO, DBG_LVL_ALL,
|
||||
"Led thread got signal to exit..hence exiting");
|
||||
Adapter->LEDInfo.led_thread_running =
|
||||
BCM_LED_THREAD_DISABLED;
|
||||
return EVENT_SIGNALED;
|
||||
}
|
||||
if (Status)
|
||||
return EVENT_SIGNALED;
|
||||
}
|
||||
|
||||
/* Turn off both Tx and Rx LEDs before next second */
|
||||
TURN_OFF_LED(Adapter, 1 << GPIO_Num_tx, uiTxLedIndex);
|
||||
TURN_OFF_LED(Adapter, 1 << GPIO_Num_rx, uiTxLedIndex);
|
||||
|
||||
/*
|
||||
* Read the Tx & Rx packets transmission after 1 second and
|
||||
* calculate rate of transfer
|
||||
*/
|
||||
Final_num_of_packts_tx = Adapter->dev->stats.tx_packets;
|
||||
Final_num_of_packts_rx = Adapter->dev->stats.rx_packets;
|
||||
|
||||
rate_of_transfer_tx = Final_num_of_packts_tx -
|
||||
Initial_num_of_packts_tx;
|
||||
rate_of_transfer_rx = Final_num_of_packts_rx -
|
||||
Initial_num_of_packts_rx;
|
||||
|
||||
/* Read initial value of packets sent/received */
|
||||
Initial_num_of_packts_tx = Final_num_of_packts_tx;
|
||||
Initial_num_of_packts_rx = Final_num_of_packts_rx;
|
||||
|
||||
/* Scale the rate of transfer to no of blinks. */
|
||||
num_of_time_tx =
|
||||
ScaleRateofTransfer((ULONG)rate_of_transfer_tx);
|
||||
num_of_time_rx =
|
||||
ScaleRateofTransfer((ULONG)rate_of_transfer_rx);
|
||||
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* Procedure: ValidateDSDParamsChecksum
|
||||
*
|
||||
* Description: Reads DSD Params and validates checkusm.
|
||||
*
|
||||
* Arguments:
|
||||
* Adapter - Pointer to Adapter structure.
|
||||
* ulParamOffset - Start offset of the DSD parameter to be read and
|
||||
* validated.
|
||||
* usParamLen - Length of the DSD Parameter.
|
||||
*
|
||||
* Returns:
|
||||
* <OSAL_STATUS_CODE>
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
static INT ValidateDSDParamsChecksum(struct bcm_mini_adapter *Adapter,
|
||||
ULONG ulParamOffset,
|
||||
USHORT usParamLen)
|
||||
{
|
||||
INT Status = STATUS_SUCCESS;
|
||||
PUCHAR puBuffer = NULL;
|
||||
USHORT usChksmOrg = 0;
|
||||
USHORT usChecksumCalculated = 0;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO, DBG_LVL_ALL,
|
||||
"LED Thread:ValidateDSDParamsChecksum: 0x%lx 0x%X",
|
||||
ulParamOffset, usParamLen);
|
||||
|
||||
puBuffer = kmalloc(usParamLen, GFP_KERNEL);
|
||||
if (!puBuffer) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO,
|
||||
DBG_LVL_ALL,
|
||||
"LED Thread: ValidateDSDParamsChecksum Allocation failed");
|
||||
return -ENOMEM;
|
||||
|
||||
}
|
||||
|
||||
/* Read the DSD data from the parameter offset. */
|
||||
if (STATUS_SUCCESS != BeceemNVMRead(Adapter, (PUINT)puBuffer,
|
||||
ulParamOffset, usParamLen)) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO,
|
||||
DBG_LVL_ALL,
|
||||
"LED Thread: ValidateDSDParamsChecksum BeceemNVMRead failed");
|
||||
Status = STATUS_IMAGE_CHECKSUM_MISMATCH;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Calculate the checksum of the data read from the DSD parameter. */
|
||||
usChecksumCalculated = CFG_CalculateChecksum(puBuffer, usParamLen);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO, DBG_LVL_ALL,
|
||||
"LED Thread: usCheckSumCalculated = 0x%x\n",
|
||||
usChecksumCalculated);
|
||||
|
||||
/*
|
||||
* End of the DSD parameter will have a TWO bytes checksum stored in it.
|
||||
* Read it and compare with the calculated Checksum.
|
||||
*/
|
||||
if (STATUS_SUCCESS != BeceemNVMRead(Adapter, (PUINT)&usChksmOrg,
|
||||
ulParamOffset+usParamLen, 2)) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO,
|
||||
DBG_LVL_ALL,
|
||||
"LED Thread: ValidateDSDParamsChecksum BeceemNVMRead failed");
|
||||
Status = STATUS_IMAGE_CHECKSUM_MISMATCH;
|
||||
goto exit;
|
||||
}
|
||||
usChksmOrg = ntohs(usChksmOrg);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO, DBG_LVL_ALL,
|
||||
"LED Thread: usChksmOrg = 0x%x", usChksmOrg);
|
||||
|
||||
/*
|
||||
* Compare the checksum calculated with the checksum read
|
||||
* from DSD section
|
||||
*/
|
||||
if (usChecksumCalculated ^ usChksmOrg) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO,
|
||||
DBG_LVL_ALL,
|
||||
"LED Thread: ValidateDSDParamsChecksum: Checksums don't match");
|
||||
Status = STATUS_IMAGE_CHECKSUM_MISMATCH;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
exit:
|
||||
kfree(puBuffer);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* Procedure: ValidateHWParmStructure
|
||||
*
|
||||
* Description: Validates HW Parameters.
|
||||
*
|
||||
* Arguments:
|
||||
* Adapter - Pointer to Adapter structure.
|
||||
* ulHwParamOffset - Start offset of the HW parameter Section to be read
|
||||
* and validated.
|
||||
*
|
||||
* Returns:
|
||||
* <OSAL_STATUS_CODE>
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
static INT ValidateHWParmStructure(struct bcm_mini_adapter *Adapter,
|
||||
ULONG ulHwParamOffset)
|
||||
{
|
||||
|
||||
INT Status = STATUS_SUCCESS;
|
||||
USHORT HwParamLen = 0;
|
||||
/*
|
||||
* Add DSD start offset to the hwParamOffset to get
|
||||
* the actual address.
|
||||
*/
|
||||
ulHwParamOffset += DSD_START_OFFSET;
|
||||
|
||||
/* Read the Length of HW_PARAM structure */
|
||||
BeceemNVMRead(Adapter, (PUINT)&HwParamLen, ulHwParamOffset, 2);
|
||||
HwParamLen = ntohs(HwParamLen);
|
||||
if (0 == HwParamLen || HwParamLen > Adapter->uiNVMDSDSize)
|
||||
return STATUS_IMAGE_CHECKSUM_MISMATCH;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO, DBG_LVL_ALL,
|
||||
"LED Thread:HwParamLen = 0x%x", HwParamLen);
|
||||
Status = ValidateDSDParamsChecksum(Adapter, ulHwParamOffset,
|
||||
HwParamLen);
|
||||
return Status;
|
||||
} /* ValidateHWParmStructure() */
|
||||
|
||||
static int ReadLEDInformationFromEEPROM(struct bcm_mini_adapter *Adapter,
|
||||
UCHAR GPIO_Array[])
|
||||
{
|
||||
int Status = STATUS_SUCCESS;
|
||||
|
||||
ULONG dwReadValue = 0;
|
||||
USHORT usHwParamData = 0;
|
||||
USHORT usEEPROMVersion = 0;
|
||||
UCHAR ucIndex = 0;
|
||||
UCHAR ucGPIOInfo[32] = {0};
|
||||
|
||||
BeceemNVMRead(Adapter, (PUINT)&usEEPROMVersion,
|
||||
EEPROM_VERSION_OFFSET, 2);
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO, DBG_LVL_ALL,
|
||||
"usEEPROMVersion: Minor:0x%X Major:0x%x",
|
||||
usEEPROMVersion & 0xFF,
|
||||
((usEEPROMVersion >> 8) & 0xFF));
|
||||
|
||||
|
||||
if (((usEEPROMVersion>>8)&0xFF) < EEPROM_MAP5_MAJORVERSION) {
|
||||
BeceemNVMRead(Adapter, (PUINT)&usHwParamData,
|
||||
EEPROM_HW_PARAM_POINTER_ADDRESS, 2);
|
||||
usHwParamData = ntohs(usHwParamData);
|
||||
dwReadValue = usHwParamData;
|
||||
} else {
|
||||
/*
|
||||
* Validate Compatibility section and then read HW param
|
||||
* if compatibility section is valid.
|
||||
*/
|
||||
Status = ValidateDSDParamsChecksum(Adapter,
|
||||
DSD_START_OFFSET,
|
||||
COMPATIBILITY_SECTION_LENGTH_MAP5);
|
||||
|
||||
if (Status != STATUS_SUCCESS)
|
||||
return Status;
|
||||
|
||||
BeceemNVMRead(Adapter, (PUINT)&dwReadValue,
|
||||
EEPROM_HW_PARAM_POINTER_ADDRRES_MAP5, 4);
|
||||
dwReadValue = ntohl(dwReadValue);
|
||||
}
|
||||
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO, DBG_LVL_ALL,
|
||||
"LED Thread: Start address of HW_PARAM structure = 0x%lx",
|
||||
dwReadValue);
|
||||
|
||||
/*
|
||||
* Validate if the address read out is within the DSD.
|
||||
* Adapter->uiNVMDSDSize gives whole DSD size inclusive of Autoinit.
|
||||
* lower limit should be above DSD_START_OFFSET and
|
||||
* upper limit should be below (Adapter->uiNVMDSDSize-DSD_START_OFFSET)
|
||||
*/
|
||||
if (dwReadValue < DSD_START_OFFSET ||
|
||||
dwReadValue > (Adapter->uiNVMDSDSize-DSD_START_OFFSET))
|
||||
return STATUS_IMAGE_CHECKSUM_MISMATCH;
|
||||
|
||||
Status = ValidateHWParmStructure(Adapter, dwReadValue);
|
||||
if (Status)
|
||||
return Status;
|
||||
|
||||
/*
|
||||
* Add DSD_START_OFFSET to the offset read from the EEPROM.
|
||||
* This will give the actual start HW Parameters start address.
|
||||
* To read GPIO section, add GPIO offset further.
|
||||
*/
|
||||
|
||||
dwReadValue += DSD_START_OFFSET;
|
||||
/* = start address of hw param section. */
|
||||
dwReadValue += GPIO_SECTION_START_OFFSET;
|
||||
/* = GPIO start offset within HW Param section. */
|
||||
|
||||
/*
|
||||
* Read the GPIO values for 32 GPIOs from EEPROM and map the function
|
||||
* number to GPIO pin number to GPIO_Array
|
||||
*/
|
||||
BeceemNVMRead(Adapter, (UINT *)ucGPIOInfo, dwReadValue, 32);
|
||||
for (ucIndex = 0; ucIndex < 32; ucIndex++) {
|
||||
|
||||
switch (ucGPIOInfo[ucIndex]) {
|
||||
case RED_LED:
|
||||
GPIO_Array[RED_LED] = ucIndex;
|
||||
Adapter->gpioBitMap |= (1 << ucIndex);
|
||||
break;
|
||||
case BLUE_LED:
|
||||
GPIO_Array[BLUE_LED] = ucIndex;
|
||||
Adapter->gpioBitMap |= (1 << ucIndex);
|
||||
break;
|
||||
case YELLOW_LED:
|
||||
GPIO_Array[YELLOW_LED] = ucIndex;
|
||||
Adapter->gpioBitMap |= (1 << ucIndex);
|
||||
break;
|
||||
case GREEN_LED:
|
||||
GPIO_Array[GREEN_LED] = ucIndex;
|
||||
Adapter->gpioBitMap |= (1 << ucIndex);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO, DBG_LVL_ALL,
|
||||
"GPIO's bit map correspond to LED :0x%X",
|
||||
Adapter->gpioBitMap);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
static int ReadConfigFileStructure(struct bcm_mini_adapter *Adapter,
|
||||
bool *bEnableThread)
|
||||
{
|
||||
int Status = STATUS_SUCCESS;
|
||||
/* Array to store GPIO numbers from EEPROM */
|
||||
UCHAR GPIO_Array[NUM_OF_LEDS+1];
|
||||
UINT uiIndex = 0;
|
||||
UINT uiNum_of_LED_Type = 0;
|
||||
PUCHAR puCFGData = NULL;
|
||||
UCHAR bData = 0;
|
||||
struct bcm_led_state_info *curr_led_state;
|
||||
|
||||
memset(GPIO_Array, DISABLE_GPIO_NUM, NUM_OF_LEDS+1);
|
||||
|
||||
if (!Adapter->pstargetparams || IS_ERR(Adapter->pstargetparams)) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO,
|
||||
DBG_LVL_ALL, "Target Params not Avail.\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
/* Populate GPIO_Array with GPIO numbers for LED functions */
|
||||
/* Read the GPIO numbers from EEPROM */
|
||||
Status = ReadLEDInformationFromEEPROM(Adapter, GPIO_Array);
|
||||
if (Status == STATUS_IMAGE_CHECKSUM_MISMATCH) {
|
||||
*bEnableThread = false;
|
||||
return STATUS_SUCCESS;
|
||||
} else if (Status) {
|
||||
*bEnableThread = false;
|
||||
return Status;
|
||||
}
|
||||
|
||||
/*
|
||||
* CONFIG file read successfully. Deallocate the memory of
|
||||
* uiFileNameBufferSize
|
||||
*/
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO, DBG_LVL_ALL,
|
||||
"LED Thread: Config file read successfully\n");
|
||||
puCFGData = (PUCHAR) &Adapter->pstargetparams->HostDrvrConfig1;
|
||||
|
||||
/*
|
||||
* Offset for HostDrvConfig1, HostDrvConfig2, HostDrvConfig3 which
|
||||
* will have the information of LED type, LED on state for different
|
||||
* driver state and LED blink state.
|
||||
*/
|
||||
|
||||
for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) {
|
||||
bData = *puCFGData;
|
||||
curr_led_state = &Adapter->LEDInfo.LEDState[uiIndex];
|
||||
|
||||
/*
|
||||
* Check Bit 8 for polarity. If it is set,
|
||||
* polarity is reverse polarity
|
||||
*/
|
||||
if (bData & 0x80) {
|
||||
curr_led_state->BitPolarity = 0;
|
||||
/* unset the bit 8 */
|
||||
bData = bData & 0x7f;
|
||||
}
|
||||
|
||||
curr_led_state->LED_Type = bData;
|
||||
if (bData <= NUM_OF_LEDS)
|
||||
curr_led_state->GPIO_Num = GPIO_Array[bData];
|
||||
else
|
||||
curr_led_state->GPIO_Num = DISABLE_GPIO_NUM;
|
||||
|
||||
puCFGData++;
|
||||
bData = *puCFGData;
|
||||
curr_led_state->LED_On_State = bData;
|
||||
puCFGData++;
|
||||
bData = *puCFGData;
|
||||
curr_led_state->LED_Blink_State = bData;
|
||||
puCFGData++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if all the LED settings are disabled. If it is disabled,
|
||||
* dont launch the LED control thread.
|
||||
*/
|
||||
for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) {
|
||||
curr_led_state = &Adapter->LEDInfo.LEDState[uiIndex];
|
||||
|
||||
if ((curr_led_state->LED_Type == DISABLE_GPIO_NUM) ||
|
||||
(curr_led_state->LED_Type == 0x7f) ||
|
||||
(curr_led_state->LED_Type == 0))
|
||||
uiNum_of_LED_Type++;
|
||||
}
|
||||
if (uiNum_of_LED_Type >= NUM_OF_LEDS)
|
||||
*bEnableThread = false;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* Procedure: LedGpioInit
|
||||
*
|
||||
* Description: Initializes LED GPIOs. Makes the LED GPIOs to OUTPUT mode
|
||||
* and make the initial state to be OFF.
|
||||
*
|
||||
* Arguments:
|
||||
* Adapter - Pointer to MINI_ADAPTER structure.
|
||||
*
|
||||
* Returns: VOID
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
static VOID LedGpioInit(struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
UINT uiResetValue = 0;
|
||||
UINT uiIndex = 0;
|
||||
struct bcm_led_state_info *curr_led_state;
|
||||
|
||||
/* Set all LED GPIO Mode to output mode */
|
||||
if (rdmalt(Adapter, GPIO_MODE_REGISTER, &uiResetValue,
|
||||
sizeof(uiResetValue)) < 0)
|
||||
BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO,
|
||||
DBG_LVL_ALL, "LED Thread: RDM Failed\n");
|
||||
for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) {
|
||||
curr_led_state = &Adapter->LEDInfo.LEDState[uiIndex];
|
||||
|
||||
if (curr_led_state->GPIO_Num != DISABLE_GPIO_NUM)
|
||||
uiResetValue |= (1 << curr_led_state->GPIO_Num);
|
||||
|
||||
TURN_OFF_LED(Adapter, 1 << curr_led_state->GPIO_Num, uiIndex);
|
||||
|
||||
}
|
||||
if (wrmalt(Adapter, GPIO_MODE_REGISTER, &uiResetValue,
|
||||
sizeof(uiResetValue)) < 0)
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO,
|
||||
DBG_LVL_ALL, "LED Thread: WRM Failed\n");
|
||||
|
||||
Adapter->LEDInfo.bIdle_led_off = false;
|
||||
}
|
||||
|
||||
static INT BcmGetGPIOPinInfo(struct bcm_mini_adapter *Adapter,
|
||||
UCHAR *GPIO_num_tx,
|
||||
UCHAR *GPIO_num_rx,
|
||||
UCHAR *uiLedTxIndex,
|
||||
UCHAR *uiLedRxIndex,
|
||||
enum bcm_led_events currdriverstate)
|
||||
{
|
||||
UINT uiIndex = 0;
|
||||
struct bcm_led_state_info *led_state_info;
|
||||
|
||||
*GPIO_num_tx = DISABLE_GPIO_NUM;
|
||||
*GPIO_num_rx = DISABLE_GPIO_NUM;
|
||||
|
||||
for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) {
|
||||
led_state_info = &Adapter->LEDInfo.LEDState[uiIndex];
|
||||
|
||||
if (((currdriverstate == NORMAL_OPERATION) ||
|
||||
(currdriverstate == IDLEMODE_EXIT) ||
|
||||
(currdriverstate == FW_DOWNLOAD)) &&
|
||||
(led_state_info->LED_Blink_State & currdriverstate) &&
|
||||
(led_state_info->GPIO_Num != DISABLE_GPIO_NUM)) {
|
||||
if (*GPIO_num_tx == DISABLE_GPIO_NUM) {
|
||||
*GPIO_num_tx = led_state_info->GPIO_Num;
|
||||
*uiLedTxIndex = uiIndex;
|
||||
} else {
|
||||
*GPIO_num_rx = led_state_info->GPIO_Num;
|
||||
*uiLedRxIndex = uiIndex;
|
||||
}
|
||||
} else {
|
||||
if ((led_state_info->LED_On_State & currdriverstate) &&
|
||||
(led_state_info->GPIO_Num != DISABLE_GPIO_NUM)) {
|
||||
*GPIO_num_tx = led_state_info->GPIO_Num;
|
||||
*uiLedTxIndex = uiIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void handle_adapter_driver_state(struct bcm_mini_adapter *ad,
|
||||
enum bcm_led_events currdriverstate,
|
||||
UCHAR GPIO_num,
|
||||
UCHAR dummyGPIONum,
|
||||
UCHAR uiLedIndex,
|
||||
UCHAR dummyIndex,
|
||||
ulong timeout,
|
||||
UINT uiResetValue,
|
||||
UINT uiIndex)
|
||||
{
|
||||
switch (ad->DriverState) {
|
||||
case DRIVER_INIT:
|
||||
currdriverstate = DRIVER_INIT;
|
||||
/* ad->DriverState; */
|
||||
BcmGetGPIOPinInfo(ad, &GPIO_num, &dummyGPIONum,
|
||||
&uiLedIndex, &dummyIndex,
|
||||
currdriverstate);
|
||||
|
||||
if (GPIO_num != DISABLE_GPIO_NUM)
|
||||
TURN_ON_LED(ad, 1 << GPIO_num, uiLedIndex);
|
||||
|
||||
break;
|
||||
case FW_DOWNLOAD:
|
||||
/*
|
||||
* BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS,
|
||||
* LED_DUMP_INFO, DBG_LVL_ALL,
|
||||
* "LED Thread: FW_DN_DONE called\n");
|
||||
*/
|
||||
currdriverstate = FW_DOWNLOAD;
|
||||
BcmGetGPIOPinInfo(ad, &GPIO_num, &dummyGPIONum,
|
||||
&uiLedIndex, &dummyIndex,
|
||||
currdriverstate);
|
||||
|
||||
if (GPIO_num != DISABLE_GPIO_NUM) {
|
||||
timeout = 50;
|
||||
LED_Blink(ad, 1 << GPIO_num, uiLedIndex, timeout,
|
||||
-1, currdriverstate);
|
||||
}
|
||||
break;
|
||||
case FW_DOWNLOAD_DONE:
|
||||
currdriverstate = FW_DOWNLOAD_DONE;
|
||||
BcmGetGPIOPinInfo(ad, &GPIO_num, &dummyGPIONum,
|
||||
&uiLedIndex, &dummyIndex, currdriverstate);
|
||||
if (GPIO_num != DISABLE_GPIO_NUM)
|
||||
TURN_ON_LED(ad, 1 << GPIO_num, uiLedIndex);
|
||||
break;
|
||||
|
||||
case SHUTDOWN_EXIT:
|
||||
/*
|
||||
* no break, continue to NO_NETWORK_ENTRY
|
||||
* state as well.
|
||||
*/
|
||||
case NO_NETWORK_ENTRY:
|
||||
currdriverstate = NO_NETWORK_ENTRY;
|
||||
BcmGetGPIOPinInfo(ad, &GPIO_num, &dummyGPIONum,
|
||||
&uiLedIndex, &dummyGPIONum, currdriverstate);
|
||||
if (GPIO_num != DISABLE_GPIO_NUM)
|
||||
TURN_ON_LED(ad, 1 << GPIO_num, uiLedIndex);
|
||||
break;
|
||||
case NORMAL_OPERATION:
|
||||
{
|
||||
UCHAR GPIO_num_tx = DISABLE_GPIO_NUM;
|
||||
UCHAR GPIO_num_rx = DISABLE_GPIO_NUM;
|
||||
UCHAR uiLEDTx = 0;
|
||||
UCHAR uiLEDRx = 0;
|
||||
|
||||
currdriverstate = NORMAL_OPERATION;
|
||||
ad->LEDInfo.bIdle_led_off = false;
|
||||
|
||||
BcmGetGPIOPinInfo(ad, &GPIO_num_tx, &GPIO_num_rx,
|
||||
&uiLEDTx, &uiLEDRx, currdriverstate);
|
||||
if ((GPIO_num_tx == DISABLE_GPIO_NUM) &&
|
||||
(GPIO_num_rx == DISABLE_GPIO_NUM)) {
|
||||
GPIO_num = DISABLE_GPIO_NUM;
|
||||
} else {
|
||||
/*
|
||||
* If single LED is selected, use same
|
||||
* for both Tx and Rx
|
||||
*/
|
||||
if (GPIO_num_tx == DISABLE_GPIO_NUM) {
|
||||
GPIO_num_tx = GPIO_num_rx;
|
||||
uiLEDTx = uiLEDRx;
|
||||
} else if (GPIO_num_rx == DISABLE_GPIO_NUM) {
|
||||
GPIO_num_rx = GPIO_num_tx;
|
||||
uiLEDRx = uiLEDTx;
|
||||
}
|
||||
/*
|
||||
* Blink the LED in proportionate
|
||||
* to Tx and Rx transmissions.
|
||||
*/
|
||||
LED_Proportional_Blink(ad,
|
||||
GPIO_num_tx, uiLEDTx,
|
||||
GPIO_num_rx, uiLEDRx,
|
||||
currdriverstate);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LOWPOWER_MODE_ENTER:
|
||||
currdriverstate = LOWPOWER_MODE_ENTER;
|
||||
if (DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING ==
|
||||
ad->ulPowerSaveMode) {
|
||||
/* Turn OFF all the LED */
|
||||
uiResetValue = 0;
|
||||
for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) {
|
||||
if (ad->LEDInfo.LEDState[uiIndex].GPIO_Num != DISABLE_GPIO_NUM)
|
||||
TURN_OFF_LED(ad,
|
||||
(1 << ad->LEDInfo.LEDState[uiIndex].GPIO_Num),
|
||||
uiIndex);
|
||||
}
|
||||
|
||||
}
|
||||
/* Turn off LED And WAKE-UP for Sendinf IDLE mode ACK */
|
||||
ad->LEDInfo.bLedInitDone = false;
|
||||
ad->LEDInfo.bIdle_led_off = TRUE;
|
||||
wake_up(&ad->LEDInfo.idleModeSyncEvent);
|
||||
GPIO_num = DISABLE_GPIO_NUM;
|
||||
break;
|
||||
case IDLEMODE_CONTINUE:
|
||||
currdriverstate = IDLEMODE_CONTINUE;
|
||||
GPIO_num = DISABLE_GPIO_NUM;
|
||||
break;
|
||||
case IDLEMODE_EXIT:
|
||||
break;
|
||||
case DRIVER_HALT:
|
||||
currdriverstate = DRIVER_HALT;
|
||||
GPIO_num = DISABLE_GPIO_NUM;
|
||||
for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) {
|
||||
if (ad->LEDInfo.LEDState[uiIndex].GPIO_Num !=
|
||||
DISABLE_GPIO_NUM)
|
||||
TURN_OFF_LED(ad,
|
||||
(1 << ad->LEDInfo.LEDState[uiIndex].GPIO_Num),
|
||||
uiIndex);
|
||||
}
|
||||
/* ad->DriverState = DRIVER_INIT; */
|
||||
break;
|
||||
case LED_THREAD_INACTIVE:
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, LED_DUMP_INFO,
|
||||
DBG_LVL_ALL, "InActivating LED thread...");
|
||||
currdriverstate = LED_THREAD_INACTIVE;
|
||||
ad->LEDInfo.led_thread_running =
|
||||
BCM_LED_THREAD_RUNNING_INACTIVELY;
|
||||
ad->LEDInfo.bLedInitDone = false;
|
||||
/* disable ALL LED */
|
||||
for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) {
|
||||
if (ad->LEDInfo.LEDState[uiIndex].GPIO_Num !=
|
||||
DISABLE_GPIO_NUM)
|
||||
TURN_OFF_LED(ad,
|
||||
(1 << ad->LEDInfo.LEDState[uiIndex].GPIO_Num),
|
||||
uiIndex);
|
||||
}
|
||||
break;
|
||||
case LED_THREAD_ACTIVE:
|
||||
BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, LED_DUMP_INFO,
|
||||
DBG_LVL_ALL, "Activating LED thread again...");
|
||||
if (ad->LinkUpStatus == false)
|
||||
ad->DriverState = NO_NETWORK_ENTRY;
|
||||
else
|
||||
ad->DriverState = NORMAL_OPERATION;
|
||||
|
||||
ad->LEDInfo.led_thread_running =
|
||||
BCM_LED_THREAD_RUNNING_ACTIVELY;
|
||||
break;
|
||||
/* return; */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static VOID LEDControlThread(struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
UINT uiIndex = 0;
|
||||
UCHAR GPIO_num = 0;
|
||||
UCHAR uiLedIndex = 0;
|
||||
UINT uiResetValue = 0;
|
||||
enum bcm_led_events currdriverstate = 0;
|
||||
ulong timeout = 0;
|
||||
|
||||
INT Status = 0;
|
||||
|
||||
UCHAR dummyGPIONum = 0;
|
||||
UCHAR dummyIndex = 0;
|
||||
|
||||
/* currdriverstate = Adapter->DriverState; */
|
||||
Adapter->LEDInfo.bIdleMode_tx_from_host = false;
|
||||
|
||||
/*
|
||||
* Wait till event is triggered
|
||||
*
|
||||
* wait_event(Adapter->LEDInfo.notify_led_event,
|
||||
* currdriverstate!= Adapter->DriverState);
|
||||
*/
|
||||
|
||||
GPIO_num = DISABLE_GPIO_NUM;
|
||||
|
||||
while (TRUE) {
|
||||
/* Wait till event is triggered */
|
||||
if ((GPIO_num == DISABLE_GPIO_NUM)
|
||||
||
|
||||
((currdriverstate != FW_DOWNLOAD) &&
|
||||
(currdriverstate != NORMAL_OPERATION) &&
|
||||
(currdriverstate != LOWPOWER_MODE_ENTER))
|
||||
||
|
||||
(currdriverstate == LED_THREAD_INACTIVE))
|
||||
Status = wait_event_interruptible(
|
||||
Adapter->LEDInfo.notify_led_event,
|
||||
currdriverstate != Adapter->DriverState
|
||||
|| kthread_should_stop());
|
||||
|
||||
if (kthread_should_stop() || Adapter->device_removed) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO,
|
||||
DBG_LVL_ALL,
|
||||
"Led thread got signal to exit..hence exiting");
|
||||
Adapter->LEDInfo.led_thread_running =
|
||||
BCM_LED_THREAD_DISABLED;
|
||||
TURN_OFF_LED(Adapter, 1 << GPIO_num, uiLedIndex);
|
||||
return; /* STATUS_FAILURE; */
|
||||
}
|
||||
|
||||
if (GPIO_num != DISABLE_GPIO_NUM)
|
||||
TURN_OFF_LED(Adapter, 1 << GPIO_num, uiLedIndex);
|
||||
|
||||
if (Adapter->LEDInfo.bLedInitDone == false) {
|
||||
LedGpioInit(Adapter);
|
||||
Adapter->LEDInfo.bLedInitDone = TRUE;
|
||||
}
|
||||
|
||||
handle_adapter_driver_state(Adapter,
|
||||
currdriverstate,
|
||||
GPIO_num,
|
||||
dummyGPIONum,
|
||||
uiLedIndex,
|
||||
dummyIndex,
|
||||
timeout,
|
||||
uiResetValue,
|
||||
uiIndex
|
||||
);
|
||||
}
|
||||
Adapter->LEDInfo.led_thread_running = BCM_LED_THREAD_DISABLED;
|
||||
}
|
||||
|
||||
int InitLedSettings(struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
int Status = STATUS_SUCCESS;
|
||||
bool bEnableThread = TRUE;
|
||||
UCHAR uiIndex = 0;
|
||||
|
||||
/*
|
||||
* Initially set BitPolarity to normal polarity. The bit 8 of LED type
|
||||
* is used to change the polarity of the LED.
|
||||
*/
|
||||
|
||||
for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++)
|
||||
Adapter->LEDInfo.LEDState[uiIndex].BitPolarity = 1;
|
||||
|
||||
/*
|
||||
* Read the LED settings of CONFIG file and map it
|
||||
* to GPIO numbers in EEPROM
|
||||
*/
|
||||
Status = ReadConfigFileStructure(Adapter, &bEnableThread);
|
||||
if (STATUS_SUCCESS != Status) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO,
|
||||
DBG_LVL_ALL,
|
||||
"LED Thread: FAILED in ReadConfigFileStructure\n");
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (Adapter->LEDInfo.led_thread_running) {
|
||||
if (bEnableThread) {
|
||||
;
|
||||
} else {
|
||||
Adapter->DriverState = DRIVER_HALT;
|
||||
wake_up(&Adapter->LEDInfo.notify_led_event);
|
||||
Adapter->LEDInfo.led_thread_running =
|
||||
BCM_LED_THREAD_DISABLED;
|
||||
}
|
||||
|
||||
} else if (bEnableThread) {
|
||||
/* Create secondary thread to handle the LEDs */
|
||||
init_waitqueue_head(&Adapter->LEDInfo.notify_led_event);
|
||||
init_waitqueue_head(&Adapter->LEDInfo.idleModeSyncEvent);
|
||||
Adapter->LEDInfo.led_thread_running =
|
||||
BCM_LED_THREAD_RUNNING_ACTIVELY;
|
||||
Adapter->LEDInfo.bIdle_led_off = false;
|
||||
Adapter->LEDInfo.led_cntrl_threadid =
|
||||
kthread_run((int (*)(void *)) LEDControlThread,
|
||||
Adapter, "led_control_thread");
|
||||
if (IS_ERR(Adapter->LEDInfo.led_cntrl_threadid)) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LED_DUMP_INFO,
|
||||
DBG_LVL_ALL,
|
||||
"Not able to spawn Kernel Thread\n");
|
||||
Adapter->LEDInfo.led_thread_running =
|
||||
BCM_LED_THREAD_DISABLED;
|
||||
return PTR_ERR(Adapter->LEDInfo.led_cntrl_threadid);
|
||||
}
|
||||
}
|
||||
return Status;
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
#ifndef _LED_CONTROL_H
|
||||
#define _LED_CONTROL_H
|
||||
|
||||
#define NUM_OF_LEDS 4
|
||||
#define DSD_START_OFFSET 0x0200
|
||||
#define EEPROM_VERSION_OFFSET 0x020E
|
||||
#define EEPROM_HW_PARAM_POINTER_ADDRESS 0x0218
|
||||
#define EEPROM_HW_PARAM_POINTER_ADDRRES_MAP5 0x0220
|
||||
#define GPIO_SECTION_START_OFFSET 0x03
|
||||
#define COMPATIBILITY_SECTION_LENGTH 42
|
||||
#define COMPATIBILITY_SECTION_LENGTH_MAP5 84
|
||||
#define EEPROM_MAP5_MAJORVERSION 5
|
||||
#define EEPROM_MAP5_MINORVERSION 0
|
||||
#define MAX_NUM_OF_BLINKS 10
|
||||
#define NUM_OF_GPIO_PINS 16
|
||||
#define DISABLE_GPIO_NUM 0xFF
|
||||
#define EVENT_SIGNALED 1
|
||||
#define MAX_FILE_NAME_BUFFER_SIZE 100
|
||||
|
||||
#define TURN_ON_LED(ad, GPIO, index) do { \
|
||||
unsigned int gpio_val = GPIO; \
|
||||
(ad->LEDInfo.LEDState[index].BitPolarity == 1) ? \
|
||||
wrmaltWithLock(ad, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val)) : \
|
||||
wrmaltWithLock(ad, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)); \
|
||||
} while (0)
|
||||
|
||||
#define TURN_OFF_LED(ad, GPIO, index) do { \
|
||||
unsigned int gpio_val = GPIO; \
|
||||
(ad->LEDInfo.LEDState[index].BitPolarity == 1) ? \
|
||||
wrmaltWithLock(ad, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)) : \
|
||||
wrmaltWithLock(ad, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val)); \
|
||||
} while (0)
|
||||
|
||||
enum bcm_led_colors {
|
||||
RED_LED = 1,
|
||||
BLUE_LED = 2,
|
||||
YELLOW_LED = 3,
|
||||
GREEN_LED = 4
|
||||
};
|
||||
|
||||
enum bcm_led_events {
|
||||
SHUTDOWN_EXIT = 0x00,
|
||||
DRIVER_INIT = 0x1,
|
||||
FW_DOWNLOAD = 0x2,
|
||||
FW_DOWNLOAD_DONE = 0x4,
|
||||
NO_NETWORK_ENTRY = 0x8,
|
||||
NORMAL_OPERATION = 0x10,
|
||||
LOWPOWER_MODE_ENTER = 0x20,
|
||||
IDLEMODE_CONTINUE = 0x40,
|
||||
IDLEMODE_EXIT = 0x80,
|
||||
LED_THREAD_INACTIVE = 0x100, /* Makes the LED thread Inactivce. It wil be equivallent to putting the thread on hold. */
|
||||
LED_THREAD_ACTIVE = 0x200, /* Makes the LED Thread Active back. */
|
||||
DRIVER_HALT = 0xff
|
||||
}; /* Enumerated values of different driver states */
|
||||
|
||||
/*
|
||||
* Structure which stores the information of different LED types
|
||||
* and corresponding LED state information of driver states
|
||||
*/
|
||||
struct bcm_led_state_info {
|
||||
unsigned char LED_Type; /* specify GPIO number - use 0xFF if not used */
|
||||
unsigned char LED_On_State; /* Bits set or reset for different states */
|
||||
unsigned char LED_Blink_State; /* Bits set or reset for blinking LEDs for different states */
|
||||
unsigned char GPIO_Num;
|
||||
unsigned char BitPolarity; /* To represent whether H/W is normal polarity or reverse polarity */
|
||||
};
|
||||
|
||||
struct bcm_led_info {
|
||||
struct bcm_led_state_info LEDState[NUM_OF_LEDS];
|
||||
bool bIdleMode_tx_from_host; /* Variable to notify whether driver came out from idlemode due to Host or target */
|
||||
bool bIdle_led_off;
|
||||
wait_queue_head_t notify_led_event;
|
||||
wait_queue_head_t idleModeSyncEvent;
|
||||
struct task_struct *led_cntrl_threadid;
|
||||
int led_thread_running;
|
||||
bool bLedInitDone;
|
||||
};
|
||||
|
||||
/* LED Thread state. */
|
||||
#define BCM_LED_THREAD_DISABLED 0 /* LED Thread is not running. */
|
||||
#define BCM_LED_THREAD_RUNNING_ACTIVELY 1 /* LED thread is running. */
|
||||
#define BCM_LED_THREAD_RUNNING_INACTIVELY 2 /* LED thread has been put on hold */
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,286 +0,0 @@
|
|||
/***************************************************************************************
|
||||
*
|
||||
* Copyright (c) Beceem Communications Inc.
|
||||
*
|
||||
* Module Name:
|
||||
* NVM.h
|
||||
*
|
||||
* Abstract:
|
||||
* This file has the prototypes,preprocessors and definitions various NVM libraries.
|
||||
*
|
||||
*
|
||||
* Revision History:
|
||||
* Who When What
|
||||
* -------- -------- ----------------------------------------------
|
||||
* Name Date Created/reviewed/modified
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef _NVM_H_
|
||||
#define _NVM_H_
|
||||
|
||||
struct bcm_flash_cs_info {
|
||||
u32 MagicNumber;
|
||||
/* let the magic number be 0xBECE-F1A5 - F1A5 for "flas-h" */
|
||||
u32 FlashLayoutVersion;
|
||||
u32 ISOImageVersion;
|
||||
u32 SCSIFirmwareVersion;
|
||||
u32 OffsetFromZeroForPart1ISOImage;
|
||||
u32 OffsetFromZeroForScsiFirmware;
|
||||
u32 SizeOfScsiFirmware;
|
||||
u32 OffsetFromZeroForPart2ISOImage;
|
||||
u32 OffsetFromZeroForCalibrationStart;
|
||||
u32 OffsetFromZeroForCalibrationEnd;
|
||||
u32 OffsetFromZeroForVSAStart;
|
||||
u32 OffsetFromZeroForVSAEnd;
|
||||
u32 OffsetFromZeroForControlSectionStart;
|
||||
u32 OffsetFromZeroForControlSectionData;
|
||||
u32 CDLessInactivityTimeout;
|
||||
u32 NewImageSignature;
|
||||
u32 FlashSectorSizeSig;
|
||||
u32 FlashSectorSize;
|
||||
u32 FlashWriteSupportSize;
|
||||
u32 TotalFlashSize;
|
||||
u32 FlashBaseAddr;
|
||||
u32 FlashPartMaxSize;
|
||||
u32 IsCDLessDeviceBootSig;
|
||||
/* MSC Timeout after reset to switch from MSC to NW Mode */
|
||||
u32 MassStorageTimeout;
|
||||
};
|
||||
|
||||
#define FLASH2X_TOTAL_SIZE (64 * 1024 * 1024)
|
||||
#define DEFAULT_SECTOR_SIZE (64 * 1024)
|
||||
|
||||
struct bcm_flash2x_cs_info {
|
||||
/* magic number as 0xBECE-F1A5 - F1A5 for "flas-h" */
|
||||
u32 MagicNumber;
|
||||
u32 FlashLayoutVersion;
|
||||
u32 ISOImageVersion;
|
||||
u32 SCSIFirmwareVersion;
|
||||
u32 OffsetFromZeroForPart1ISOImage;
|
||||
u32 OffsetFromZeroForScsiFirmware;
|
||||
u32 SizeOfScsiFirmware;
|
||||
u32 OffsetFromZeroForPart2ISOImage;
|
||||
u32 OffsetFromZeroForDSDStart;
|
||||
u32 OffsetFromZeroForDSDEnd;
|
||||
u32 OffsetFromZeroForVSAStart;
|
||||
u32 OffsetFromZeroForVSAEnd;
|
||||
u32 OffsetFromZeroForControlSectionStart;
|
||||
u32 OffsetFromZeroForControlSectionData;
|
||||
/* NO Data Activity timeout to switch from MSC to NW Mode */
|
||||
u32 CDLessInactivityTimeout;
|
||||
u32 NewImageSignature;
|
||||
u32 FlashSectorSizeSig;
|
||||
u32 FlashSectorSize;
|
||||
u32 FlashWriteSupportSize;
|
||||
u32 TotalFlashSize;
|
||||
u32 FlashBaseAddr;
|
||||
u32 FlashPartMaxSize;
|
||||
u32 IsCDLessDeviceBootSig;
|
||||
/* MSC Timeout after reset to switch from MSC to NW Mode */
|
||||
u32 MassStorageTimeout;
|
||||
/* Flash Map 2.0 Field */
|
||||
u32 OffsetISOImage1Part1Start;
|
||||
u32 OffsetISOImage1Part1End;
|
||||
u32 OffsetISOImage1Part2Start;
|
||||
u32 OffsetISOImage1Part2End;
|
||||
u32 OffsetISOImage1Part3Start;
|
||||
u32 OffsetISOImage1Part3End;
|
||||
u32 OffsetISOImage2Part1Start;
|
||||
u32 OffsetISOImage2Part1End;
|
||||
u32 OffsetISOImage2Part2Start;
|
||||
u32 OffsetISOImage2Part2End;
|
||||
u32 OffsetISOImage2Part3Start;
|
||||
u32 OffsetISOImage2Part3End;
|
||||
/* DSD Header offset from start of DSD */
|
||||
u32 OffsetFromDSDStartForDSDHeader;
|
||||
u32 OffsetFromZeroForDSD1Start;
|
||||
u32 OffsetFromZeroForDSD1End;
|
||||
u32 OffsetFromZeroForDSD2Start;
|
||||
u32 OffsetFromZeroForDSD2End;
|
||||
u32 OffsetFromZeroForVSA1Start;
|
||||
u32 OffsetFromZeroForVSA1End;
|
||||
u32 OffsetFromZeroForVSA2Start;
|
||||
u32 OffsetFromZeroForVSA2End;
|
||||
/*
|
||||
* ACCESS_BITS_PER_SECTOR 2
|
||||
* ACCESS_RW 0
|
||||
* ACCESS_RO 1
|
||||
* ACCESS_RESVD 2
|
||||
* ACCESS_RESVD 3
|
||||
*/
|
||||
u32 SectorAccessBitMap[FLASH2X_TOTAL_SIZE / (DEFAULT_SECTOR_SIZE * 16)];
|
||||
/* All expansions to the control data structure should add here */
|
||||
};
|
||||
|
||||
struct bcm_vendor_section_info {
|
||||
u32 OffsetFromZeroForSectionStart;
|
||||
u32 OffsetFromZeroForSectionEnd;
|
||||
u32 AccessFlags;
|
||||
u32 Reserved[16];
|
||||
};
|
||||
|
||||
struct bcm_flash2x_vendor_info {
|
||||
struct bcm_vendor_section_info VendorSection[TOTAL_SECTIONS];
|
||||
u32 Reserved[16];
|
||||
};
|
||||
|
||||
struct bcm_dsd_header {
|
||||
u32 DSDImageSize;
|
||||
u32 DSDImageCRC;
|
||||
u32 DSDImagePriority;
|
||||
/* We should not consider right now. Reading reserve is worthless. */
|
||||
u32 Reserved[252]; /* Resvd for DSD Header */
|
||||
u32 DSDImageMagicNumber;
|
||||
};
|
||||
|
||||
struct bcm_iso_header {
|
||||
u32 ISOImageMagicNumber;
|
||||
u32 ISOImageSize;
|
||||
u32 ISOImageCRC;
|
||||
u32 ISOImagePriority;
|
||||
/* We should not consider right now. Reading reserve is worthless. */
|
||||
u32 Reserved[60]; /* Resvd for ISO Header extension */
|
||||
};
|
||||
|
||||
#define EEPROM_BEGIN_CIS (0)
|
||||
#define EEPROM_BEGIN_NON_CIS (0x200)
|
||||
#define EEPROM_END (0x2000)
|
||||
#define INIT_PARAMS_SIGNATURE (0x95a7a597)
|
||||
#define MAX_INIT_PARAMS_LENGTH (2048)
|
||||
#define MAC_ADDRESS_OFFSET 0x200
|
||||
|
||||
#define INIT_PARAMS_1_SIGNATURE_ADDRESS EEPROM_BEGIN_NON_CIS
|
||||
#define INIT_PARAMS_1_DATA_ADDRESS (INIT_PARAMS_1_SIGNATURE_ADDRESS+16)
|
||||
#define INIT_PARAMS_1_MACADDRESS_ADDRESS (MAC_ADDRESS_OFFSET)
|
||||
#define INIT_PARAMS_1_LENGTH_ADDRESS (INIT_PARAMS_1_SIGNATURE_ADDRESS+4)
|
||||
|
||||
#define INIT_PARAMS_2_SIGNATURE_ADDRESS (EEPROM_BEGIN_NON_CIS + 2048 + 16)
|
||||
#define INIT_PARAMS_2_DATA_ADDRESS (INIT_PARAMS_2_SIGNATURE_ADDRESS + 16)
|
||||
#define INIT_PARAMS_2_MACADDRESS_ADDRESS (INIT_PARAMS_2_SIGNATURE_ADDRESS + 8)
|
||||
#define INIT_PARAMS_2_LENGTH_ADDRESS (INIT_PARAMS_2_SIGNATURE_ADDRESS + 4)
|
||||
|
||||
#define EEPROM_SPI_DEV_CONFIG_REG 0x0F003000
|
||||
#define EEPROM_SPI_Q_STATUS1_REG 0x0F003004
|
||||
#define EEPROM_SPI_Q_STATUS1_MASK_REG 0x0F00300C
|
||||
|
||||
#define EEPROM_SPI_Q_STATUS_REG 0x0F003008
|
||||
#define EEPROM_CMDQ_SPI_REG 0x0F003018
|
||||
#define EEPROM_WRITE_DATAQ_REG 0x0F00301C
|
||||
#define EEPROM_READ_DATAQ_REG 0x0F003020
|
||||
#define SPI_FLUSH_REG 0x0F00304C
|
||||
|
||||
#define EEPROM_WRITE_ENABLE 0x06000000
|
||||
#define EEPROM_READ_STATUS_REGISTER 0x05000000
|
||||
#define EEPROM_16_BYTE_PAGE_WRITE 0xFA000000
|
||||
#define EEPROM_WRITE_QUEUE_EMPTY 0x00001000
|
||||
#define EEPROM_WRITE_QUEUE_AVAIL 0x00002000
|
||||
#define EEPROM_WRITE_QUEUE_FULL 0x00004000
|
||||
#define EEPROM_16_BYTE_PAGE_READ 0xFB000000
|
||||
#define EEPROM_4_BYTE_PAGE_READ 0x3B000000
|
||||
|
||||
#define EEPROM_CMD_QUEUE_FLUSH 0x00000001
|
||||
#define EEPROM_WRITE_QUEUE_FLUSH 0x00000002
|
||||
#define EEPROM_READ_QUEUE_FLUSH 0x00000004
|
||||
#define EEPROM_ETH_QUEUE_FLUSH 0x00000008
|
||||
#define EEPROM_ALL_QUEUE_FLUSH 0x0000000f
|
||||
#define EEPROM_READ_ENABLE 0x06000000
|
||||
#define EEPROM_16_BYTE_PAGE_WRITE 0xFA000000
|
||||
#define EEPROM_READ_DATA_FULL 0x00000010
|
||||
#define EEPROM_READ_DATA_AVAIL 0x00000020
|
||||
#define EEPROM_READ_QUEUE_EMPTY 0x00000002
|
||||
#define EEPROM_CMD_QUEUE_EMPTY 0x00000100
|
||||
#define EEPROM_CMD_QUEUE_AVAIL 0x00000200
|
||||
#define EEPROM_CMD_QUEUE_FULL 0x00000400
|
||||
|
||||
/* Most EEPROM status register bit 0 indicates if the EEPROM is busy
|
||||
* with a write if set 1. See the details of the EEPROM Status Register
|
||||
* in the EEPROM data sheet.
|
||||
*/
|
||||
#define EEPROM_STATUS_REG_WRITE_BUSY 0x00000001
|
||||
|
||||
/* We will have 1 mSec for every RETRIES_PER_DELAY count and have a max attempts of MAX_EEPROM_RETRIES
|
||||
* This will give us 80 mSec minimum of delay = 80mSecs
|
||||
*/
|
||||
#define MAX_EEPROM_RETRIES 80
|
||||
#define RETRIES_PER_DELAY 64
|
||||
#define MAX_RW_SIZE 0x10
|
||||
#define MAX_READ_SIZE 0x10
|
||||
#define MAX_SECTOR_SIZE (512 * 1024)
|
||||
#define MIN_SECTOR_SIZE (1024)
|
||||
#define FLASH_SECTOR_SIZE_OFFSET 0xEFFFC
|
||||
#define FLASH_SECTOR_SIZE_SIG_OFFSET 0xEFFF8
|
||||
#define FLASH_SECTOR_SIZE_SIG 0xCAFEBABE
|
||||
#define FLASH_CS_INFO_START_ADDR 0xFF0000
|
||||
#define FLASH_CONTROL_STRUCT_SIGNATURE 0xBECEF1A5
|
||||
#define SCSI_FIRMWARE_MAJOR_VERSION 0x1
|
||||
#define SCSI_FIRMWARE_MINOR_VERSION 0x5
|
||||
#define BYTE_WRITE_SUPPORT 0x1
|
||||
#define FLASH_AUTO_INIT_BASE_ADDR 0xF00000
|
||||
#define FLASH_CONTIGIOUS_START_ADDR_AFTER_INIT 0x1C000000
|
||||
#define FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT 0x1F000000
|
||||
#define FLASH_CONTIGIOUS_START_ADDR_BCS350 0x08000000
|
||||
#define FLASH_CONTIGIOUS_END_ADDR_BCS350 0x08FFFFFF
|
||||
#define FLASH_SIZE_ADDR 0xFFFFEC
|
||||
#define FLASH_SPI_CMDQ_REG 0xAF003040
|
||||
#define FLASH_SPI_WRITEQ_REG 0xAF003044
|
||||
#define FLASH_SPI_READQ_REG 0xAF003048
|
||||
#define FLASH_CONFIG_REG 0xAF003050
|
||||
#define FLASH_GPIO_CONFIG_REG 0xAF000030
|
||||
#define FLASH_CMD_WRITE_ENABLE 0x06
|
||||
#define FLASH_CMD_READ_ENABLE 0x03
|
||||
#define FLASH_CMD_RESET_WRITE_ENABLE 0x04
|
||||
#define FLASH_CMD_STATUS_REG_READ 0x05
|
||||
#define FLASH_CMD_STATUS_REG_WRITE 0x01
|
||||
#define FLASH_CMD_READ_ID 0x9F
|
||||
#define PAD_SELECT_REGISTER 0xAF000410
|
||||
#define FLASH_PART_SST25VF080B 0xBF258E
|
||||
#define EEPROM_CAL_DATA_INTERNAL_LOC 0xbFB00008
|
||||
#define EEPROM_CALPARAM_START 0x200
|
||||
#define EEPROM_SIZE_OFFSET 524
|
||||
|
||||
/* As Read/Write time vaires from 1.5 to 3.0 ms.
|
||||
* so After Ignoring the rdm/wrm time(that is dependent on many factor like interface etc.),
|
||||
* here time calculated meets the worst case delay, 3.0 ms
|
||||
*/
|
||||
#define MAX_FLASH_RETRIES 4
|
||||
#define FLASH_PER_RETRIES_DELAY 16
|
||||
#define EEPROM_MAX_CAL_AREA_SIZE 0xF0000
|
||||
#define BECM ntohl(0x4245434d)
|
||||
#define FLASH_2X_MAJOR_NUMBER 0x2
|
||||
#define DSD_IMAGE_MAGIC_NUMBER 0xBECE0D5D
|
||||
#define ISO_IMAGE_MAGIC_NUMBER 0xBECE0150
|
||||
#define NON_CDLESS_DEVICE_BOOT_SIG 0xBECEB007
|
||||
|
||||
#define MINOR_VERSION(x) ((x >> 16) & 0xFFFF)
|
||||
#define MAJOR_VERSION(x) (x & 0xFFFF)
|
||||
|
||||
#define CORRUPTED_PATTERN 0x0
|
||||
#define UNINIT_PTR_IN_CS 0xBBBBDDDD
|
||||
#define VENDOR_PTR_IN_CS 0xAAAACCCC
|
||||
#define FLASH2X_SECTION_PRESENT (1 << 0)
|
||||
#define FLASH2X_SECTION_VALID (1 << 1)
|
||||
#define FLASH2X_SECTION_RO (1 << 2)
|
||||
#define FLASH2X_SECTION_ACT (1 << 3)
|
||||
#define SECTOR_IS_NOT_WRITABLE STATUS_FAILURE
|
||||
#define INVALID_OFFSET STATUS_FAILURE
|
||||
#define INVALID_SECTION STATUS_FAILURE
|
||||
#define SECTOR_1K 1024
|
||||
#define SECTOR_64K (64 * SECTOR_1K)
|
||||
#define SECTOR_128K (2 * SECTOR_64K)
|
||||
#define SECTOR_256k (2 * SECTOR_128K)
|
||||
#define SECTOR_512K (2 * SECTOR_256k)
|
||||
#define FLASH_PART_SIZE (16 * 1024 * 1024)
|
||||
#define RESET_CHIP_SELECT -1
|
||||
#define CHIP_SELECT_BIT12 12
|
||||
#define SECTOR_READWRITE_PERMISSION 0
|
||||
#define SECTOR_READONLY 1
|
||||
#define SIGNATURE_SIZE 4
|
||||
#define DEFAULT_BUFF_SIZE 0x10000
|
||||
|
||||
#define FIELD_OFFSET_IN_HEADER(HeaderPointer, Field) ((u8 *)&((HeaderPointer)(NULL))->Field - (u8 *)(NULL))
|
||||
|
||||
#endif
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
#include "headers.h"
|
||||
#include <linux/sort.h>
|
||||
|
||||
/*
|
||||
* File Name: sort.c
|
||||
*
|
||||
* Author: Beceem Communications Pvt. Ltd
|
||||
*
|
||||
* Abstract: This file contains the routines sorting the classification rules.
|
||||
*
|
||||
* Copyright (c) 2007 Beceem Communications Pvt. Ltd
|
||||
*/
|
||||
|
||||
static int compare_packet_info(void const *a, void const *b)
|
||||
{
|
||||
struct bcm_packet_info const *pa = a;
|
||||
struct bcm_packet_info const *pb = b;
|
||||
|
||||
if (!pa->bValid || !pb->bValid)
|
||||
return 0;
|
||||
|
||||
return pa->u8TrafficPriority - pb->u8TrafficPriority;
|
||||
}
|
||||
|
||||
VOID SortPackInfo(struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG,
|
||||
DBG_LVL_ALL, "<=======");
|
||||
|
||||
sort(Adapter->PackInfo, NO_OF_QUEUES, sizeof(struct bcm_packet_info),
|
||||
compare_packet_info, NULL);
|
||||
}
|
||||
|
||||
static int compare_classifiers(void const *a, void const *b)
|
||||
{
|
||||
struct bcm_classifier_rule const *pa = a;
|
||||
struct bcm_classifier_rule const *pb = b;
|
||||
|
||||
if (!pa->bUsed || !pb->bUsed)
|
||||
return 0;
|
||||
|
||||
return pa->u8ClassifierRulePriority - pb->u8ClassifierRulePriority;
|
||||
}
|
||||
|
||||
VOID SortClassifiers(struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG,
|
||||
DBG_LVL_ALL, "<=======");
|
||||
|
||||
sort(Adapter->astClassifierTable, MAX_CLASSIFIERS,
|
||||
sizeof(struct bcm_classifier_rule), compare_classifiers, NULL);
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
#ifndef TARGET_PARAMS_H
|
||||
#define TARGET_PARAMS_H
|
||||
|
||||
struct bcm_target_params {
|
||||
u32 m_u32CfgVersion;
|
||||
u32 m_u32CenterFrequency;
|
||||
u32 m_u32BandAScan;
|
||||
u32 m_u32BandBScan;
|
||||
u32 m_u32BandCScan;
|
||||
u32 m_u32ErtpsOptions;
|
||||
u32 m_u32PHSEnable;
|
||||
u32 m_u32HoEnable;
|
||||
u32 m_u32HoReserved1;
|
||||
u32 m_u32HoReserved2;
|
||||
u32 m_u32MimoEnable;
|
||||
u32 m_u32SecurityEnable;
|
||||
u32 m_u32PowerSavingModesEnable; /* bit 1: 1 Idlemode enable; bit2: 1 Sleepmode Enable */
|
||||
/* PowerSaving Mode Options:
|
||||
* bit 0 = 1: CPE mode - to keep pcmcia if alive;
|
||||
* bit 1 = 1: CINR reporting in Idlemode Msg
|
||||
* bit 2 = 1: Default PSC Enable in sleepmode
|
||||
*/
|
||||
u32 m_u32PowerSavingModeOptions;
|
||||
u32 m_u32ArqEnable;
|
||||
/* From Version #3, the HARQ section renamed as general */
|
||||
u32 m_u32HarqEnable;
|
||||
u32 m_u32EEPROMFlag;
|
||||
/* BINARY TYPE - 4th MSByte: Interface Type - 3rd MSByte: Vendor Type - 2nd MSByte
|
||||
* Unused - LSByte
|
||||
*/
|
||||
u32 m_u32Customize;
|
||||
u32 m_u32ConfigBW; /* In Hz */
|
||||
u32 m_u32ShutDownInitThresholdTimer;
|
||||
u32 m_u32RadioParameter;
|
||||
u32 m_u32PhyParameter1;
|
||||
u32 m_u32PhyParameter2;
|
||||
u32 m_u32PhyParameter3;
|
||||
u32 m_u32TestOptions; /* in eval mode only; lower 16bits = basic cid for testing; then bit 16 is test cqich,bit 17 test init rang; bit 18 test periodic rang and bit 19 is test harq ack/nack */
|
||||
u32 m_u32MaxMACDataperDLFrame;
|
||||
u32 m_u32MaxMACDataperULFrame;
|
||||
u32 m_u32Corr2MacFlags;
|
||||
u32 HostDrvrConfig1;
|
||||
u32 HostDrvrConfig2;
|
||||
u32 HostDrvrConfig3;
|
||||
u32 HostDrvrConfig4;
|
||||
u32 HostDrvrConfig5;
|
||||
u32 HostDrvrConfig6;
|
||||
u32 m_u32SegmentedPUSCenable;
|
||||
/* removed SHUT down related 'unused' params from here to sync 4.x and 5.x CFG files..
|
||||
* BAMC Related Parameters
|
||||
* Bit 0-15 Band AMC signaling configuration: Bit 1 = 1 Enable Band AMC signaling.
|
||||
* bit 16-31 Band AMC Data configuration: Bit 16 = 1 Band AMC 2x3 support.
|
||||
*/
|
||||
u32 m_u32BandAMCEnable;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,145 +0,0 @@
|
|||
#include "headers.h"
|
||||
/*
|
||||
* Procedure: vendorextnGetSectionInfo
|
||||
*
|
||||
* Description: Finds the type of NVM used.
|
||||
*
|
||||
* Arguments:
|
||||
* Adapter - ptr to Adapter object instance
|
||||
* pNVMType - ptr to NVM type.
|
||||
* Returns:
|
||||
* STATUS_SUCCESS/STATUS_FAILURE
|
||||
*
|
||||
*/
|
||||
INT vendorextnGetSectionInfo(PVOID pContext,
|
||||
struct bcm_flash2x_vendor_info *pVendorInfo)
|
||||
{
|
||||
return STATUS_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Procedure: vendorextnInit
|
||||
*
|
||||
* Description: Initializing the vendor extension NVM interface
|
||||
*
|
||||
* Arguments:
|
||||
* Adapter - Pointer to MINI Adapter Structure
|
||||
* Returns:
|
||||
* STATUS_SUCCESS/STATUS_FAILURE
|
||||
*
|
||||
*
|
||||
*/
|
||||
INT vendorextnInit(struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Procedure: vendorextnExit
|
||||
*
|
||||
* Description: Free the resource associated with vendor extension NVM interface
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* Returns:
|
||||
* STATUS_SUCCESS/STATUS_FAILURE
|
||||
*
|
||||
*
|
||||
*/
|
||||
INT vendorextnExit(struct bcm_mini_adapter *Adapter)
|
||||
{
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Procedure: vendorextnIoctl
|
||||
*
|
||||
* Description: execute the vendor extension specific ioctl
|
||||
*
|
||||
* Arguments:
|
||||
* Adapter -Beceem private Adapter Structure
|
||||
* cmd -vendor extension specific Ioctl commad
|
||||
* arg -input parameter sent by vendor
|
||||
*
|
||||
* Returns:
|
||||
* CONTINUE_COMMON_PATH in case it is not meant to be processed
|
||||
* by vendor ioctls
|
||||
* STATUS_SUCCESS/STATUS_FAILURE as per the IOCTL return value
|
||||
*/
|
||||
|
||||
INT vendorextnIoctl(struct bcm_mini_adapter *Adapter, UINT cmd, ULONG arg)
|
||||
{
|
||||
return CONTINUE_COMMON_PATH;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Procedure: vendorextnReadSection
|
||||
*
|
||||
* Description: Reads from a section of NVM
|
||||
*
|
||||
* Arguments:
|
||||
* pContext - ptr to Adapter object instance
|
||||
* pBuffer - Read the data from Vendor Area to this buffer
|
||||
* SectionVal - Value of type of Section
|
||||
* Offset - Read from the Offset of the Vendor Section.
|
||||
* numOfBytes - Read numOfBytes from the Vendor section to Buffer
|
||||
*
|
||||
* Returns:
|
||||
* STATUS_SUCCESS/STATUS_FAILURE
|
||||
*/
|
||||
|
||||
INT vendorextnReadSection(PVOID pContext, PUCHAR pBuffer,
|
||||
enum bcm_flash2x_section_val SectionVal, UINT offset, UINT numOfBytes)
|
||||
{
|
||||
return STATUS_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Procedure: vendorextnWriteSection
|
||||
*
|
||||
* Description: Write to a Section of NVM
|
||||
*
|
||||
* Arguments:
|
||||
* pContext - ptr to Adapter object instance
|
||||
* pBuffer - Write the data provided in the buffer
|
||||
* SectionVal - Value of type of Section
|
||||
* Offset - Writes to the Offset of the Vendor Section.
|
||||
* numOfBytes - Write num Bytes after reading from pBuffer.
|
||||
* bVerify - the Buffer Written should be verified.
|
||||
*
|
||||
* Returns:
|
||||
* STATUS_SUCCESS/STATUS_FAILURE
|
||||
*/
|
||||
INT vendorextnWriteSection(PVOID pContext, PUCHAR pBuffer,
|
||||
enum bcm_flash2x_section_val SectionVal, UINT offset,
|
||||
UINT numOfBytes, bool bVerify)
|
||||
{
|
||||
return STATUS_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Procedure: vendorextnWriteSectionWithoutErase
|
||||
*
|
||||
* Description: Write to a Section of NVM without erasing the sector
|
||||
*
|
||||
* Arguments:
|
||||
* pContext - ptr to Adapter object instance
|
||||
* pBuffer - Write the data provided in the buffer
|
||||
* SectionVal - Value of type of Section
|
||||
* Offset - Writes to the Offset of the Vendor Section.
|
||||
* numOfBytes - Write num Bytes after reading from pBuffer.
|
||||
*
|
||||
* Returns:
|
||||
* STATUS_SUCCESS/STATUS_FAILURE
|
||||
*/
|
||||
INT vendorextnWriteSectionWithoutErase(PVOID pContext, PUCHAR pBuffer,
|
||||
enum bcm_flash2x_section_val SectionVal, UINT offset, UINT numOfBytes)
|
||||
{
|
||||
return STATUS_FAILURE;
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
|
||||
#ifndef __VENDOR_EXTN_NVM_H__
|
||||
#define __VENDOR_EXTN_NVM_H__
|
||||
|
||||
#define CONTINUE_COMMON_PATH 0xFFFF
|
||||
|
||||
INT vendorextnGetSectionInfo(PVOID pContext, struct bcm_flash2x_vendor_info *pVendorInfo);
|
||||
INT vendorextnExit(struct bcm_mini_adapter *Adapter);
|
||||
INT vendorextnInit(struct bcm_mini_adapter *Adapter);
|
||||
INT vendorextnIoctl(struct bcm_mini_adapter *Adapter, UINT cmd, ULONG arg);
|
||||
INT vendorextnReadSection(PVOID pContext, PUCHAR pBuffer, enum bcm_flash2x_section_val SectionVal,
|
||||
UINT offset, UINT numOfBytes);
|
||||
INT vendorextnWriteSection(PVOID pContext, PUCHAR pBuffer, enum bcm_flash2x_section_val SectionVal,
|
||||
UINT offset, UINT numOfBytes, bool bVerify);
|
||||
INT vendorextnWriteSectionWithoutErase(PVOID pContext, PUCHAR pBuffer, enum bcm_flash2x_section_val SectionVal,
|
||||
UINT offset, UINT numOfBytes);
|
||||
|
||||
#endif /* */
|
Loading…
Reference in New Issue