Home | History | Annotate | Line # | Download | only in dev
swreg.h revision 1.4.78.1
      1  1.4.78.1    yamt /*	$NetBSD: swreg.h,v 1.4.78.1 2008/05/16 02:23:11 yamt Exp $	*/
      2       1.1      pk 
      3       1.1      pk /*-
      4       1.1      pk  * Copyright (c) 2000 The NetBSD Foundation, Inc.
      5       1.1      pk  * All rights reserved.
      6       1.1      pk  *
      7       1.1      pk  * This code is derived from software contributed to The NetBSD Foundation
      8       1.1      pk  * by Paul Kranenburg.
      9       1.1      pk  *
     10       1.1      pk  * Redistribution and use in source and binary forms, with or without
     11       1.1      pk  * modification, are permitted provided that the following conditions
     12       1.1      pk  * are met:
     13       1.1      pk  * 1. Redistributions of source code must retain the above copyright
     14       1.1      pk  *    notice, this list of conditions and the following disclaimer.
     15       1.1      pk  * 2. Redistributions in binary form must reproduce the above copyright
     16       1.1      pk  *    notice, this list of conditions and the following disclaimer in the
     17       1.1      pk  *    documentation and/or other materials provided with the distribution.
     18       1.1      pk  *
     19       1.1      pk  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20       1.1      pk  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21       1.1      pk  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22       1.1      pk  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23       1.1      pk  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24       1.1      pk  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25       1.1      pk  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26       1.1      pk  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27       1.1      pk  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28       1.1      pk  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29       1.1      pk  * POSSIBILITY OF SUCH DAMAGE.
     30       1.1      pk  */
     31       1.1      pk 
     32       1.1      pk /*
     33       1.1      pk  * Register map for the Sun3 SCSI Interface (si)
     34       1.1      pk  * The first part of this register map is an NCR5380
     35       1.1      pk  * SCSI Bus Interface Controller (SBIC).  The rest is a
     36       1.1      pk  * DMA controller and custom logic for the OBIO interface (3/50,3/60,4/110)
     37       1.1      pk  *
     38       1.3  keihan  * Modified for Sun 4 systems by Jason R. Thorpe <thorpej (at) NetBSD.org>.
     39       1.1      pk  */
     40       1.1      pk 
     41       1.1      pk /*
     42       1.1      pk  * Note that the obio version on the 4/1xx (the so-called "SCSI Weird", or
     43       1.1      pk  * "sw" controller) is laid out a bit differently, and hence the evilness
     44       1.1      pk  * with unions.  Also, the "sw" doesn't appear to have a FIFO.
     45       1.1      pk  */
     46       1.1      pk 
     47       1.1      pk #if __for_reference_only__
     48       1.1      pk struct sw_regs {
     49       1.1      pk 	/*
     50       1.1      pk 	 * Am5380 Register map (no padding). See dev/ic/ncr5380reg.h
     51       1.1      pk 	 */
     52       1.1      pk 	struct ncr5380regs {
     53       1.1      pk 		u_char r[8];
     54       1.1      pk 	} sci;
     55       1.1      pk 
     56       1.1      pk 	/* DMA controller registers on OBIO */
     57       1.2     wiz 	u_int	dma_addr;	/* DMA address */
     58       1.2     wiz 	u_int	dma_count;	/* DMA count */
     59       1.1      pk 	u_int	pad0;		/* no-existent register */
     60       1.1      pk 	u_int	sw_csr;		/* sw control/status */
     61       1.1      pk 	u_int	bpr;		/* sw byte pack */
     62       1.1      pk };
     63       1.1      pk #endif
     64       1.1      pk 
     65       1.1      pk /*
     66       1.1      pk  * Size of NCR5380 registers located at the bottom of the register bank.
     67       1.1      pk  */
     68       1.1      pk #define NCR5380REGS_SZ	8
     69       1.1      pk 
     70       1.1      pk /*
     71       1.1      pk  * Register definition for the `sw' OBIO controller
     72       1.1      pk  */
     73       1.1      pk #define SWREG_DMA_ADDR	(NCR5380REGS_SZ + 0)
     74       1.1      pk #define SWREG_DMA_CNT	(NCR5380REGS_SZ + 4)
     75       1.1      pk #define SWREG_CSR	(NCR5380REGS_SZ + 12)
     76       1.1      pk #define SWREG_BPR	(NCR5380REGS_SZ + 16)
     77       1.1      pk #define SWREG_BANK_SZ	(NCR5380REGS_SZ + 20)
     78       1.1      pk 
     79       1.1      pk /*
     80       1.1      pk  * Status Register.
     81       1.1      pk  * Note:
     82       1.1      pk  *	(r)	indicates bit is read only.
     83       1.1      pk  *	(rw)	indicates bit is read or write.
     84       1.1      pk  *	(v)	vme host adaptor interface only.
     85       1.1      pk  *	(o)	sun3/50 onboard host adaptor interface only.
     86       1.1      pk  *	(b)	both vme and sun3/50 host adaptor interfaces.
     87       1.1      pk  */
     88       1.2     wiz #define SW_CSR_DMA_ACTIVE	0x8000	/* (r,o) DMA transfer active */
     89       1.2     wiz #define SW_CSR_DMA_CONFLICT	0x4000	/* (r,b) reg accessed while DMA'ing */
     90       1.2     wiz #define SW_CSR_DMA_BUS_ERR	0x2000	/* (r,b) bus error during DMA */
     91       1.1      pk #define SW_CSR_ID		0x1000	/* (r,b) 0 for 3/50, 1 for SCSI-3, */
     92       1.1      pk 					/* 0 if SCSI-3 unmodified */
     93       1.1      pk #define SW_CSR_FIFO_FULL	0x0800	/* (r,b) fifo full */
     94       1.1      pk #define SW_CSR_FIFO_EMPTY	0x0400	/* (r,b) fifo empty */
     95       1.1      pk #define SW_CSR_SBC_IP		0x0200	/* (r,b) sbc interrupt pending */
     96       1.2     wiz #define SW_CSR_DMA_IP		0x0100	/* (r,b) DMA interrupt pending */
     97       1.2     wiz #define SW_CSR_DMA_EN		0x0010	/* (rw,v) DMA/interrupt enable */
     98       1.2     wiz #define SW_CSR_SEND		0x0008	/* (rw,b) DMA dir, 1=to device */
     99       1.1      pk #define SW_CSR_INTR_EN		0x0004	/* (rw,b) interrupts enable */
    100       1.1      pk #define SW_CSR_FIFO_RES		0x0002	/* (rw,b) inits fifo, 0=reset */
    101       1.1      pk #define SW_CSR_SCSI_RES		0x0001	/* (rw,b) reset sbc and udc, 0=reset */
    102