| 1 | /* up.c 4.62 82/12/05 */ |
| 2 | |
| 3 | #include "up.h" |
| 4 | #if NSC > 0 |
| 5 | /* |
| 6 | * UNIBUS disk driver with: |
| 7 | * overlapped seeks, |
| 8 | * ECC recovery, and |
| 9 | * bad sector forwarding. |
| 10 | * |
| 11 | * TODO: |
| 12 | * Check that offset recovery code works |
| 13 | */ |
| 14 | |
| 15 | #include "../h/param.h" |
| 16 | #include "../h/systm.h" |
| 17 | #include "../h/dk.h" |
| 18 | #include "../h/dkbad.h" |
| 19 | #include "../h/buf.h" |
| 20 | #include "../h/conf.h" |
| 21 | #include "../h/dir.h" |
| 22 | #include "../h/user.h" |
| 23 | #include "../h/map.h" |
| 24 | #include "../h/pte.h" |
| 25 | #include "../h/vm.h" |
| 26 | #include "../h/cmap.h" |
| 27 | #include "../h/uio.h" |
| 28 | #include "../h/dkbad.h" |
| 29 | #include "../vax/cpu.h" |
| 30 | #include "../vax/nexus.h" |
| 31 | #include "../vaxuba/ubavar.h" |
| 32 | #include "../vaxuba/ubareg.h" |
| 33 | #include "../vaxuba/upreg.h" |
| 34 | |
| 35 | struct up_softc { |
| 36 | int sc_softas; |
| 37 | int sc_ndrive; |
| 38 | int sc_wticks; |
| 39 | int sc_recal; |
| 40 | } up_softc[NSC]; |
| 41 | |
| 42 | /* THIS SHOULD BE READ OFF THE PACK, PER DRIVE */ |
| 43 | struct size |
| 44 | { |
| 45 | daddr_t nblocks; |
| 46 | int cyloff; |
| 47 | } up_sizes[8] = { |
| 48 | #ifdef ERNIE |
| 49 | 49324, 0, /* A=cyl 0 thru 26 */ |
| 50 | #else |
| 51 | #ifdef ERNIE |
| 52 | 49324, 0, /* A=cyl 0 thru 26 */ |
| 53 | #else |
| 54 | 15884, 0, /* A=cyl 0 thru 26 */ |
| 55 | #endif |
| 56 | #endif |
| 57 | 33440, 27, /* B=cyl 27 thru 81 */ |
| 58 | 495520, 0, /* C=cyl 0 thru 814 */ |
| 59 | 15884, 562, /* D=cyl 562 thru 588 */ |
| 60 | 55936, 589, /* E=cyl 589 thru 680 */ |
| 61 | #ifndef NOBADSECT |
| 62 | 81376, 681, /* F=cyl 681 thru 814 */ |
| 63 | 153728, 562, /* G=cyl 562 thru 814 */ |
| 64 | #else |
| 65 | 81472, 681, |
| 66 | 153824, 562, |
| 67 | #endif |
| 68 | 291346, 82, /* H=cyl 82 thru 561 */ |
| 69 | }, fj_sizes[8] = { |
| 70 | 15884, 0, /* A=cyl 0 thru 49 */ |
| 71 | 33440, 50, /* B=cyl 50 thru 154 */ |
| 72 | 263360, 0, /* C=cyl 0 thru 822 */ |
| 73 | 0, 0, |
| 74 | 0, 0, |
| 75 | 0, 0, |
| 76 | 0, 0, |
| 77 | #ifndef NOBADSECT |
| 78 | 213664, 155, /* H=cyl 155 thru 822 */ |
| 79 | #else |
| 80 | 213760, 155, |
| 81 | #endif |
| 82 | }, upam_sizes[8] = { |
| 83 | 15884, 0, /* A=cyl 0 thru 31 */ |
| 84 | 33440, 32, /* B=cyl 32 thru 97 */ |
| 85 | 524288, 0, /* C=cyl 0 thru 1023 */ |
| 86 | 27786, 668, |
| 87 | 27786, 723, |
| 88 | 125440, 778, |
| 89 | 181760, 668, /* G=cyl 668 thru 1022 */ |
| 90 | 291346, 98, /* H=cyl 98 thru 667 */ |
| 91 | }; |
| 92 | /* END OF STUFF WHICH SHOULD BE READ IN PER DISK */ |
| 93 | |
| 94 | /* |
| 95 | * On a 780 upSDIST could be 2, but |
| 96 | * in the interest of 750's... |
| 97 | */ |
| 98 | #define _upSDIST 3 /* 1.5 msec */ |
| 99 | #define _upRDIST 4 /* 2.0 msec */ |
| 100 | |
| 101 | int upSDIST = _upSDIST; |
| 102 | int upRDIST = _upRDIST; |
| 103 | |
| 104 | int upprobe(), upslave(), upattach(), updgo(), upintr(); |
| 105 | struct uba_ctlr *upminfo[NSC]; |
| 106 | struct uba_device *updinfo[NUP]; |
| 107 | #define UPIPUNITS 8 |
| 108 | struct uba_device *upip[NSC][UPIPUNITS]; /* fuji w/fixed head gives n,n+4 */ |
| 109 | |
| 110 | u_short upstd[] = { 0776700, 0774400, 0776300, 0 }; |
| 111 | struct uba_driver scdriver = |
| 112 | { upprobe, upslave, upattach, updgo, upstd, "up", updinfo, "sc", upminfo }; |
| 113 | struct buf uputab[NUP]; |
| 114 | char upinit[NUP]; |
| 115 | char upinit[NUP]; |
| 116 | |
| 117 | struct upst { |
| 118 | short nsect; |
| 119 | short ntrak; |
| 120 | short nspc; |
| 121 | short ncyl; |
| 122 | struct size *sizes; |
| 123 | } upst[] = { |
| 124 | 32, 19, 32*19, 823, up_sizes, /* 9300/cdc */ |
| 125 | /* 9300 actually has 815 cylinders... */ |
| 126 | 32, 10, 32*10, 823, fj_sizes, /* fujitsu 160m */ |
| 127 | 32, 16, 32*16, 1024, upam_sizes, /* ampex capricorn */ |
| 128 | }; |
| 129 | |
| 130 | u_char up_offset[16] = { |
| 131 | UPOF_P400, UPOF_M400, UPOF_P400, UPOF_M400, |
| 132 | UPOF_P800, UPOF_M800, UPOF_P800, UPOF_M800, |
| 133 | UPOF_P1200, UPOF_M1200, UPOF_P1200, UPOF_M1200, |
| 134 | 0, 0, 0, 0 |
| 135 | }; |
| 136 | |
| 137 | struct buf rupbuf[NUP]; |
| 138 | #ifndef NOBADSECT |
| 139 | struct buf bupbuf[NUP]; |
| 140 | struct dkbad upbad[NUP]; |
| 141 | #endif |
| 142 | #ifndef NOBADSECT |
| 143 | struct buf bupbuf[NUP]; |
| 144 | struct dkbad upbad[NUP]; |
| 145 | #endif |
| 146 | |
| 147 | #define b_cylin b_resid |
| 148 | |
| 149 | #ifdef INTRLVE |
| 150 | daddr_t dkblock(); |
| 151 | #endif |
| 152 | |
| 153 | int upwstart, upwatch(); /* Have started guardian */ |
| 154 | int upseek; |
| 155 | int upwaitdry; |
| 156 | |
| 157 | /*ARGSUSED*/ |
| 158 | upprobe(reg) |
| 159 | caddr_t reg; |
| 160 | { |
| 161 | register int br, cvec; |
| 162 | |
| 163 | #ifdef lint |
| 164 | br = 0; cvec = br; br = cvec; |
| 165 | #endif |
| 166 | ((struct updevice *)reg)->upcs1 = UP_IE|UP_RDY; |
| 167 | DELAY(10); |
| 168 | ((struct updevice *)reg)->upcs1 = 0; |
| 169 | return (sizeof (struct updevice)); |
| 170 | } |
| 171 | |
| 172 | upslave(ui, reg) |
| 173 | struct uba_device *ui; |
| 174 | caddr_t reg; |
| 175 | { |
| 176 | register struct updevice *upaddr = (struct updevice *)reg; |
| 177 | |
| 178 | upaddr->upcs1 = 0; /* conservative */ |
| 179 | upaddr->upcs2 = ui->ui_slave; |
| 180 | upaddr->upcs1 = UP_NOP|UP_GO; |
| 181 | upaddr->upcs1 = UP_NOP|UP_GO; |
| 182 | if (upaddr->upcs2&UPCS2_NED) { |
| 183 | upaddr->upcs1 = UP_DCLR|UP_GO; |
| 184 | return (0); |
| 185 | } |
| 186 | return (1); |
| 187 | } |
| 188 | |
| 189 | upattach(ui) |
| 190 | register struct uba_device *ui; |
| 191 | { |
| 192 | register struct updevice *upaddr; |
| 193 | |
| 194 | if (upwstart == 0) { |
| 195 | timeout(upwatch, (caddr_t)0, hz); |
| 196 | upwstart++; |
| 197 | } |
| 198 | if (ui->ui_dk >= 0) |
| 199 | dk_mspw[ui->ui_dk] = .0000020345; |
| 200 | upip[ui->ui_ctlr][ui->ui_slave] = ui; |
| 201 | up_softc[ui->ui_ctlr].sc_ndrive++; |
| 202 | upaddr = (struct updevice *)ui->ui_addr; |
| 203 | upaddr->upcs1 = 0; |
| 204 | upaddr->upcs2 = ui->ui_slave; |
| 205 | upaddr->uphr = UPHR_MAXTRAK; |
| 206 | if (upaddr->uphr == 9) |
| 207 | ui->ui_type = 1; /* fujitsu hack */ |
| 208 | else if (upaddr->uphr == 15) |
| 209 | ui->ui_type = 2; /* ampex hack */ |
| 210 | upaddr->upcs2 = UPCS2_CLR; |
| 211 | } |
| 212 | |
| 213 | upopen(dev) |
| 214 | dev_t dev; |
| 215 | { |
| 216 | register int unit = minor(dev) >> 3; |
| 217 | register struct uba_device *ui; |
| 218 | |
| 219 | if (unit >= NUP || (ui = updinfo[unit]) == 0 || ui->ui_alive == 0) |
| 220 | return (ENXIO); |
| 221 | return (0); |
| 222 | } |
| 223 | |
| 224 | upstrategy(bp) |
| 225 | register struct buf *bp; |
| 226 | { |
| 227 | register struct uba_device *ui; |
| 228 | register struct upst *st; |
| 229 | register int unit; |
| 230 | register struct buf *dp; |
| 231 | int xunit = minor(bp->b_dev) & 07; |
| 232 | long bn, sz; |
| 233 | |
| 234 | sz = (bp->b_bcount+511) >> 9; |
| 235 | unit = dkunit(bp); |
| 236 | if (unit >= NUP) |
| 237 | goto bad; |
| 238 | ui = updinfo[unit]; |
| 239 | if (ui == 0 || ui->ui_alive == 0) |
| 240 | goto bad; |
| 241 | st = &upst[ui->ui_type]; |
| 242 | if (bp->b_blkno < 0 || |
| 243 | (bn = dkblock(bp))+sz > st->sizes[xunit].nblocks) |
| 244 | goto bad; |
| 245 | bp->b_cylin = bn/st->nspc + st->sizes[xunit].cyloff; |
| 246 | (void) spl5(); |
| 247 | dp = &uputab[ui->ui_unit]; |
| 248 | disksort(dp, bp); |
| 249 | if (dp->b_active == 0) { |
| 250 | (void) upustart(ui); |
| 251 | bp = &ui->ui_mi->um_tab; |
| 252 | if (bp->b_actf && bp->b_active == 0) |
| 253 | (void) upstart(ui->ui_mi); |
| 254 | } |
| 255 | (void) spl0(); |
| 256 | return; |
| 257 | |
| 258 | bad: |
| 259 | bp->b_flags |= B_ERROR; |
| 260 | iodone(bp); |
| 261 | return; |
| 262 | } |
| 263 | |
| 264 | /* |
| 265 | * Unit start routine. |
| 266 | * Seek the drive to be where the data is |
| 267 | * and then generate another interrupt |
| 268 | * to actually start the transfer. |
| 269 | * If there is only one drive on the controller, |
| 270 | * or we are very close to the data, don't |
| 271 | * bother with the search. If called after |
| 272 | * searching once, don't bother to look where |
| 273 | * we are, just queue for transfer (to avoid |
| 274 | * positioning forever without transferrring.) |
| 275 | */ |
| 276 | upustart(ui) |
| 277 | register struct uba_device *ui; |
| 278 | { |
| 279 | register struct buf *bp, *dp; |
| 280 | register struct uba_ctlr *um; |
| 281 | register struct updevice *upaddr; |
| 282 | register struct upst *st; |
| 283 | daddr_t bn; |
| 284 | int sn, csn; |
| 285 | /* |
| 286 | * The SC21 cancels commands if you just say |
| 287 | * cs1 = UP_IE |
| 288 | * so we are cautious about handling of cs1. |
| 289 | * Also don't bother to clear as bits other than in upintr(). |
| 290 | */ |
| 291 | int didie = 0; |
| 292 | |
| 293 | if (ui == 0) |
| 294 | return (0); |
| 295 | um = ui->ui_mi; |
| 296 | dk_busy &= ~(1<<ui->ui_dk); |
| 297 | dp = &uputab[ui->ui_unit]; |
| 298 | if ((bp = dp->b_actf) == NULL) |
| 299 | goto out; |
| 300 | /* |
| 301 | * If the controller is active, just remember |
| 302 | * that this device would like to be positioned... |
| 303 | * if we tried to position now we would confuse the SC21. |
| 304 | */ |
| 305 | if (um->um_tab.b_active) { |
| 306 | up_softc[um->um_ctlr].sc_softas |= 1<<ui->ui_slave; |
| 307 | return (0); |
| 308 | } |
| 309 | /* |
| 310 | * If we have already positioned this drive, |
| 311 | * then just put it on the ready queue. |
| 312 | */ |
| 313 | if (dp->b_active) |
| 314 | goto done; |
| 315 | dp->b_active = 1; |
| 316 | upaddr = (struct updevice *)um->um_addr; |
| 317 | upaddr->upcs2 = ui->ui_slave; |
| 318 | /* |
| 319 | * If drive has just come up, |
| 320 | * setup the pack. |
| 321 | */ |
| 322 | if ((upaddr->upds & UPDS_VV) == 0 || upinit[ui->ui_unit] == 0) { |
| 323 | #ifndef NOBADSECT |
| 324 | struct buf *bbp = &bupbuf[ui->ui_unit]; |
| 325 | #endif |
| 326 | /* SHOULD WARN SYSTEM THAT THIS HAPPENED */ |
| 327 | upinit[ui->ui_unit] = 1; |
| 328 | upinit[ui->ui_unit] = 1; |
| 329 | upaddr->upcs1 = UP_IE|UP_DCLR|UP_GO; |
| 330 | upaddr->upcs1 = UP_IE|UP_PRESET|UP_GO; |
| 331 | upaddr->upof = UPOF_FMT22; |
| 332 | didie = 1; |
| 333 | #ifndef NOBADSECT |
| 334 | st = &upst[ui->ui_type]; |
| 335 | bbp->b_flags = B_READ|B_BUSY; |
| 336 | bbp->b_dev = bp->b_dev; |
| 337 | bbp->b_bcount = 512; |
| 338 | bbp->b_un.b_addr = (caddr_t)&upbad[ui->ui_unit]; |
| 339 | bbp->b_blkno = st->ncyl * st->nspc - st->nsect; |
| 340 | bbp->b_cylin = st->ncyl - 1; |
| 341 | dp->b_actf = bbp; |
| 342 | bbp->av_forw = bp; |
| 343 | bp = bbp; |
| 344 | #endif |
| 345 | #ifndef NOBADSECT |
| 346 | st = &upst[ui->ui_type]; |
| 347 | bbp->b_flags = B_READ|B_BUSY; |
| 348 | bbp->b_dev = bp->b_dev; |
| 349 | bbp->b_bcount = 512; |
| 350 | bbp->b_un.b_addr = (caddr_t)&upbad[ui->ui_unit]; |
| 351 | bbp->b_blkno = st->ncyl * st->nspc - st->nsect; |
| 352 | bbp->b_cylin = st->ncyl - 1; |
| 353 | dp->b_actf = bbp; |
| 354 | bbp->av_forw = bp; |
| 355 | bp = bbp; |
| 356 | #endif |
| 357 | } |
| 358 | /* |
| 359 | * If drive is offline, forget about positioning. |
| 360 | */ |
| 361 | if ((upaddr->upds & (UPDS_DPR|UPDS_MOL)) != (UPDS_DPR|UPDS_MOL)) |
| 362 | goto done; |
| 363 | /* |
| 364 | * If there is only one drive, |
| 365 | * dont bother searching. |
| 366 | */ |
| 367 | if (up_softc[um->um_ctlr].sc_ndrive == 1) |
| 368 | goto done; |
| 369 | /* |
| 370 | * Figure out where this transfer is going to |
| 371 | * and see if we are close enough to justify not searching. |
| 372 | */ |
| 373 | st = &upst[ui->ui_type]; |
| 374 | bn = dkblock(bp); |
| 375 | sn = bn%st->nspc; |
| 376 | sn = (sn + st->nsect - upSDIST) % st->nsect; |
| 377 | if (bp->b_cylin - upaddr->updc) |
| 378 | goto search; /* Not on-cylinder */ |
| 379 | else if (upseek) |
| 380 | goto done; /* Ok just to be on-cylinder */ |
| 381 | csn = (upaddr->upla>>6) - sn - 1; |
| 382 | if (csn < 0) |
| 383 | csn += st->nsect; |
| 384 | if (csn > st->nsect - upRDIST) |
| 385 | goto done; |
| 386 | search: |
| 387 | upaddr->updc = bp->b_cylin; |
| 388 | /* |
| 389 | * Not on cylinder at correct position, |
| 390 | * seek/search. |
| 391 | */ |
| 392 | if (upseek) |
| 393 | upaddr->upcs1 = UP_IE|UP_SEEK|UP_GO; |
| 394 | else { |
| 395 | upaddr->upda = sn; |
| 396 | upaddr->upcs1 = UP_IE|UP_SEARCH|UP_GO; |
| 397 | } |
| 398 | didie = 1; |
| 399 | /* |
| 400 | * Mark unit busy for iostat. |
| 401 | */ |
| 402 | if (ui->ui_dk >= 0) { |
| 403 | dk_busy |= 1<<ui->ui_dk; |
| 404 | dk_seek[ui->ui_dk]++; |
| 405 | } |
| 406 | goto out; |
| 407 | done: |
| 408 | /* |
| 409 | * Device is ready to go. |
| 410 | * Put it on the ready queue for the controller |
| 411 | * (unless its already there.) |
| 412 | */ |
| 413 | if (dp->b_active != 2) { |
| 414 | dp->b_forw = NULL; |
| 415 | if (um->um_tab.b_actf == NULL) |
| 416 | um->um_tab.b_actf = dp; |
| 417 | else |
| 418 | um->um_tab.b_actl->b_forw = dp; |
| 419 | um->um_tab.b_actl = dp; |
| 420 | dp->b_active = 2; |
| 421 | } |
| 422 | out: |
| 423 | return (didie); |
| 424 | } |
| 425 | |
| 426 | /* |
| 427 | * Start up a transfer on a drive. |
| 428 | */ |
| 429 | upstart(um) |
| 430 | register struct uba_ctlr *um; |
| 431 | { |
| 432 | register struct buf *bp, *dp; |
| 433 | register struct uba_device *ui; |
| 434 | register struct updevice *upaddr; |
| 435 | struct upst *st; |
| 436 | daddr_t bn; |
| 437 | int dn, sn, tn, cmd, waitdry; |
| 438 | |
| 439 | loop: |
| 440 | /* |
| 441 | * Pull a request off the controller queue |
| 442 | */ |
| 443 | if ((dp = um->um_tab.b_actf) == NULL) |
| 444 | return (0); |
| 445 | if ((bp = dp->b_actf) == NULL) { |
| 446 | um->um_tab.b_actf = dp->b_forw; |
| 447 | goto loop; |
| 448 | } |
| 449 | /* |
| 450 | * Mark controller busy, and |
| 451 | * determine destination of this request. |
| 452 | */ |
| 453 | um->um_tab.b_active++; |
| 454 | ui = updinfo[dkunit(bp)]; |
| 455 | bn = dkblock(bp); |
| 456 | dn = ui->ui_slave; |
| 457 | st = &upst[ui->ui_type]; |
| 458 | sn = bn%st->nspc; |
| 459 | tn = sn/st->nsect; |
| 460 | sn %= st->nsect; |
| 461 | upaddr = (struct updevice *)ui->ui_addr; |
| 462 | /* |
| 463 | * Select drive if not selected already. |
| 464 | */ |
| 465 | if ((upaddr->upcs2&07) != dn) |
| 466 | upaddr->upcs2 = dn; |
| 467 | /* |
| 468 | * Check that it is ready and online |
| 469 | */ |
| 470 | waitdry = 0; |
| 471 | while ((upaddr->upds&UPDS_DRY) == 0) { |
| 472 | printf("up%d: ds wait ds=%o\n",dkunit(bp),upaddr->upds); |
| 473 | printf("up%d: ds wait ds=%o\n",dkunit(bp),upaddr->upds); |
| 474 | if (++waitdry > 512) |
| 475 | break; |
| 476 | upwaitdry++; |
| 477 | } |
| 478 | if ((upaddr->upds & UPDS_DREADY) != UPDS_DREADY) { |
| 479 | printf("up%d: not ready", dkunit(bp)); |
| 480 | if ((upaddr->upds & UPDS_DREADY) != UPDS_DREADY) { |
| 481 | printf("\n"); |
| 482 | um->um_tab.b_active = 0; |
| 483 | um->um_tab.b_errcnt = 0; |
| 484 | dp->b_actf = bp->av_forw; |
| 485 | dp->b_active = 0; |
| 486 | bp->b_flags |= B_ERROR; |
| 487 | iodone(bp); |
| 488 | goto loop; |
| 489 | } |
| 490 | /* |
| 491 | * Oh, well, sometimes this |
| 492 | * happens, for reasons unknown. |
| 493 | */ |
| 494 | printf(" (flakey)\n"); |
| 495 | } |
| 496 | /* |
| 497 | * Setup for the transfer, and get in the |
| 498 | * UNIBUS adaptor queue. |
| 499 | */ |
| 500 | upaddr->updc = bp->b_cylin; |
| 501 | upaddr->upda = (tn << 8) + sn; |
| 502 | upaddr->upwc = -bp->b_bcount / sizeof (short); |
| 503 | if (bp->b_flags & B_READ) |
| 504 | cmd = UP_IE|UP_RCOM|UP_GO; |
| 505 | else |
| 506 | cmd = UP_IE|UP_WCOM|UP_GO; |
| 507 | um->um_cmd = cmd; |
| 508 | (void) ubago(ui); |
| 509 | return (1); |
| 510 | } |
| 511 | |
| 512 | /* |
| 513 | * Now all ready to go, stuff the registers. |
| 514 | */ |
| 515 | updgo(um) |
| 516 | struct uba_ctlr *um; |
| 517 | { |
| 518 | register struct updevice *upaddr = (struct updevice *)um->um_addr; |
| 519 | |
| 520 | um->um_tab.b_active = 2; /* should now be 2 */ |
| 521 | upaddr->upba = um->um_ubinfo; |
| 522 | upaddr->upcs1 = um->um_cmd|((um->um_ubinfo>>8)&0x300); |
| 523 | } |
| 524 | |
| 525 | /* |
| 526 | * Handle a disk interrupt. |
| 527 | */ |
| 528 | upintr(sc21) |
| 529 | register sc21; |
| 530 | { |
| 531 | register struct buf *bp, *dp; |
| 532 | register struct uba_ctlr *um = upminfo[sc21]; |
| 533 | register struct uba_device *ui; |
| 534 | register struct updevice *upaddr = (struct updevice *)um->um_addr; |
| 535 | register unit; |
| 536 | struct up_softc *sc = &up_softc[um->um_ctlr]; |
| 537 | int as = (upaddr->upas & 0377) | sc->sc_softas; |
| 538 | int needie = 1, waitdry; |
| 539 | |
| 540 | sc->sc_wticks = 0; |
| 541 | sc->sc_softas = 0; |
| 542 | /* |
| 543 | * If controller wasn't transferring, then this is an |
| 544 | * interrupt for attention status on seeking drives. |
| 545 | * Just service them. |
| 546 | */ |
| 547 | if (um->um_tab.b_active != 2 && !sc->sc_recal) { |
| 548 | if (upaddr->upcs1 & UP_TRE) |
| 549 | upaddr->upcs1 = UP_TRE; |
| 550 | goto doattn; |
| 551 | } |
| 552 | um->um_tab.b_active = 1; |
| 553 | um->um_tab.b_active = 1; |
| 554 | /* |
| 555 | * Get device and block structures, and a pointer |
| 556 | * to the uba_device for the drive. Select the drive. |
| 557 | */ |
| 558 | dp = um->um_tab.b_actf; |
| 559 | bp = dp->b_actf; |
| 560 | ui = updinfo[dkunit(bp)]; |
| 561 | dk_busy &= ~(1 << ui->ui_dk); |
| 562 | if ((upaddr->upcs2&07) != ui->ui_slave) |
| 563 | upaddr->upcs2 = ui->ui_slave; |
| 564 | #ifndef NOBADSECT |
| 565 | if (bp->b_flags&B_BAD) { |
| 566 | if (upecc(ui, CONT)) |
| 567 | return; |
| 568 | } |
| 569 | #endif |
| 570 | #ifndef NOBADSECT |
| 571 | if (bp->b_flags&B_BAD) { |
| 572 | if (upecc(ui, CONT)) |
| 573 | return; |
| 574 | } |
| 575 | #endif |
| 576 | /* |
| 577 | * Check for and process errors on |
| 578 | * either the drive or the controller. |
| 579 | */ |
| 580 | if ((upaddr->upds&UPDS_ERR) || (upaddr->upcs1&UP_TRE)) { |
| 581 | waitdry = 0; |
| 582 | while ((upaddr->upds & UPDS_DRY) == 0) { |
| 583 | if (++waitdry > 512) |
| 584 | break; |
| 585 | upwaitdry++; |
| 586 | } |
| 587 | if (upaddr->uper1&UPER1_WLE) { |
| 588 | /* |
| 589 | * Give up on write locked devices |
| 590 | * immediately. |
| 591 | */ |
| 592 | printf("up%d: write locked\n", dkunit(bp)); |
| 593 | bp->b_flags |= B_ERROR; |
| 594 | } else if (++um->um_tab.b_errcnt > 27) { |
| 595 | /* |
| 596 | * After 28 retries (16 without offset, and |
| 597 | * 12 with offset positioning) give up. |
| 598 | */ |
| 599 | hard: |
| 600 | hard: |
| 601 | harderr(bp, "up"); |
| 602 | printf("cn=%d tn=%d sn=%d cs2=%b er1=%b er2=%b\n", |
| 603 | upaddr->updc, ((upaddr->upda)>>8)&077, |
| 604 | (upaddr->upda)&037, |
| 605 | upaddr->upcs2, UPCS2_BITS, |
| 606 | upaddr->uper1, UPER1_BITS, |
| 607 | upaddr->uper2, UPER2_BITS); |
| 608 | bp->b_flags |= B_ERROR; |
| 609 | } else if (upaddr->uper2 & UPER2_BSE) { |
| 610 | #ifndef NOBADSECT |
| 611 | if (upecc(ui, BSE)) |
| 612 | return; |
| 613 | else |
| 614 | #endif |
| 615 | goto hard; |
| 616 | } else if (upaddr->uper2 & UPER2_BSE) { |
| 617 | #ifndef NOBADSECT |
| 618 | if (upecc(ui, BSE)) |
| 619 | return; |
| 620 | else |
| 621 | #endif |
| 622 | goto hard; |
| 623 | } else { |
| 624 | /* |
| 625 | * Retriable error. |
| 626 | * If a soft ecc, correct it (continuing |
| 627 | * by returning if necessary. |
| 628 | * Otherwise fall through and retry the transfer |
| 629 | */ |
| 630 | if ((upaddr->uper1&(UPER1_DCK|UPER1_ECH))==UPER1_DCK) { |
| 631 | if (upecc(ui, ECC)) |
| 632 | return; |
| 633 | } else |
| 634 | um->um_tab.b_active = 0; /* force retry */ |
| 635 | } else |
| 636 | um->um_tab.b_active = 0; /* force retry */ |
| 637 | } |
| 638 | /* |
| 639 | * Clear drive error and, every eight attempts, |
| 640 | * (starting with the fourth) |
| 641 | * recalibrate to clear the slate. |
| 642 | */ |
| 643 | upaddr->upcs1 = UP_TRE|UP_IE|UP_DCLR|UP_GO; |
| 644 | needie = 0; |
| 645 | if ((um->um_tab.b_errcnt&07) == 4 && um->um_tab.b_active == 0) { |
| 646 | upaddr->upcs1 = UP_RECAL|UP_IE|UP_GO; |
| 647 | sc->sc_recal = 0; |
| 648 | goto nextrecal; |
| 649 | } |
| 650 | } |
| 651 | /* |
| 652 | * Advance recalibration finite state machine |
| 653 | * if recalibrate in progress, through |
| 654 | * RECAL |
| 655 | * SEEK |
| 656 | * OFFSET (optional) |
| 657 | * RETRY |
| 658 | */ |
| 659 | switch (sc->sc_recal) { |
| 660 | |
| 661 | case 1: |
| 662 | upaddr->updc = bp->b_cylin; |
| 663 | upaddr->upcs1 = UP_SEEK|UP_IE|UP_GO; |
| 664 | goto nextrecal; |
| 665 | case 2: |
| 666 | if (um->um_tab.b_errcnt < 16 || (bp->b_flags&B_READ) == 0) |
| 667 | goto donerecal; |
| 668 | upaddr->upof = up_offset[um->um_tab.b_errcnt & 017] | UPOF_FMT22; |
| 669 | upaddr->upcs1 = UP_IE|UP_OFFSET|UP_GO; |
| 670 | goto nextrecal; |
| 671 | nextrecal: |
| 672 | sc->sc_recal++; |
| 673 | um->um_tab.b_active = 1; |
| 674 | return; |
| 675 | donerecal: |
| 676 | case 3: |
| 677 | sc->sc_recal = 0; |
| 678 | um->um_tab.b_active = 0; |
| 679 | break; |
| 680 | } |
| 681 | /* |
| 682 | * If still ``active'', then don't need any more retries. |
| 683 | */ |
| 684 | if (um->um_tab.b_active) { |
| 685 | /* |
| 686 | * If we were offset positioning, |
| 687 | * return to centerline. |
| 688 | */ |
| 689 | if (um->um_tab.b_errcnt >= 16) { |
| 690 | upaddr->upof = UPOF_FMT22; |
| 691 | upaddr->upcs1 = UP_RTC|UP_GO|UP_IE; |
| 692 | while (upaddr->upds & UPDS_PIP) |
| 693 | DELAY(25); |
| 694 | needie = 0; |
| 695 | } |
| 696 | um->um_tab.b_active = 0; |
| 697 | um->um_tab.b_errcnt = 0; |
| 698 | um->um_tab.b_actf = dp->b_forw; |
| 699 | dp->b_active = 0; |
| 700 | dp->b_errcnt = 0; |
| 701 | dp->b_actf = bp->av_forw; |
| 702 | bp->b_resid = (-upaddr->upwc * sizeof(short)); |
| 703 | iodone(bp); |
| 704 | /* |
| 705 | * If this unit has more work to do, |
| 706 | * then start it up right away. |
| 707 | */ |
| 708 | if (dp->b_actf) |
| 709 | if (upustart(ui)) |
| 710 | needie = 0; |
| 711 | } |
| 712 | as &= ~(1<<ui->ui_slave); |
| 713 | /* |
| 714 | * Release unibus resources and flush data paths. |
| 715 | */ |
| 716 | ubadone(um); |
| 717 | doattn: |
| 718 | /* |
| 719 | * Process other units which need attention. |
| 720 | * For each unit which needs attention, call |
| 721 | * the unit start routine to place the slave |
| 722 | * on the controller device queue. |
| 723 | */ |
| 724 | while (unit = ffs(as)) { |
| 725 | unit--; /* was 1 origin */ |
| 726 | as &= ~(1<<unit); |
| 727 | upaddr->upas = 1<<unit; |
| 728 | if (unit < UPIPUNITS && upustart(upip[sc21][unit])) |
| 729 | needie = 0; |
| 730 | } |
| 731 | /* |
| 732 | * If the controller is not transferring, but |
| 733 | * there are devices ready to transfer, start |
| 734 | * the controller. |
| 735 | */ |
| 736 | if (um->um_tab.b_actf && um->um_tab.b_active == 0) |
| 737 | if (upstart(um)) |
| 738 | needie = 0; |
| 739 | if (needie) |
| 740 | upaddr->upcs1 = UP_IE; |
| 741 | } |
| 742 | |
| 743 | upread(dev, uio) |
| 744 | dev_t dev; |
| 745 | struct uio *uio; |
| 746 | { |
| 747 | register int unit = minor(dev) >> 3; |
| 748 | |
| 749 | if (unit >= NUP) |
| 750 | return (ENXIO); |
| 751 | return (physio(upstrategy, &rupbuf[unit], dev, B_READ, minphys, uio)); |
| 752 | } |
| 753 | |
| 754 | upwrite(dev, uio) |
| 755 | dev_t dev; |
| 756 | struct uio *uio; |
| 757 | { |
| 758 | register int unit = minor(dev) >> 3; |
| 759 | |
| 760 | if (unit >= NUP) |
| 761 | return (ENXIO); |
| 762 | return (physio(upstrategy, &rupbuf[unit], dev, B_WRITE, minphys, uio)); |
| 763 | } |
| 764 | |
| 765 | /* |
| 766 | * Correct an ECC error, and restart the i/o to complete |
| 767 | * the transfer if necessary. This is quite complicated because |
| 768 | * the transfer may be going to an odd memory address base and/or |
| 769 | * across a page boundary. |
| 770 | */ |
| 771 | upecc(ui, flag) |
| 772 | register struct uba_device *ui; |
| 773 | int flag; |
| 774 | int flag; |
| 775 | { |
| 776 | register struct updevice *up = (struct updevice *)ui->ui_addr; |
| 777 | register struct buf *bp = uputab[ui->ui_unit].b_actf; |
| 778 | register struct uba_ctlr *um = ui->ui_mi; |
| 779 | register struct upst *st; |
| 780 | struct uba_regs *ubp = ui->ui_hd->uh_uba; |
| 781 | register int i; |
| 782 | caddr_t addr; |
| 783 | int reg, bit, byte, npf, mask, o, cmd, ubaddr; |
| 784 | int bn, cn, tn, sn; |
| 785 | |
| 786 | /* |
| 787 | * Npf is the number of sectors transferred before the sector |
| 788 | * containing the ECC error, and reg is the UBA register |
| 789 | * mapping (the first part of) the transfer. |
| 790 | * O is offset within a memory page of the first byte transferred. |
| 791 | */ |
| 792 | #ifndef NOBADSECT |
| 793 | if (flag == CONT) |
| 794 | npf = bp->b_error; |
| 795 | else |
| 796 | #endif |
| 797 | npf = btop((up->upwc * sizeof(short)) + bp->b_bcount); |
| 798 | reg = btop(um->um_ubinfo&0x3ffff) + npf; |
| 799 | o = (int)bp->b_un.b_addr & PGOFSET; |
| 800 | printf("up%d%c: soft ecc sn%d\n", dkunit(bp), |
| 801 | 'a'+(minor(bp->b_dev)&07), bp->b_blkno + npf); |
| 802 | mask = up->upec2; |
| 803 | #ifdef UPECCDEBUG |
| 804 | printf("npf %d reg %x o %d mask %o pos %d\n", npf, reg, o, mask, |
| 805 | up->upec1); |
| 806 | #endif |
| 807 | bn = dkblock(bp); |
| 808 | st = &upst[ui->ui_type]; |
| 809 | cn = bp->b_cylin; |
| 810 | sn = bn%st->nspc + npf; |
| 811 | tn = sn/st->nsect; |
| 812 | sn %= st->nsect; |
| 813 | cn += tn/st->ntrak; |
| 814 | tn %= st->ntrak; |
| 815 | ubapurge(um); |
| 816 | um->um_tab.b_active=2; |
| 817 | /* |
| 818 | * action taken depends on the flag |
| 819 | */ |
| 820 | switch(flag){ |
| 821 | case ECC: |
| 822 | npf--; |
| 823 | reg--; |
| 824 | mask = up->upec2; |
| 825 | printf("up%d%c: soft ecc sn%d\n", dkunit(bp), |
| 826 | 'a'+(minor(bp->b_dev)&07), bp->b_blkno + npf); |
| 827 | /* |
| 828 | * Flush the buffered data path, and compute the |
| 829 | * byte and bit position of the error. The variable i |
| 830 | * is the byte offset in the transfer, the variable byte |
| 831 | * is the offset from a page boundary in main memory. |
| 832 | */ |
| 833 | i = up->upec1 - 1; /* -1 makes 0 origin */ |
| 834 | bit = i&07; |
| 835 | i = (i&~07)>>3; |
| 836 | byte = i + o; |
| 837 | /* |
| 838 | * Correct while possible bits remain of mask. Since mask |
| 839 | * contains 11 bits, we continue while the bit offset is > -11. |
| 840 | * Also watch out for end of this block and the end of the whole |
| 841 | * transfer. |
| 842 | */ |
| 843 | while (i < 512 && (int)ptob(npf)+i < bp->b_bcount && bit > -11) { |
| 844 | addr = ptob(ubp->uba_map[reg+btop(byte)].pg_pfnum)+ |
| 845 | (byte & PGOFSET); |
| 846 | #ifdef UPECCDEBUG |
| 847 | printf("addr %x map reg %x\n", |
| 848 | addr, *(int *)(&ubp->uba_map[reg+btop(byte)])); |
| 849 | printf("old: %x, ", getmemc(addr)); |
| 850 | #endif |
| 851 | putmemc(addr, getmemc(addr)^(mask<<bit)); |
| 852 | #ifdef UPECCDEBUG |
| 853 | printf("new: %x\n", getmemc(addr)); |
| 854 | #endif |
| 855 | byte++; |
| 856 | i++; |
| 857 | } |
| 858 | if (up->upwc == 0) |
| 859 | return (0); |
| 860 | npf++; |
| 861 | reg++; |
| 862 | break; |
| 863 | #ifndef NOBADSECT |
| 864 | case BSE: |
| 865 | /* |
| 866 | * if not in bad sector table, return 0 |
| 867 | */ |
| 868 | if ((bn = isbad(&upbad[ui->ui_unit], cn, tn, sn)) < 0) |
| 869 | return(0); |
| 870 | /* |
| 871 | * flag this one as bad |
| 872 | */ |
| 873 | bp->b_flags |= B_BAD; |
| 874 | bp->b_error = npf + 1; |
| 875 | #ifdef UPECCDEBUG |
| 876 | printf("BSE: restart at %d\n",npf+1); |
| 877 | #endif |
| 878 | bn = st->ncyl * st->nspc -st->nsect - 1 - bn; |
| 879 | cn = bn / st->nspc; |
| 880 | sn = bn % st->nspc; |
| 881 | tn = sn / st->nsect; |
| 882 | sn %= st->nsect; |
| 883 | up->upwc = -(512 / sizeof (short)); |
| 884 | #ifdef UPECCDEBUG |
| 885 | printf("revector to cn %d tn %d sn %d\n", cn, tn, sn); |
| 886 | #endif |
| 887 | break; |
| 888 | case CONT: |
| 889 | #ifdef UPECCDEBUG |
| 890 | printf("upecc, CONT: bn %d cn %d tn %d sn %d\n", bn, cn, tn, sn); |
| 891 | #endif |
| 892 | bp->b_flags &= ~B_BAD; |
| 893 | up->upwc = -((bp->b_bcount - (int)ptob(npf)) / sizeof(short)); |
| 894 | if (up->upwc == 0) |
| 895 | return(0); |
| 896 | break; |
| 897 | #endif |
| 898 | } |
| 899 | if (up->upwc == 0) { |
| 900 | um->um_tab.b_active = 0; |
| 901 | return (0); |
| 902 | } |
| 903 | } |
| 904 | /* |
| 905 | * Have to continue the transfer... clear the drive, |
| 906 | * and compute the position where the transfer is to continue. |
| 907 | * We have completed npf+1 sectors of the transfer already; |
| 908 | * restart at offset o of next sector (i.e. in UBA register reg+1). |
| 909 | */ |
| 910 | #ifdef notdef |
| 911 | up->uper1 = 0; |
| 912 | up->upcs1 |= UP_GO; |
| 913 | #else |
| 914 | up->upcs1 = UP_TRE|UP_IE|UP_DCLR|UP_GO; |
| 915 | up->updc = cn; |
| 916 | up->upda = (tn << 8) | sn; |
| 917 | ubaddr = (int)ptob(reg) + o; |
| 918 | up->upba = ubaddr; |
| 919 | cmd = (ubaddr >> 8) & 0x300; |
| 920 | cmd |= ((bp->b_flags&B_READ)?UP_RCOM:UP_WCOM)|UP_IE|UP_GO; |
| 921 | um->um_tab.b_errcnt = 0; |
| 922 | up->upcs1 = cmd; |
| 923 | #endif |
| 924 | return (1); |
| 925 | } |
| 926 | |
| 927 | /* |
| 928 | * Reset driver after UBA init. |
| 929 | * Cancel software state of all pending transfers |
| 930 | * and restart all units and the controller. |
| 931 | */ |
| 932 | upreset(uban) |
| 933 | int uban; |
| 934 | { |
| 935 | register struct uba_ctlr *um; |
| 936 | register struct uba_device *ui; |
| 937 | register sc21, unit; |
| 938 | |
| 939 | for (sc21 = 0; sc21 < NSC; sc21++) { |
| 940 | if ((um = upminfo[sc21]) == 0 || um->um_ubanum != uban || |
| 941 | um->um_alive == 0) |
| 942 | continue; |
| 943 | printf(" sc%d", sc21); |
| 944 | um->um_tab.b_active = 0; |
| 945 | um->um_tab.b_actf = um->um_tab.b_actl = 0; |
| 946 | up_softc[sc21].sc_recal = 0; |
| 947 | up_softc[sc21].sc_wticks = 0; |
| 948 | if (um->um_ubinfo) { |
| 949 | printf("<%d>", (um->um_ubinfo>>28)&0xf); |
| 950 | um->um_ubinfo = 0; |
| 951 | } |
| 952 | ((struct updevice *)(um->um_addr))->upcs2 = UPCS2_CLR; |
| 953 | for (unit = 0; unit < NUP; unit++) { |
| 954 | if ((ui = updinfo[unit]) == 0) |
| 955 | continue; |
| 956 | if (ui->ui_alive == 0 || ui->ui_mi != um) |
| 957 | continue; |
| 958 | uputab[unit].b_active = 0; |
| 959 | (void) upustart(ui); |
| 960 | } |
| 961 | (void) upstart(um); |
| 962 | } |
| 963 | } |
| 964 | |
| 965 | /* |
| 966 | * Wake up every second and if an interrupt is pending |
| 967 | * but nothing has happened increment a counter. |
| 968 | * If nothing happens for 20 seconds, reset the UNIBUS |
| 969 | * and begin anew. |
| 970 | */ |
| 971 | upwatch() |
| 972 | { |
| 973 | register struct uba_ctlr *um; |
| 974 | register sc21, unit; |
| 975 | register struct up_softc *sc; |
| 976 | |
| 977 | timeout(upwatch, (caddr_t)0, hz); |
| 978 | for (sc21 = 0; sc21 < NSC; sc21++) { |
| 979 | um = upminfo[sc21]; |
| 980 | if (um == 0 || um->um_alive == 0) |
| 981 | continue; |
| 982 | sc = &up_softc[sc21]; |
| 983 | if (um->um_tab.b_active == 0) { |
| 984 | for (unit = 0; unit < NUP; unit++) |
| 985 | if (uputab[unit].b_active && |
| 986 | updinfo[unit]->ui_mi == um) |
| 987 | goto active; |
| 988 | sc->sc_wticks = 0; |
| 989 | continue; |
| 990 | } |
| 991 | active: |
| 992 | sc->sc_wticks++; |
| 993 | if (sc->sc_wticks >= 20) { |
| 994 | sc->sc_wticks = 0; |
| 995 | printf("sc%d: lost interrupt\n", sc21); |
| 996 | ubareset(um->um_ubanum); |
| 997 | } |
| 998 | } |
| 999 | } |
| 1000 | |
| 1001 | #define DBSIZE 20 |
| 1002 | |
| 1003 | updump(dev) |
| 1004 | dev_t dev; |
| 1005 | { |
| 1006 | struct updevice *upaddr; |
| 1007 | char *start; |
| 1008 | int num, blk, unit; |
| 1009 | struct size *sizes; |
| 1010 | register struct uba_regs *uba; |
| 1011 | register struct uba_device *ui; |
| 1012 | register short *rp; |
| 1013 | struct upst *st; |
| 1014 | register int retry; |
| 1015 | register int retry; |
| 1016 | |
| 1017 | unit = minor(dev) >> 3; |
| 1018 | if (unit >= NUP) |
| 1019 | return (ENXIO); |
| 1020 | #define phys(cast, addr) ((cast)((int)addr & 0x7fffffff)) |
| 1021 | ui = phys(struct uba_device *, updinfo[unit]); |
| 1022 | if (ui->ui_alive == 0) |
| 1023 | return (ENXIO); |
| 1024 | uba = phys(struct uba_hd *, ui->ui_hd)->uh_physuba; |
| 1025 | ubainit(uba); |
| 1026 | upaddr = (struct updevice *)ui->ui_physaddr; |
| 1027 | DELAY(5000000); |
| 1028 | num = maxfree; |
| 1029 | upaddr->upcs2 = unit; |
| 1030 | DELAY(100); |
| 1031 | upaddr->upcs1 = UP_DCLR|UP_GO; |
| 1032 | upaddr->upcs1 = UP_PRESET|UP_GO; |
| 1033 | upaddr->upof = UPOF_FMT22; |
| 1034 | retry = 0; |
| 1035 | do { |
| 1036 | DELAY(25); |
| 1037 | if (++retry > 527) |
| 1038 | break; |
| 1039 | } while ((upaddr->upds & UP_RDY) == 0); |
| 1040 | if ((upaddr->upds & UPDS_DREADY) != UPDS_DREADY) |
| 1041 | return (EFAULT); |
| 1042 | start = 0; |
| 1043 | st = &upst[ui->ui_type]; |
| 1044 | start = 0; |
| 1045 | sizes = phys(struct size *, st->sizes); |
| 1046 | if (dumplo < 0 || dumplo + num >= sizes[minor(dev)&07].nblocks) |
| 1047 | return (EINVAL); |
| 1048 | while (num > 0) { |
| 1049 | register struct pte *io; |
| 1050 | register int i; |
| 1051 | int cn, sn, tn; |
| 1052 | daddr_t bn; |
| 1053 | |
| 1054 | blk = num > DBSIZE ? DBSIZE : num; |
| 1055 | io = uba->uba_map; |
| 1056 | for (i = 0; i < blk; i++) |
| 1057 | *(int *)io++ = (btop(start)+i) | (1<<21) | UBAMR_MRV; |
| 1058 | *(int *)io = 0; |
| 1059 | bn = dumplo + btop(start); |
| 1060 | cn = bn/st->nspc + sizes[minor(dev)&07].cyloff; |
| 1061 | sn = bn%st->nspc; |
| 1062 | tn = sn/st->nsect; |
| 1063 | sn = sn%st->nsect; |
| 1064 | upaddr->updc = cn; |
| 1065 | rp = (short *) &upaddr->upda; |
| 1066 | *rp = (tn << 8) + sn; |
| 1067 | *--rp = 0; |
| 1068 | *--rp = -blk*NBPG / sizeof (short); |
| 1069 | *--rp = UP_GO|UP_WCOM; |
| 1070 | retry = 0; |
| 1071 | retry = 0; |
| 1072 | do { |
| 1073 | DELAY(25); |
| 1074 | if (++retry > 527) |
| 1075 | break; |
| 1076 | if (++retry > 527) |
| 1077 | break; |
| 1078 | } while ((upaddr->upcs1 & UP_RDY) == 0); |
| 1079 | if ((upaddr->upds & UPDS_DREADY) != UPDS_DREADY) { |
| 1080 | printf("up%d: not ready", unit); |
| 1081 | if ((upaddr->upds & UPDS_DREADY) != UPDS_DREADY) { |
| 1082 | printf("\n"); |
| 1083 | return (EIO); |
| 1084 | } |
| 1085 | printf(" (flakey)\n"); |
| 1086 | } |
| 1087 | if ((upaddr->upds & UPDS_DREADY) != UPDS_DREADY) { |
| 1088 | printf("up%d: not ready", unit); |
| 1089 | if ((upaddr->upds & UPDS_DREADY) != UPDS_DREADY) { |
| 1090 | printf("\n"); |
| 1091 | return (EIO); |
| 1092 | } |
| 1093 | printf(" (flakey)\n"); |
| 1094 | } |
| 1095 | if (upaddr->upds&UPDS_ERR) |
| 1096 | return (EIO); |
| 1097 | start += blk*NBPG; |
| 1098 | num -= blk; |
| 1099 | } |
| 1100 | return (0); |
| 1101 | } |
| 1102 | #endif |