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