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