1 /* if_enpreg.h 1.3 86/12/15 */ 2 3 /* Copyright (c) 1984 by Communication Machinery Corporation 4 * 5 * This file contains material which is proprietary to 6 * Communication Machinery Corporation (CMC) and which 7 * may not be divulged without the written permission 8 * of CMC. 9 * 10 * ENP-10 Ram Definition 11 * 12 * 3/15/85 Jon Phares 13 * Update 7/10/85 S. Holmgren 14 * ENP-10 update 7/21/85 J. Mullen 15 * ENP-20 update 8/11/85 J. Mullen 16 * Mods for CCI TAHOE system 8/14/85 J. Mullen 17 */ 18 19 #define K *1024 20 21 struct ether_addr { 22 u_char ea_addr[6]; 23 }; 24 25 typedef struct ethlist { 26 int e_listsize; /* active addr entries */ 27 struct ether_addr e_baseaddr; /* addr lance is working with */ 28 struct ether_addr e_addrs[16]; /* possible addresses */ 29 } ETHLIST; 30 31 typedef struct { 32 u_long e_xmit_successful; /* Successful transmissions */ 33 u_long e_mult_retry; /* multiple retries on xmit */ 34 u_long e_one_retry; /* single retries */ 35 u_long e_fail_retry; /* too many retries */ 36 u_long e_deferrals; /* xmit delayed 'cuz cable busy */ 37 u_long e_xmit_buff_err; /* xmit data chaining failed -- 38 "can't happen" */ 39 u_long e_silo_underrun; /* transmit data fetch failed */ 40 u_long e_late_coll; /* collision after xmit */ 41 u_long e_lost_carrier; 42 u_long e_babble; /* xmit length > 1518 */ 43 u_long e_collision; 44 u_long e_xmit_mem_err; 45 u_long e_rcv_successful; /* good receptions */ 46 u_long e_rcv_missed; /* no recv buff available */ 47 u_long e_crc_err; /* checksum failed */ 48 u_long e_frame_err; /* crc error & data length != 0 mod 8 */ 49 u_long e_rcv_buff_err; /* rcv data chain failure -- 50 "can't happen" */ 51 u_long e_silo_overrun; /* receive data store failed */ 52 u_long e_rcv_mem_err; 53 } ENPSTAT; 54 55 typedef struct RING { 56 short r_rdidx; 57 short r_wrtidx; 58 short r_size; 59 short r_pad; 60 int r_slot[1]; 61 } RING; 62 63 typedef struct RING32 { 64 short r_rdidx; 65 short r_wrtidx; 66 short r_size; 67 short r_pad; /* to make VAXen happy */ 68 int r_slot[32]; 69 } RING32; 70 71 /* 72 * ENP Ram data layout 73 */ 74 75 /* 76 * Note: paged window (4 K) is identity mapped by ENP kernel to provide 77 * 124 K contiguous RAM (as reflected in RAM_SIZE) 78 */ 79 #define RAM_WINDOW (128 K) 80 #define IOACCESS_WINDOW (512) 81 #define FIXED_WINDOW (RAM_WINDOW - IOACCESS_WINDOW) 82 #define RAMROM_SWAP (4 K) 83 #define RAM_SIZE (FIXED_WINDOW - RAMROM_SWAP) 84 85 #define HOST_RAMSIZE (48 K) 86 #define ENP_RAMSIZE (20 K) 87 88 typedef struct iow20 { 89 char pad0; 90 char hst2enp_interrupt; 91 char pad1[510]; 92 } iow20; 93 94 struct enpdevice { 95 #ifdef notdef 96 char enp_ram_rom[4 K]; 97 #endif notdef 98 union { 99 char all_ram[RAM_SIZE]; 100 struct { 101 u_int t_go; 102 u_int t_pstart; 103 } t; 104 struct { 105 char nram[RAM_SIZE - (HOST_RAMSIZE + ENP_RAMSIZE)]; 106 char hram[HOST_RAMSIZE]; 107 char kram[ENP_RAMSIZE]; 108 } u_ram; 109 struct { 110 char pad7[0x100]; /* starts 0x1100 - 0x2000 */ 111 short e_enpstate; /* 1102 */ 112 short e_enpmode; /* 1104 */ 113 int e_enpbase; /* 1104 */ 114 int e_enprun; /* 1108 */ 115 u_short e_intrvec; 116 u_short e_dummy[3]; 117 RING32 h_toenp; /* 110C */ 118 RING32 h_hostfree; 119 RING32 e_tohost; 120 RING32 e_enpfree; 121 ENPSTAT e_stat; 122 ETHLIST e_netaddr; 123 } iface; 124 } enp_u; 125 iow20 enp_iow; 126 }; 127 128 #define enp_ram enp_u.all_ram 129 #define enp_nram enp_u.u_ram.nram 130 #define enp_hram enp_u.u_ram.hram 131 #define enp_kram enp_u.u_ram.kram 132 #define enp_go enp_u.t.t_go 133 #define enp_prog_start enp_u.t.t_pstart 134 #define enp_intrvec enp_u.iface.e_intrvec 135 #define enp_state enp_u.iface.e_enpstate 136 #define enp_mode enp_u.iface.e_enpmode 137 #define enp_base enp_u.iface.e_enpbase 138 #define enp_enprun enp_u.iface.e_enprun 139 #define enp_toenp enp_u.iface.h_toenp 140 #define enp_hostfree enp_u.iface.h_hostfree 141 #define enp_tohost enp_u.iface.e_tohost 142 #define enp_enpfree enp_u.iface.e_enpfree 143 #define enp_freembuf enp_u.iface.h_freembuf 144 #define enp_stat enp_u.iface.e_stat 145 #define enp_addr enp_u.iface.e_netaddr 146 147 #define ENPVAL 0xff /* enp_iow.hst2enp_interrupt poke value */ 148 #define RESETVAL 0x00 /* enp_iow.enp2hst_clear_intr poke value */ 149 150 #define INTR_ENP(addr) (addr->enp_iow.hst2enp_interrupt = ENPVAL) 151 152 #if ENP == 30 153 #define ACK_ENP_INTR(addr) (addr->enp_iow.enp2hst_clear_intr = RESETVAL) 154 #define IS_ENP_INTR(addr) (addr->enp_iow.enp2hst_clear_intr&0x80) 155 #endif 156 157 #ifdef notdef 158 #define RESET_ENP(addr) (addr->enp_iow.hst2enp_reset = 01) 159 #else 160 #define RESET_ENP(addr) 161 #endif notdef 162 163 #ifdef TAHOE 164 #define ENP_GO(addr,start) { \ 165 int v = start; \ 166 enpcopy((u_char *)&v, (u_char *)&addr->enp_prog_start, sizeof(v) ); \ 167 v = 0x80800000; \ 168 enpcopy((u_char *)&v, (u_char *)&addr->enp_go, sizeof(v) ); \ 169 } 170 #else 171 #define ENP_GO(addr,start,intvec ) { \ 172 addr->enp_prog_start = (u_int)(start); \ 173 addr->enp_intrvec = (u_short) intvec; \ 174 addr->enp_go = 0x80800000; \ 175 } 176 #endif TAHOE 177 178 /* 179 * State bits 180 */ 181 #define S_ENPRESET 01 /* enp is in reset state */ 182 #define S_ENPRUN 02 /* enp is in run state */ 183 184 /* 185 * Mode bits 186 */ 187 #define E_SWAP16 0x1 /* swap two octets within 16 */ 188 #define E_SWAP32 0x2 /* swap 16s within 32 */ 189 #define E_SWAPRD 0x4 /* swap on read */ 190 #define E_SWAPWRT 0x8 /* swap on write */ 191 #define E_DMA 0x10 /* enp does data moving */ 192 193 #define E_EXAM_LIST 0x80000000 /* enp should examine addrlist */ 194 #define E_ADDR_SUPP 0x40000000 /* enp should use supplied addr */ 195 196 /* 197 * Download ioctl definitions 198 */ 199 #define ENPIOGO _IO(S,1) /* start the enp */ 200 #define ENPIORESET _IO(S,2) /* reset the enp */ 201 202 /* 203 * The ENP Data Buffer Structure 204 */ 205 typedef struct BCB { 206 struct BCB *b_link; 207 short b_stat; 208 short b_len; 209 u_char *b_addr; 210 short b_msglen; 211 short b_reserved; 212 } BCB; 213