rdreg.h revision 1.3
11.3Swiz/* $NetBSD: rdreg.h,v 1.3 2003/11/02 10:31:06 wiz Exp $ */ 21.1Sgmcgarry 31.1Sgmcgarry/* 41.1Sgmcgarry * Copyright (c) 1982, 1990, 1993 51.1Sgmcgarry * The Regents of the University of California. All rights reserved. 61.2Sagc * 71.2Sagc * This code is derived from software contributed to Berkeley by 81.2Sagc * the Systems Programming Group of the University of Utah Computer 91.2Sagc * Science Department. 101.2Sagc * 111.2Sagc * Redistribution and use in source and binary forms, with or without 121.2Sagc * modification, are permitted provided that the following conditions 131.2Sagc * are met: 141.2Sagc * 1. Redistributions of source code must retain the above copyright 151.2Sagc * notice, this list of conditions and the following disclaimer. 161.2Sagc * 2. Redistributions in binary form must reproduce the above copyright 171.2Sagc * notice, this list of conditions and the following disclaimer in the 181.2Sagc * documentation and/or other materials provided with the distribution. 191.2Sagc * 3. Neither the name of the University nor the names of its contributors 201.2Sagc * may be used to endorse or promote products derived from this software 211.2Sagc * without specific prior written permission. 221.2Sagc * 231.2Sagc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 241.2Sagc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 251.2Sagc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 261.2Sagc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 271.2Sagc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 281.2Sagc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 291.2Sagc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 301.2Sagc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 311.2Sagc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 321.2Sagc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 331.2Sagc * SUCH DAMAGE. 341.2Sagc * 351.2Sagc * from: Utah $Hdr: rdreg.h 1.2 90/10/12$ 361.2Sagc * 371.2Sagc * @(#)rdreg.h 8.1 (Berkeley) 6/10/93 381.2Sagc */ 391.2Sagc 401.2Sagc/* 411.2Sagc * Copyright (c) 1988 University of Utah. 421.1Sgmcgarry * 431.1Sgmcgarry * This code is derived from software contributed to Berkeley by 441.1Sgmcgarry * the Systems Programming Group of the University of Utah Computer 451.1Sgmcgarry * Science Department. 461.1Sgmcgarry * 471.1Sgmcgarry * Redistribution and use in source and binary forms, with or without 481.1Sgmcgarry * modification, are permitted provided that the following conditions 491.1Sgmcgarry * are met: 501.1Sgmcgarry * 1. Redistributions of source code must retain the above copyright 511.1Sgmcgarry * notice, this list of conditions and the following disclaimer. 521.1Sgmcgarry * 2. Redistributions in binary form must reproduce the above copyright 531.1Sgmcgarry * notice, this list of conditions and the following disclaimer in the 541.1Sgmcgarry * documentation and/or other materials provided with the distribution. 551.1Sgmcgarry * 3. All advertising materials mentioning features or use of this software 561.1Sgmcgarry * must display the following acknowledgement: 571.1Sgmcgarry * This product includes software developed by the University of 581.1Sgmcgarry * California, Berkeley and its contributors. 591.1Sgmcgarry * 4. Neither the name of the University nor the names of its contributors 601.1Sgmcgarry * may be used to endorse or promote products derived from this software 611.1Sgmcgarry * without specific prior written permission. 621.1Sgmcgarry * 631.1Sgmcgarry * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 641.1Sgmcgarry * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 651.1Sgmcgarry * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 661.1Sgmcgarry * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 671.1Sgmcgarry * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 681.1Sgmcgarry * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 691.1Sgmcgarry * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 701.1Sgmcgarry * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 711.1Sgmcgarry * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 721.1Sgmcgarry * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 731.1Sgmcgarry * SUCH DAMAGE. 741.1Sgmcgarry * 751.1Sgmcgarry * from: Utah $Hdr: rdreg.h 1.2 90/10/12$ 761.1Sgmcgarry * 771.1Sgmcgarry * @(#)rdreg.h 8.1 (Berkeley) 6/10/93 781.1Sgmcgarry */ 791.1Sgmcgarry 801.1Sgmcgarrystruct rd_iocmd { 811.1Sgmcgarry u_int8_t c_pad; /* alignment */ 821.1Sgmcgarry u_int8_t c_unit; /* punit */ 831.1Sgmcgarry u_int8_t c_volume; /* CS80CMD_SVOL(0) */ 841.1Sgmcgarry u_int8_t c_saddr; /* CS80CMD_SADDR */ 851.1Sgmcgarry u_int16_t c_hiaddr; /* always 0 */ 861.1Sgmcgarry u_int32_t c_addr; /* blkno */ 871.1Sgmcgarry u_int8_t c_nop2; /* CS80CMD_NOP - 32-bit alignment */ 881.1Sgmcgarry u_int8_t c_slen; /* CS80CMD_SLEN */ 891.1Sgmcgarry u_int32_t c_len; /* number of sectors */ 901.1Sgmcgarry u_int8_t c_cmd; /* CS80CMD_READ/CS80CMD_WRITE */ 911.1Sgmcgarry} __attribute__((__packed__)); 921.1Sgmcgarry 931.1Sgmcgarrystruct rd_rscmd { /* different */ 941.1Sgmcgarry u_int8_t c_unit; 951.1Sgmcgarry u_int8_t c_sram; 961.1Sgmcgarry u_int8_t c_ram; 971.1Sgmcgarry u_int8_t c_cmd; 981.1Sgmcgarry} __attribute__((__packed__)); 991.1Sgmcgarry 1001.1Sgmcgarry/* HW ids */ 1011.1Sgmcgarry#define RD7946AID 0x220 /* also 7945A */ 1021.1Sgmcgarry#define RD9134DID 0x221 /* also 9122S */ 1031.1Sgmcgarry#define RD9134LID 0x222 /* also 9122D */ 1041.1Sgmcgarry#define RD7912PID 0x209 1051.1Sgmcgarry#define RD7914CTID 0x20A 1061.1Sgmcgarry#define RD7914PID 0x20B 1071.1Sgmcgarry#define RD7958AID 0x22B 1081.1Sgmcgarry#define RD7957AID 0x22A 1091.1Sgmcgarry#define RD7933HID 0x212 1101.1Sgmcgarry#define RD7936HID 0x213 /* just guessing -- as of yet unknown */ 1111.1Sgmcgarry#define RD7937HID 0x214 1121.1Sgmcgarry#define RD7957BID 0x22C /* another guess based on 7958B */ 1131.1Sgmcgarry#define RD7958BID 0x22D 1141.1Sgmcgarry#define RD7959BID 0x22E /* another guess based on 7958B */ 1151.1Sgmcgarry#define RD2200AID 0x22F 1161.1Sgmcgarry#define RD2203AID 0x230 /* yet another guess */ 1171.1Sgmcgarry 1181.1Sgmcgarry/* SW ids -- indicies into rdidentinfo, order is arbitrary */ 1191.1Sgmcgarry#define RD7945A 0 1201.1Sgmcgarry#define RD9134D 1 1211.1Sgmcgarry#define RD9122S 2 1221.1Sgmcgarry#define RD7912P 3 1231.1Sgmcgarry#define RD7914P 4 1241.1Sgmcgarry#define RD7958A 5 1251.1Sgmcgarry#define RD7957A 6 1261.1Sgmcgarry#define RD7933H 7 1271.1Sgmcgarry#define RD9134L 8 1281.1Sgmcgarry#define RD7936H 9 1291.1Sgmcgarry#define RD7937H 10 1301.1Sgmcgarry#define RD7914CT 11 1311.1Sgmcgarry#define RD7946A 12 1321.1Sgmcgarry#define RD9122D 13 1331.1Sgmcgarry#define RD7957B 14 1341.1Sgmcgarry#define RD7958B 15 1351.1Sgmcgarry#define RD7959B 16 1361.1Sgmcgarry 1371.1Sgmcgarry#define NRD7945ABPT 16 1381.1Sgmcgarry#define NRD7945ATRK 7 1391.1Sgmcgarry#define NRD9134DBPT 16 1401.1Sgmcgarry#define NRD9134DTRK 6 1411.1Sgmcgarry#define NRD9122SBPT 8 1421.1Sgmcgarry#define NRD9122STRK 2 1431.1Sgmcgarry#define NRD7912PBPT 32 1441.1Sgmcgarry#define NRD7912PTRK 7 1451.1Sgmcgarry#define NRD7914PBPT 32 1461.1Sgmcgarry#define NRD7914PTRK 7 1471.1Sgmcgarry#define NRD7933HBPT 46 1481.1Sgmcgarry#define NRD7933HTRK 13 1491.1Sgmcgarry#define NRD9134LBPT 16 1501.1Sgmcgarry#define NRD9134LTRK 5 1511.1Sgmcgarry 1521.1Sgmcgarry/* 1531.1Sgmcgarry * Several HP drives have an odd number of 256 byte sectors per track. 1541.1Sgmcgarry * This makes it rather difficult to break them into 512 and 1024 byte blocks. 1551.1Sgmcgarry * So...we just do like HPUX and don't bother to respect hardware track/head 1561.3Swiz * boundaries -- we just mold the disk so that we use the entire capacity. 1571.3Swiz * HPUX also sometimes doesn't abide by cylinder boundaries, we attempt to 1581.1Sgmcgarry * whenever possible. 1591.1Sgmcgarry * 1601.1Sgmcgarry * DISK REAL (256 BPS) HPUX (1024 BPS) BSD (512 BPS) 1611.1Sgmcgarry * SPT x HD x CYL SPT x HD x CYL SPT x HD x CYL 1621.1Sgmcgarry * ----- --------------- --------------- -------------- 1631.1Sgmcgarry * 7936: 123 x 7 x 1396 25 x 7 x 1716 123 x 7 x 698 1641.1Sgmcgarry * 7937: 123 x 13 x 1396 25 x 16 x 1395 123 x 13 x 698 1651.1Sgmcgarry * 1661.1Sgmcgarry * 7957A: 63 x 5 x 1013 11 x 7 x 1036 22 x 7 x 1036 1671.1Sgmcgarry * 7958A: 63 x 8 x 1013 21 x 6 x 1013 36 x 7 x 1013 1681.1Sgmcgarry * 1691.1Sgmcgarry * 7957B: 63 x 4 x 1269 9 x 7 x 1269 18 x 7 x 1269 1701.1Sgmcgarry * 7958B: 63 x 6 x 1572 21 x 9 x 786 42 x 9 x 786 1711.1Sgmcgarry * 7959B: 63 x 12 x 1572 21 x 9 x 1572 42 x 9 x 1572 1721.1Sgmcgarry * 1731.1Sgmcgarry * 2200A: 113 x 8 x 1449 113 x 2 x 1449 113 x 4 x 1449 1741.1Sgmcgarry * 2203A: 113 x 16 x 1449 113 x 4 x 1449 113 x 8 x 1449 1751.1Sgmcgarry */ 1761.1Sgmcgarry#define NRD7936HBPT 123 1771.1Sgmcgarry#define NRD7936HTRK 7 1781.1Sgmcgarry#define NRD7937HBPT 123 1791.1Sgmcgarry#define NRD7937HTRK 13 1801.1Sgmcgarry#define NRD7957ABPT 22 1811.1Sgmcgarry#define NRD7957ATRK 7 1821.1Sgmcgarry#define NRD7958ABPT 36 1831.1Sgmcgarry#define NRD7958ATRK 7 1841.1Sgmcgarry#define NRD7957BBPT 18 1851.1Sgmcgarry#define NRD7957BTRK 7 1861.1Sgmcgarry#define NRD7958BBPT 42 1871.1Sgmcgarry#define NRD7958BTRK 9 1881.1Sgmcgarry#define NRD7959BBPT 42 1891.1Sgmcgarry#define NRD7959BTRK 9 1901.1Sgmcgarry#define NRD2200ABPT 113 1911.1Sgmcgarry#define NRD2200ATRK 4 1921.1Sgmcgarry#define NRD2203ABPT 113 1931.1Sgmcgarry#define NRD2203ATRK 8 1941.1Sgmcgarry 1951.1Sgmcgarry/* convert 512 byte count into DEV_BSIZE count */ 1961.1Sgmcgarry#define RDSZ(x) ((x) >> (DEV_BSHIFT-9)) 1971.1Sgmcgarry 1981.1Sgmcgarry/* convert block number into sector number and back */ 1991.1Sgmcgarry#define RDBTOS(x) ((x) << (DEV_BSHIFT-8)) 2001.1Sgmcgarry#define RDSTOB(x) ((x) >> (DEV_BSHIFT-8)) 2011.1Sgmcgarry 2021.1Sgmcgarry/* extract cyl/head/sect info from three-vector address */ 2031.1Sgmcgarry#define RDCYL(tva) ((u_int32_t)(tva).cu_cyhd >> 8) 2041.1Sgmcgarry#define RDHEAD(tva) ((tva).cu_cyhd & 0xFF) 2051.1Sgmcgarry#define RDSECT(tva) ((tva).cu_sect) 206