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