blob: 5dfdf5a4411d35d9625b01e94e8e8ad6ec42db3d [file] [log] [blame]
Stephen Hemmingerf8942e02010-09-08 14:46:36 -07001/***********************************
2* Adapter.h
3************************************/
4#ifndef __ADAPTER_H__
5#define __ADAPTER_H__
6
7#define MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES 256
8#include "Debug.h"
9
Kevin McKinneyff352042012-05-26 12:05:11 -040010struct bcm_leader {
Kevin McKinney90942142012-05-18 08:50:55 -040011 USHORT Vcid;
12 USHORT PLength;
13 UCHAR Status;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070014 UCHAR Unused[3];
Kevin McKinneye1325ad2012-05-18 08:50:57 -040015} __packed;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070016
Kevin McKinneya8699932012-05-26 12:05:10 -040017struct bcm_packettosend {
Kevin McKinneyff352042012-05-26 12:05:11 -040018 struct bcm_leader Leader;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070019 UCHAR ucPayload;
Kevin McKinneye1325ad2012-05-18 08:50:57 -040020} __packed;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070021
Kevin McKinneyc1975ed2012-05-26 12:05:09 -040022struct bcm_control_packet {
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070023 PVOID ControlBuff;
24 UINT ControlBuffLen;
Kevin McKinneyc1975ed2012-05-26 12:05:09 -040025 struct bcm_control_packet *next;
Kevin McKinneye1325ad2012-05-18 08:50:57 -040026} __packed;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070027
Kevin McKinney2610c7a2012-05-26 12:05:08 -040028struct bcm_link_request {
Kevin McKinneyff352042012-05-26 12:05:11 -040029 struct bcm_leader Leader;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070030 UCHAR szData[4];
Kevin McKinneye1325ad2012-05-18 08:50:57 -040031} __packed;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070032
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070033#define MAX_IP_RANGE_LENGTH 4
34#define MAX_PORT_RANGE 4
35#define MAX_PROTOCOL_LENGTH 32
36#define IPV6_ADDRESS_SIZEINBYTES 0x10
37
Himangi Saraogid5a49962013-10-29 06:28:03 +053038union u_ip_address {
Kevin McKinney90942142012-05-18 08:50:55 -040039 struct {
Kevin McKinney5db647a2012-05-18 08:50:56 -040040 ULONG ulIpv4Addr[MAX_IP_RANGE_LENGTH]; /* Source Ip Address Range */
41 ULONG ulIpv4Mask[MAX_IP_RANGE_LENGTH]; /* Source Ip Mask Address Range */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070042 };
Kevin McKinneyc71e0a62012-05-18 08:50:54 -040043 struct {
Kevin McKinney5db647a2012-05-18 08:50:56 -040044 ULONG ulIpv6Addr[MAX_IP_RANGE_LENGTH * 4]; /* Source Ip Address Range */
45 ULONG ulIpv6Mask[MAX_IP_RANGE_LENGTH * 4]; /* Source Ip Mask Address Range */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070046 };
Kevin McKinneyc71e0a62012-05-18 08:50:54 -040047 struct {
Kevin McKinney90942142012-05-18 08:50:55 -040048 UCHAR ucIpv4Address[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS];
49 UCHAR ucIpv4Mask[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS];
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070050 };
Kevin McKinneyc71e0a62012-05-18 08:50:54 -040051 struct {
Kevin McKinney90942142012-05-18 08:50:55 -040052 UCHAR ucIpv6Address[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES];
53 UCHAR ucIpv6Mask[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES];
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070054 };
Himangi Saraogid5a49962013-10-29 06:28:03 +053055};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070056
Peter Meerwaldb38e2742012-06-13 20:44:35 +020057struct bcm_hdr_suppression_contextinfo {
58 UCHAR ucaHdrSuppressionInBuf[MAX_PHS_LENGTHS]; /* Intermediate buffer to accumulate pkt Header for PHS */
59 UCHAR ucaHdrSuppressionOutBuf[MAX_PHS_LENGTHS + PHSI_LEN]; /* Intermediate buffer containing pkt Header after PHS */
Kevin McKinneyf4284502012-05-26 12:05:04 -040060};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070061
Kevin McKinney92562ae2012-05-26 12:05:03 -040062struct bcm_classifier_rule {
Kevin McKinney90942142012-05-18 08:50:55 -040063 ULONG ulSFID;
64 UCHAR ucReserved[2];
65 B_UINT16 uiClassifierRuleIndex;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -070066 bool bUsed;
Kevin McKinney90942142012-05-18 08:50:55 -040067 USHORT usVCID_Value;
Kevin McKinney5db647a2012-05-18 08:50:56 -040068 B_UINT8 u8ClassifierRulePriority; /* This field detemines the Classifier Priority */
Himangi Saraogid5a49962013-10-29 06:28:03 +053069 union u_ip_address stSrcIpAddress;
Kevin McKinney5db647a2012-05-18 08:50:56 -040070 UCHAR ucIPSourceAddressLength; /* Ip Source Address Length */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070071
Himangi Saraogid5a49962013-10-29 06:28:03 +053072 union u_ip_address stDestIpAddress;
Kevin McKinney5db647a2012-05-18 08:50:56 -040073 UCHAR ucIPDestinationAddressLength; /* Ip Destination Address Length */
74 UCHAR ucIPTypeOfServiceLength; /* Type of service Length */
75 UCHAR ucTosLow; /* Tos Low */
76 UCHAR ucTosHigh; /* Tos High */
77 UCHAR ucTosMask; /* Tos Mask */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070078
Kevin McKinney5db647a2012-05-18 08:50:56 -040079 UCHAR ucProtocolLength; /* protocol Length */
80 UCHAR ucProtocol[MAX_PROTOCOL_LENGTH]; /* protocol Length */
Kevin McKinney90942142012-05-18 08:50:55 -040081 USHORT usSrcPortRangeLo[MAX_PORT_RANGE];
82 USHORT usSrcPortRangeHi[MAX_PORT_RANGE];
83 UCHAR ucSrcPortRangeLength;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070084
Kevin McKinney90942142012-05-18 08:50:55 -040085 USHORT usDestPortRangeLo[MAX_PORT_RANGE];
86 USHORT usDestPortRangeHi[MAX_PORT_RANGE];
87 UCHAR ucDestPortRangeLength;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070088
Lisa Nguyen3abd6f12013-10-28 01:35:59 -070089 bool bProtocolValid;
90 bool bTOSValid;
91 bool bDestIpValid;
92 bool bSrcIpValid;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070093
Kevin McKinney5db647a2012-05-18 08:50:56 -040094 /* For IPv6 Addressing */
Kevin McKinney90942142012-05-18 08:50:55 -040095 UCHAR ucDirection;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -070096 bool bIpv6Protocol;
Kevin McKinney90942142012-05-18 08:50:55 -040097 UINT32 u32PHSRuleID;
Kevin McKinneya903d652012-12-20 00:31:34 -050098 struct bcm_phs_rule sPhsRule;
Kevin McKinney90942142012-05-18 08:50:55 -040099 UCHAR u8AssociatedPHSI;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700100
Kevin McKinney5db647a2012-05-18 08:50:56 -0400101 /* Classification fields for ETH CS */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700102 UCHAR ucEthCSSrcMACLen;
103 UCHAR au8EThCSSrcMAC[MAC_ADDRESS_SIZE];
104 UCHAR au8EThCSSrcMACMask[MAC_ADDRESS_SIZE];
105 UCHAR ucEthCSDestMACLen;
106 UCHAR au8EThCSDestMAC[MAC_ADDRESS_SIZE];
107 UCHAR au8EThCSDestMACMask[MAC_ADDRESS_SIZE];
108 UCHAR ucEtherTypeLen;
109 UCHAR au8EthCSEtherType[NUM_ETHERTYPE_BYTES];
110 UCHAR usUserPriority[2];
111 USHORT usVLANID;
112 USHORT usValidityBitMap;
Kevin McKinney92562ae2012-05-26 12:05:03 -0400113};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700114
Kevin McKinney7f224852012-05-26 12:05:02 -0400115struct bcm_fragmented_packet_info {
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700116 bool bUsed;
Kevin McKinney90942142012-05-18 08:50:55 -0400117 ULONG ulSrcIpAddress;
118 USHORT usIpIdentification;
Kevin McKinney92562ae2012-05-26 12:05:03 -0400119 struct bcm_classifier_rule *pstMatchedClassifierEntry;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700120 bool bOutOfOrderFragment;
Kevin McKinney7f224852012-05-26 12:05:02 -0400121};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700122
Kevin McKinney0b3edf72012-05-26 12:05:01 -0400123struct bcm_packet_info {
Kevin McKinney5db647a2012-05-18 08:50:56 -0400124 /* classification extension Rule */
Kevin McKinney90942142012-05-18 08:50:55 -0400125 ULONG ulSFID;
126 USHORT usVCID_Value;
127 UINT uiThreshold;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400128 /* This field determines the priority of the SF Queues */
Kevin McKinney90942142012-05-18 08:50:55 -0400129 B_UINT8 u8TrafficPriority;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700130
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700131 bool bValid;
132 bool bActive;
133 bool bActivateRequestSent;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700134
Kevin McKinney5db647a2012-05-18 08:50:56 -0400135 B_UINT8 u8QueueType; /* BE or rtPS */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700136
Kevin McKinney5db647a2012-05-18 08:50:56 -0400137 UINT uiMaxBucketSize; /* maximum size of the bucket for the queue */
Kevin McKinney90942142012-05-18 08:50:55 -0400138 UINT uiCurrentQueueDepthOnTarget;
139 UINT uiCurrentBytesOnHost;
140 UINT uiCurrentPacketsOnHost;
141 UINT uiDroppedCountBytes;
142 UINT uiDroppedCountPackets;
143 UINT uiSentBytes;
144 UINT uiSentPackets;
145 UINT uiCurrentDrainRate;
146 UINT uiThisPeriodSentBytes;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700147 LARGE_INTEGER liDrainCalculated;
Kevin McKinney90942142012-05-18 08:50:55 -0400148 UINT uiCurrentTokenCount;
149 LARGE_INTEGER liLastUpdateTokenAt;
150 UINT uiMaxAllowedRate;
151 UINT NumOfPacketsSent;
152 UCHAR ucDirection;
153 USHORT usCID;
Kevin McKinney8c7d51a2012-11-25 19:28:59 -0500154 struct bcm_mibs_parameters stMibsExtServiceFlowTable;
Kevin McKinney90942142012-05-18 08:50:55 -0400155 UINT uiCurrentRxRate;
156 UINT uiThisPeriodRxBytes;
157 UINT uiTotalRxBytes;
158 UINT uiTotalTxBytes;
159 UINT uiPendedLast;
160 UCHAR ucIpVersion;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700161
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400162 union {
163 struct {
Kevin McKinney90942142012-05-18 08:50:55 -0400164 struct sk_buff *FirstTxQueue;
165 struct sk_buff *LastTxQueue;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700166 };
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400167 struct {
Kevin McKinney90942142012-05-18 08:50:55 -0400168 struct sk_buff *ControlHead;
169 struct sk_buff *ControlTail;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700170 };
171 };
Kevin McKinney90942142012-05-18 08:50:55 -0400172
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700173 bool bProtocolValid;
174 bool bTOSValid;
175 bool bDestIpValid;
176 bool bSrcIpValid;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700177
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700178 bool bActiveSet;
179 bool bAdmittedSet;
180 bool bAuthorizedSet;
181 bool bClassifierPriority;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700182 UCHAR ucServiceClassName[MAX_CLASS_NAME_LENGTH];
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700183 bool bHeaderSuppressionEnabled;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700184 spinlock_t SFQueueLock;
Kevin McKinney90942142012-05-18 08:50:55 -0400185 void *pstSFIndication;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700186 struct timeval stLastUpdateTokenAt;
Kevin McKinney90942142012-05-18 08:50:55 -0400187 atomic_t uiPerSFTxResourceCount;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700188 UINT uiMaxLatency;
Kevin McKinney90942142012-05-18 08:50:55 -0400189 UCHAR bIPCSSupport;
190 UCHAR bEthCSSupport;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700191};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700192
Kevin McKinney774bea82012-05-26 12:05:00 -0400193struct bcm_tarang_data {
194 struct bcm_tarang_data *next;
Kevin McKinney29794602012-05-26 12:05:12 -0400195 struct bcm_mini_adapter *Adapter;
Kevin McKinney90942142012-05-18 08:50:55 -0400196 struct sk_buff *RxAppControlHead;
197 struct sk_buff *RxAppControlTail;
Kevin McKinney26cd2302012-05-18 08:50:59 -0400198 int AppCtrlQueueLen;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700199 bool MacTracingEnabled;
200 bool bApplicationToExit;
Kevin McKinney2790a3c2012-11-25 19:28:57 -0500201 struct bcm_mibs_dropped_cntrl_msg stDroppedAppCntrlMsgs;
Kevin McKinney90942142012-05-18 08:50:55 -0400202 ULONG RxCntrlMsgBitMask;
Kevin McKinney774bea82012-05-26 12:05:00 -0400203};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700204
Kevin McKinney37531642012-05-26 12:04:58 -0400205struct bcm_targetdsx_buffer {
Kevin McKinney90942142012-05-18 08:50:55 -0400206 ULONG ulTargetDsxBuffer;
207 B_UINT16 tid;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700208 bool valid;
Kevin McKinney37531642012-05-26 12:04:58 -0400209};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700210
Kevin McKinney29794602012-05-26 12:05:12 -0400211typedef int (*FP_FLASH_WRITE)(struct bcm_mini_adapter *, UINT, PVOID);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700212
Kevin McKinney29794602012-05-26 12:05:12 -0400213typedef int (*FP_FLASH_WRITE_STATUS)(struct bcm_mini_adapter *, UINT, PVOID);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700214
Kevin McKinney5db647a2012-05-18 08:50:56 -0400215/*
216 * Driver adapter data structure
217 */
Kevin McKinney29794602012-05-26 12:05:12 -0400218struct bcm_mini_adapter {
219 struct bcm_mini_adapter *next;
Stephen Hemminger4fd64dd2010-11-01 12:12:31 -0400220 struct net_device *dev;
221 u32 msg_enable;
Kevin McKinney90942142012-05-18 08:50:55 -0400222 CHAR *caDsxReqResp;
Stephen Hemminger3349d952010-11-01 11:12:56 -0400223 atomic_t ApplicationRunning;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700224 bool AppCtrlQueueOverFlow;
Stephen Hemminger3349d952010-11-01 11:12:56 -0400225 atomic_t CurrentApplicationCount;
Kevin McKinney90942142012-05-18 08:50:55 -0400226 atomic_t RegisteredApplicationCount;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700227 bool LinkUpStatus;
228 bool TimerActive;
Stephen Hemminger3349d952010-11-01 11:12:56 -0400229 u32 StatisticsPointer;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700230 struct sk_buff *RxControlHead;
231 struct sk_buff *RxControlTail;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700232 struct semaphore RxAppControlQueuelock;
233 struct semaphore fw_download_sema;
Kevin McKinney774bea82012-05-26 12:05:00 -0400234 struct bcm_tarang_data *pTarangs;
Kevin McKinney90942142012-05-18 08:50:55 -0400235 spinlock_t control_queue_lock;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700236 wait_queue_head_t process_read_wait_queue;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700237
Kevin McKinney5db647a2012-05-18 08:50:56 -0400238 /* the pointer to the first packet we have queued in send
239 * deserialized miniport support variables
240 */
Kevin McKinney90942142012-05-18 08:50:55 -0400241 atomic_t TotalPacketCount;
242 atomic_t TxPktAvail;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700243
Kevin McKinney5db647a2012-05-18 08:50:56 -0400244 /* this to keep track of the Tx and Rx MailBox Registers. */
Kevin McKinney90942142012-05-18 08:50:55 -0400245 atomic_t CurrNumFreeTxDesc;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400246 /* to keep track the no of byte received */
Kevin McKinney90942142012-05-18 08:50:55 -0400247 USHORT PrevNumRecvDescs;
248 USHORT CurrNumRecvDescs;
249 UINT u32TotalDSD;
Kevin McKinney0b3edf72012-05-26 12:05:01 -0400250 struct bcm_packet_info PackInfo[NO_OF_QUEUES];
Kevin McKinney92562ae2012-05-26 12:05:03 -0400251 struct bcm_classifier_rule astClassifierTable[MAX_CLASSIFIERS];
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700252 bool TransferMode;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700253
254 /*************** qos ******************/
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700255 bool bETHCSEnabled;
Kevin McKinney90942142012-05-18 08:50:55 -0400256 ULONG BEBucketSize;
257 ULONG rtPSBucketSize;
258 UCHAR LinkStatus;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700259 bool AutoLinkUp;
260 bool AutoSyncup;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700261
Kevin McKinney90942142012-05-18 08:50:55 -0400262 int major;
263 int minor;
264 wait_queue_head_t tx_packet_wait_queue;
265 wait_queue_head_t process_rx_cntrlpkt;
266 atomic_t process_waiting;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700267 bool fw_download_done;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700268
Kevin McKinney90942142012-05-18 08:50:55 -0400269 char *txctlpacket[MAX_CNTRL_PKTS];
270 atomic_t cntrlpktCnt ;
271 atomic_t index_app_read_cntrlpkt;
272 atomic_t index_wr_txcntrlpkt;
273 atomic_t index_rd_txcntrlpkt;
274 UINT index_datpkt;
275 struct semaphore rdmwrmsync;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700276
Kevin McKinney37531642012-05-26 12:04:58 -0400277 struct bcm_targetdsx_buffer astTargetDsxBuffer[MAX_TARGET_DSX_BUFFERS];
Stephen Hemminger3349d952010-11-01 11:12:56 -0400278 ULONG ulFreeTargetBufferCnt;
Kevin McKinney90942142012-05-18 08:50:55 -0400279 ULONG ulCurrentTargetBuffer;
280 ULONG ulTotalTargetBuffersAvailable;
281 unsigned long chip_id;
282 wait_queue_head_t lowpower_mode_wait_queue;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700283 bool bFlashBoot;
284 bool bBinDownloaded;
285 bool bCfgDownloaded;
286 bool bSyncUpRequestSent;
Stephen Hemminger3349d952010-11-01 11:12:56 -0400287 USHORT usBestEffortQueueIndex;
Kevin McKinney90942142012-05-18 08:50:55 -0400288 wait_queue_head_t ioctl_fw_dnld_wait_queue;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700289 bool waiting_to_fw_download_done;
Kevin McKinney90942142012-05-18 08:50:55 -0400290 pid_t fw_download_process_pid;
Kevin McKinneyc8182332012-12-17 17:35:20 -0500291 struct bcm_target_params *pstargetparams;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700292 bool device_removed;
293 bool DeviceAccess;
294 bool bIsAutoCorrectEnabled;
295 bool bDDRInitDone;
Kevin McKinneyd4262052012-05-18 08:50:58 -0400296 int DDRSetting;
Kevin McKinney90942142012-05-18 08:50:55 -0400297 ULONG ulPowerSaveMode;
298 spinlock_t txtransmitlock;
299 B_UINT8 txtransmit_running;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700300 /* Thread for control packet handling */
Kevin McKinney90942142012-05-18 08:50:55 -0400301 struct task_struct *control_packet_handler;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700302 /* thread for transmitting packets. */
Kevin McKinney90942142012-05-18 08:50:55 -0400303 struct task_struct *transmit_packet_thread;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700304
305 /* LED Related Structures */
Kevin McKinney684fb7e2012-12-14 19:26:50 -0500306 struct bcm_led_info LEDInfo;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700307
308 /* Driver State for LED Blinking */
Kevin McKinneyb3d9a8f2012-12-14 19:26:52 -0500309 enum bcm_led_events DriverState;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700310 /* Interface Specific */
Kevin McKinney90942142012-05-18 08:50:55 -0400311 PVOID pvInterfaceAdapter;
312 int (*bcm_file_download)(PVOID,
313 struct file *,
314 unsigned int);
315 int (*bcm_file_readback_from_chip)(PVOID,
316 struct file *,
317 unsigned int);
Kevin McKinneyd4262052012-05-18 08:50:58 -0400318 int (*interface_rdm)(PVOID,
Kevin McKinney90942142012-05-18 08:50:55 -0400319 UINT,
320 PVOID,
Kevin McKinneyd4262052012-05-18 08:50:58 -0400321 int);
322 int (*interface_wrm)(PVOID,
Kevin McKinney90942142012-05-18 08:50:55 -0400323 UINT,
324 PVOID,
Kevin McKinneyd4262052012-05-18 08:50:58 -0400325 int);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700326 int (*interface_transmit)(PVOID, PVOID , UINT);
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700327 bool IdleMode;
328 bool bDregRequestSentInIdleMode;
329 bool bTriedToWakeUpFromlowPowerMode;
330 bool bShutStatus;
331 bool bWakeUpDevice;
Kevin McKinney90942142012-05-18 08:50:55 -0400332 unsigned int usIdleModePattern;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400333 /* BOOLEAN bTriedToWakeUpFromShutdown; */
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700334 bool bLinkDownRequested;
Kevin McKinney90942142012-05-18 08:50:55 -0400335 int downloadDDR;
Kevin McKinney60dadf92012-12-20 00:31:28 -0500336 struct bcm_phs_extension stBCMPhsContext;
Peter Meerwaldb38e2742012-06-13 20:44:35 +0200337 struct bcm_hdr_suppression_contextinfo stPhsTxContextInfo;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700338 uint8_t ucaPHSPktRestoreBuf[2048];
339 uint8_t bPHSEnabled;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700340 bool AutoFirmDld;
341 bool bMipsConfig;
342 bool bDPLLConfig;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700343 UINT32 aTxPktSizeHist[MIBS_MAX_HIST_ENTRIES];
344 UINT32 aRxPktSizeHist[MIBS_MAX_HIST_ENTRIES];
Kevin McKinney7f224852012-05-26 12:05:02 -0400345 struct bcm_fragmented_packet_info astFragmentedPktClassifierTable[MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES];
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700346 atomic_t uiMBupdate;
347 UINT32 PmuMode;
Kevin McKinneyaf72c612012-12-21 15:10:36 -0500348 enum bcm_nvm_type eNVMType;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700349 UINT uiSectorSize;
350 UINT uiSectorSizeInCFG;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700351 bool bSectorSizeOverride;
352 bool bStatusWrite;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700353 UINT uiNVMDSDSize;
354 UINT uiVendorExtnFlag;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400355 /* it will always represent chosen DSD at any point of time.
356 * Generally it is Active DSD but in case of NVM RD/WR it might be different.
357 */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700358 UINT ulFlashCalStart;
Kevin McKinney90942142012-05-18 08:50:55 -0400359 ULONG ulFlashControlSectionStart;
360 ULONG ulFlashWriteSize;
361 ULONG ulFlashID;
362 FP_FLASH_WRITE fpFlashWrite;
363 FP_FLASH_WRITE_STATUS fpFlashWriteWithStatusCheck;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700364
365 struct semaphore NVMRdmWrmLock;
Kevin McKinney90942142012-05-18 08:50:55 -0400366 struct device *pstCreatedClassDevice;
Stephen Hemminger3705a842010-10-29 08:14:16 -0700367
Kevin McKinney5db647a2012-05-18 08:50:56 -0400368 /* BOOLEAN InterfaceUpStatus; */
Kevin McKinney08391732012-12-01 01:15:55 -0500369 struct bcm_flash2x_cs_info *psFlash2xCSInfo;
Kevin McKinney168b1402012-12-01 01:15:56 -0500370 struct bcm_flash_cs_info *psFlashCSInfo;
Kevin McKinney2fe119f2012-12-01 01:15:53 -0500371 struct bcm_flash2x_vendor_info *psFlash2xVendorInfo;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400372 UINT uiFlashBaseAdd; /* Flash start address */
373 UINT uiActiveISOOffset; /* Active ISO offset chosen before f/w download */
Kevin McKinneyff4e0652012-11-22 14:48:50 -0500374 enum bcm_flash2x_section_val eActiveISO; /* Active ISO section val */
375 enum bcm_flash2x_section_val eActiveDSD; /* Active DSD val chosen before f/w download */
Kevin McKinney5db647a2012-05-18 08:50:56 -0400376 UINT uiActiveDSDOffsetAtFwDld; /* For accessing Active DSD chosen before f/w download */
Kevin McKinney90942142012-05-18 08:50:55 -0400377 UINT uiFlashLayoutMajorVersion;
378 UINT uiFlashLayoutMinorVersion;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700379 bool bAllDSDWriteAllow;
380 bool bSigCorrupted;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400381 /* this should be set who so ever want to change the Headers. after Wrtie it should be reset immediately. */
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700382 bool bHeaderChangeAllowed;
Kevin McKinneyd4262052012-05-18 08:50:58 -0400383 int SelectedChip;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700384 bool bEndPointHalted;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400385 /* while bFlashRawRead will be true, Driver ignore map lay out and consider flash as of without any map. */
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700386 bool bFlashRawRead;
387 bool bPreparingForLowPowerMode;
388 bool bDoSuspend;
Kevin McKinney90942142012-05-18 08:50:55 -0400389 UINT syscfgBefFwDld;
Lisa Nguyen3abd6f12013-10-28 01:35:59 -0700390 bool StopAllXaction;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400391 UINT32 liTimeSinceLastNetEntry; /* Used to Support extended CAPI requirements from */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700392 struct semaphore LowPowerModeSync;
Kevin McKinney90942142012-05-18 08:50:55 -0400393 ULONG liDrainCalculated;
394 UINT gpioBitMap;
Kevin McKinney4b388a92013-01-04 23:35:08 -0500395 struct bcm_debug_state stDebugState;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700396};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700397
Kevin McKinney90942142012-05-18 08:50:55 -0400398#define GET_BCM_ADAPTER(net_dev) netdev_priv(net_dev)
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700399
Kevin McKinney406a5082012-05-26 12:04:57 -0400400struct bcm_eth_header {
Kevin McKinney90942142012-05-18 08:50:55 -0400401 UCHAR au8DestinationAddress[6];
402 UCHAR au8SourceAddress[6];
403 USHORT u16Etype;
Kevin McKinneye1325ad2012-05-18 08:50:57 -0400404} __packed;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700405
Kevin McKinney7a27a2c2012-05-26 12:04:56 -0400406struct bcm_firmware_info {
Kevin McKinney90942142012-05-18 08:50:55 -0400407 void __user *pvMappedFirmwareAddress;
408 ULONG u32FirmwareLength;
409 ULONG u32StartingAddress;
Kevin McKinney7a27a2c2012-05-26 12:04:56 -0400410} __packed;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700411
Kevin McKinney5db647a2012-05-18 08:50:56 -0400412/* holds the value of net_device structure.. */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700413extern struct net_device *gblpnetdev;
Kevin McKinney7905c782012-05-26 12:04:55 -0400414
Kevin McKinneybe309992012-05-26 12:04:54 -0400415struct bcm_ddr_setting {
Alejandro R. SedeƱob7061132010-11-10 01:42:01 -0500416 UINT ulRegAddress;
417 UINT ulRegValue;
Kevin McKinneybe309992012-05-26 12:04:54 -0400418};
Kevin McKinney29794602012-05-26 12:05:12 -0400419int InitAdapter(struct bcm_mini_adapter *psAdapter);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700420
Kevin McKinney5db647a2012-05-18 08:50:56 -0400421/* =====================================================================
422 * Beceem vendor request codes for EP0
423 * =====================================================================
424 */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700425
Kevin McKinney90942142012-05-18 08:50:55 -0400426#define BCM_REQUEST_READ 0x2
427#define BCM_REQUEST_WRITE 0x1
428#define EP2_MPS_REG 0x0F0110A0
429#define EP2_MPS 0x40
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700430
Kevin McKinney90942142012-05-18 08:50:55 -0400431#define EP2_CFG_REG 0x0F0110A8
432#define EP2_CFG_INT 0x27
433#define EP2_CFG_BULK 0x25
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700434
Kevin McKinney90942142012-05-18 08:50:55 -0400435#define EP4_MPS_REG 0x0F0110F0
436#define EP4_MPS 0x8C
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700437
Kevin McKinney90942142012-05-18 08:50:55 -0400438#define EP4_CFG_REG 0x0F0110F8
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700439
Kevin McKinney90942142012-05-18 08:50:55 -0400440#define ISO_MPS_REG 0x0F0110C8
441#define ISO_MPS 0x00000000
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700442
443#define EP1 0
444#define EP2 1
445#define EP3 2
446#define EP4 3
447#define EP5 4
448#define EP6 5
449
Kevin McKinney76cc6f92012-05-26 12:04:53 -0400450enum bcm_einterface_setting {
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700451 DEFAULT_SETTING_0 = 0,
452 ALTERNATE_SETTING_1 = 1,
Kevin McKinney76cc6f92012-05-26 12:04:53 -0400453};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700454
Kevin McKinney5db647a2012-05-18 08:50:56 -0400455#endif /* __ADAPTER_H__ */