Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
farsync.c File Reference
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/pci.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/if.h>
#include <linux/hdlc.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include "farsync.h"

Go to the source code of this file.

Data Structures

union  txdesc
 
struct  rxdesc
 
struct  cirbuff
 
struct  port_cfg
 
struct  su_config
 
struct  su_status
 
struct  fst_shared
 
struct  buf_window
 
struct  fst_port_info
 
struct  fst_card_info
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define FST_MAX_PORTS   4
 
#define FST_MAX_CARDS   32
 
#define FST_TX_QUEUE_LEN
 
#define FST_TXQ_DEPTH
 
#define FST_HIGH_WATER_MARK
 
#define FST_LOW_WATER_MARK
 
#define FST_MAX_MTU   8000 /* Huge but possible */
 
#define FST_DEF_MTU   1500 /* Common sane value */
 
#define FST_TX_TIMEOUT   (2*HZ)
 
#define ARPHRD_MYTYPE   ARPHRD_HDLC /* Cisco-HDLC (keepalives etc) */
 
#define SMC_VERSION   24
 
#define FST_MEMSIZE   0x100000 /* Size of card memory (1Mb) */
 
#define SMC_BASE
 
#define BFM_BASE
 
#define LEN_TX_BUFFER   8192 /* Size of packet buffers */
 
#define LEN_RX_BUFFER   8192
 
#define LEN_SMALL_TX_BUFFER   256 /* Size of obsolete buffs used for DOS diags */
 
#define LEN_SMALL_RX_BUFFER   256
 
#define NUM_TX_BUFFER   2 /* Must be power of 2. Fixed by firmware */
 
#define NUM_RX_BUFFER   8
 
#define INT_RETRY_TIME   2
 
#define cnv_bcnt(len)   (-(len))
 
#define DMA_OWN   0x80 /* SmartDMA owns the descriptor */
 
#define TX_STP   0x02 /* Tx: start of packet */
 
#define TX_ENP   0x01 /* Tx: end of packet */
 
#define RX_ERR   0x40 /* Rx: error (OR of next 4 bits) */
 
#define RX_FRAM   0x20 /* Rx: framing error */
 
#define RX_OFLO   0x10 /* Rx: overflow error */
 
#define RX_CRC   0x08 /* Rx: CRC error */
 
#define RX_HBUF   0x04 /* Rx: buffer error */
 
#define RX_STP   0x02 /* Rx: start of packet */
 
#define RX_ENP   0x01 /* Rx: end of packet */
 
#define MAX_CIRBUFF   32
 
#define CTLA_CHG   0x18 /* Control signal changed */
 
#define CTLB_CHG   0x19
 
#define CTLC_CHG   0x1A
 
#define CTLD_CHG   0x1B
 
#define INIT_CPLT   0x20 /* Initialisation complete */
 
#define INIT_FAIL   0x21 /* Initialisation failed */
 
#define ABTA_SENT   0x24 /* Abort sent */
 
#define ABTB_SENT   0x25
 
#define ABTC_SENT   0x26
 
#define ABTD_SENT   0x27
 
#define TXA_UNDF   0x28 /* Transmission underflow */
 
#define TXB_UNDF   0x29
 
#define TXC_UNDF   0x2A
 
#define TXD_UNDF   0x2B
 
#define F56_INT   0x2C
 
#define M32_INT   0x2D
 
#define TE1_ALMA   0x30
 
#define END_SIG   0x12345678
 
#define NOP   0 /* No operation */
 
#define ACK   1 /* Positive acknowledgement to PC driver */
 
#define NAK   2 /* Negative acknowledgement to PC driver */
 
#define STARTPORT   3 /* Start an HDLC port */
 
#define STOPPORT   4 /* Stop an HDLC port */
 
#define ABORTTX   5 /* Abort the transmitter for a port */
 
#define SETV24O   6 /* Set V24 outputs */
 
#define CNTRL_9052   0x50 /* Control Register */
 
#define CNTRL_9054   0x6c /* Control Register */
 
#define INTCSR_9052   0x4c /* Interrupt control/status register */
 
#define INTCSR_9054   0x68 /* Interrupt control/status register */
 
#define DMAMODE0   0x80
 
#define DMAPADR0   0x84
 
#define DMALADR0   0x88
 
#define DMASIZ0   0x8c
 
#define DMADPR0   0x90
 
#define DMAMODE1   0x94
 
#define DMAPADR1   0x98
 
#define DMALADR1   0x9c
 
#define DMASIZ1   0xa0
 
#define DMADPR1   0xa4
 
#define DMACSR0   0xa8
 
#define DMACSR1   0xa9
 
#define DMAARB   0xac
 
#define DMATHR   0xb0
 
#define DMADAC0   0xb4
 
#define DMADAC1   0xb8
 
#define DMAMARBR   0xac
 
#define FST_MIN_DMA_LEN   64
 
#define FST_RX_DMA_INT   0x01
 
#define FST_TX_DMA_INT   0x02
 
#define FST_CARD_INT   0x04
 
#define BUF_OFFSET(X)   (BFM_BASE + offsetof(struct buf_window, X))
 
#define dev_to_port(D)   (dev_to_hdlc(D)->priv)
 
#define port_to_dev(P)   ((P)->dev)
 
#define WIN_OFFSET(X)   ((long)&(((struct fst_shared *)SMC_BASE)->X))
 
#define FST_RDB(C, E)   readb ((C)->mem + WIN_OFFSET(E))
 
#define FST_RDW(C, E)   readw ((C)->mem + WIN_OFFSET(E))
 
#define FST_RDL(C, E)   readl ((C)->mem + WIN_OFFSET(E))
 
#define FST_WRB(C, E, B)   writeb ((B), (C)->mem + WIN_OFFSET(E))
 
#define FST_WRW(C, E, W)   writew ((W), (C)->mem + WIN_OFFSET(E))
 
#define FST_WRL(C, E, L)   writel ((L), (C)->mem + WIN_OFFSET(E))
 
#define dbg(F, fmt, args...)
 

Functions

 MODULE_AUTHOR ("R.J.Dunlop <[email protected]>")
 
 MODULE_DESCRIPTION ("FarSync T-Series WAN driver. FarSite Communications Ltd.")
 
 MODULE_LICENSE ("GPL")
 
 module_param (fst_txq_low, int, 0)
 
 module_param (fst_txq_high, int, 0)
 
 module_param (fst_max_reads, int, 0)
 
 module_param (fst_excluded_cards, int, 0)
 
 module_param_array (fst_excluded_list, int, NULL, 0)
 
 MODULE_DEVICE_TABLE (pci, fst_pci_dev_id)
 
 module_init (fst_init)
 
 module_exit (fst_cleanup_module)
 

Macro Definition Documentation

#define ABORTTX   5 /* Abort the transmitter for a port */

Definition at line 363 of file farsync.c.

#define ABTA_SENT   0x24 /* Abort sent */

Definition at line 191 of file farsync.c.

#define ABTB_SENT   0x25

Definition at line 192 of file farsync.c.

#define ABTC_SENT   0x26

Definition at line 193 of file farsync.c.

#define ABTD_SENT   0x27

Definition at line 194 of file farsync.c.

#define ACK   1 /* Positive acknowledgement to PC driver */

Definition at line 359 of file farsync.c.

#define ARPHRD_MYTYPE   ARPHRD_HDLC /* Cisco-HDLC (keepalives etc) */

Definition at line 66 of file farsync.c.

#define BFM_BASE
Value:
0x00010000L /* Base offset of the shared memory window DMA
* buffers */

Definition at line 104 of file farsync.c.

#define BUF_OFFSET (   X)    (BFM_BASE + offsetof(struct buf_window, X))

Definition at line 408 of file farsync.c.

#define CNTRL_9052   0x50 /* Control Register */

Definition at line 367 of file farsync.c.

#define CNTRL_9054   0x6c /* Control Register */

Definition at line 368 of file farsync.c.

#define cnv_bcnt (   len)    (-(len))

Definition at line 155 of file farsync.c.

#define CTLA_CHG   0x18 /* Control signal changed */

Definition at line 183 of file farsync.c.

#define CTLB_CHG   0x19

Definition at line 184 of file farsync.c.

#define CTLC_CHG   0x1A

Definition at line 185 of file farsync.c.

#define CTLD_CHG   0x1B

Definition at line 186 of file farsync.c.

#define dbg (   F,
  fmt,
  args... 
)
Value:
do { \
if (0) \
printk(KERN_DEBUG pr_fmt(fmt), ##args); \
} while (0)

Definition at line 514 of file farsync.c.

#define dev_to_port (   D)    (dev_to_hdlc(D)->priv)

Definition at line 473 of file farsync.c.

#define DMA_OWN   0x80 /* SmartDMA owns the descriptor */

Definition at line 158 of file farsync.c.

#define DMAARB   0xac

Definition at line 390 of file farsync.c.

#define DMACSR0   0xa8

Definition at line 388 of file farsync.c.

#define DMACSR1   0xa9

Definition at line 389 of file farsync.c.

#define DMADAC0   0xb4

Definition at line 392 of file farsync.c.

#define DMADAC1   0xb8

Definition at line 393 of file farsync.c.

#define DMADPR0   0x90

Definition at line 382 of file farsync.c.

#define DMADPR1   0xa4

Definition at line 387 of file farsync.c.

#define DMALADR0   0x88

Definition at line 380 of file farsync.c.

#define DMALADR1   0x9c

Definition at line 385 of file farsync.c.

#define DMAMARBR   0xac

Definition at line 394 of file farsync.c.

#define DMAMODE0   0x80

Definition at line 378 of file farsync.c.

#define DMAMODE1   0x94

Definition at line 383 of file farsync.c.

#define DMAPADR0   0x84

Definition at line 379 of file farsync.c.

#define DMAPADR1   0x98

Definition at line 384 of file farsync.c.

#define DMASIZ0   0x8c

Definition at line 381 of file farsync.c.

#define DMASIZ1   0xa0

Definition at line 386 of file farsync.c.

#define DMATHR   0xb0

Definition at line 391 of file farsync.c.

#define END_SIG   0x12345678

Definition at line 355 of file farsync.c.

#define F56_INT   0x2C

Definition at line 201 of file farsync.c.

#define FST_CARD_INT   0x04

Definition at line 399 of file farsync.c.

#define FST_DEF_MTU   1500 /* Common sane value */

Definition at line 59 of file farsync.c.

#define FST_HIGH_WATER_MARK
Value:
12 /* Point at which we flow control
* network layer */

Definition at line 56 of file farsync.c.

#define FST_LOW_WATER_MARK
Value:
8 /* Point at which we remove flow
* control from network layer */

Definition at line 57 of file farsync.c.

#define FST_MAX_CARDS   32

Definition at line 50 of file farsync.c.

#define FST_MAX_MTU   8000 /* Huge but possible */

Definition at line 58 of file farsync.c.

#define FST_MAX_PORTS   4

Definition at line 49 of file farsync.c.

#define FST_MEMSIZE   0x100000 /* Size of card memory (1Mb) */

Definition at line 101 of file farsync.c.

#define FST_MIN_DMA_LEN   64

Definition at line 396 of file farsync.c.

#define FST_RDB (   C,
  E 
)    readb ((C)->mem + WIN_OFFSET(E))

Definition at line 488 of file farsync.c.

#define FST_RDL (   C,
  E 
)    readl ((C)->mem + WIN_OFFSET(E))

Definition at line 490 of file farsync.c.

#define FST_RDW (   C,
  E 
)    readw ((C)->mem + WIN_OFFSET(E))

Definition at line 489 of file farsync.c.

#define FST_RX_DMA_INT   0x01

Definition at line 397 of file farsync.c.

#define FST_TX_DMA_INT   0x02

Definition at line 398 of file farsync.c.

#define FST_TX_QUEUE_LEN
Value:
100 /* At 8Mbps a longer queue length is
* useful */

Definition at line 54 of file farsync.c.

#define FST_TX_TIMEOUT   (2*HZ)

Definition at line 61 of file farsync.c.

#define FST_TXQ_DEPTH
Value:
16 /* This one is for the buffering
* of frames on the way down to the card
* so that we can keep the card busy
* and maximise throughput
*/

Definition at line 55 of file farsync.c.

#define FST_WRB (   C,
  E,
  B 
)    writeb ((B), (C)->mem + WIN_OFFSET(E))

Definition at line 492 of file farsync.c.

#define FST_WRL (   C,
  E,
  L 
)    writel ((L), (C)->mem + WIN_OFFSET(E))

Definition at line 494 of file farsync.c.

#define FST_WRW (   C,
  E,
  W 
)    writew ((W), (C)->mem + WIN_OFFSET(E))

Definition at line 493 of file farsync.c.

#define INIT_CPLT   0x20 /* Initialisation complete */

Definition at line 188 of file farsync.c.

#define INIT_FAIL   0x21 /* Initialisation failed */

Definition at line 189 of file farsync.c.

#define INT_RETRY_TIME   2

Definition at line 116 of file farsync.c.

#define INTCSR_9052   0x4c /* Interrupt control/status register */

Definition at line 370 of file farsync.c.

#define INTCSR_9054   0x68 /* Interrupt control/status register */

Definition at line 371 of file farsync.c.

#define LEN_RX_BUFFER   8192

Definition at line 107 of file farsync.c.

#define LEN_SMALL_RX_BUFFER   256

Definition at line 110 of file farsync.c.

#define LEN_SMALL_TX_BUFFER   256 /* Size of obsolete buffs used for DOS diags */

Definition at line 109 of file farsync.c.

#define LEN_TX_BUFFER   8192 /* Size of packet buffers */

Definition at line 106 of file farsync.c.

#define M32_INT   0x2D

Definition at line 202 of file farsync.c.

#define MAX_CIRBUFF   32

Definition at line 172 of file farsync.c.

#define NAK   2 /* Negative acknowledgement to PC driver */

Definition at line 360 of file farsync.c.

#define NOP   0 /* No operation */

Definition at line 358 of file farsync.c.

#define NUM_RX_BUFFER   8

Definition at line 113 of file farsync.c.

#define NUM_TX_BUFFER   2 /* Must be power of 2. Fixed by firmware */

Definition at line 112 of file farsync.c.

#define port_to_dev (   P)    ((P)->dev)

Definition at line 474 of file farsync.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 18 of file farsync.c.

#define RX_CRC   0x08 /* Rx: CRC error */

Definition at line 164 of file farsync.c.

#define RX_ENP   0x01 /* Rx: end of packet */

Definition at line 167 of file farsync.c.

#define RX_ERR   0x40 /* Rx: error (OR of next 4 bits) */

Definition at line 161 of file farsync.c.

#define RX_FRAM   0x20 /* Rx: framing error */

Definition at line 162 of file farsync.c.

#define RX_HBUF   0x04 /* Rx: buffer error */

Definition at line 165 of file farsync.c.

#define RX_OFLO   0x10 /* Rx: overflow error */

Definition at line 163 of file farsync.c.

#define RX_STP   0x02 /* Rx: start of packet */

Definition at line 166 of file farsync.c.

#define SETV24O   6 /* Set V24 outputs */

Definition at line 364 of file farsync.c.

#define SMC_BASE
Value:
0x00002000L /* Base offset of the shared memory window main
* configuration structure */

Definition at line 103 of file farsync.c.

#define SMC_VERSION   24

Definition at line 99 of file farsync.c.

#define STARTPORT   3 /* Start an HDLC port */

Definition at line 361 of file farsync.c.

#define STOPPORT   4 /* Stop an HDLC port */

Definition at line 362 of file farsync.c.

#define TE1_ALMA   0x30

Definition at line 204 of file farsync.c.

#define TX_ENP   0x01 /* Tx: end of packet */

Definition at line 160 of file farsync.c.

#define TX_STP   0x02 /* Tx: start of packet */

Definition at line 159 of file farsync.c.

#define TXA_UNDF   0x28 /* Transmission underflow */

Definition at line 196 of file farsync.c.

#define TXB_UNDF   0x29

Definition at line 197 of file farsync.c.

#define TXC_UNDF   0x2A

Definition at line 198 of file farsync.c.

#define TXD_UNDF   0x2B

Definition at line 199 of file farsync.c.

#define WIN_OFFSET (   X)    ((long)&(((struct fst_shared *)SMC_BASE)->X))

Definition at line 486 of file farsync.c.

Function Documentation

MODULE_AUTHOR ( "R.J.Dunlop <[email protected]>"  )
MODULE_DESCRIPTION ( "FarSync T-Series WAN driver. FarSite Communications Ltd."  )
MODULE_DEVICE_TABLE ( pci  ,
fst_pci_dev_id   
)
module_exit ( fst_cleanup_module  )
module_init ( fst_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( fst_txq_low  ,
int  ,
 
)
module_param ( fst_txq_high  ,
int  ,
 
)
module_param ( fst_max_reads  ,
int  ,
 
)
module_param ( fst_excluded_cards  ,
int  ,
 
)
module_param_array ( fst_excluded_list  ,
int  ,
NULL  ,
 
)