if_ievar.h revision 1.1 1 /* $NetBSD: if_ievar.h,v 1.1 1994/12/12 18:59:11 gwr Exp $ */
2
3 /*
4 * Machine-dependent glue for the Intel Ethernet (ie) driver.
5 */
6
7 #define B_PER_F 3 /* number of buffers to allocate per frame */
8 #define MXFRAMES 300 /* max number of frames to allow for receive */
9 #define MXRXBUF (MXFRAMES*B_PER_F) /* max number of buffers to allocate */
10 #define IE_RBUF_SIZE 256 /* size of each buffer, MUST BE POWER OF TWO */
11 #define NTXBUF 2 /* number of transmit buffer/command pairs */
12 #define IE_TBUF_SIZE 1512 /* length of transmit buffer */
13
14 enum ie_hardware {
15 IE_VME, /* multibus to VME ie card */
16 IE_OBIO, /* on board */
17 IE_VME3E, /* sun 3e VME card */
18 IE_UNKNOWN
19 };
20
21 const char *ie_hardware_names[] = {
22 "multibus/vme",
23 "onboard",
24 "3e/vme",
25 "unknown"
26 };
27
28 /*
29 * Ethernet status, per interface.
30 *
31 * hardware addresses/sizes to know (all KVA):
32 * sc_iobase = base of chip's 24 bit address space
33 * sc_maddr = base address of chip RAM as stored in ie_base of iscp
34 * sc_msize = size of chip's RAM
35 * sc_reg = address of card dependent registers
36 *
37 * the chip uses two types of pointers: 16 bit and 24 bit
38 * 16 bit pointers are offsets from sc_maddr/ie_base
39 * KVA(16 bit offset) = offset + sc_maddr
40 * 24 bit pointers are offset from sc_iobase in KVA
41 * KVA(24 bit address) = address + sc_iobase
42 *
43 * on the vme/multibus we have the page map to control where ram appears
44 * in the address space. we choose to have RAM start at 0 in the
45 * 24 bit address space. this means that sc_iobase == sc_maddr!
46 * to get the phyiscal address of the board's RAM you must take the
47 * top 12 bits of the physical address of the register address
48 * and or in the 4 bits from the status word as bits 17-20 (remember that
49 * the board ignores the chip's top 4 address lines).
50 * For example:
51 * if the register is @ 0xffe88000, then the top 12 bits are 0xffe00000.
52 * to get the 4 bits from the the status word just do status & IEVME_HADDR.
53 * suppose the value is "4". Then just shift it left 16 bits to get
54 * it into bits 17-20 (e.g. 0x40000). Then or it to get the
55 * address of RAM (in our example: 0xffe40000). see the attach routine!
56 *
57 * XXX CONFIRM THE BELOW COMMENT
58 * on the onboard ie interface the 24 bit address space is hardwired
59 * to be 0xff000000 -> 0xffffffff of KVA. this means that sc_iobase
60 * will be 0xff000000. sc_maddr will be where ever we allocate RAM
61 * in KVA. note that since the SCP is at a fixed address it means
62 * that we have to allocate a fixed KVA for the SCP.
63 */
64 struct ie_softc {
65 struct device sc_dev; /* device structure */
66
67 struct arpcom sc_arpcom;/* system arpcom structure */
68 #define sc_if sc_arpcom.ac_if /* network-visible interface */
69 #define sc_addr sc_arpcom.ac_enaddr /* hardware Ethernet address */
70
71 caddr_t sc_iobase; /* KVA of base of 24bit addr space */
72 caddr_t sc_maddr; /* KVA of base of chip's RAM */
73 u_int sc_msize; /* how much RAM we have/use */
74 caddr_t sc_reg; /* KVA of card's register */
75
76 void (*reset_586)(); /* card dependent reset function */
77 void (*chan_attn)(); /* card dependent attn function */
78 void (*run_586)(); /* card dependent "go on-line" function */
79
80 enum ie_hardware hard_type; /* card type */
81 void (*memcopy) __P((const void *, void *, u_int));
82 void (*memzero) __P((void *, u_int));
83
84 int want_mcsetup; /* flag for multicast setup */
85 int promisc; /* are we in promisc mode? */
86
87 /*
88 * pointers to the 3 major control structures
89 */
90 volatile struct ie_sys_conf_ptr *scp;
91 volatile struct ie_int_sys_conf_ptr *iscp;
92 volatile struct ie_sys_ctl_block *scb;
93
94 /*
95 * pointer and size of a block of KVA where the buffers
96 * are to be allocated from
97 */
98 caddr_t buf_area;
99 int buf_area_sz;
100
101 /*
102 * the actual buffers (recv and xmit)
103 */
104 volatile struct ie_recv_frame_desc *rframes[MXFRAMES];
105 volatile struct ie_recv_buf_desc *rbuffs[MXRXBUF];
106 volatile char *cbuffs[MXRXBUF];
107 int rfhead, rftail, rbhead, rbtail;
108
109 volatile struct ie_xmit_cmd *xmit_cmds[NTXBUF];
110 volatile struct ie_xmit_buf *xmit_buffs[NTXBUF];
111 int xmit_count;
112 u_char *xmit_cbuffs[NTXBUF];
113
114 struct ie_en_addr mcast_addrs[MAXMCAST + 1];
115 int mcast_count;
116
117 int nframes, nrxbuf;
118 #ifdef IEDEBUG
119 int sc_debug;
120 #endif
121 };
122
123
124 extern int ie_md_match(struct device *, void *, void *args);
125 extern void ie_md_attach(struct device *, struct device *, void *);
126 extern int ie_intr(void *);
127