1*95e1ffb1Schristos /* $NetBSD: if_dereg.h,v 1.4 2005/12/11 12:23:29 christos Exp $ */ 289955057Sragge 389955057Sragge /* 489955057Sragge * Copyright (c) 1982, 1986 Regents of the University of California. 589955057Sragge * All rights reserved. 689955057Sragge * 789955057Sragge * Redistribution and use in source and binary forms, with or without 889955057Sragge * modification, are permitted provided that the following conditions 989955057Sragge * are met: 1089955057Sragge * 1. Redistributions of source code must retain the above copyright 1189955057Sragge * notice, this list of conditions and the following disclaimer. 1289955057Sragge * 2. Redistributions in binary form must reproduce the above copyright 1389955057Sragge * notice, this list of conditions and the following disclaimer in the 1489955057Sragge * documentation and/or other materials provided with the distribution. 15aad01611Sagc * 3. Neither the name of the University nor the names of its contributors 1689955057Sragge * may be used to endorse or promote products derived from this software 1789955057Sragge * without specific prior written permission. 1889955057Sragge * 1989955057Sragge * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2089955057Sragge * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2189955057Sragge * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2289955057Sragge * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2389955057Sragge * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2489955057Sragge * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2589955057Sragge * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2689955057Sragge * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2789955057Sragge * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2889955057Sragge * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2989955057Sragge * SUCH DAMAGE. 3089955057Sragge * 3189955057Sragge * @(#)if_dereg.h 7.3 (Berkeley) 6/28/90 3289955057Sragge */ 3389955057Sragge 3489955057Sragge /* 3589955057Sragge * DEC DEUNA interface 3689955057Sragge */ 3789955057Sragge #ifdef notdef 3889955057Sragge struct dedevice { 3989955057Sragge union { 4089955057Sragge short p0_w; 4189955057Sragge char p0_b[2]; 4289955057Sragge } u_p0; 4389955057Sragge #define pcsr0 u_p0.p0_w 4489955057Sragge #define pclow u_p0.p0_b[0] 4589955057Sragge #define pchigh u_p0.p0_b[1] 4689955057Sragge short pcsr1; 4789955057Sragge short pcsr2; 4889955057Sragge short pcsr3; 4989955057Sragge }; 5089955057Sragge #endif 5189955057Sragge 5289955057Sragge #define DE_PCSR0 0 5389955057Sragge #define DE_PCSR1 2 5489955057Sragge #define DE_PCSR2 4 5589955057Sragge #define DE_PCSR3 6 5689955057Sragge 5789955057Sragge /* 5889955057Sragge * PCSR 0 bit descriptions 5989955057Sragge */ 6089955057Sragge #define PCSR0_SERI 0x8000 /* Status error interrupt */ 6189955057Sragge #define PCSR0_PCEI 0x4000 /* Port command error interrupt */ 6289955057Sragge #define PCSR0_RXI 0x2000 /* Receive done interrupt */ 6389955057Sragge #define PCSR0_TXI 0x1000 /* Transmit done interrupt */ 6489955057Sragge #define PCSR0_DNI 0x0800 /* Done interrupt */ 6589955057Sragge #define PCSR0_RCBI 0x0400 /* Receive buffer unavail intrpt */ 6689955057Sragge #define PCSR0_FATI 0x0100 /* Fatal error interrupt */ 6789955057Sragge #define PCSR0_INTR 0x0080 /* Interrupt summary */ 6889955057Sragge #define PCSR0_INTE 0x0040 /* Interrupt enable */ 6989955057Sragge #define PCSR0_RSET 0x0020 /* DEUNA reset */ 7089955057Sragge #define PCSR0_CMASK 0x000f /* command mask */ 7189955057Sragge 7289955057Sragge #define PCSR0_BITS "\20\20SERI\17PCEI\16RXI\15TXI\14DNI\13RCBI\11FATI\10INTR\7INTE\6RSET" 7389955057Sragge 7489955057Sragge /* bits 0-3 are for the PORT_COMMAND */ 7589955057Sragge #define CMD_NOOP 0x0 7689955057Sragge #define CMD_GETPCBB 0x1 /* Get PCB Block */ 7789955057Sragge #define CMD_GETCMD 0x2 /* Execute command in PCB */ 7889955057Sragge #define CMD_STEST 0x3 /* Self test mode */ 7989955057Sragge #define CMD_START 0x4 /* Reset xmit and receive ring ptrs */ 8089955057Sragge #define CMD_BOOT 0x5 /* Boot DEUNA */ 8189955057Sragge #define CMD_PDMD 0x8 /* Polling demand */ 8289955057Sragge #define CMD_TMRO 0x9 /* Sanity timer on */ 8389955057Sragge #define CMD_TMRF 0xa /* Sanity timer off */ 8489955057Sragge #define CMD_RSTT 0xb /* Reset sanity timer */ 8589955057Sragge #define CMD_STOP 0xf /* Suspend operation */ 8689955057Sragge 8789955057Sragge /* 8889955057Sragge * PCSR 1 bit descriptions 8989955057Sragge */ 9089955057Sragge #define PCSR1_XPWR 0x8000 /* Transceiver power BAD */ 9189955057Sragge #define PCSR1_ICAB 0x4000 /* Interconnect cabling BAD */ 9289955057Sragge #define PCSR1_STCODE 0x3f00 /* Self test error code */ 9389955057Sragge #define PCSR1_PCTO 0x0080 /* Port command timed out */ 9489955057Sragge #define PCSR1_ILLINT 0x0040 /* Illegal interrupt */ 9589955057Sragge #define PCSR1_TIMEOUT 0x0020 /* Timeout */ 9689955057Sragge #define PCSR1_POWER 0x0010 /* Power fail */ 9789955057Sragge #define PCSR1_RMTC 0x0008 /* Remote console reserved */ 9889955057Sragge #define PCSR1_STMASK 0x0007 /* State */ 9989955057Sragge 10089955057Sragge /* bit 0-3 are for STATE */ 10189955057Sragge #define STAT_RESET 0x0 10289955057Sragge #define STAT_PRIMLD 0x1 /* Primary load */ 10389955057Sragge #define STAT_READY 0x2 10489955057Sragge #define STAT_RUN 0x3 10589955057Sragge #define STAT_UHALT 0x5 /* UNIBUS halted */ 10689955057Sragge #define STAT_NIHALT 0x6 /* NI halted */ 10789955057Sragge #define STAT_NIUHALT 0x7 /* NI and UNIBUS Halted */ 10889955057Sragge 10989955057Sragge #define PCSR1_BITS "\20\20XPWR\17ICAB\10PCTO\7ILLINT\6TIMEOUT\5POWER\4RMTC" 11089955057Sragge 11189955057Sragge /* 11289955057Sragge * Port Control Block Base 11389955057Sragge */ 11489955057Sragge struct de_pcbb { 11589955057Sragge int16_t pcbb0; /* function */ 11689955057Sragge int16_t pcbb2; /* command specific */ 11789955057Sragge int16_t pcbb4; 11889955057Sragge int16_t pcbb6; 11989955057Sragge }; 12089955057Sragge 12189955057Sragge /* PCBB function codes */ 12289955057Sragge #define FC_NOOP 0x00 /* NO-OP */ 12389955057Sragge #define FC_LSUADDR 0x01 /* Load and start microaddress */ 12489955057Sragge #define FC_RDDEFAULT 0x02 /* Read default physical address */ 12589955057Sragge #define FC_RDPHYAD 0x04 /* Read physical address */ 12689955057Sragge #define FC_WTPHYAD 0x05 /* Write physical address */ 12789955057Sragge #define FC_RDMULTI 0x06 /* Read multicast address list */ 12889955057Sragge #define FC_WTMULTI 0x07 /* Read multicast address list */ 12989955057Sragge #define FC_RDRING 0x08 /* Read ring format */ 13089955057Sragge #define FC_WTRING 0x09 /* Write ring format */ 13189955057Sragge #define FC_RDCNTS 0x0a /* Read counters */ 13289955057Sragge #define FC_RCCNTS 0x0b /* Read and clear counters */ 13389955057Sragge #define FC_RDMODE 0x0c /* Read mode */ 13489955057Sragge #define FC_WTMODE 0x0d /* Write mode */ 13589955057Sragge #define FC_RDSTATUS 0x0e /* Read port status */ 13689955057Sragge #define FC_RCSTATUS 0x0f /* Read and clear port status */ 13789955057Sragge #define FC_DUMPMEM 0x10 /* Dump internal memory */ 13889955057Sragge #define FC_LOADMEM 0x11 /* Load internal memory */ 13989955057Sragge #define FC_RDSYSID 0x12 /* Read system ID parameters */ 14089955057Sragge #define FC_WTSYSID 0x13 /* Write system ID parameters */ 14189955057Sragge #define FC_RDSERAD 0x14 /* Read load server address */ 14289955057Sragge #define FC_WTSERAD 0x15 /* Write load server address */ 14389955057Sragge 14489955057Sragge /* 14589955057Sragge * Unibus Data Block Base (UDBB) for ring buffers 14689955057Sragge */ 14789955057Sragge struct de_udbbuf { 14889955057Sragge int16_t b_tdrbl; /* Transmit desc ring base low 16 bits */ 14989955057Sragge int8_t b_tdrbh; /* Transmit desc ring base high 2 bits */ 15089955057Sragge int8_t b_telen; /* Length of each transmit entry */ 15189955057Sragge int16_t b_trlen; /* Number of entries in the XMIT desc ring */ 15289955057Sragge int16_t b_rdrbl; /* Receive desc ring base low 16 bits */ 15389955057Sragge int8_t b_rdrbh; /* Receive desc ring base high 2 bits */ 15489955057Sragge int8_t b_relen; /* Length of each receive entry */ 15589955057Sragge int16_t b_rrlen; /* Number of entries in the RECV desc ring */ 15689955057Sragge }; 15789955057Sragge 15889955057Sragge /* 15989955057Sragge * Transmit/Receive Ring Entry 16089955057Sragge */ 16189955057Sragge struct de_ring { 16289955057Sragge int16_t r_slen; /* Segment length */ 16389955057Sragge int16_t r_segbl; /* Segment address (low 16 bits) */ 16489955057Sragge int8_t r_segbh; /* Segment address (hi 2 bits) */ 16589955057Sragge u_int8_t r_flags; /* Status flags */ 16689955057Sragge u_int16_t r_tdrerr; /* Errors */ 16789955057Sragge #define r_lenerr r_tdrerr 16889955057Sragge }; 16989955057Sragge 17089955057Sragge #define XFLG_OWN 0x80 /* If 0 then owned by driver */ 17189955057Sragge #define XFLG_ERRS 0x40 /* Error summary */ 17289955057Sragge #define XFLG_MTCH 0x20 /* Address match on xmit request */ 17389955057Sragge #define XFLG_MORE 0x10 /* More than one entry required */ 17489955057Sragge #define XFLG_ONE 0x08 /* One collision encountered */ 17589955057Sragge #define XFLG_DEF 0x04 /* Transmit deferred */ 17689955057Sragge #define XFLG_STP 0x02 /* Start of packet */ 17789955057Sragge #define XFLG_ENP 0x01 /* End of packet */ 17889955057Sragge 17989955057Sragge #define XFLG_BITS "\10\10OWN\7ERRS\6MTCH\5MORE\4ONE\3DEF\2STP\1ENP" 18089955057Sragge 18189955057Sragge #define XERR_BUFL 0x8000 /* Buffer length error */ 18289955057Sragge #define XERR_UBTO 0x4000 /* UNIBUS tiemout */ 18389955057Sragge #define XERR_LCOL 0x1000 /* Late collision */ 18489955057Sragge #define XERR_LCAR 0x0800 /* Loss of carrier */ 18589955057Sragge #define XERR_RTRY 0x0400 /* Failed after 16 retries */ 18689955057Sragge #define XERR_TDR 0x03ff /* TDR value */ 18789955057Sragge 18889955057Sragge #define XERR_BITS "\20\20BUFL\17UBTO\15LCOL\14LCAR\13RTRY" 18989955057Sragge 19089955057Sragge #define RFLG_OWN 0x80 /* If 0 then owned by driver */ 19189955057Sragge #define RFLG_ERRS 0x40 /* Error summary */ 19289955057Sragge #define RFLG_FRAM 0x20 /* Framing error */ 19389955057Sragge #define RFLG_OFLO 0x10 /* Message overflow */ 19489955057Sragge #define RFLG_CRC 0x08 /* CRC error */ 19589955057Sragge #define RFLG_STP 0x02 /* Start of packet */ 19689955057Sragge #define RFLG_ENP 0x01 /* End of packet */ 19789955057Sragge 19889955057Sragge #define RFLG_BITS "\10\10OWN\7ERRS\6FRAM\5OFLO\4CRC\2STP\1ENP" 19989955057Sragge 20089955057Sragge #define RERR_BUFL 0x8000 /* Buffer length error */ 20189955057Sragge #define RERR_UBTO 0x4000 /* UNIBUS tiemout */ 20289955057Sragge #define RERR_NCHN 0x2000 /* No data chaining */ 20389955057Sragge #define RERR_MLEN 0x0fff /* Message length */ 20489955057Sragge 20589955057Sragge #define RERR_BITS "\20\20BUFL\17UBTO\16NCHN" 20689955057Sragge 20789955057Sragge /* mode description bits */ 20889955057Sragge #define MOD_HDX 0x0001 /* Half duplex mode */ 20989955057Sragge #define MOD_LOOP 0x0004 /* Enable internal loopback */ 21089955057Sragge #define MOD_DTCR 0x0008 /* Disables CRC generation */ 21189955057Sragge #define MOD_DMNT 0x0200 /* Disable maintenance features */ 21289955057Sragge #define MOD_ECT 0x0400 /* Enable collision test */ 21389955057Sragge #define MOD_TPAD 0x1000 /* Transmit message pad enable */ 21489955057Sragge #define MOD_DRDC 0x2000 /* Disable data chaining */ 21589955057Sragge #define MOD_ENAL 0x4000 /* Enable all multicast */ 21689955057Sragge #define MOD_PROM 0x8000 /* Enable promiscuous mode */ 217