1 /*****************************************************************
3 * defines for 3Com Etherlink Plus adapter
5 *****************************************************************/
9 #define ELP_MAX_CARDS 4
12 * I/O register offsets
14 #define PORT_COMMAND 0x00 /* read/write, 8-bit */
15 #define PORT_STATUS 0x02 /* read only, 8-bit */
16 #define PORT_AUXDMA 0x02 /* write only, 8-bit */
17 #define PORT_DATA 0x04 /* read/write, 16-bit */
18 #define PORT_CONTROL 0x06 /* read/write, 8-bit */
20 #define ELP_IO_EXTENT 0x10 /* size of used IO registers */
23 * host control registers bits
25 #define ATTN 0x80 /* attention */
26 #define FLSH 0x40 /* flush data register */
27 #define DMAE 0x20 /* DMA enable */
28 #define DIR 0x10 /* direction */
29 #define TCEN 0x08 /* terminal count interrupt enable */
30 #define CMDE 0x04 /* command register interrupt enable */
31 #define HSF2 0x02 /* host status flag 2 */
32 #define HSF1 0x01 /* host status flag 1 */
35 * combinations of HSF flags used for PCB transmission
37 #define HSF_PCB_ACK HSF1
38 #define HSF_PCB_NAK HSF2
39 #define HSF_PCB_END (HSF2|HSF1)
40 #define HSF_PCB_MASK (HSF2|HSF1)
43 * host status register bits
45 #define HRDY 0x80 /* data register ready */
46 #define HCRE 0x40 /* command register empty */
47 #define ACRF 0x20 /* adapter command register full */
48 /* #define DIR 0x10 direction - same as in control register */
49 #define DONE 0x08 /* DMA done */
50 #define ASF3 0x04 /* adapter status flag 3 */
51 #define ASF2 0x02 /* adapter status flag 2 */
52 #define ASF1 0x01 /* adapter status flag 1 */
55 * combinations of ASF flags used for PCB reception
57 #define ASF_PCB_ACK ASF1
58 #define ASF_PCB_NAK ASF2
59 #define ASF_PCB_END (ASF2|ASF1)
60 #define ASF_PCB_MASK (ASF2|ASF1)
63 * host aux DMA register bits
65 #define DMA_BRST 0x01 /* DMA burst */
68 * maximum amount of data allowed in a PCB
70 #define MAX_PCB_DATA 62
72 /*****************************************************************
75 * this is a rough value used for loops to stop them from
76 * locking up the whole machine in the case of failure or
79 *****************************************************************/
83 /*****************************************************************
87 *****************************************************************/
93 CMD_CONFIGURE_ADAPTER_MEMORY
= 0x01,
94 CMD_CONFIGURE_82586
= 0x02,
95 CMD_STATION_ADDRESS
= 0x03,
96 CMD_DMA_DOWNLOAD
= 0x04,
97 CMD_DMA_UPLOAD
= 0x05,
98 CMD_PIO_DOWNLOAD
= 0x06,
99 CMD_PIO_UPLOAD
= 0x07,
100 CMD_RECEIVE_PACKET
= 0x08,
101 CMD_TRANSMIT_PACKET
= 0x09,
102 CMD_NETWORK_STATISTICS
= 0x0a,
103 CMD_LOAD_MULTICAST_LIST
= 0x0b,
104 CMD_CLEAR_PROGRAM
= 0x0c,
105 CMD_DOWNLOAD_PROGRAM
= 0x0d,
106 CMD_EXECUTE_PROGRAM
= 0x0e,
107 CMD_SELF_TEST
= 0x0f,
108 CMD_SET_STATION_ADDRESS
= 0x10,
109 CMD_ADAPTER_INFO
= 0x11,
113 * adapter PCB commands
115 CMD_CONFIGURE_ADAPTER_RESPONSE
= 0x31,
116 CMD_CONFIGURE_82586_RESPONSE
= 0x32,
117 CMD_ADDRESS_RESPONSE
= 0x33,
118 CMD_DOWNLOAD_DATA_REQUEST
= 0x34,
119 CMD_UPLOAD_DATA_REQUEST
= 0x35,
120 CMD_RECEIVE_PACKET_COMPLETE
= 0x38,
121 CMD_TRANSMIT_PACKET_COMPLETE
= 0x39,
122 CMD_NETWORK_STATISTICS_RESPONSE
= 0x3a,
123 CMD_LOAD_MULTICAST_RESPONSE
= 0x3b,
124 CMD_CLEAR_PROGRAM_RESPONSE
= 0x3c,
125 CMD_DOWNLOAD_PROGRAM_RESPONSE
= 0x3d,
126 CMD_EXECUTE_RESPONSE
= 0x3e,
127 CMD_SELF_TEST_RESPONSE
= 0x3f,
128 CMD_SET_ADDRESS_RESPONSE
= 0x40,
129 CMD_ADAPTER_INFO_RESPONSE
= 0x41
132 /* Definitions for the PCB data structure */
135 typedef unsigned char byte
;
136 typedef unsigned short int word
;
137 typedef unsigned long int dword
;
139 /* Data structures */
217 Primary Command Block. The most important data structure. All communication
218 between the host and the adapter is done with these. (Except for the actual
219 Ethernet data, which has different packaging.)
225 struct Memconf memconf
;
227 struct Rcv_pkt rcv_pkt
;
228 struct Xmit_pkt xmit_pkt
;
229 byte multicast
[10][6];
232 struct Rcv_resp rcv_resp
;
233 struct Xmit_resp xmit_resp
;
234 struct Netstat netstat
;
235 struct Selftest selftest
;
237 struct Memdump memdump
;
242 /* These defines for 'configure' */
243 #define RECV_STATION 0x00
244 #define RECV_BROAD 0x01
245 #define RECV_MULTI 0x02
246 #define RECV_PROMISC 0x04
247 #define NO_LOOPBACK 0x00
248 #define INT_LOOPBACK 0x08
249 #define EXT_LOOPBACK 0x10
251 /*****************************************************************
253 * structure to hold context information for adapter
255 *****************************************************************/
257 #define DMA_BUFFER_SIZE 1600
258 #define BACKLOG_SIZE 4
261 volatile short got
[NUM_TRANSMIT_CMDS
]; /* flags for
262 command completion */
263 pcb_struct tx_pcb
; /* PCB for foreground sending */
264 pcb_struct rx_pcb
; /* PCB for foreground receiving */
265 pcb_struct itx_pcb
; /* PCB for background sending */
266 pcb_struct irx_pcb
; /* PCB for background receiving */
271 unsigned int length
[BACKLOG_SIZE
];
277 unsigned int direction
;
281 unsigned long start_time
;
285 unsigned long send_pcb_semaphore
;
286 unsigned long dmaing
;
289 unsigned int rx_active
; /* number of receive PCBs */
290 volatile unsigned char hcr_val
; /* what we think the HCR contains */
291 spinlock_t lock
; /* Interrupt v tx lock */