1 1.2 thorpej /* $NetBSD: sireg.h,v 1.2 2024/02/13 13:46:14 thorpej Exp $ */ 2 1.1 thorpej 3 1.1 thorpej /*- 4 1.1 thorpej * Copyright (c) 2000 The NetBSD Foundation, Inc. 5 1.1 thorpej * All rights reserved. 6 1.1 thorpej * 7 1.1 thorpej * This code is derived from software contributed to The NetBSD Foundation 8 1.1 thorpej * by Paul Kranenburg. 9 1.1 thorpej * 10 1.1 thorpej * Redistribution and use in source and binary forms, with or without 11 1.1 thorpej * modification, are permitted provided that the following conditions 12 1.1 thorpej * are met: 13 1.1 thorpej * 1. Redistributions of source code must retain the above copyright 14 1.1 thorpej * notice, this list of conditions and the following disclaimer. 15 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright 16 1.1 thorpej * notice, this list of conditions and the following disclaimer in the 17 1.1 thorpej * documentation and/or other materials provided with the distribution. 18 1.1 thorpej * 19 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 1.1 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 1.1 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 1.1 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 1.1 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 1.1 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 1.1 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 1.1 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 1.1 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 1.1 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 1.1 thorpej * POSSIBILITY OF SUCH DAMAGE. 30 1.1 thorpej */ 31 1.1 thorpej 32 1.1 thorpej /* 33 1.1 thorpej * Register map for the VME SCSI-3 adapter (si) 34 1.1 thorpej * The first part of this register map is an NCR5380 35 1.1 thorpej * SCSI Bus Interface Controller (SBIC). The rest is a 36 1.1 thorpej * DMA controller and custom logic. 37 1.1 thorpej */ 38 1.1 thorpej 39 1.1 thorpej 40 1.1 thorpej #if __for_reference_only__ 41 1.1 thorpej /* 42 1.1 thorpej * Am5380 Register map (no padding). See dev/ic/ncr5380reg.h 43 1.1 thorpej */ 44 1.1 thorpej struct ncr5380regs { 45 1.1 thorpej u_char r[8]; 46 1.1 thorpej }; 47 1.1 thorpej 48 1.1 thorpej struct si_regs { 49 1.1 thorpej struct ncr5380regs sci; 50 1.1 thorpej 51 1.1 thorpej /* DMA controller registers */ 52 1.1 thorpej u_short dma_addrh; /* DMA address (VME only) */ 53 1.1 thorpej u_short dma_addrl; /* (high word, low word) */ 54 1.1 thorpej u_short dma_counth; /* DMA count (VME only) */ 55 1.1 thorpej u_short dma_countl; /* (high word, low word) */ 56 1.1 thorpej 57 1.2 thorpej /* AMD 9516 regs (OBIO only) see am9516.h */ 58 1.2 thorpej u_short udc_data; /* Am9516, reg data (OBIO only) */ 59 1.2 thorpej u_short udc_addr; /* Am9516, reg addr (OBIO only) */ 60 1.1 thorpej 61 1.1 thorpej u_short fifo_data; /* fifo data register */ 62 1.1 thorpej u_short fifo_count; /* fifo count register */ 63 1.1 thorpej u_short si_csr; /* si control/status */ 64 1.1 thorpej u_short bprh; /* VME byte pack high */ 65 1.1 thorpej u_short bprl; /* VME byte pack low */ 66 1.1 thorpej u_short iv_am; /* bits 0-7: intr vector */ 67 1.1 thorpej /* bits 8-13: addr modifier (VME only) */ 68 1.1 thorpej /* bits 14-15: unused */ 69 1.1 thorpej u_short fifo_cnt_hi; /* high part of fifo_count (VME only) */ 70 1.1 thorpej 71 1.1 thorpej /* Whole thing repeats after 32 bytes. */ 72 1.1 thorpej u_short _space[3]; 73 1.1 thorpej }; 74 1.1 thorpej #endif 75 1.1 thorpej 76 1.1 thorpej /* 77 1.1 thorpej * Size of NCR5380 registers located at the bottom of the register bank 78 1.1 thorpej */ 79 1.1 thorpej #define NCR5380REGS_SZ 8 80 1.1 thorpej 81 1.1 thorpej /* 82 1.1 thorpej * Register definition for the `si' VME controller 83 1.1 thorpej */ 84 1.1 thorpej #define SIREG_DMA_ADDRH (NCR5380REGS_SZ + 0) /* DMA address, high word */ 85 1.1 thorpej #define SIREG_DMA_ADDRL (NCR5380REGS_SZ + 2) /* DMA address, low word */ 86 1.1 thorpej #define SIREG_DMA_CNTH (NCR5380REGS_SZ + 4) /* DMA count, high word */ 87 1.1 thorpej #define SIREG_DMA_CNTL (NCR5380REGS_SZ + 6) /* DMA count, low word */ 88 1.2 thorpej #define SIREG_UDC_DATA (NCR5380REGS_SZ + 8) /* UDC reg data */ 89 1.2 thorpej #define SIREG_UDC_ADDR (NCR5380REGS_SZ + 10) /* UDC reg addr */ 90 1.1 thorpej #define SIREG_FIFO_DATA (NCR5380REGS_SZ + 12) /* FIFO data */ 91 1.1 thorpej #define SIREG_FIFO_CNT (NCR5380REGS_SZ + 14) /* FIFO count, low word */ 92 1.1 thorpej #define SIREG_CSR (NCR5380REGS_SZ + 16) /* Control/status register */ 93 1.1 thorpej #define SIREG_BPRH (NCR5380REGS_SZ + 18) /* VME byte pack, high word */ 94 1.1 thorpej #define SIREG_BPRL (NCR5380REGS_SZ + 20) /* VME byte pack, low word */ 95 1.1 thorpej #define SIREG_IV_AM (NCR5380REGS_SZ + 22) /* bits 0-7: intr vector; 96 1.1 thorpej bits 8-13: addr modifier */ 97 1.1 thorpej #define SIREG_FIFO_CNTH (NCR5380REGS_SZ + 24) /* FIFO count, high word */ 98 1.1 thorpej #define SIREG_BANK_SZ (NCR5380REGS_SZ + 26) 99 1.1 thorpej 100 1.1 thorpej /* 101 1.1 thorpej * Status Register. 102 1.1 thorpej * Note: 103 1.1 thorpej * (r) indicates bit is read only. 104 1.1 thorpej * (rw) indicates bit is read or write. 105 1.1 thorpej * (v) vme host adaptor interface only. 106 1.1 thorpej * (o) sun3/50 onboard host adaptor interface only. 107 1.1 thorpej * (b) both vme and sun3/50 host adaptor interfaces. 108 1.1 thorpej * 109 1.1 thorpej * Note 2: because of the historical connections of this VME driver 110 1.1 thorpej * with the on-board SCSI interfaces found in sun3/50, sun3/60 and sun4/100 111 1.1 thorpej * systems, the (v), (o) and (b) qualifications are left in for 112 1.1 thorpej * cross-reference. 113 1.1 thorpej */ 114 1.1 thorpej #define SI_CSR_DMA_ACTIVE 0x8000 /* (r,o) DMA transfer active */ 115 1.1 thorpej #define SI_CSR_DMA_CONFLICT 0x4000 /* (r,b) reg accessed while DMA'ing */ 116 1.1 thorpej #define SI_CSR_DMA_BUS_ERR 0x2000 /* (r,b) bus error during DMA */ 117 1.1 thorpej #define SI_CSR_ID 0x1000 /* (r,b) 0 for 3/50, 1 for SCSI-3, */ 118 1.1 thorpej /* 0 if SCSI-3 unmodified */ 119 1.1 thorpej #define SI_CSR_FIFO_FULL 0x0800 /* (r,b) fifo full */ 120 1.1 thorpej #define SI_CSR_FIFO_EMPTY 0x0400 /* (r,b) fifo empty */ 121 1.1 thorpej #define SI_CSR_SBC_IP 0x0200 /* (r,b) sbc interrupt pending */ 122 1.1 thorpej #define SI_CSR_DMA_IP 0x0100 /* (r,b) DMA interrupt pending */ 123 1.1 thorpej #define SI_CSR_LOB 0x00c0 /* (r,v) number of leftover bytes */ 124 1.1 thorpej #define SI_CSR_LOB_THREE 0x00c0 /* (r,v) three leftover bytes */ 125 1.1 thorpej #define SI_CSR_LOB_TWO 0x0080 /* (r,v) two leftover bytes */ 126 1.1 thorpej #define SI_CSR_LOB_ONE 0x0040 /* (r,v) one leftover byte */ 127 1.1 thorpej #define SI_CSR_BPCON 0x0020 /* (rw,v) byte packing control */ 128 1.1 thorpej /* DMA is in 0=longwords, 1=words */ 129 1.1 thorpej #define SI_CSR_DMA_EN 0x0010 /* (rw,v) DMA/interrupt enable */ 130 1.1 thorpej #define SI_CSR_SEND 0x0008 /* (rw,b) DMA dir, 1=to device */ 131 1.1 thorpej #define SI_CSR_INTR_EN 0x0004 /* (rw,b) interrupts enable */ 132 1.1 thorpej #define SI_CSR_FIFO_RES 0x0002 /* (rw,b) inits fifo, 0=reset */ 133 1.1 thorpej #define SI_CSR_SCSI_RES 0x0001 /* (rw,b) reset sbc and udc, 0=reset */ 134