1 /* 2 * Copyright (c) 1988 University of Utah. 3 * Copyright (c) 1982, 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * the Systems Programming Group of the University of Utah Computer 8 * Science Department. 9 * 10 * %sccs.include.redist.c% 11 * 12 * from: Utah $Hdr: rd.c 1.30 89/09/17$ 13 * 14 * @(#)rd.c 7.5 (Berkeley) 12/16/90 15 */ 16 17 /* 18 * CS80/SS80 disk driver 19 */ 20 #include "rd.h" 21 #if NRD > 0 22 23 #include "sys/param.h" 24 #include "sys/systm.h" 25 #include "sys/errno.h" 26 #include "sys/dkstat.h" 27 #include "sys/disklabel.h" 28 #include "sys/buf.h" 29 #include "sys/uio.h" 30 31 #include "device.h" 32 #include "rdreg.h" 33 34 #include "vm/vm_param.h" 35 #include "vm/pmap.h" 36 #include "vm/vm_prot.h" 37 38 int rdinit(), rdstart(), rdgo(), rdintr(); 39 struct driver rddriver = { 40 rdinit, "rd", rdstart, rdgo, rdintr, 41 }; 42 43 struct rd_softc { 44 struct hp_device *sc_hd; 45 int sc_flags; 46 short sc_type; 47 short sc_punit; 48 char *sc_addr; 49 int sc_resid; 50 u_int sc_wpms; 51 struct rdinfo *sc_info; 52 struct devqueue sc_dq; 53 struct rd_iocmd sc_ioc; 54 struct rd_rscmd sc_rsc; 55 struct rd_stat sc_stat; 56 struct rd_ssmcmd sc_ssmc; 57 struct rd_srcmd sc_src; 58 struct rd_clearcmd sc_clear; 59 } rd_softc[NRD]; 60 61 /* sc_flags values */ 62 #define RDF_ALIVE 0x1 63 #define RDF_SEEK 0x2 64 #define RDF_SWAIT 0x4 65 66 struct size { 67 daddr_t nblocks; 68 int cyloff; 69 }; 70 71 #ifdef DEBUG 72 int rddebug = 0x80; 73 #define RDB_FOLLOW 0x01 74 #define RDB_STATUS 0x02 75 #define RDB_IDENT 0x04 76 #define RDB_IO 0x08 77 #define RDB_ASYNC 0x10 78 #define RDB_ERROR 0x80 79 #define RDB_DUMP 0x80000000 80 81 struct rdstats { 82 long rdretries; 83 long rdresets; 84 long rdtimeouts; 85 long rdpolltries; 86 long rdpollwaits; 87 } rdstats[NRD]; 88 89 /* error message tables */ 90 char *err_reject[] = { 91 0, 0, 92 "channel parity error", /* 0x2000 */ 93 0, 0, 94 "illegal opcode", /* 0x0400 */ 95 "module addressing", /* 0x0200 */ 96 "address bounds", /* 0x0100 */ 97 "parameter bounds", /* 0x0080 */ 98 "illegal parameter", /* 0x0040 */ 99 "message sequence", /* 0x0020 */ 100 0, 101 "message length", /* 0x0008 */ 102 0, 0, 0 103 }; 104 105 char *err_fault[] = { 106 0, 107 "cross unit", /* 0x4000 */ 108 0, 109 "controller fault", /* 0x1000 */ 110 0, 0, 111 "unit fault", /* 0x0200 */ 112 0, 113 "diagnostic result", /* 0x0080 */ 114 0, 115 "operator release request", /* 0x0020 */ 116 "diagnostic release request", /* 0x0010 */ 117 "internal maintenance release request", /* 0x0008 */ 118 0, 119 "power fail", /* 0x0002 */ 120 "retransmit" /* 0x0001 */ 121 }; 122 123 char *err_access[] = { 124 "illegal parallel operation", /* 0x8000 */ 125 "uninitialized media", /* 0x4000 */ 126 "no spares available", /* 0x2000 */ 127 "not ready", /* 0x1000 */ 128 "write protect", /* 0x0800 */ 129 "no data found", /* 0x0400 */ 130 0, 0, 131 "unrecoverable data overflow", /* 0x0080 */ 132 "unrecoverable data", /* 0x0040 */ 133 0, 134 "end of file", /* 0x0010 */ 135 "end of volume", /* 0x0008 */ 136 0, 0, 0 137 }; 138 139 char *err_info[] = { 140 "operator release request", /* 0x8000 */ 141 "diagnostic release request", /* 0x4000 */ 142 "internal maintenance release request", /* 0x2000 */ 143 "media wear", /* 0x1000 */ 144 "latency induced", /* 0x0800 */ 145 0, 0, 146 "auto sparing invoked", /* 0x0100 */ 147 0, 148 "recoverable data overflow", /* 0x0040 */ 149 "marginal data", /* 0x0020 */ 150 "recoverable data", /* 0x0010 */ 151 0, 152 "maintenance track overflow", /* 0x0004 */ 153 0, 0 154 }; 155 #endif 156 157 /* 158 * CS/80 partitions. We reserve the first cylinder for a LIF 159 * style boot directory (the 8k allowed in the BSD filesystem 160 * is just way too small). This boot area is outside of all but 161 * the C partition. This implies that you cannot use the C 162 * partition on a bootable disk since the filesystem would overlay 163 * the boot area. You must use the A partition. 164 * 165 * These maps support four basic layouts: 166 * 167 * A/B/G: This is the "traditional" setup for a bootable disk. 168 * A is the root partition, B the swap, and G a user partition. 169 * A/D/H: This is a setup for bootable systems requiring more swap 170 * (e.g. those who use HPCL). It has A as the root, D as a 171 * larger swap, and H as a smaller user partition. 172 * A/D/E/F: Similar to A/D/H with E and F breaking H into two partitions. 173 * E could be used for /usr and F for users. 174 * C: This gives a single, non-bootable, large user filesystem. 175 * Good for second drives on a machine (e.g. /usr/src). 176 */ 177 struct size rd7945A_sizes[8] = { 178 RDSZ(15904), 1, /* A=cyl 1 thru 142 */ 179 RDSZ(20160), 143, /* B=cyl 143 thru 322 */ 180 RDSZ(108416), 0, /* C=cyl 0 thru 967 */ 181 RDSZ(40320), 143, /* D=cyl 143 thru 502 */ 182 RDSZ(0), 0, /* E=<undefined> */ 183 RDSZ(0), 0, /* F=<undefined> */ 184 RDSZ(72240), 323, /* G=cyl 323 thru 967 */ 185 RDSZ(52080), 503, /* H=cyl 503 thru 967 */ 186 }, rd9134D_sizes[8] = { 187 RDSZ(15936), 1, /* A=cyl 1 thru 166 */ 188 RDSZ(13056), 167, /* B=cyl 167 thru 302 */ 189 RDSZ(29088), 0, /* C=cyl 0 thru 302 */ 190 RDSZ(0), 0, /* D=<undefined> */ 191 RDSZ(0), 0, /* E=<undefined> */ 192 RDSZ(0), 0, /* F=<undefined> */ 193 RDSZ(0), 0, /* G=<undefined> */ 194 RDSZ(0), 0, /* H=<undefined> */ 195 }, rd9122S_sizes[8] = { 196 RDSZ(0), 0, /* A=<undefined> */ 197 RDSZ(0), 0, /* B=<undefined> */ 198 RDSZ(1232), 0, /* C=cyl 0 thru 76 */ 199 RDSZ(0), 0, /* D=<undefined> */ 200 RDSZ(0), 0, /* E=<undefined> */ 201 RDSZ(0), 0, /* F=<undefined> */ 202 RDSZ(0), 0, /* G=<undefined> */ 203 RDSZ(0), 0, /* H=<undefined> */ 204 }, rd7912P_sizes[8] = { 205 RDSZ(15904), 0, /* A=cyl 1 thru 71 */ 206 RDSZ(22400), 72, /* B=cyl 72 thru 171 */ 207 RDSZ(128128), 0, /* C=cyl 0 thru 571 */ 208 RDSZ(42560), 72, /* D=cyl 72 thru 261 */ 209 RDSZ(0), 292, /* E=<undefined> */ 210 RDSZ(0), 542, /* F=<undefined> */ 211 RDSZ(89600), 172, /* G=cyl 221 thru 571 */ 212 RDSZ(69440), 262, /* H=cyl 262 thru 571 */ 213 }, rd7914P_sizes[8] = { 214 RDSZ(15904), 1, /* A=cyl 1 thru 71 */ 215 RDSZ(40320), 72, /* B=cyl 72 thru 251 */ 216 RDSZ(258048), 0, /* C=cyl 0 thru 1151 */ 217 RDSZ(64960), 72, /* D=cyl 72 thru 361 */ 218 RDSZ(98560), 362, /* E=cyl 362 thru 801 */ 219 RDSZ(78400), 802, /* F=cyl 802 thru 1151 */ 220 RDSZ(201600), 252, /* G=cyl 221 thru 1151 */ 221 RDSZ(176960), 362, /* H=cyl 362 thru 1151 */ 222 }, rd7933H_sizes[8] = { 223 RDSZ(16146), 1, /* A=cyl 1 thru 27 */ 224 RDSZ(66976), 28, /* B=cyl 28 thru 139 */ 225 RDSZ(789958), 0, /* C=cyl 0 thru 1320 */ 226 RDSZ(16146), 140, /* D=cyl 140 thru 166 */ 227 RDSZ(165646), 167, /* E=cyl 167 thru 443 */ 228 RDSZ(165646), 444, /* F=cyl 444 thru 720 */ 229 RDSZ(706238), 140, /* G=cyl 140 thru 1320 */ 230 RDSZ(358800), 721, /* H=cyl 721 thru 1320 */ 231 }, rd9134L_sizes[8] = { 232 RDSZ(15920), 1, /* A=cyl 1 thru 199 */ 233 RDSZ(20000), 200, /* B=cyl 200 thru 449 */ 234 RDSZ(77840), 0, /* C=cyl 0 thru 972 */ 235 RDSZ(32000), 200, /* D=cyl 200 thru 599 */ 236 RDSZ(0), 0, /* E=<undefined> */ 237 RDSZ(0), 0, /* F=<undefined> */ 238 RDSZ(41840), 450, /* G=cyl 450 thru 972 */ 239 RDSZ(29840), 600, /* H=cyl 600 thru 972 */ 240 }, rd7957A_sizes[8] = { 241 RDSZ(16016), 1, /* A=cyl 1 thru 104 */ 242 RDSZ(24640), 105, /* B=cyl 105 thru 264 */ 243 RDSZ(159544), 0, /* C=cyl 0 thru 1035 */ 244 RDSZ(42350), 105, /* D=cyl 105 thru 379 */ 245 RDSZ(54824), 380, /* E=cyl 380 thru 735 */ 246 RDSZ(46200), 736, /* F=cyl 736 thru 1035 */ 247 RDSZ(118734), 265, /* G=cyl 265 thru 1035 */ 248 RDSZ(101024), 380, /* H=cyl 380 thru 1035 */ 249 }, rd7958A_sizes[8] = { 250 RDSZ(16128), 1, /* A=cyl 1 thru 64 */ 251 RDSZ(32256), 65, /* B=cyl 65 thru 192 */ 252 RDSZ(255276), 0, /* C=cyl 0 thru 1012 */ 253 RDSZ(48384), 65, /* D=cyl 65 thru 256 */ 254 RDSZ(100800), 257, /* E=cyl 257 thru 656 */ 255 RDSZ(89712), 657, /* F=cyl 657 thru 1012 */ 256 RDSZ(206640), 193, /* G=cyl 193 thru 1012 */ 257 RDSZ(190512), 257, /* H=cyl 257 thru 1012 */ 258 }, rd7957B_sizes[8] = { 259 RDSZ(16002), 1, /* A=cyl 1 thru 127 */ 260 RDSZ(32760), 128, /* B=cyl 128 thru 387 */ 261 RDSZ(159894), 0, /* C=cyl 0 thru 1268 */ 262 RDSZ(49140), 128, /* D=cyl 128 thru 517 */ 263 RDSZ(50400), 518, /* E=cyl 518 thru 917 */ 264 RDSZ(44226), 918, /* F=cyl 918 thru 1268 */ 265 RDSZ(111006), 388, /* G=cyl 388 thru 1268 */ 266 RDSZ(94626), 518, /* H=cyl 518 thru 1268 */ 267 }, rd7958B_sizes[8] = { 268 RDSZ(16254), 1, /* A=cyl 1 thru 43 */ 269 RDSZ(32886), 44, /* B=cyl 44 thru 130 */ 270 RDSZ(297108), 0, /* C=cyl 0 thru 785 */ 271 RDSZ(49140), 44, /* D=cyl 44 thru 173 */ 272 RDSZ(121716), 174, /* E=cyl 174 thru 495 */ 273 RDSZ(109620), 496, /* F=cyl 496 thru 785 */ 274 RDSZ(247590), 131, /* G=cyl 131 thru 785 */ 275 RDSZ(231336), 174, /* H=cyl 174 thru 785 */ 276 }, rd7959B_sizes[8] = { 277 RDSZ(16254), 1, /* A=cyl 1 thru 43 */ 278 RDSZ(49140), 44, /* B=cyl 44 thru 173 */ 279 RDSZ(594216), 0, /* C=cyl 0 thru 1571 */ 280 RDSZ(65772), 44, /* D=cyl 44 thru 217 */ 281 RDSZ(303912), 218, /* E=cyl 218 thru 1021 */ 282 RDSZ(207900), 1022, /* F=cyl 1022 thru 1571 */ 283 RDSZ(528444), 174, /* G=cyl 174 thru 1571 */ 284 RDSZ(511812), 218, /* H=cyl 218 thru 1571 */ 285 286 #if DEV_BSIZE == 512 287 /* 288 * These values would not work for 1k, 289 * since the number of cylinders would be different. 290 */ 291 }, rd7936H_sizes[8] = { 292 RDSZ(16359), 1, /* A=cyl 1 thru 19 */ 293 RDSZ(67158), 20, /* B=cyl 20 thru 97 */ 294 RDSZ(600978), 0, /* C=cyl 0 thru 697 */ 295 RDSZ(16359), 98, /* D=cyl 98 thru 116 */ 296 RDSZ(120540), 117, /* E=cyl 117 thru 256 */ 297 RDSZ(120540), 256, /* F=cyl 256 thru 396 */ 298 RDSZ(516600), 98, /* G=cyl 98 thru 697 */ 299 RDSZ(259161), 397, /* H=cyl 397 thru 697 */ 300 }, rd7937H_sizes[8] = { 301 #ifdef UTAH 302 RDSZ(15990), 1, /* A=cyl 1 thru 10 */ 303 RDSZ(67158), 11, /* B=cyl 11 thru 52 */ 304 RDSZ(1116102), 0, /* C=cyl 0 thru 697 */ 305 RDSZ(124722), 53, /* D=cyl 53 thru 130 */ 306 RDSZ(163098), 131, /* E=cyl 131 thru 232 */ 307 RDSZ(287820), 233, /* F=cyl 233 thru 412 */ 308 RDSZ(1031355), 53, /* G=cyl 53 thru 697 */ 309 RDSZ(455715), 413, /* H=cyl 413 thru 697 */ 310 #else 311 RDSZ(15990), 1, /* A=cyl 1 thru 10 */ 312 RDSZ(67158), 11, /* B=cyl 11 thru 52 */ 313 RDSZ(1116102), 0, /* C=cyl 0 thru 697 */ 314 RDSZ(15990), 53, /* D=cyl 53 thru 62 */ 315 RDSZ(246246), 63, /* E=cyl 63 thru 216 */ 316 RDSZ(246246), 217, /* F=cyl 217 thru 370 */ 317 RDSZ(1031355), 53, /* G=cyl 53 thru 697 */ 318 RDSZ(522873), 371, /* H=cyl 371 thru 697 */ 319 #endif 320 #endif 321 }; 322 323 struct rdinfo { 324 int nbpt; /* DEV_BSIZE blocks per track */ 325 int ntpc; /* tracks per cylinder */ 326 int nbpc; /* blocks per cylinder */ 327 struct size *sizes; /* default partition info (if no disklabel) */ 328 short hwid; /* 2 byte HW id */ 329 short maxunum; /* maximum allowed unit number */ 330 char *desc; /* drive type description */ 331 }; 332 333 struct rdinfo rdinfo[] = { 334 NRD7945ABPT, NRD7945ATRK, NRD7945ABPT * NRD7945ATRK, 335 rd7945A_sizes, RD7946AID, 0, "7945A", 336 NRD9134DBPT, NRD9134DTRK, NRD9134DBPT * NRD9134DTRK, 337 rd9134D_sizes, RD9134DID, 1, "9134D", 338 NRD9122SBPT, NRD9122STRK, NRD9122SBPT * NRD9122STRK, 339 rd9122S_sizes, RD9134LID, 1, "9122S", 340 NRD7912PBPT, NRD7912PTRK, NRD7912PBPT * NRD7912PTRK, 341 rd7912P_sizes, RD7912PID, 0, "7912P", 342 NRD7914PBPT, NRD7914PTRK, NRD7914PBPT * NRD7914PTRK, 343 rd7914P_sizes, RD7914PID, 0, "7914P", 344 NRD7958ABPT, NRD7958ATRK, NRD7958ABPT * NRD7958ATRK, 345 rd7958A_sizes, RD7958AID, 0, "7958A", 346 NRD7957ABPT, NRD7957ATRK, NRD7957ABPT * NRD7957ATRK, 347 rd7957A_sizes, RD7957AID, 0, "7957A", 348 NRD7933HBPT, NRD7933HTRK, NRD7933HBPT * NRD7933HTRK, 349 rd7933H_sizes, RD7933HID, 0, "7933H", 350 NRD9134LBPT, NRD9134LTRK, NRD9134LBPT * NRD9134LTRK, 351 rd9134L_sizes, RD9134LID, 1, "9134L", 352 NRD7936HBPT, NRD7936HTRK, NRD7936HBPT * NRD7936HTRK, 353 rd7936H_sizes, RD7936HID, 0, "7936H", 354 NRD7937HBPT, NRD7937HTRK, NRD7937HBPT * NRD7937HTRK, 355 rd7937H_sizes, RD7937HID, 0, "7937H", 356 NRD7914PBPT, NRD7914PTRK, NRD7914PBPT * NRD7914PTRK, 357 rd7914P_sizes, RD7914CTID, 0, "7914CT", 358 NRD7945ABPT, NRD7945ATRK, NRD7945ABPT * NRD7945ATRK, 359 rd7945A_sizes, RD7946AID, 0, "7946A", 360 NRD9122SBPT, NRD9122STRK, NRD9122SBPT * NRD9122STRK, 361 rd9122S_sizes, RD9134LID, 1, "9122D", 362 NRD7957BBPT, NRD7957BTRK, NRD7957BBPT * NRD7957BTRK, 363 rd7957B_sizes, RD7957BID, 0, "7957B", 364 NRD7958BBPT, NRD7958BTRK, NRD7958BBPT * NRD7958BTRK, 365 rd7958B_sizes, RD7958BID, 0, "7958B", 366 NRD7959BBPT, NRD7959BTRK, NRD7959BBPT * NRD7959BTRK, 367 rd7959B_sizes, RD7959BID, 0, "7959B", 368 }; 369 int nrdinfo = sizeof(rdinfo) / sizeof(rdinfo[0]); 370 371 struct buf rdtab[NRD]; 372 struct buf rdbuf[NRD]; 373 374 #define rdunit(x) ((minor(x) >> 3) & 0xf) 375 #define rdpart(x) (minor(x) & 0x7) 376 #define rdpunit(x) ((x) & 7) 377 #define b_cylin b_resid 378 #define RDRETRY 5 379 #define RDWAITC 1 /* min time for timeout in seconds */ 380 381 int rderrthresh = RDRETRY-1; /* when to start reporting errors */ 382 383 rdinit(hd) 384 register struct hp_device *hd; 385 { 386 register struct rd_softc *rs = &rd_softc[hd->hp_unit]; 387 388 rs->sc_hd = hd; 389 rs->sc_punit = rdpunit(hd->hp_flags); 390 rs->sc_type = rdident(rs, hd); 391 if (rs->sc_type < 0) 392 return(0); 393 rs->sc_dq.dq_ctlr = hd->hp_ctlr; 394 rs->sc_dq.dq_unit = hd->hp_unit; 395 rs->sc_dq.dq_slave = hd->hp_slave; 396 rs->sc_dq.dq_driver = &rddriver; 397 rs->sc_info = &rdinfo[rs->sc_type]; 398 rs->sc_flags = RDF_ALIVE; 399 #ifdef DEBUG 400 /* always report errors */ 401 if (rddebug & RDB_ERROR) 402 rderrthresh = 0; 403 #endif 404 return(1); 405 } 406 407 rdident(rs, hd) 408 struct rd_softc *rs; 409 struct hp_device *hd; 410 { 411 struct rd_describe desc; 412 u_char stat, cmd[3]; 413 int unit, lunit; 414 char name[7]; 415 register int ctlr, slave, id, i; 416 417 ctlr = hd->hp_ctlr; 418 slave = hd->hp_slave; 419 unit = rs->sc_punit; 420 lunit = hd->hp_unit; 421 422 /* 423 * Grab device id and make sure: 424 * 1. It is a CS80 device. 425 * 2. It is one of the types we support. 426 * 3. If it is a 7946, we are accessing the disk unit (0) 427 */ 428 id = hpibid(ctlr, slave); 429 if ((id & 0x200) == 0) 430 return(-1); 431 for (i = 0; i < nrdinfo; i++) 432 if (id == rdinfo[i].hwid) 433 break; 434 if (i == nrdinfo || unit > rdinfo[i].maxunum) 435 return(-1); 436 id = i; 437 438 /* 439 * Reset drive and collect device description. 440 * Don't really use the description info right now but 441 * might come in handy in the future (for disk labels). 442 */ 443 rdreset(rs, hd); 444 cmd[0] = C_SUNIT(unit); 445 cmd[1] = C_SVOL(0); 446 cmd[2] = C_DESC; 447 hpibsend(ctlr, slave, C_CMD, cmd, sizeof(cmd)); 448 hpibrecv(ctlr, slave, C_EXEC, &desc, 37); 449 hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat)); 450 bzero(name, sizeof(name)); 451 if (!stat) { 452 register int n = desc.d_name; 453 for (i = 5; i >= 0; i--) { 454 name[i] = (n & 0xf) + '0'; 455 n >>= 4; 456 } 457 /* use drive characteristics to calculate xfer rate */ 458 rs->sc_wpms = 1000000 * (desc.d_sectsize/2) / desc.d_blocktime; 459 } 460 #ifdef DEBUG 461 if (rddebug & RDB_IDENT) { 462 printf("rd%d: name: %x ('%s')\n", 463 lunit, desc.d_name, name); 464 printf(" iuw %x, maxxfr %d, ctype %d\n", 465 desc.d_iuw, desc.d_cmaxxfr, desc.d_ctype); 466 printf(" utype %d, bps %d, blkbuf %d, burst %d, blktime %d\n", 467 desc.d_utype, desc.d_sectsize, 468 desc.d_blkbuf, desc.d_burstsize, desc.d_blocktime); 469 printf(" avxfr %d, ort %d, atp %d, maxint %d, fv %x, rv %x\n", 470 desc.d_uavexfr, desc.d_retry, desc.d_access, 471 desc.d_maxint, desc.d_fvbyte, desc.d_rvbyte); 472 printf(" maxcyl/head/sect %d/%d/%d, maxvsect %d, inter %d\n", 473 desc.d_maxcyl, desc.d_maxhead, desc.d_maxsect, 474 desc.d_maxvsectl, desc.d_interleave); 475 } 476 #endif 477 /* 478 * Take care of a couple of anomolies: 479 * 1. 7945A and 7946A both return same HW id 480 * 2. 9122S and 9134D both return same HW id 481 * 3. 9122D and 9134L both return same HW id 482 */ 483 switch (rdinfo[id].hwid) { 484 case RD7946AID: 485 if (bcmp(name, "079450", 6) == 0) 486 id = RD7945A; 487 else 488 id = RD7946A; 489 break; 490 491 case RD9134LID: 492 if (bcmp(name, "091340", 6) == 0) 493 id = RD9134L; 494 else 495 id = RD9122D; 496 break; 497 498 case RD9134DID: 499 if (bcmp(name, "091220", 6) == 0) 500 id = RD9122S; 501 else 502 id = RD9134D; 503 break; 504 } 505 printf("rd%d: %s\n", lunit, rdinfo[id].desc); 506 return(id); 507 } 508 509 rdreset(rs, hd) 510 register struct rd_softc *rs; 511 register struct hp_device *hd; 512 { 513 u_char stat; 514 515 rs->sc_clear.c_unit = C_SUNIT(rs->sc_punit); 516 rs->sc_clear.c_cmd = C_CLEAR; 517 hpibsend(hd->hp_ctlr, hd->hp_slave, C_TCMD, &rs->sc_clear, 518 sizeof(rs->sc_clear)); 519 hpibswait(hd->hp_ctlr, hd->hp_slave); 520 hpibrecv(hd->hp_ctlr, hd->hp_slave, C_QSTAT, &stat, sizeof(stat)); 521 rs->sc_src.c_unit = C_SUNIT(RDCTLR); 522 rs->sc_src.c_nop = C_NOP; 523 rs->sc_src.c_cmd = C_SREL; 524 rs->sc_src.c_param = C_REL; 525 hpibsend(hd->hp_ctlr, hd->hp_slave, C_CMD, &rs->sc_src, 526 sizeof(rs->sc_src)); 527 hpibswait(hd->hp_ctlr, hd->hp_slave); 528 hpibrecv(hd->hp_ctlr, hd->hp_slave, C_QSTAT, &stat, sizeof(stat)); 529 rs->sc_ssmc.c_unit = C_SUNIT(rs->sc_punit); 530 rs->sc_ssmc.c_cmd = C_SSM; 531 rs->sc_ssmc.c_refm = REF_MASK; 532 rs->sc_ssmc.c_fefm = FEF_MASK; 533 rs->sc_ssmc.c_aefm = AEF_MASK; 534 rs->sc_ssmc.c_iefm = IEF_MASK; 535 hpibsend(hd->hp_ctlr, hd->hp_slave, C_CMD, &rs->sc_ssmc, 536 sizeof(rs->sc_ssmc)); 537 hpibswait(hd->hp_ctlr, hd->hp_slave); 538 hpibrecv(hd->hp_ctlr, hd->hp_slave, C_QSTAT, &stat, sizeof(stat)); 539 #ifdef DEBUG 540 rdstats[hd->hp_unit].rdresets++; 541 #endif 542 } 543 544 /*ARGSUSED*/ 545 rdopen(dev, flags) 546 dev_t dev; 547 { 548 register int unit = rdunit(dev); 549 register struct rd_softc *rs = &rd_softc[unit]; 550 551 if (unit >= NRD || (rs->sc_flags & RDF_ALIVE) == 0) 552 return(ENXIO); 553 if (rs->sc_hd->hp_dk >= 0) { 554 /* guess at xfer rate based on 3600 rpm (60 rps) */ 555 if (rs->sc_wpms == 0) 556 rs->sc_wpms = 60 * rs->sc_info->nbpt * DEV_BSIZE / 2; 557 dk_wpms[rs->sc_hd->hp_dk] = rs->sc_wpms; 558 } 559 return(0); 560 } 561 562 rdstrategy(bp) 563 register struct buf *bp; 564 { 565 register int unit = rdunit(bp->b_dev); 566 register struct rd_softc *rs = &rd_softc[unit]; 567 register struct size *pinfo = &rs->sc_info->sizes[rdpart(bp->b_dev)]; 568 register struct buf *dp = &rdtab[unit]; 569 register daddr_t bn; 570 register int sz, s; 571 572 #ifdef DEBUG 573 if (rddebug & RDB_FOLLOW) 574 printf("rdstrategy(%x): dev %x, bn %x, bcount %x, %c\n", 575 bp, bp->b_dev, bp->b_blkno, bp->b_bcount, 576 (bp->b_flags & B_READ) ? 'R' : 'W'); 577 #endif 578 bn = bp->b_blkno; 579 sz = howmany(bp->b_bcount, DEV_BSIZE); 580 if (bn < 0 || bn + sz > pinfo->nblocks) { 581 sz = pinfo->nblocks - bn; 582 if (sz == 0) { 583 bp->b_resid = bp->b_bcount; 584 goto done; 585 } 586 if (sz < 0) { 587 bp->b_error = EINVAL; 588 bp->b_flags |= B_ERROR; 589 goto done; 590 } 591 bp->b_bcount = dbtob(sz); 592 } 593 bp->b_cylin = bn / rs->sc_info->nbpc + pinfo->cyloff; 594 s = splbio(); 595 disksort(dp, bp); 596 if (dp->b_active == 0) { 597 dp->b_active = 1; 598 rdustart(unit); 599 } 600 splx(s); 601 return; 602 done: 603 biodone(bp); 604 } 605 606 /* 607 * Called from timeout() when handling maintenance releases 608 */ 609 rdrestart(unit) 610 int unit; 611 { 612 int s = splbio(); 613 rdustart(unit); 614 splx(s); 615 } 616 617 rdustart(unit) 618 register int unit; 619 { 620 register struct buf *bp; 621 register struct rd_softc *rs = &rd_softc[unit]; 622 623 bp = rdtab[unit].b_actf; 624 rs->sc_addr = bp->b_un.b_addr; 625 rs->sc_resid = bp->b_bcount; 626 if (hpibreq(&rs->sc_dq)) 627 rdstart(unit); 628 } 629 630 rdstart(unit) 631 register int unit; 632 { 633 register struct rd_softc *rs = &rd_softc[unit]; 634 register struct buf *bp = rdtab[unit].b_actf; 635 register struct hp_device *hp = rs->sc_hd; 636 register int part; 637 638 again: 639 #ifdef DEBUG 640 if (rddebug & RDB_FOLLOW) 641 printf("rdstart(%d): bp %x, %c\n", unit, bp, 642 (bp->b_flags & B_READ) ? 'R' : 'W'); 643 #endif 644 part = rdpart(bp->b_dev); 645 rs->sc_flags |= RDF_SEEK; 646 rs->sc_ioc.c_unit = C_SUNIT(rs->sc_punit); 647 rs->sc_ioc.c_volume = C_SVOL(0); 648 rs->sc_ioc.c_saddr = C_SADDR; 649 rs->sc_ioc.c_hiaddr = 0; 650 rs->sc_ioc.c_addr = RDBTOS(bp->b_blkno + rs->sc_info->nbpc * 651 rs->sc_info->sizes[part].cyloff); 652 rs->sc_ioc.c_nop2 = C_NOP; 653 rs->sc_ioc.c_slen = C_SLEN; 654 rs->sc_ioc.c_len = rs->sc_resid; 655 rs->sc_ioc.c_cmd = bp->b_flags & B_READ ? C_READ : C_WRITE; 656 #ifdef DEBUG 657 if (rddebug & RDB_IO) 658 printf("rdstart: hpibsend(%x, %x, %x, %x, %x)\n", 659 hp->hp_ctlr, hp->hp_slave, C_CMD, 660 &rs->sc_ioc.c_unit, sizeof(rs->sc_ioc)-2); 661 #endif 662 if (hpibsend(hp->hp_ctlr, hp->hp_slave, C_CMD, &rs->sc_ioc.c_unit, 663 sizeof(rs->sc_ioc)-2) == sizeof(rs->sc_ioc)-2) { 664 if (hp->hp_dk >= 0) { 665 dk_busy |= 1 << hp->hp_dk; 666 dk_seek[hp->hp_dk]++; 667 } 668 #ifdef DEBUG 669 if (rddebug & RDB_IO) 670 printf("rdstart: hpibawait(%x)\n", hp->hp_ctlr); 671 #endif 672 hpibawait(hp->hp_ctlr); 673 return; 674 } 675 /* 676 * Experience has shown that the hpibwait in this hpibsend will 677 * occasionally timeout. It appears to occur mostly on old 7914 678 * drives with full maintenance tracks. We should probably 679 * integrate this with the backoff code in rderror. 680 */ 681 #ifdef DEBUG 682 if (rddebug & RDB_ERROR) 683 printf("rd%d: rdstart: cmd %x adr %d blk %d len %d ecnt %d\n", 684 unit, rs->sc_ioc.c_cmd, rs->sc_ioc.c_addr, 685 bp->b_blkno, rs->sc_resid, rdtab[unit].b_errcnt); 686 rdstats[unit].rdretries++; 687 #endif 688 rs->sc_flags &= ~RDF_SEEK; 689 rdreset(rs, hp); 690 if (rdtab[unit].b_errcnt++ < RDRETRY) 691 goto again; 692 printf("rd%d: rdstart err: cmd 0x%x sect %d blk %d len %d\n", 693 unit, rs->sc_ioc.c_cmd, rs->sc_ioc.c_addr, 694 bp->b_blkno, rs->sc_resid); 695 rdtab[unit].b_errcnt = 0; 696 rdtab[unit].b_actf = bp->b_actf; 697 bp->b_flags |= B_ERROR; 698 bp->b_error = EIO; 699 bp->b_resid = 0; 700 biodone(bp); 701 hpibfree(&rs->sc_dq); 702 bp = rdtab[unit].b_actf; 703 if (bp == NULL) { 704 rdtab[unit].b_active = 0; 705 return; 706 } 707 rs->sc_addr = bp->b_un.b_addr; 708 rs->sc_resid = bp->b_bcount; 709 if (hpibreq(&rs->sc_dq)) 710 goto again; 711 } 712 713 rdgo(unit) 714 register int unit; 715 { 716 register struct rd_softc *rs = &rd_softc[unit]; 717 register struct hp_device *hp = rs->sc_hd; 718 struct buf *bp = rdtab[unit].b_actf; 719 720 if (hp->hp_dk >= 0) { 721 dk_busy |= 1 << hp->hp_dk; 722 dk_xfer[hp->hp_dk]++; 723 dk_wds[hp->hp_dk] += rs->sc_resid >> 6; 724 } 725 hpibgo(hp->hp_ctlr, hp->hp_slave, C_EXEC, 726 rs->sc_addr, rs->sc_resid, bp->b_flags & B_READ); 727 } 728 729 rdintr(unit) 730 register int unit; 731 { 732 register struct rd_softc *rs = &rd_softc[unit]; 733 register struct buf *bp = rdtab[unit].b_actf; 734 register struct hp_device *hp = rs->sc_hd; 735 u_char stat = 13; /* in case hpibrecv fails */ 736 int rv, restart; 737 738 #ifdef DEBUG 739 if (rddebug & RDB_FOLLOW) 740 printf("rdintr(%d): bp %x, %c, flags %x\n", unit, bp, 741 (bp->b_flags & B_READ) ? 'R' : 'W', rs->sc_flags); 742 if (bp == NULL) { 743 printf("rd%d: bp == NULL\n", unit); 744 return; 745 } 746 #endif 747 if (hp->hp_dk >= 0) 748 dk_busy &= ~(1 << hp->hp_dk); 749 if (rs->sc_flags & RDF_SEEK) { 750 rs->sc_flags &= ~RDF_SEEK; 751 if (hpibustart(hp->hp_ctlr)) 752 rdgo(unit); 753 return; 754 } 755 if ((rs->sc_flags & RDF_SWAIT) == 0) { 756 #ifdef DEBUG 757 rdstats[unit].rdpolltries++; 758 #endif 759 if (hpibpptest(hp->hp_ctlr, hp->hp_slave) == 0) { 760 #ifdef DEBUG 761 rdstats[unit].rdpollwaits++; 762 #endif 763 if (hp->hp_dk >= 0) 764 dk_busy |= 1 << hp->hp_dk; 765 rs->sc_flags |= RDF_SWAIT; 766 hpibawait(hp->hp_ctlr); 767 return; 768 } 769 } else 770 rs->sc_flags &= ~RDF_SWAIT; 771 rv = hpibrecv(hp->hp_ctlr, hp->hp_slave, C_QSTAT, &stat, 1); 772 if (rv != 1 || stat) { 773 #ifdef DEBUG 774 if (rddebug & RDB_ERROR) 775 printf("rdintr: recv failed or bad stat %d\n", stat); 776 #endif 777 restart = rderror(unit); 778 #ifdef DEBUG 779 rdstats[unit].rdretries++; 780 #endif 781 if (rdtab[unit].b_errcnt++ < RDRETRY) { 782 if (restart) 783 rdstart(unit); 784 return; 785 } 786 bp->b_flags |= B_ERROR; 787 bp->b_error = EIO; 788 } 789 rdtab[unit].b_errcnt = 0; 790 rdtab[unit].b_actf = bp->b_actf; 791 bp->b_resid = 0; 792 biodone(bp); 793 hpibfree(&rs->sc_dq); 794 if (rdtab[unit].b_actf) 795 rdustart(unit); 796 else 797 rdtab[unit].b_active = 0; 798 } 799 800 rdstatus(rs) 801 register struct rd_softc *rs; 802 { 803 register int c, s; 804 u_char stat; 805 int rv; 806 807 c = rs->sc_hd->hp_ctlr; 808 s = rs->sc_hd->hp_slave; 809 rs->sc_rsc.c_unit = C_SUNIT(rs->sc_punit); 810 rs->sc_rsc.c_sram = C_SRAM; 811 rs->sc_rsc.c_ram = C_RAM; 812 rs->sc_rsc.c_cmd = C_STATUS; 813 bzero((caddr_t)&rs->sc_stat, sizeof(rs->sc_stat)); 814 rv = hpibsend(c, s, C_CMD, &rs->sc_rsc, sizeof(rs->sc_rsc)); 815 if (rv != sizeof(rs->sc_rsc)) { 816 #ifdef DEBUG 817 if (rddebug & RDB_STATUS) 818 printf("rdstatus: send C_CMD failed %d != %d\n", 819 rv, sizeof(rs->sc_rsc)); 820 #endif 821 return(1); 822 } 823 rv = hpibrecv(c, s, C_EXEC, &rs->sc_stat, sizeof(rs->sc_stat)); 824 if (rv != sizeof(rs->sc_stat)) { 825 #ifdef DEBUG 826 if (rddebug & RDB_STATUS) 827 printf("rdstatus: send C_EXEC failed %d != %d\n", 828 rv, sizeof(rs->sc_stat)); 829 #endif 830 return(1); 831 } 832 rv = hpibrecv(c, s, C_QSTAT, &stat, 1); 833 if (rv != 1 || stat) { 834 #ifdef DEBUG 835 if (rddebug & RDB_STATUS) 836 printf("rdstatus: recv failed %d or bad stat %d\n", 837 rv, stat); 838 #endif 839 return(1); 840 } 841 return(0); 842 } 843 844 /* 845 * Deal with errors. 846 * Returns 1 if request should be restarted, 847 * 0 if we should just quietly give up. 848 */ 849 rderror(unit) 850 int unit; 851 { 852 struct rd_softc *rs = &rd_softc[unit]; 853 register struct rd_stat *sp; 854 struct buf *bp; 855 daddr_t hwbn, pbn; 856 857 if (rdstatus(rs)) { 858 #ifdef DEBUG 859 printf("rd%d: couldn't get status\n", unit); 860 #endif 861 rdreset(rs, rs->sc_hd); 862 return(1); 863 } 864 sp = &rs->sc_stat; 865 if (sp->c_fef & FEF_REXMT) 866 return(1); 867 if (sp->c_fef & FEF_PF) { 868 rdreset(rs, rs->sc_hd); 869 return(1); 870 } 871 /* 872 * Unit requests release for internal maintenance. 873 * We just delay awhile and try again later. Use expontially 874 * increasing backoff ala ethernet drivers since we don't really 875 * know how long the maintenance will take. With RDWAITC and 876 * RDRETRY as defined, the range is 1 to 32 seconds. 877 */ 878 if (sp->c_fef & FEF_IMR) { 879 extern int hz; 880 int rdtimo = RDWAITC << rdtab[unit].b_errcnt; 881 #ifdef DEBUG 882 printf("rd%d: internal maintenance, %d second timeout\n", 883 unit, rdtimo); 884 rdstats[unit].rdtimeouts++; 885 #endif 886 hpibfree(&rs->sc_dq); 887 timeout(rdrestart, unit, rdtimo*hz); 888 return(0); 889 } 890 /* 891 * Only report error if we have reached the error reporting 892 * threshhold. By default, this will only report after the 893 * retry limit has been exceeded. 894 */ 895 if (rdtab[unit].b_errcnt < rderrthresh) 896 return(1); 897 898 /* 899 * First conjure up the block number at which the error occured. 900 * Note that not all errors report a block number, in that case 901 * we just use b_blkno. 902 */ 903 bp = rdtab[unit].b_actf; 904 pbn = rs->sc_info->nbpc * 905 rs->sc_info->sizes[rdpart(bp->b_dev)].cyloff; 906 if ((sp->c_fef & FEF_CU) || (sp->c_fef & FEF_DR) || 907 (sp->c_ief & IEF_RRMASK)) { 908 hwbn = RDBTOS(pbn + bp->b_blkno); 909 pbn = bp->b_blkno; 910 } else { 911 hwbn = sp->c_blk; 912 pbn = RDSTOB(hwbn) - pbn; 913 } 914 /* 915 * Now output a generic message suitable for badsect. 916 * Note that we don't use harderr cuz it just prints 917 * out b_blkno which is just the beginning block number 918 * of the transfer, not necessary where the error occured. 919 */ 920 printf("rd%d%c: hard error sn%d\n", 921 rdunit(bp->b_dev), 'a'+rdpart(bp->b_dev), pbn); 922 /* 923 * Now report the status as returned by the hardware with 924 * attempt at interpretation (unless debugging). 925 */ 926 printf("rd%d %s error:", 927 unit, (bp->b_flags & B_READ) ? "read" : "write"); 928 #ifdef DEBUG 929 if (rddebug & RDB_ERROR) { 930 /* status info */ 931 printf("\n volume: %d, unit: %d\n", 932 (sp->c_vu>>4)&0xF, sp->c_vu&0xF); 933 rdprinterr("reject", sp->c_ref, err_reject); 934 rdprinterr("fault", sp->c_fef, err_fault); 935 rdprinterr("access", sp->c_aef, err_access); 936 rdprinterr("info", sp->c_ief, err_info); 937 printf(" block: %d, P1-P10: ", hwbn); 938 printf("%s", hexstr(*(u_int *)&sp->c_raw[0], 8)); 939 printf("%s", hexstr(*(u_int *)&sp->c_raw[4], 8)); 940 printf("%s\n", hexstr(*(u_short *)&sp->c_raw[8], 4)); 941 /* command */ 942 printf(" ioc: "); 943 printf("%s", hexstr(*(u_int *)&rs->sc_ioc.c_pad, 8)); 944 printf("%s", hexstr(*(u_short *)&rs->sc_ioc.c_hiaddr, 4)); 945 printf("%s", hexstr(*(u_int *)&rs->sc_ioc.c_addr, 8)); 946 printf("%s", hexstr(*(u_short *)&rs->sc_ioc.c_nop2, 4)); 947 printf("%s", hexstr(*(u_int *)&rs->sc_ioc.c_len, 8)); 948 printf("%s\n", hexstr(*(u_short *)&rs->sc_ioc.c_cmd, 4)); 949 return(1); 950 } 951 #endif 952 printf(" v%d u%d, R0x%x F0x%x A0x%x I0x%x\n", 953 (sp->c_vu>>4)&0xF, sp->c_vu&0xF, 954 sp->c_ref, sp->c_fef, sp->c_aef, sp->c_ief); 955 printf("P1-P10: "); 956 printf("%s", hexstr(*(u_int *)&sp->c_raw[0], 8)); 957 printf("%s", hexstr(*(u_int *)&sp->c_raw[4], 8)); 958 printf("%s\n", hexstr(*(u_short *)&sp->c_raw[8], 4)); 959 return(1); 960 } 961 962 rdread(dev, uio) 963 dev_t dev; 964 struct uio *uio; 965 { 966 register int unit = rdunit(dev); 967 968 return(physio(rdstrategy, &rdbuf[unit], dev, B_READ, minphys, uio)); 969 } 970 971 rdwrite(dev, uio) 972 dev_t dev; 973 struct uio *uio; 974 { 975 register int unit = rdunit(dev); 976 977 return(physio(rdstrategy, &rdbuf[unit], dev, B_WRITE, minphys, uio)); 978 } 979 980 /*ARGSUSED*/ 981 rdioctl(dev, cmd, data, flag) 982 dev_t dev; 983 int cmd; 984 caddr_t data; 985 int flag; 986 { 987 return(EINVAL); 988 } 989 990 rdsize(dev) 991 dev_t dev; 992 { 993 register int unit = rdunit(dev); 994 register struct rd_softc *rs = &rd_softc[unit]; 995 996 if (unit >= NRD || (rs->sc_flags & RDF_ALIVE) == 0) 997 return(-1); 998 return(rs->sc_info->sizes[rdpart(dev)].nblocks); 999 } 1000 1001 #ifdef DEBUG 1002 rdprinterr(str, err, tab) 1003 char *str; 1004 short err; 1005 char *tab[]; 1006 { 1007 register int i; 1008 int printed; 1009 1010 if (err == 0) 1011 return; 1012 printf(" %s error field:", str, err); 1013 printed = 0; 1014 for (i = 0; i < 16; i++) 1015 if (err & (0x8000 >> i)) 1016 printf("%s%s", printed++ ? " + " : " ", tab[i]); 1017 printf("\n"); 1018 } 1019 #endif 1020 1021 /* 1022 * Non-interrupt driven, non-dma dump routine. 1023 */ 1024 rddump(dev) 1025 dev_t dev; 1026 { 1027 int part = rdpart(dev); 1028 int unit = rdunit(dev); 1029 register struct rd_softc *rs = &rd_softc[unit]; 1030 register struct hp_device *hp = rs->sc_hd; 1031 register daddr_t baddr; 1032 register int maddr, pages, i; 1033 char stat; 1034 extern int lowram, dumpsize; 1035 #ifdef DEBUG 1036 extern int pmapdebug; 1037 pmapdebug = 0; 1038 #endif 1039 1040 pages = dumpsize; 1041 #ifdef DEBUG 1042 if (rddebug & RDB_DUMP) 1043 printf("rddump(%x): u %d p %d dumplo %d ram %x pmem %d\n", 1044 dev, unit, part, dumplo, lowram, ctod(pages)); 1045 #endif 1046 /* is drive ok? */ 1047 if (unit >= NRD || (rs->sc_flags & RDF_ALIVE) == 0) 1048 return (ENXIO); 1049 /* HPIB idle? */ 1050 if (!hpibreq(&rs->sc_dq)) { 1051 #ifdef DEBUG 1052 /* is this a safe thing to do?? */ 1053 hpibreset(hp->hp_ctlr); 1054 rdreset(rs, rs->sc_hd); 1055 printf("[ drive %d reset ] ", unit); 1056 #else 1057 return (EFAULT); 1058 #endif 1059 } 1060 /* dump parameters in range? */ 1061 if (dumplo < 0 || dumplo >= rs->sc_info->sizes[part].nblocks) 1062 return (EINVAL); 1063 if (dumplo + ctod(pages) > rs->sc_info->sizes[part].nblocks) 1064 pages = dtoc(rs->sc_info->sizes[part].nblocks - dumplo); 1065 maddr = lowram; 1066 baddr = dumplo + rs->sc_info->nbpc * rs->sc_info->sizes[part].cyloff; 1067 #ifdef DEBUG 1068 if (rddebug & RDB_DUMP) 1069 printf("rddump: dumping %d pages from %x to disk block %d\n", 1070 pages, maddr, baddr); 1071 #endif 1072 for (i = 0; i < pages; i++) { 1073 #ifdef DEBUG 1074 #define NPGMB (1024*1024/NBPG) 1075 /* print out how many Mbs we have dumped */ 1076 if (i && (i % NPGMB) == 0) 1077 printf("%d ", i / NPGMB); 1078 #undef NPBMG 1079 #endif 1080 rs->sc_ioc.c_unit = C_SUNIT(rs->sc_punit); 1081 rs->sc_ioc.c_volume = C_SVOL(0); 1082 rs->sc_ioc.c_saddr = C_SADDR; 1083 rs->sc_ioc.c_hiaddr = 0; 1084 rs->sc_ioc.c_addr = RDBTOS(baddr); 1085 rs->sc_ioc.c_nop2 = C_NOP; 1086 rs->sc_ioc.c_slen = C_SLEN; 1087 rs->sc_ioc.c_len = NBPG; 1088 rs->sc_ioc.c_cmd = C_WRITE; 1089 hpibsend(hp->hp_ctlr, hp->hp_slave, C_CMD, 1090 &rs->sc_ioc.c_unit, sizeof(rs->sc_ioc)-2); 1091 if (hpibswait(hp->hp_ctlr, hp->hp_slave)) { 1092 #ifdef DEBUG 1093 if (rddebug & RDB_DUMP) 1094 printf("rddump: IOC wait timeout\n"); 1095 #endif 1096 return (EIO); 1097 } 1098 pmap_enter(pmap_kernel(), vmmap, maddr, VM_PROT_READ, TRUE); 1099 hpibsend(hp->hp_ctlr, hp->hp_slave, C_EXEC, vmmap, NBPG); 1100 if (hpibswait(hp->hp_ctlr, hp->hp_slave)) { 1101 #ifdef DEBUG 1102 if (rddebug & RDB_DUMP) 1103 printf("rddump: write wait timeout\n"); 1104 #endif 1105 } 1106 hpibrecv(hp->hp_ctlr, hp->hp_slave, C_QSTAT, &stat, 1); 1107 if (stat) { 1108 #ifdef DEBUG 1109 if (rddebug & RDB_DUMP) 1110 printf("rddump: write failed, status %x\n", 1111 stat); 1112 #endif 1113 return (EIO); 1114 } 1115 maddr += NBPG; 1116 baddr += ctod(1); 1117 } 1118 return (0); 1119 } 1120 #endif 1121