Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
declance.c File Reference
#include <linux/crc32.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/if_ether.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/spinlock.h>
#include <linux/stddef.h>
#include <linux/string.h>
#include <linux/tc.h>
#include <linux/types.h>
#include <asm/addrspace.h>
#include <asm/dec/interrupts.h>
#include <asm/dec/ioasic.h>
#include <asm/dec/ioasic_addrs.h>
#include <asm/dec/kn01.h>
#include <asm/dec/machtype.h>
#include <asm/dec/system.h>

Go to the source code of this file.

Data Structures

struct  lance_rx_desc
 
struct  lance_tx_desc
 
struct  lance_init_block
 
struct  lance_private
 
struct  lance_regs
 

Macros

#define __unused   __attribute__ ((unused))
 
#define ASIC_LANCE   1
 
#define PMAD_LANCE   2
 
#define PMAX_LANCE   3
 
#define LE_CSR0   0
 
#define LE_CSR1   1
 
#define LE_CSR2   2
 
#define LE_CSR3   3
 
#define LE_MO_PROM   0x8000 /* Enable promiscuous mode */
 
#define LE_C0_ERR   0x8000 /* Error: set if BAB, SQE, MISS or ME is set */
 
#define LE_C0_BABL   0x4000 /* BAB: Babble: tx timeout. */
 
#define LE_C0_CERR   0x2000 /* SQE: Signal quality error */
 
#define LE_C0_MISS   0x1000 /* MISS: Missed a packet */
 
#define LE_C0_MERR   0x0800 /* ME: Memory error */
 
#define LE_C0_RINT   0x0400 /* Received interrupt */
 
#define LE_C0_TINT   0x0200 /* Transmitter Interrupt */
 
#define LE_C0_IDON   0x0100 /* IFIN: Init finished. */
 
#define LE_C0_INTR   0x0080 /* Interrupt or error */
 
#define LE_C0_INEA   0x0040 /* Interrupt enable */
 
#define LE_C0_RXON   0x0020 /* Receiver on */
 
#define LE_C0_TXON   0x0010 /* Transmitter on */
 
#define LE_C0_TDMD   0x0008 /* Transmitter demand */
 
#define LE_C0_STOP   0x0004 /* Stop the card */
 
#define LE_C0_STRT   0x0002 /* Start the card */
 
#define LE_C0_INIT   0x0001 /* Init the card */
 
#define LE_C3_BSWP   0x4 /* SWAP */
 
#define LE_C3_ACON   0x2 /* ALE Control */
 
#define LE_C3_BCON   0x1 /* Byte control */
 
#define LE_R1_OWN   0x8000 /* Who owns the entry */
 
#define LE_R1_ERR   0x4000 /* Error: if FRA, OFL, CRC or BUF is set */
 
#define LE_R1_FRA   0x2000 /* FRA: Frame error */
 
#define LE_R1_OFL   0x1000 /* OFL: Frame overflow */
 
#define LE_R1_CRC   0x0800 /* CRC error */
 
#define LE_R1_BUF   0x0400 /* BUF: Buffer error */
 
#define LE_R1_SOP   0x0200 /* Start of packet */
 
#define LE_R1_EOP   0x0100 /* End of packet */
 
#define LE_R1_POK   0x0300 /* Packet is complete: SOP + EOP */
 
#define LE_T1_OWN   0x8000 /* Lance owns the packet */
 
#define LE_T1_ERR   0x4000 /* Error summary */
 
#define LE_T1_EMORE   0x1000 /* Error: more than one retry needed */
 
#define LE_T1_EONE   0x0800 /* Error: one retry needed */
 
#define LE_T1_EDEF   0x0400 /* Error: deferred */
 
#define LE_T1_SOP   0x0200 /* Start of packet */
 
#define LE_T1_EOP   0x0100 /* End of packet */
 
#define LE_T1_POK   0x0300 /* Packet is complete: SOP + EOP */
 
#define LE_T3_BUF   0x8000 /* Buffer error */
 
#define LE_T3_UFL   0x4000 /* Error underflow */
 
#define LE_T3_LCOL   0x1000 /* Error late collision */
 
#define LE_T3_CLOS   0x0800 /* Error carrier loss */
 
#define LE_T3_RTY   0x0400 /* Error retry */
 
#define LE_T3_TDR   0x03ff /* Time Domain Reflectometry counter */
 
#define LANCE_LOG_TX_BUFFERS   4
 
#define LANCE_LOG_RX_BUFFERS   4
 
#define TX_RING_SIZE   (1 << (LANCE_LOG_TX_BUFFERS))
 
#define TX_RING_MOD_MASK   (TX_RING_SIZE - 1)
 
#define RX_RING_SIZE   (1 << (LANCE_LOG_RX_BUFFERS))
 
#define RX_RING_MOD_MASK   (RX_RING_SIZE - 1)
 
#define PKT_BUF_SZ   1536
 
#define RX_BUFF_SIZE   PKT_BUF_SZ
 
#define TX_BUFF_SIZE   PKT_BUF_SZ
 
#define ZERO   0
 
#define BUF_OFFSET_CPU   sizeof(struct lance_init_block)
 
#define BUF_OFFSET_LNC   sizeof(struct lance_init_block)
 
#define shift_off(off, type)   (type == ASIC_LANCE || type == PMAX_LANCE ? off << 1 : off)
 
#define lib_off(rt, type)   shift_off(offsetof(struct lance_init_block, rt), type)
 
#define lib_ptr(ib, rt, type)   ((volatile u16 *)((u8 *)(ib) + lib_off(rt, type)))
 
#define rds_off(rt, type)   shift_off(offsetof(struct lance_rx_desc, rt), type)
 
#define rds_ptr(rd, rt, type)   ((volatile u16 *)((u8 *)(rd) + rds_off(rt, type)))
 
#define tds_off(rt, type)   shift_off(offsetof(struct lance_tx_desc, rt), type)
 
#define tds_ptr(td, rt, type)   ((volatile u16 *)((u8 *)(td) + tds_off(rt, type)))
 
#define TX_BUFFS_AVAIL
 

Functions

 MODULE_AUTHOR ("Linux MIPS DECstation task force")
 
 MODULE_DESCRIPTION ("DEC LANCE (DECstation onboard, PMAD-xx) driver")
 
 MODULE_LICENSE ("GPL")
 
 module_init (dec_lance_init)
 
 module_exit (dec_lance_exit)
 

Variables

int dec_lance_debug = 2
 

Macro Definition Documentation

#define __unused   __attribute__ ((unused))

Definition at line 82 of file declance.c.

#define ASIC_LANCE   1

Definition at line 87 of file declance.c.

#define BUF_OFFSET_CPU   sizeof(struct lance_init_block)

Definition at line 225 of file declance.c.

#define BUF_OFFSET_LNC   sizeof(struct lance_init_block)

Definition at line 226 of file declance.c.

#define LANCE_LOG_RX_BUFFERS   4

Definition at line 152 of file declance.c.

#define LANCE_LOG_TX_BUFFERS   4

Definition at line 151 of file declance.c.

#define LE_C0_BABL   0x4000 /* BAB: Babble: tx timeout. */

Definition at line 100 of file declance.c.

#define LE_C0_CERR   0x2000 /* SQE: Signal quality error */

Definition at line 101 of file declance.c.

#define LE_C0_ERR   0x8000 /* Error: set if BAB, SQE, MISS or ME is set */

Definition at line 99 of file declance.c.

#define LE_C0_IDON   0x0100 /* IFIN: Init finished. */

Definition at line 106 of file declance.c.

#define LE_C0_INEA   0x0040 /* Interrupt enable */

Definition at line 108 of file declance.c.

#define LE_C0_INIT   0x0001 /* Init the card */

Definition at line 114 of file declance.c.

#define LE_C0_INTR   0x0080 /* Interrupt or error */

Definition at line 107 of file declance.c.

#define LE_C0_MERR   0x0800 /* ME: Memory error */

Definition at line 103 of file declance.c.

#define LE_C0_MISS   0x1000 /* MISS: Missed a packet */

Definition at line 102 of file declance.c.

#define LE_C0_RINT   0x0400 /* Received interrupt */

Definition at line 104 of file declance.c.

#define LE_C0_RXON   0x0020 /* Receiver on */

Definition at line 109 of file declance.c.

#define LE_C0_STOP   0x0004 /* Stop the card */

Definition at line 112 of file declance.c.

#define LE_C0_STRT   0x0002 /* Start the card */

Definition at line 113 of file declance.c.

#define LE_C0_TDMD   0x0008 /* Transmitter demand */

Definition at line 111 of file declance.c.

#define LE_C0_TINT   0x0200 /* Transmitter Interrupt */

Definition at line 105 of file declance.c.

#define LE_C0_TXON   0x0010 /* Transmitter on */

Definition at line 110 of file declance.c.

#define LE_C3_ACON   0x2 /* ALE Control */

Definition at line 117 of file declance.c.

#define LE_C3_BCON   0x1 /* Byte control */

Definition at line 118 of file declance.c.

#define LE_C3_BSWP   0x4 /* SWAP */

Definition at line 116 of file declance.c.

#define LE_CSR0   0

Definition at line 92 of file declance.c.

#define LE_CSR1   1

Definition at line 93 of file declance.c.

#define LE_CSR2   2

Definition at line 94 of file declance.c.

#define LE_CSR3   3

Definition at line 95 of file declance.c.

#define LE_MO_PROM   0x8000 /* Enable promiscuous mode */

Definition at line 97 of file declance.c.

#define LE_R1_BUF   0x0400 /* BUF: Buffer error */

Definition at line 126 of file declance.c.

#define LE_R1_CRC   0x0800 /* CRC error */

Definition at line 125 of file declance.c.

#define LE_R1_EOP   0x0100 /* End of packet */

Definition at line 128 of file declance.c.

#define LE_R1_ERR   0x4000 /* Error: if FRA, OFL, CRC or BUF is set */

Definition at line 122 of file declance.c.

#define LE_R1_FRA   0x2000 /* FRA: Frame error */

Definition at line 123 of file declance.c.

#define LE_R1_OFL   0x1000 /* OFL: Frame overflow */

Definition at line 124 of file declance.c.

#define LE_R1_OWN   0x8000 /* Who owns the entry */

Definition at line 121 of file declance.c.

#define LE_R1_POK   0x0300 /* Packet is complete: SOP + EOP */

Definition at line 129 of file declance.c.

#define LE_R1_SOP   0x0200 /* Start of packet */

Definition at line 127 of file declance.c.

#define LE_T1_EDEF   0x0400 /* Error: deferred */

Definition at line 136 of file declance.c.

#define LE_T1_EMORE   0x1000 /* Error: more than one retry needed */

Definition at line 134 of file declance.c.

#define LE_T1_EONE   0x0800 /* Error: one retry needed */

Definition at line 135 of file declance.c.

#define LE_T1_EOP   0x0100 /* End of packet */

Definition at line 138 of file declance.c.

#define LE_T1_ERR   0x4000 /* Error summary */

Definition at line 133 of file declance.c.

#define LE_T1_OWN   0x8000 /* Lance owns the packet */

Definition at line 132 of file declance.c.

#define LE_T1_POK   0x0300 /* Packet is complete: SOP + EOP */

Definition at line 139 of file declance.c.

#define LE_T1_SOP   0x0200 /* Start of packet */

Definition at line 137 of file declance.c.

#define LE_T3_BUF   0x8000 /* Buffer error */

Definition at line 141 of file declance.c.

#define LE_T3_CLOS   0x0800 /* Error carrier loss */

Definition at line 144 of file declance.c.

#define LE_T3_LCOL   0x1000 /* Error late collision */

Definition at line 143 of file declance.c.

#define LE_T3_RTY   0x0400 /* Error retry */

Definition at line 145 of file declance.c.

#define LE_T3_TDR   0x03ff /* Time Domain Reflectometry counter */

Definition at line 146 of file declance.c.

#define LE_T3_UFL   0x4000 /* Error underflow */

Definition at line 142 of file declance.c.

#define lib_off (   rt,
  type 
)    shift_off(offsetof(struct lance_init_block, rt), type)

Definition at line 231 of file declance.c.

#define lib_ptr (   ib,
  rt,
  type 
)    ((volatile u16 *)((u8 *)(ib) + lib_off(rt, type)))

Definition at line 234 of file declance.c.

#define PKT_BUF_SZ   1536

Definition at line 161 of file declance.c.

#define PMAD_LANCE   2

Definition at line 88 of file declance.c.

#define PMAX_LANCE   3

Definition at line 89 of file declance.c.

#define rds_off (   rt,
  type 
)    shift_off(offsetof(struct lance_rx_desc, rt), type)

Definition at line 237 of file declance.c.

#define rds_ptr (   rd,
  rt,
  type 
)    ((volatile u16 *)((u8 *)(rd) + rds_off(rt, type)))

Definition at line 240 of file declance.c.

#define RX_BUFF_SIZE   PKT_BUF_SZ

Definition at line 162 of file declance.c.

#define RX_RING_MOD_MASK   (RX_RING_SIZE - 1)

Definition at line 159 of file declance.c.

#define RX_RING_SIZE   (1 << (LANCE_LOG_RX_BUFFERS))

Definition at line 158 of file declance.c.

#define shift_off (   off,
  type 
)    (type == ASIC_LANCE || type == PMAX_LANCE ? off << 1 : off)

Definition at line 228 of file declance.c.

#define tds_off (   rt,
  type 
)    shift_off(offsetof(struct lance_tx_desc, rt), type)

Definition at line 243 of file declance.c.

#define tds_ptr (   td,
  rt,
  type 
)    ((volatile u16 *)((u8 *)(td) + tds_off(rt, type)))

Definition at line 246 of file declance.c.

#define TX_BUFF_SIZE   PKT_BUF_SZ

Definition at line 163 of file declance.c.

#define TX_BUFFS_AVAIL
Value:
((lp->tx_old<=lp->tx_new)?\
lp->tx_old+TX_RING_MOD_MASK-lp->tx_new:\
lp->tx_old - lp->tx_new-1)

Definition at line 273 of file declance.c.

#define TX_RING_MOD_MASK   (TX_RING_SIZE - 1)

Definition at line 156 of file declance.c.

#define TX_RING_SIZE   (1 << (LANCE_LOG_TX_BUFFERS))

Definition at line 155 of file declance.c.

#define ZERO   0

Definition at line 166 of file declance.c.

Function Documentation

MODULE_AUTHOR ( "Linux MIPS DECstation task force )
MODULE_DESCRIPTION ( "DEC LANCE (DECstation onboard, PMAD-xx) driver )
module_exit ( dec_lance_exit  )
module_init ( dec_lance_init  )
MODULE_LICENSE ( "GPL"  )

Variable Documentation

int dec_lance_debug = 2

Definition at line 289 of file declance.c.