Home | History | Annotate | Line # | Download | only in qbus
if_qereg.h revision 1.11
      1  1.11  andvar /*	$NetBSD: if_qereg.h,v 1.11 2025/08/18 20:59:55 andvar Exp $ */
      2   1.1   ragge /*
      3   1.1   ragge  * Copyright (c) 1988 Regents of the University of California.
      4   1.1   ragge  * All rights reserved.
      5   1.1   ragge  *
      6   1.1   ragge  * This code is derived from software contributed to Berkeley by
      7   1.1   ragge  * Digital Equipment Corp.
      8   1.1   ragge  *
      9   1.1   ragge  * Redistribution and use in source and binary forms, with or without
     10   1.1   ragge  * modification, are permitted provided that the following conditions
     11   1.1   ragge  * are met:
     12   1.1   ragge  * 1. Redistributions of source code must retain the above copyright
     13   1.1   ragge  *    notice, this list of conditions and the following disclaimer.
     14   1.1   ragge  * 2. Redistributions in binary form must reproduce the above copyright
     15   1.1   ragge  *    notice, this list of conditions and the following disclaimer in the
     16   1.1   ragge  *    documentation and/or other materials provided with the distribution.
     17   1.7     agc  * 3. Neither the name of the University nor the names of its contributors
     18   1.1   ragge  *    may be used to endorse or promote products derived from this software
     19   1.1   ragge  *    without specific prior written permission.
     20   1.1   ragge  *
     21   1.1   ragge  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22   1.1   ragge  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23   1.1   ragge  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24   1.1   ragge  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25   1.1   ragge  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26   1.1   ragge  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27   1.1   ragge  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28   1.1   ragge  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29   1.1   ragge  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30   1.1   ragge  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31   1.1   ragge  * SUCH DAMAGE.
     32   1.1   ragge  *
     33   1.1   ragge  *	@(#)if_qereg.h	7.3 (Berkeley) 6/28/90
     34   1.1   ragge  */
     35   1.1   ragge 
     36   1.1   ragge /* @(#)if_qereg.h	1.2 (ULTRIX) 1/3/85 */
     37   1.8  simonb 
     38   1.1   ragge /****************************************************************
     39   1.1   ragge  *								*
     40   1.1   ragge  *        Licensed from Digital Equipment Corporation 		*
     41   1.1   ragge  *                       Copyright (c) 				*
     42   1.1   ragge  *               Digital Equipment Corporation			*
     43   1.1   ragge  *                   Maynard, Massachusetts 			*
     44   1.1   ragge  *                         1985, 1986 				*
     45   1.1   ragge  *                    All rights reserved. 			*
     46   1.1   ragge  *								*
     47   1.1   ragge  *        The Information in this software is subject to change *
     48   1.1   ragge  *   without notice and should not be construed as a commitment *
     49   1.1   ragge  *   by  Digital  Equipment  Corporation.   Digital   makes  no *
     50   1.1   ragge  *   representations about the suitability of this software for *
     51   1.1   ragge  *   any purpose.  It is supplied "As Is" without expressed  or *
     52   1.1   ragge  *   implied  warranty. 					*
     53   1.1   ragge  *								*
     54   1.1   ragge  *        If the Regents of the University of California or its *
     55   1.1   ragge  *   licensees modify the software in a manner creating  	*
     56   1.3      pk  *   derivative copyright rights, appropriate copyright  	*
     57   1.3      pk  *   legends may be placed on  the derivative work in addition  *
     58   1.1   ragge  *   to that set forth above. 					*
     59   1.1   ragge  *								*
     60   1.1   ragge  ****************************************************************/
     61   1.1   ragge /* ---------------------------------------------------------------------
     62   1.8  simonb  * Modification History
     63   1.1   ragge  *
     64   1.1   ragge  *  13 Feb. 84 -- rjl
     65   1.1   ragge  *
     66   1.1   ragge  *	Initial version of driver. derived from IL driver.
     67   1.8  simonb  *
     68   1.1   ragge  * ---------------------------------------------------------------------
     69   1.1   ragge  */
     70   1.8  simonb 
     71   1.1   ragge /*
     72   1.8  simonb  * Digital Q-BUS to NI Adapter
     73   1.1   ragge  */
     74   1.5   ragge #ifdef notdef
     75   1.1   ragge struct qedevice {
     76   1.8  simonb 	u_short	qe_sta_addr[2];		/* Station address (actually 6	*/
     77   1.8  simonb 	u_short	qe_rcvlist_lo;		/* Receive list lo address	*/
     78   1.8  simonb 	u_short	qe_rcvlist_hi;		/* Receive list hi address	*/
     79   1.8  simonb 	u_short	qe_xmtlist_lo;		/* Transmit list lo address	*/
     80   1.8  simonb 	u_short	qe_xmtlist_hi;		/* Transmit list hi address	*/
     81   1.8  simonb 	u_short	qe_vector;		/* Interrupt vector		*/
     82   1.8  simonb 	u_short	qe_csr;			/* Command and Status Register	*/
     83   1.1   ragge };
     84   1.5   ragge #endif
     85   1.5   ragge 
     86   1.5   ragge /*
     87   1.5   ragge  * Register offsets in register space.
     88   1.5   ragge  */
     89   1.5   ragge #define	QE_CSR_ADDR1	0
     90   1.5   ragge #define	QE_CSR_ADDR2	2
     91   1.5   ragge #define	QE_CSR_RCLL	4
     92   1.5   ragge #define	QE_CSR_RCLH	6
     93   1.5   ragge #define	QE_CSR_XMTL	8
     94   1.5   ragge #define	QE_CSR_XMTH	10
     95   1.5   ragge #define	QE_CSR_VECTOR	12
     96   1.5   ragge #define	QE_CSR_CSR	14
     97   1.8  simonb 
     98   1.1   ragge /*
     99   1.1   ragge  * Command and status bits (csr)
    100   1.1   ragge  */
    101   1.1   ragge #define QE_RCV_ENABLE	0x0001		/* Receiver enable		*/
    102   1.1   ragge #define QE_RESET	0x0002		/* Software reset		*/
    103   1.6     wiz #define QE_NEX_MEM_INT	0x0004		/* Non existent mem interrupt	*/
    104   1.1   ragge #define QE_LOAD_ROM	0x0008		/* Load boot/diag from rom	*/
    105   1.1   ragge #define QE_XL_INVALID	0x0010		/* Transmit list invalid	*/
    106   1.1   ragge #define QE_RL_INVALID	0x0020		/* Receive list invalid		*/
    107   1.1   ragge #define QE_INT_ENABLE	0x0040		/* Interrupt enable		*/
    108   1.1   ragge #define QE_XMIT_INT	0x0080		/* Transmit interrupt		*/
    109   1.8  simonb #define QE_ILOOP	0x0100		/* Internal loopback		*/
    110   1.1   ragge #define QE_ELOOP	0x0200		/* External loopback		*/
    111   1.1   ragge #define QE_STIM_ENABLE	0x0400		/* Sanity timer enable		*/
    112  1.11  andvar #define QE_POWERUP	0x1000		/* Transceiver power on		*/
    113   1.1   ragge #define QE_CARRIER	0x2000		/* Carrier detect		*/
    114   1.1   ragge #define QE_RCV_INT	0x8000		/* Receiver interrupt		*/
    115   1.8  simonb 
    116   1.1   ragge /*
    117  1.10  andvar  * Transmit and receive ring descriptor ---------------------------
    118   1.1   ragge  *
    119   1.1   ragge  * The QNA uses the flag, status1 and the valid bit as a handshake/semiphore
    120   1.8  simonb  * mechinism.
    121   1.8  simonb  *
    122   1.1   ragge  * The flag word is written on ( bits 15,15 set to 1 ) when it reads the
    123   1.1   ragge  * descriptor. If the valid bit is set it considers the address to be valid.
    124   1.1   ragge  * When it uses the buffer pointed to by the valid address it sets status word
    125   1.1   ragge  * one.
    126   1.1   ragge  */
    127   1.1   ragge struct qe_ring	{
    128   1.1   ragge 	u_short qe_flag;		/* Buffer utilization flags	*/
    129   1.5   ragge 	u_short qe_addr_hi;
    130   1.1   ragge 	u_short qe_addr_lo;		/* Low order bits of address	*/
    131   1.1   ragge 	short qe_buf_len;		/* Negative buffer length	*/
    132   1.1   ragge 	u_short qe_status1;		/* Status word one		*/
    133   1.1   ragge 	u_short qe_status2;		/* Status word two		*/
    134   1.1   ragge };
    135   1.5   ragge 
    136   1.5   ragge /*
    137   1.5   ragge  * High word address control bits.
    138   1.5   ragge  */
    139   1.5   ragge #define	QE_VALID		0x8000
    140   1.5   ragge #define	QE_CHAIN		0x4000
    141   1.5   ragge #define	QE_EOMSG		0x2000
    142   1.5   ragge #define	QE_SETUP		0x1000
    143   1.5   ragge #define	QE_ODDEND		0x0080
    144   1.5   ragge #define	QE_ODDBEGIN		0x0040
    145   1.8  simonb 
    146   1.1   ragge /*
    147   1.1   ragge  * Status word definations (receive)
    148   1.1   ragge  *	word1
    149   1.1   ragge  */
    150   1.1   ragge #define QE_OVF			0x0001	/* Receiver overflow		*/
    151   1.1   ragge #define QE_CRCERR		0x0002	/* CRC error			*/
    152   1.1   ragge #define QE_FRAME		0x0004	/* Framing alignment error	*/
    153   1.1   ragge #define QE_SHORT		0x0008	/* Packet size < 10 bytes	*/
    154   1.1   ragge #define QE_RBL_HI		0x0700	/* Hi bits of receive len	*/
    155   1.1   ragge #define QE_RUNT			0x0800	/* Runt packet			*/
    156   1.1   ragge #define QE_DISCARD		0x1000	/* Discard the packet		*/
    157   1.1   ragge #define QE_ESETUP		0x2000	/* Looped back setup or eloop	*/
    158   1.1   ragge #define QE_ERROR		0x4000	/* Receiver error		*/
    159   1.1   ragge #define QE_LASTNOT		0x8000	/* Not the last in the packet	*/
    160   1.1   ragge /*	word2								*/
    161   1.1   ragge #define QE_RBL_LO		0x00ff	/* Low bits of receive len	*/
    162   1.8  simonb 
    163   1.1   ragge /*
    164   1.1   ragge  * Status word definations (transmit)
    165   1.1   ragge  *	word1
    166   1.1   ragge  */
    167   1.1   ragge #define QE_CCNT			0x00f0	/* Collision count this packet	*/
    168   1.1   ragge #define QE_FAIL			0x0100	/* Heart beat check failure	*/
    169   1.1   ragge #define QE_ABORT		0x0200	/* Transmission abort		*/
    170   1.1   ragge #define QE_STE16		0x0400	/* Sanity timer default on	*/
    171   1.1   ragge #define QE_NOCAR		0x0800	/* No carrier			*/
    172   1.1   ragge #define QE_LOSS			0x1000	/* Loss of carrier while xmit	*/
    173   1.1   ragge /*	word2								*/
    174   1.1   ragge #define QE_TDR			0x3fff	/* Time domain reflectometry	*/
    175   1.8  simonb 
    176   1.1   ragge /*
    177   1.1   ragge  * General constant definations
    178   1.1   ragge  */
    179   1.8  simonb #define QEALLOC			0	/* Allocate an mbuf		*/
    180   1.1   ragge #define QENOALLOC		1	/* No mbuf allocation		*/
    181   1.1   ragge #define QEDEALLOC		2	/* Release an mbuf chain	*/
    182   1.8  simonb 
    183   1.1   ragge #define QE_NOTYET		0x8000	/* Descriptor not in use yet	*/
    184   1.1   ragge #define QE_INUSE		0x4000	/* Descriptor being used by QNA	*/
    185   1.1   ragge #define QE_MASK			0xc000	/* Lastnot/error/used mask	*/
    186   1.2   ragge 
    187   1.2   ragge /*
    188   1.2   ragge  * Values for the length of the setup packet that control reception filter.
    189   1.2   ragge  */
    190   1.5   ragge #define	QE_SETUPLEN		128	/* Size of setup packet		*/
    191   1.5   ragge #define QE_ALLMULTI		1	/* Receive all multicasts	*/
    192   1.5   ragge #define QE_PROMISC		2	/* Receive all packets		*/
    193