drivers/net/ethernet/amd/7990.h

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/amd/7990.h

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/amd/7990.h
Extension
.h
Size
9688 bytes
Lines
252
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct lance_rx_desc {
	volatile unsigned short rmd0;	    /* low address of packet */
	volatile unsigned char  rmd1_bits;  /* descriptor bits */
	volatile unsigned char  rmd1_hadr;  /* high address of packet */
	volatile short    length;	    /* This length is 2s complement (negative)!
					     * Buffer length */
	volatile unsigned short mblength;   /* Actual number of bytes received */
};

/* Ditto for TMD: */
struct lance_tx_desc {
	volatile unsigned short tmd0;	    /* low address of packet */
	volatile unsigned char  tmd1_bits;  /* descriptor bits */
	volatile unsigned char  tmd1_hadr;  /* high address of packet */
	volatile short    length;	    /* Length is 2s complement (negative)! */
	volatile unsigned short misc;
};

/* There are three memory structures accessed by the LANCE:
 * the initialization block, the receive and transmit descriptor rings,
 * and the data buffers themselves. In fact we might as well put the
 * init block,the Tx and Rx rings and the buffers together in memory:
 */
struct lance_init_block {
	volatile unsigned short mode;		/* Pre-set mode (reg. 15) */
	volatile unsigned char phys_addr[6];	/* Physical ethernet address */
	volatile unsigned filter[2];		/* Multicast filter (64 bits) */

	/* Receive and transmit ring base, along with extra bits. */
	volatile unsigned short rx_ptr;		/* receive descriptor addr */
	volatile unsigned short rx_len;		/* receive len and high addr */
	volatile unsigned short tx_ptr;		/* transmit descriptor addr */
	volatile unsigned short tx_len;		/* transmit len and high addr */

	/* The Tx and Rx ring entries must be aligned on 8-byte boundaries.
	 * This will be true if this whole struct is 8-byte aligned.
	 */
	volatile struct lance_tx_desc btx_ring[TX_RING_SIZE];
	volatile struct lance_rx_desc brx_ring[RX_RING_SIZE];

	volatile char tx_buf[TX_RING_SIZE][TX_BUFF_SIZE];
	volatile char rx_buf[RX_RING_SIZE][RX_BUFF_SIZE];
	/* we use this just to make the struct big enough that we can move its startaddr
	 * in order to force alignment to an eight byte boundary.
	 */
};

/* This is where we keep all the stuff the driver needs to know about.
 * I'm definitely unhappy about the mechanism for allowing specific
 * drivers to add things...
 */
struct lance_private {
	const char *name;
	unsigned long base;
	volatile struct lance_init_block *init_block; /* CPU address of RAM */
	volatile struct lance_init_block *lance_init_block; /* LANCE address of RAM */

	int rx_new, tx_new;
	int rx_old, tx_old;

	int lance_log_rx_bufs, lance_log_tx_bufs;
	int rx_ring_mod_mask, tx_ring_mod_mask;

	int tpe;			/* TPE is selected */
	int auto_select;		/* cable-selection is by carrier */
	unsigned short busmaster_regval;

	unsigned int irq;		/* IRQ to register */

	/* This is because the HP LANCE is disgusting and you have to check
	 * a DIO-specific register every time you read/write the LANCE regs :-<
	 * [could we get away with making these some sort of macro?]
	 */
	void (*writerap)(void *, unsigned short);
	void (*writerdp)(void *, unsigned short);
	unsigned short (*readrdp)(void *);
	spinlock_t devlock;
	char tx_full;
};

/*
 *		Am7990 Control and Status Registers
 */
#define LE_CSR0		0x0000	/* LANCE Controller Status */
#define LE_CSR1		0x0001	/* IADR[15:0] (bit0==0 ie word aligned) */
#define LE_CSR2		0x0002	/* IADR[23:16] (high bits reserved) */
#define LE_CSR3		0x0003	/* Misc */

/*
 *		Bit definitions for CSR0 (LANCE Controller Status)

Annotation

Implementation Notes