1 1.7 christos /* $NetBSD: ncr5380reg.h,v 1.7 2005/12/11 12:21:28 christos Exp $ */ 2 1.1 pk 3 1.6 perry /* 4 1.1 pk * Mach Operating System 5 1.1 pk * Copyright (c) 1991,1990,1989 Carnegie Mellon University 6 1.1 pk * All Rights Reserved. 7 1.6 perry * 8 1.1 pk * Permission to use, copy, modify and distribute this software and its 9 1.1 pk * documentation is hereby granted, provided that both the copyright 10 1.1 pk * notice and this permission notice appear in all copies of the 11 1.1 pk * software, derivative works or modified versions, and any portions 12 1.1 pk * thereof, and that both notices appear in supporting documentation. 13 1.6 perry * 14 1.4 pk * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 15 1.1 pk * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 16 1.1 pk * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 17 1.6 perry * 18 1.1 pk * Carnegie Mellon requests users of this software to return to 19 1.6 perry * 20 1.1 pk * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU 21 1.1 pk * School of Computer Science 22 1.1 pk * Carnegie Mellon University 23 1.1 pk * Pittsburgh PA 15213-3890 24 1.6 perry * 25 1.1 pk * any improvements or extensions that they make and grant Carnegie the 26 1.1 pk * rights to redistribute these changes. 27 1.1 pk */ 28 1.1 pk /* 29 1.1 pk * HISTORY (mach3) 30 1.1 pk * Revision 2.3 91/08/24 12:25:10 af 31 1.1 pk * Moved padding of regmap in impl file. 32 1.1 pk * [91/08/02 04:22:39 af] 33 1.6 perry * 34 1.1 pk * Revision 2.2 91/06/19 16:28:35 rvb 35 1.1 pk * From the NCR data sheets 36 1.1 pk * "NCR 5380 Family, SCSI Protocol Controller Data Manual" 37 1.1 pk * NCR Microelectronics Division, Colorado Spring, 6/98 T01891L 38 1.1 pk * [91/04/21 af] 39 1.6 perry * 40 1.1 pk */ 41 1.1 pk 42 1.1 pk /* 43 1.1 pk * File: scsi_5380.h 44 1.1 pk * Author: Alessandro Forin, Carnegie Mellon University 45 1.1 pk * Date: 5/91 46 1.1 pk * 47 1.1 pk * Defines for the NCR 5380 (SCSI chip), aka Am5380 48 1.1 pk */ 49 1.1 pk 50 1.1 pk /* 51 1.2 thorpej * Register map: Note not declared here anymore! 52 1.2 thorpej * All the 5380 registers are accessed through individual 53 1.2 thorpej * pointers initialized by MD code. This allows the 5380 54 1.2 thorpej * MI functions to be shared between MD drivers that have 55 1.2 thorpej * different padding between the registers (i.e. amiga). 56 1.1 pk */ 57 1.2 thorpej #if 0 /* example only */ 58 1.2 thorpej struct ncr5380regs { 59 1.2 thorpej volatile u_char sci_r0; 60 1.2 thorpej volatile u_char sci_r1; 61 1.2 thorpej volatile u_char sci_r2; 62 1.2 thorpej volatile u_char sci_r3; 63 1.2 thorpej volatile u_char sci_r4; 64 1.2 thorpej volatile u_char sci_r5; 65 1.2 thorpej volatile u_char sci_r6; 66 1.2 thorpej volatile u_char sci_r7; 67 1.2 thorpej }; 68 1.2 thorpej #endif 69 1.2 thorpej 70 1.2 thorpej /* 71 1.2 thorpej * Machine-independent code uses these names: 72 1.2 thorpej */ 73 1.2 thorpej #define sci_data sci_r0 /* r: Current data */ 74 1.2 thorpej #define sci_odata sci_r0 /* w: Out data */ 75 1.2 thorpej 76 1.2 thorpej #define sci_icmd sci_r1 /* rw: Initiator command */ 77 1.2 thorpej #define sci_mode sci_r2 /* rw: Mode */ 78 1.2 thorpej #define sci_tcmd sci_r3 /* rw: Target command */ 79 1.2 thorpej 80 1.2 thorpej #define sci_bus_csr sci_r4 /* r: Bus Status */ 81 1.2 thorpej #define sci_sel_enb sci_r4 /* w: Select enable */ 82 1.2 thorpej 83 1.2 thorpej #define sci_csr sci_r5 /* r: Status */ 84 1.5 wiz #define sci_dma_send sci_r5 /* w: Start DMA send data */ 85 1.2 thorpej 86 1.2 thorpej #define sci_idata sci_r6 /* r: Input data */ 87 1.5 wiz #define sci_trecv sci_r6 /* w: Start DMA receive, target */ 88 1.2 thorpej 89 1.2 thorpej #define sci_iack sci_r7 /* r: Interrupt Acknowledge */ 90 1.5 wiz #define sci_irecv sci_r7 /* w: Start DMA receive, initiator */ 91 1.1 pk 92 1.1 pk 93 1.1 pk /* 94 1.2 thorpej * R1: Initiator command register 95 1.1 pk */ 96 1.1 pk #define SCI_ICMD_DATA 0x01 /* rw: Assert data bus */ 97 1.1 pk #define SCI_ICMD_ATN 0x02 /* rw: Assert ATN signal */ 98 1.1 pk #define SCI_ICMD_SEL 0x04 /* rw: Assert SEL signal */ 99 1.1 pk #define SCI_ICMD_BSY 0x08 /* rw: Assert BSY signal */ 100 1.1 pk #define SCI_ICMD_ACK 0x10 /* rw: Assert ACK signal */ 101 1.1 pk #define SCI_ICMD_LST 0x20 /* r: Lost arbitration */ 102 1.1 pk #define SCI_ICMD_DIFF SCI_ICMD_LST /* w: Differential cable */ 103 1.1 pk #define SCI_ICMD_AIP 0x40 /* r: Arbitration in progress */ 104 1.1 pk #define SCI_ICMD_TEST SCI_ICMD_AIP /* w: Test mode */ 105 1.1 pk #define SCI_ICMD_RST 0x80 /* rw: Assert RST signal */ 106 1.2 thorpej /* Bits to keep when doing read/modify/write (leave out RST) */ 107 1.2 thorpej #define SCI_ICMD_RMASK 0x1F 108 1.1 pk 109 1.1 pk 110 1.1 pk /* 111 1.2 thorpej * R2: Mode register 112 1.1 pk */ 113 1.1 pk #define SCI_MODE_ARB 0x01 /* rw: Start arbitration */ 114 1.1 pk #define SCI_MODE_DMA 0x02 /* rw: Enable DMA xfers */ 115 1.1 pk #define SCI_MODE_MONBSY 0x04 /* rw: Monitor BSY signal */ 116 1.1 pk #define SCI_MODE_DMA_IE 0x08 /* rw: Enable DMA complete interrupt */ 117 1.1 pk #define SCI_MODE_PERR_IE 0x10 /* rw: Interrupt on parity errors */ 118 1.1 pk #define SCI_MODE_PAR_CHK 0x20 /* rw: Check parity */ 119 1.1 pk #define SCI_MODE_TARGET 0x40 /* rw: Target mode (Initiator if 0) */ 120 1.2 thorpej #define SCI_MODE_BLOCKDMA 0x80 /* rw: Block-mode DMA handshake */ 121 1.1 pk 122 1.1 pk 123 1.1 pk /* 124 1.2 thorpej * R3: Target command register 125 1.1 pk */ 126 1.1 pk #define SCI_TCMD_IO 0x01 /* rw: Assert I/O signal */ 127 1.1 pk #define SCI_TCMD_CD 0x02 /* rw: Assert C/D signal */ 128 1.1 pk #define SCI_TCMD_MSG 0x04 /* rw: Assert MSG signal */ 129 1.1 pk #define SCI_TCMD_PHASE_MASK 0x07 /* r: Mask for current bus phase */ 130 1.1 pk #define SCI_TCMD_REQ 0x08 /* rw: Assert REQ signal */ 131 1.1 pk #define SCI_TCMD_LAST_SENT 0x80 /* ro: Last byte was xferred 132 1.1 pk * (not on 5380/1) */ 133 1.1 pk 134 1.2 thorpej #define SCI_TCMD_PHASE(x) ((x) & 0x7) 135 1.1 pk 136 1.1 pk /* 137 1.2 thorpej * R4: Current (SCSI) Bus status (.sci_bus_csr) 138 1.1 pk */ 139 1.1 pk #define SCI_BUS_DBP 0x01 /* r: Data Bus parity */ 140 1.1 pk #define SCI_BUS_SEL 0x02 /* r: SEL signal */ 141 1.1 pk #define SCI_BUS_IO 0x04 /* r: I/O signal */ 142 1.1 pk #define SCI_BUS_CD 0x08 /* r: C/D signal */ 143 1.1 pk #define SCI_BUS_MSG 0x10 /* r: MSG signal */ 144 1.1 pk #define SCI_BUS_REQ 0x20 /* r: REQ signal */ 145 1.1 pk #define SCI_BUS_BSY 0x40 /* r: BSY signal */ 146 1.1 pk #define SCI_BUS_RST 0x80 /* r: RST signal */ 147 1.1 pk 148 1.2 thorpej #define SCI_BUS_PHASE(x) (((x) >> 2) & 7) 149 1.1 pk 150 1.1 pk /* 151 1.2 thorpej * R5: Bus and Status register (.sci_csr) 152 1.1 pk */ 153 1.1 pk #define SCI_CSR_ACK 0x01 /* r: ACK signal */ 154 1.1 pk #define SCI_CSR_ATN 0x02 /* r: ATN signal */ 155 1.1 pk #define SCI_CSR_DISC 0x04 /* r: Disconnected (BSY==0) */ 156 1.1 pk #define SCI_CSR_PHASE_MATCH 0x08 /* r: Bus and SCI_TCMD match */ 157 1.1 pk #define SCI_CSR_INT 0x10 /* r: Interrupt request */ 158 1.1 pk #define SCI_CSR_PERR 0x20 /* r: Parity error */ 159 1.1 pk #define SCI_CSR_DREQ 0x40 /* r: DMA request */ 160 1.1 pk #define SCI_CSR_DONE 0x80 /* r: DMA count is zero */ 161