Home | History | Annotate | Line # | Download | only in sbus
qecreg.h revision 1.2
      1  1.2  pk /*	$NetBSD: qecreg.h,v 1.2 1999/01/16 12:46:08 pk Exp $	*/
      2  1.2  pk 
      3  1.2  pk /*-
      4  1.2  pk  * Copyright (c) 1998 The NetBSD Foundation, Inc.
      5  1.2  pk  * All rights reserved.
      6  1.2  pk  *
      7  1.2  pk  * This code is derived from software contributed to The NetBSD Foundation
      8  1.2  pk  * by Paul Kranenburg.
      9  1.2  pk  *
     10  1.2  pk  * Redistribution and use in source and binary forms, with or without
     11  1.2  pk  * modification, are permitted provided that the following conditions
     12  1.2  pk  * are met:
     13  1.2  pk  * 1. Redistributions of source code must retain the above copyright
     14  1.2  pk  *    notice, this list of conditions and the following disclaimer.
     15  1.2  pk  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.2  pk  *    notice, this list of conditions and the following disclaimer in the
     17  1.2  pk  *    documentation and/or other materials provided with the distribution.
     18  1.2  pk  * 3. All advertising materials mentioning features or use of this software
     19  1.2  pk  *    must display the following acknowledgement:
     20  1.2  pk  *        This product includes software developed by the NetBSD
     21  1.2  pk  *        Foundation, Inc. and its contributors.
     22  1.2  pk  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.2  pk  *    contributors may be used to endorse or promote products derived
     24  1.2  pk  *    from this software without specific prior written permission.
     25  1.2  pk  *
     26  1.2  pk  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.2  pk  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.2  pk  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.2  pk  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.2  pk  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.2  pk  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.2  pk  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.2  pk  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.2  pk  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.2  pk  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.2  pk  * POSSIBILITY OF SUCH DAMAGE.
     37  1.2  pk  */
     38  1.1  pk 
     39  1.1  pk /*
     40  1.2  pk  * Copyright (c) 1998 Theo de Raadt and Jason L. Wright.
     41  1.2  pk  * All rights reserved.
     42  1.1  pk  *
     43  1.1  pk  * Redistribution and use in source and binary forms, with or without
     44  1.1  pk  * modification, are permitted provided that the following conditions
     45  1.1  pk  * are met:
     46  1.1  pk  * 1. Redistributions of source code must retain the above copyright
     47  1.1  pk  *    notice, this list of conditions and the following disclaimer.
     48  1.1  pk  * 2. Redistributions in binary form must reproduce the above copyright
     49  1.1  pk  *    notice, this list of conditions and the following disclaimer in the
     50  1.1  pk  *    documentation and/or other materials provided with the distribution.
     51  1.2  pk  * 3. The name of the authors may not be used to endorse or promote products
     52  1.1  pk  *    derived from this software without specific prior written permission.
     53  1.1  pk  *
     54  1.2  pk  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
     55  1.1  pk  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     56  1.1  pk  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     57  1.2  pk  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     58  1.1  pk  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     59  1.1  pk  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     60  1.1  pk  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     61  1.1  pk  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     62  1.1  pk  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     63  1.1  pk  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     64  1.1  pk  */
     65  1.1  pk 
     66  1.2  pk /*
     67  1.2  pk  * QEC registers layout
     68  1.2  pk  *-
     69  1.1  pk struct qecregs {
     70  1.2  pk 	u_int32_t	qec_ctrl;	// control
     71  1.2  pk 	u_int32_t	qec_stat;	// status
     72  1.2  pk 	u_int32_t	qec_psize;	// packet size
     73  1.2  pk 	u_int32_t	qec_msize;	// local-mem size (64K)
     74  1.2  pk 	u_int32_t	qec_rsize;	// receive partition size
     75  1.2  pk 	u_int32_t	qec_tsize;	// transmit partition size
     76  1.1  pk };
     77  1.2  pk  */
     78  1.2  pk #define QEC_QRI_CTRL	(0*4)
     79  1.2  pk #define QEC_QRI_STAT	(1*4)
     80  1.2  pk #define QEC_QRI_PSIZE	(2*4)
     81  1.2  pk #define QEC_QRI_MSIZE	(3*4)
     82  1.2  pk #define QEC_QRI_RSIZE	(4*4)
     83  1.2  pk #define QEC_QRI_TSIZE	(5*4)
     84  1.1  pk 
     85  1.2  pk #define QEC_CTRL_MODEMASK	0xf0000000	/* QEC mode: */
     86  1.2  pk #define  QEC_CTRL_MMODE		0x40000000	/*   MACE qec mode */
     87  1.2  pk #define  QEC_CTRL_BMODE		0x10000000	/*   BE qec mode */
     88  1.1  pk #define QEC_CTRL_EPAR		0x00000020	/* enable parity */
     89  1.1  pk #define QEC_CTRL_ACNTRL		0x00000018	/* sbus arbitration control */
     90  1.1  pk #define QEC_CTRL_B64		0x00000004	/* 64 byte dvma bursts */
     91  1.1  pk #define QEC_CTRL_B32		0x00000002	/* 32 byte dvma bursts */
     92  1.1  pk #define QEC_CTRL_B16		0x00000000	/* 16 byte dvma bursts */
     93  1.1  pk #define QEC_CTRL_RESET		0x00000001	/* reset the qec */
     94  1.1  pk 
     95  1.1  pk #define QEC_STAT_TX		0x00000008	/* bigmac transmit irq */
     96  1.1  pk #define QEC_STAT_RX		0x00000004	/* bigmac receive irq */
     97  1.1  pk #define QEC_STAT_BM		0x00000002	/* bigmac qec irq */
     98  1.1  pk #define QEC_STAT_ER		0x00000001	/* bigmac error irq */
     99  1.1  pk 
    100  1.1  pk #define QEC_PSIZE_2048		0x00		/* 2k packet size */
    101  1.1  pk #define QEC_PSIZE_4096		0x01		/* 4k packet size */
    102  1.1  pk #define QEC_PSIZE_6144		0x10		/* 6k packet size */
    103  1.1  pk #define QEC_PSIZE_8192		0x11		/* 8k packet size */
    104  1.2  pk 
    105  1.2  pk 
    106  1.2  pk 
    107  1.2  pk /*
    108  1.2  pk  * Transmit & receive buffer descriptor.
    109  1.2  pk  */
    110  1.2  pk struct qec_xd {
    111  1.2  pk 	volatile u_int32_t	xd_flags;	/* see below */
    112  1.2  pk 	volatile u_int32_t	xd_addr;	/* Buffer address (DMA) */
    113  1.2  pk };
    114  1.2  pk #define QEC_XD_OWN	0x80000000	/* ownership: 1=hw, 0=sw */
    115  1.2  pk #define QEC_XD_SOP	0x40000000	/* start of packet marker (xmit) */
    116  1.2  pk #define QEC_XD_EOP	0x20000000	/* end of packet marker (xmit) */
    117  1.2  pk #define QEC_XD_UPDATE	0x10000000	/* being updated? */
    118  1.2  pk #define QEC_XD_LENGTH	0x00001fff	/* packet length mask */
    119  1.2  pk /* Descriptor ring size is fixed */
    120  1.2  pk #define QEC_XD_RING_MAXSIZE	256		/* maximum ring size */
    121