1 /* $NetBSD: rdreg.h,v 1.1 2003/06/02 03:53:02 gmcgarry Exp $ */ 2 3 /* 4 * Copyright (c) 1988 University of Utah. 5 * Copyright (c) 1982, 1990, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * the Systems Programming Group of the University of Utah Computer 10 * Science Department. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 3. All advertising materials mentioning features or use of this software 21 * must display the following acknowledgement: 22 * This product includes software developed by the University of 23 * California, Berkeley and its contributors. 24 * 4. Neither the name of the University nor the names of its contributors 25 * may be used to endorse or promote products derived from this software 26 * without specific prior written permission. 27 * 28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 38 * SUCH DAMAGE. 39 * 40 * from: Utah $Hdr: rdreg.h 1.2 90/10/12$ 41 * 42 * @(#)rdreg.h 8.1 (Berkeley) 6/10/93 43 */ 44 45 struct rd_iocmd { 46 u_int8_t c_pad; /* alignment */ 47 u_int8_t c_unit; /* punit */ 48 u_int8_t c_volume; /* CS80CMD_SVOL(0) */ 49 u_int8_t c_saddr; /* CS80CMD_SADDR */ 50 u_int16_t c_hiaddr; /* always 0 */ 51 u_int32_t c_addr; /* blkno */ 52 u_int8_t c_nop2; /* CS80CMD_NOP - 32-bit alignment */ 53 u_int8_t c_slen; /* CS80CMD_SLEN */ 54 u_int32_t c_len; /* number of sectors */ 55 u_int8_t c_cmd; /* CS80CMD_READ/CS80CMD_WRITE */ 56 } __attribute__((__packed__)); 57 58 struct rd_rscmd { /* different */ 59 u_int8_t c_unit; 60 u_int8_t c_sram; 61 u_int8_t c_ram; 62 u_int8_t c_cmd; 63 } __attribute__((__packed__)); 64 65 /* HW ids */ 66 #define RD7946AID 0x220 /* also 7945A */ 67 #define RD9134DID 0x221 /* also 9122S */ 68 #define RD9134LID 0x222 /* also 9122D */ 69 #define RD7912PID 0x209 70 #define RD7914CTID 0x20A 71 #define RD7914PID 0x20B 72 #define RD7958AID 0x22B 73 #define RD7957AID 0x22A 74 #define RD7933HID 0x212 75 #define RD7936HID 0x213 /* just guessing -- as of yet unknown */ 76 #define RD7937HID 0x214 77 #define RD7957BID 0x22C /* another guess based on 7958B */ 78 #define RD7958BID 0x22D 79 #define RD7959BID 0x22E /* another guess based on 7958B */ 80 #define RD2200AID 0x22F 81 #define RD2203AID 0x230 /* yet another guess */ 82 83 /* SW ids -- indicies into rdidentinfo, order is arbitrary */ 84 #define RD7945A 0 85 #define RD9134D 1 86 #define RD9122S 2 87 #define RD7912P 3 88 #define RD7914P 4 89 #define RD7958A 5 90 #define RD7957A 6 91 #define RD7933H 7 92 #define RD9134L 8 93 #define RD7936H 9 94 #define RD7937H 10 95 #define RD7914CT 11 96 #define RD7946A 12 97 #define RD9122D 13 98 #define RD7957B 14 99 #define RD7958B 15 100 #define RD7959B 16 101 102 #define NRD7945ABPT 16 103 #define NRD7945ATRK 7 104 #define NRD9134DBPT 16 105 #define NRD9134DTRK 6 106 #define NRD9122SBPT 8 107 #define NRD9122STRK 2 108 #define NRD7912PBPT 32 109 #define NRD7912PTRK 7 110 #define NRD7914PBPT 32 111 #define NRD7914PTRK 7 112 #define NRD7933HBPT 46 113 #define NRD7933HTRK 13 114 #define NRD9134LBPT 16 115 #define NRD9134LTRK 5 116 117 /* 118 * Several HP drives have an odd number of 256 byte sectors per track. 119 * This makes it rather difficult to break them into 512 and 1024 byte blocks. 120 * So...we just do like HPUX and don't bother to respect hardware track/head 121 * boundries -- we just mold the disk so that we use the entire capacity. 122 * HPUX also sometimes doesn't abide by cylinder boundries, we attempt to 123 * whenever possible. 124 * 125 * DISK REAL (256 BPS) HPUX (1024 BPS) BSD (512 BPS) 126 * SPT x HD x CYL SPT x HD x CYL SPT x HD x CYL 127 * ----- --------------- --------------- -------------- 128 * 7936: 123 x 7 x 1396 25 x 7 x 1716 123 x 7 x 698 129 * 7937: 123 x 13 x 1396 25 x 16 x 1395 123 x 13 x 698 130 * 131 * 7957A: 63 x 5 x 1013 11 x 7 x 1036 22 x 7 x 1036 132 * 7958A: 63 x 8 x 1013 21 x 6 x 1013 36 x 7 x 1013 133 * 134 * 7957B: 63 x 4 x 1269 9 x 7 x 1269 18 x 7 x 1269 135 * 7958B: 63 x 6 x 1572 21 x 9 x 786 42 x 9 x 786 136 * 7959B: 63 x 12 x 1572 21 x 9 x 1572 42 x 9 x 1572 137 * 138 * 2200A: 113 x 8 x 1449 113 x 2 x 1449 113 x 4 x 1449 139 * 2203A: 113 x 16 x 1449 113 x 4 x 1449 113 x 8 x 1449 140 */ 141 #define NRD7936HBPT 123 142 #define NRD7936HTRK 7 143 #define NRD7937HBPT 123 144 #define NRD7937HTRK 13 145 #define NRD7957ABPT 22 146 #define NRD7957ATRK 7 147 #define NRD7958ABPT 36 148 #define NRD7958ATRK 7 149 #define NRD7957BBPT 18 150 #define NRD7957BTRK 7 151 #define NRD7958BBPT 42 152 #define NRD7958BTRK 9 153 #define NRD7959BBPT 42 154 #define NRD7959BTRK 9 155 #define NRD2200ABPT 113 156 #define NRD2200ATRK 4 157 #define NRD2203ABPT 113 158 #define NRD2203ATRK 8 159 160 /* convert 512 byte count into DEV_BSIZE count */ 161 #define RDSZ(x) ((x) >> (DEV_BSHIFT-9)) 162 163 /* convert block number into sector number and back */ 164 #define RDBTOS(x) ((x) << (DEV_BSHIFT-8)) 165 #define RDSTOB(x) ((x) >> (DEV_BSHIFT-8)) 166 167 /* extract cyl/head/sect info from three-vector address */ 168 #define RDCYL(tva) ((u_int32_t)(tva).cu_cyhd >> 8) 169 #define RDHEAD(tva) ((tva).cu_cyhd & 0xFF) 170 #define RDSECT(tva) ((tva).cu_sect) 171