1 /* 2 * Copyright (c) 1982,1986 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)autoconf.c 7.19 (Berkeley) 12/16/90 7 */ 8 9 /* 10 * Setup the system to run on the current machine. 11 * 12 * Configure() is called at boot time and initializes the uba and mba 13 * device tables and the memory controller monitoring. Available 14 * devices are determined (from possibilities mentioned in ioconf.c), 15 * and the drivers are initialized. 16 */ 17 18 #include "mba.h" 19 #include "uba.h" 20 #include "kra.h" /* XXX wrong file */ 21 #include "bi.h" 22 23 #include "sys/param.h" 24 #include "sys/systm.h" 25 #include "sys/map.h" 26 #include "sys/buf.h" 27 #include "sys/dkstat.h" 28 #include "sys/vm.h" 29 #include "sys/malloc.h" 30 #include "sys/conf.h" 31 #include "sys/dmap.h" 32 #include "sys/reboot.h" 33 34 #include "../include/pte.h" 35 #include "../include/cpu.h" 36 #include "mem.h" 37 #include "../include/mtpr.h" 38 #include "nexus.h" 39 #include "scb.h" 40 #include "ioa.h" 41 #include "../bi/bireg.h" 42 #include "../mba/mbareg.h" 43 #include "../mba/mbavar.h" 44 #include "../uba/ubareg.h" 45 #include "../uba/ubavar.h" 46 47 /* 48 * The following several variables are related to 49 * the configuration process, and are used in initializing 50 * the machine. 51 */ 52 int cold; /* if 1, still working on cold-start */ 53 int dkn; /* number of iostat dk numbers assigned so far */ 54 int cpuspeed = 1; /* relative cpu speed */ 55 56 /* 57 * Addresses of the (locore) routines which bootstrap us from 58 * hardware traps to C code. Filled into the system control block 59 * as necessary. 60 * 61 * RIDICULOUS! CONFIG SHOULD GENERATE AN ioconf.h FOR US, with 62 * mba glue also in `glue.s'. (Unibus adapter glue is special, though.) 63 */ 64 #if NMBA > 0 65 int (*mbaintv[4])() = { Xmba0int, Xmba1int, Xmba2int, Xmba3int }; 66 #if NMBA > 4 67 Need to expand the table for more than 4 massbus adaptors 68 #endif 69 #endif 70 #if defined(VAX780) || defined(VAX8600) 71 int (*ubaintv[])() = 72 { 73 Xua0int, Xua1int, Xua2int, Xua3int, 74 #if NUBA > 4 75 Xua4int, Xua5int, Xua6int, Xua7int, 76 #endif 77 #if NUBA > 8 78 Need to expand the table for more than 8 unibus adaptors 79 #endif 80 }; 81 #endif 82 #if NKDB > 0 83 /* kdb50 driver does not appear in udminit[] (not without csr!) */ 84 int Xkdbintr0(); /* generated by autoconf */ 85 int (*kdbintv[])() = { Xkdbintr0 }; 86 #if NKDB > 1 87 Need to expand the table for more than 1 KDB adapter 88 #endif 89 #endif 90 91 /* 92 * This allocates the space for the per-uba information, 93 * such as buffered data path usage. 94 */ 95 struct uba_hd uba_hd[NUBA]; 96 97 /* 98 * Determine mass storage and memory configuration for a machine. 99 * Get cpu type, and then switch out to machine specific procedures 100 * which will probe adaptors to see what is out there. 101 */ 102 configure() 103 { 104 union cpusid cpusid; 105 register struct percpu *ocp; 106 register struct pte *ip; 107 108 cpusid.cpusid = mfpr(SID); 109 switch (cpusid.cpuany.cp_type) { 110 #if VAX8600 111 case VAX_8600: 112 printf("VAX 8600, serial# %d(%d), hardware ECO level %d(%d)\n", 113 cpusid.cpu8600.cp_sno, cpusid.cpu8600.cp_plant, 114 cpusid.cpu8600.cp_eco >> 4, cpusid.cpu8600.cp_eco); 115 break; 116 #endif 117 #if VAX8200 118 case VAX_8200: 119 printf("\ 120 VAX 82%c0, hardware rev %d, ucode patch rev %d, sec patch %d, ucode rev %d\n", 121 cpusid.cpu8200.cp_5 ? '5' : '0', 122 cpusid.cpu8200.cp_hrev, cpusid.cpu8200.cp_patch, 123 cpusid.cpu8200.cp_secp, cpusid.cpu8200.cp_urev); 124 mastercpu = mfpr(BINID); 125 break; 126 #endif 127 #if VAX780 128 case VAX_780: 129 printf("\ 130 VAX 11/78%c, serial# %d(%d), hardware ECO level %d(%d)\n", 131 cpusid.cpu780.cp_5 ? '5' : '0', 132 cpusid.cpu780.cp_sno, cpusid.cpu780.cp_plant, 133 cpusid.cpu780.cp_eco >> 4, cpusid.cpu780.cp_eco); 134 break; 135 #endif 136 #if VAX750 137 case VAX_750: 138 printf("VAX 11/750, hardware rev %d, ucode rev %d\n", 139 cpusid.cpu750.cp_hrev, cpusid.cpu750.cp_urev); 140 break; 141 #endif 142 #if VAX730 143 case VAX_730: 144 printf("VAX 11/730, ucode rev %d\n", cpusid.cpu730.cp_urev); 145 break; 146 #endif 147 #if VAX630 148 case VAX_630: 149 printf("MicroVAX-II\n"); 150 break; 151 #endif 152 #if VAX650 153 case VAX_650: 154 printf("MicroVAX 3000, ucode rev %d\n", cpusid.cpu650.cp_urev); 155 break; 156 #endif 157 } 158 for (ocp = percpu; ocp->pc_cputype; ocp++) 159 if (ocp->pc_cputype == cpusid.cpuany.cp_type) { 160 cpuspeed = ocp->pc_cpuspeed; 161 cpuops = ocp->pc_ops; 162 if (cpuops->cpu_init != NULL) 163 (*cpuops->cpu_init)(); 164 probeio(ocp); 165 /* 166 * Write protect the scb and UNIBUS interrupt vectors. 167 * It is strange that this code is here, but this is 168 * as soon as we are done mucking with it, and the 169 * write-enable was done in assembly language 170 * to which we will never return. 171 */ 172 for (ip = kvtopte(scb); ip < kvtopte(eUNIvec); ip++) { 173 *(int *)ip &= ~PG_PROT; 174 *(int *)ip |= PG_KR; 175 } 176 mtpr(TBIA, 0); 177 #if GENERIC 178 if ((boothowto & RB_ASKNAME) == 0) 179 setroot(); 180 setconf(); 181 #else 182 setroot(); 183 #endif 184 /* 185 * Configure swap area and related system 186 * parameter based on device(s) used. 187 */ 188 swapconf(); 189 cold = 0; 190 memenable(); 191 return; 192 } 193 printf("cpu type %d not configured\n", cpusid.cpuany.cp_type); 194 asm("halt"); 195 } 196 197 #if VAX8600 || VAX780 || VAX750 || VAX730 198 int nexnum; /* current nexus number */ 199 int nsbi; /* current sbi number */ 200 #endif 201 #if VAX8200 202 int numkdb; /* current ``kdb'' number */ 203 int bi_nodes; /* XXX remembers found bi nodes */ 204 #endif 205 206 /* 207 * Probe the main IO bus(es). 208 * The percpu structure gives us a handle on the addresses and/or types. 209 */ 210 probeio(pcpu) 211 register struct percpu *pcpu; 212 { 213 register struct iobus *iob; 214 int ioanum; 215 216 ioanum = 0; 217 for (iob = pcpu->pc_io; ioanum < pcpu->pc_nioa; ioanum++, iob++) { 218 219 switch (iob->io_type) { 220 221 #if VAX630 || VAX650 222 case IO_QBUS: 223 probeqbus((struct qbus *)iob->io_details); 224 break; 225 #endif 226 227 #if VAX780 || VAX750 || VAX730 228 case IO_SBI780: 229 case IO_CMI750: 230 case IO_XXX730: 231 probenexi((struct nexusconnect *)iob->io_details); 232 break; 233 #endif 234 235 #if VAX8600 236 case IO_ABUS: 237 probe_Abus(ioanum, iob); 238 break; 239 #endif 240 241 #if VAX8200 242 case IO_BI: 243 probe_bi((struct bibus *)iob->io_details); 244 break; 245 #endif 246 247 default: 248 if (iob->io_addr) { 249 printf( 250 "IO adaptor %d, type %d, at address 0x%x is unsupported\n", 251 ioanum, iob->io_type, iob->io_addr); 252 } else 253 printf("IO adaptor %d, type %d, is unsupported\n", 254 ioanum, iob->io_type); 255 break; 256 } 257 } 258 } 259 260 #if VAX8600 261 probe_Abus(ioanum, iob) 262 register struct iobus *iob; 263 { 264 register struct ioa *ioap; 265 union ioacsr ioacsr; 266 int type; 267 struct sbia_regs *sbiaregs; 268 #ifdef notyet 269 int sbi1fail(), sbi1alert(), sbi1fault(), sbi1err(); 270 #endif 271 272 ioap = &ioa[ioanum]; 273 ioaccess(iob->io_addr, Ioamap[ioanum], iob->io_size); 274 if (badaddr((caddr_t)ioap, 4)) 275 return; 276 ioacsr.ioa_csr = ioap->ioacsr.ioa_csr; 277 type = ioacsr.ioa_type & IOA_TYPMSK; 278 279 switch (type) { 280 281 case IOA_SBIA: 282 printf("SBIA%d at IO adaptor %d address 0x%x\n", 283 nsbi, ioanum, iob->io_addr); 284 #ifdef notyet 285 /* I AM NOT SURE THESE ARE IN THE SAME PLACES */ 286 if (nscb == 1) { 287 scb[1].scb_sbifail = scbentry(sbi1fail, SCB_ISTACK); 288 /* maybe not sbifail, maybe scb1.scb_cmrd */ 289 /* but how can I find out without a broken SBIA1? */ 290 scb[1].scb_sbialert = scbentry(sbi1alert, SCB_ISTACK); 291 scb[1].scb_sbifault = scbentry(sbi1fault, SCB_ISTACK); 292 scb[1].scb_sbierr = scbentry(sbi1err, SCB_ISTACK); 293 } 294 #endif 295 probenexi((struct nexusconnect *)iob->io_details); 296 nsbi++; 297 sbiaregs = (struct sbia_regs *)ioap; 298 sbiaregs->sbi_errsum = -1; 299 sbiaregs->sbi_error = 0x1000; 300 sbiaregs->sbi_fltsts = 0xc0000; 301 break; 302 303 default: 304 printf("IOA%d at address 0x%x is unsupported (type = 0x%x)\n", 305 ioanum, iob->io_addr, ioacsr.ioa_type); 306 break; 307 } 308 } 309 #endif 310 311 #if VAX8600 || VAX780 || VAX750 || VAX730 312 /* 313 * Probe nexus space, finding the interconnects 314 * and setting up and probing mba's and uba's for devices. 315 */ 316 probenexi(pnc) 317 register struct nexusconnect *pnc; 318 { 319 register struct nexus *nxv; 320 struct nexus *nxp = pnc->psb_nexbase; 321 union nexcsr nexcsr; 322 int i; 323 324 ioaccess((caddr_t)nxp, Nexmap[nsbi * NNEXSBI], 325 pnc->psb_nnexus * sizeof(struct nexus)); 326 nxv = &nexus[nsbi * NNEXSBI]; 327 for (nexnum = 0; nexnum < pnc->psb_nnexus; nexnum++, nxp++, nxv++) { 328 if (badaddr((caddr_t)nxv, 4)) 329 continue; 330 if (pnc->psb_nextype && pnc->psb_nextype[nexnum] != NEX_ANY) 331 nexcsr.nex_csr = pnc->psb_nextype[nexnum]; 332 else 333 nexcsr = nxv->nexcsr; 334 if (nexcsr.nex_csr&NEX_APD) 335 continue; 336 switch (nexcsr.nex_type) { 337 338 case NEX_MBA: 339 printf("mba%d at tr%d\n", nummba, nexnum); 340 if (nummba >= NMBA) { 341 printf("%d mba's", ++nummba); 342 goto unconfig; 343 } 344 #if NMBA > 0 345 mbafind(nxv, nxp); 346 nummba++; 347 #endif 348 break; 349 350 case NEX_UBA0: 351 case NEX_UBA1: 352 case NEX_UBA2: 353 case NEX_UBA3: 354 printf("uba%d at tr%d\n", numuba, nexnum); 355 if (numuba >= NUBA) { 356 printf("%d uba's", ++numuba); 357 goto unconfig; 358 } 359 #if NUBA > 0 360 #if VAX750 361 if (numuba >= 2 && cpu == VAX_750) { 362 printf("More than 2 UBA's"); 363 goto unsupp; 364 } 365 #endif 366 #if defined(VAX780) || defined(VAX8600) 367 if (cpu == VAX_780 || cpu == VAX_8600) 368 setscbnex(ubaintv[numuba]); 369 #endif 370 i = nexcsr.nex_type - NEX_UBA0; 371 probeuba((struct uba_regs *)nxv, (struct uba_regs *)nxp, 372 pnc->psb_umaddr[i]); 373 #endif /* NUBA */ 374 break; 375 376 case NEX_DR32: 377 /* there can be more than one... are there other codes??? */ 378 printf("dr32"); 379 goto unsupp; 380 381 case NEX_MEM4: 382 case NEX_MEM4I: 383 case NEX_MEM16: 384 case NEX_MEM16I: 385 printf("mcr%d at tr%d\n", nmcr, nexnum); 386 if (nmcr >= MAXNMCR) { 387 printf("%d mcr's", ++nmcr); 388 goto unconfig; 389 } 390 switch (cpu) { 391 #if VAX780 392 case VAX_780: 393 /* only ka780 code looks at type */ 394 mcrtype[nmcr] = M780C; 395 break; 396 #endif 397 default: 398 break; 399 } 400 mcraddr[nmcr++] = (caddr_t)nxv; 401 break; 402 403 #if VAX780 404 case NEX_MEM64I: 405 case NEX_MEM64L: 406 case NEX_MEM64LI: 407 case NEX_MEM256I: 408 case NEX_MEM256L: 409 case NEX_MEM256LI: 410 printf("mcr%d (el) at tr%d\n", nmcr, nexnum); 411 if (nmcr >= MAXNMCR) { 412 printf("%d mcr's", ++nmcr); 413 goto unconfig; 414 } 415 mcrtype[nmcr] = M780EL; 416 mcraddr[nmcr++] = (caddr_t)nxv; 417 if (nexcsr.nex_type != NEX_MEM64I && 418 nexcsr.nex_type != NEX_MEM256I) 419 break; 420 /* fall into ... */ 421 422 case NEX_MEM64U: 423 case NEX_MEM64UI: 424 case NEX_MEM256U: 425 case NEX_MEM256UI: 426 printf("mcr%d (eu) at tr%d\n", nmcr, nexnum); 427 if (nmcr >= MAXNMCR) { 428 printf("%d mcr's", ++nmcr); 429 goto unconfig; 430 } 431 mcrtype[nmcr] = M780EU; 432 mcraddr[nmcr++] = (caddr_t)nxv; 433 break; 434 #endif 435 436 case NEX_MPM0: 437 case NEX_MPM1: 438 case NEX_MPM2: 439 case NEX_MPM3: 440 printf("mpm"); 441 goto unsupp; 442 443 case NEX_CI: 444 printf("ci"); 445 goto unsupp; 446 447 default: 448 printf("nexus type %x", nexcsr.nex_type); 449 unsupp: 450 printf(" unsupported (at tr %d)\n", nexnum); 451 continue; 452 unconfig: 453 printf(" not configured\n"); 454 continue; 455 } 456 } 457 if (nummba > NMBA) 458 nummba = NMBA; 459 if (numuba > NUBA) 460 numuba = NUBA; 461 if (nmcr > MAXNMCR) 462 nmcr = MAXNMCR; 463 } 464 465 setscbnex(fn) 466 int (*fn)(); 467 { 468 register struct scb *scbp = &scb[nsbi]; 469 470 scbp->scb_ipl14[nexnum] = scbp->scb_ipl15[nexnum] = 471 scbp->scb_ipl16[nexnum] = scbp->scb_ipl17[nexnum] = 472 scbentry(fn, SCB_ISTACK); 473 } 474 #endif 475 476 #if NBI > 0 477 /* 478 * Probe BI node space. 479 * 480 * THIS DEPENDS ON BI SPACE == NEXUS SPACE 481 * THIS WILL NOT WORK FOR MULTIPLE BIs 482 */ 483 probe_bi(p) 484 register struct bibus *p; 485 { 486 register struct bi_node *biv, *bip; 487 register int node; 488 short dtype; 489 490 /* must ignore BI errors while configuring */ 491 bip = p->pbi_base; 492 ioaccess((caddr_t)bip, Nexmap[0], sizeof(*bip) * NNODEBI);/* XXX */ 493 printf("vaxbi0 at address 0x%x\n", bip); 494 biv = (struct bi_node *) &nexus[0]; /* XXX */ 495 for (node = 0; node < NNODEBI; node++, bip++, biv++) { 496 if (badaddr((caddr_t)biv, 4)) 497 continue; 498 bi_nodes |= 1 << node; /* XXX */ 499 dtype = biv->biic.bi_dtype; 500 /* clear bus errors */ 501 biv->biic.bi_ber = ~(BIBER_MBZ|BIBER_NMR|BIBER_UPEN); 502 switch (dtype) { 503 504 case BIDT_KA820: { 505 /* is this right?? */ 506 int cp5 = biv->biic.bi_revs & 0x8000 ? '5' : '0'; 507 508 if (node != mastercpu) { 509 printf("slave ka82%c cpu", cp5); 510 goto unsupp; 511 } 512 printf("ka82%c cpu at node %x\n", cp5, node); 513 biv->biic.bi_intrdes = 1 << mastercpu; 514 biv->biic.bi_csr |= BICSR_SEIE | BICSR_HEIE; 515 break; 516 } 517 518 case BIDT_DWBUA: 519 if (numuba >= NUBA || /*XXX*/numuba > 2) { 520 printf("%d uba's", ++numuba); 521 goto unconfig; 522 } 523 #if NUBA > 0 524 printf("uba%d at node %x\n", numuba, node); 525 526 /* 527 * Run a self test reset to drop any `old' errors, 528 * so that they cannot cause a BI bus error. 529 */ 530 (void) bi_selftest(&biv->biic); 531 532 /* 533 * Enable interrupts. DWBUAs must have 534 * high priority. 535 */ 536 biv->biic.bi_intrdes = 1 << mastercpu; 537 biv->biic.bi_csr = (biv->biic.bi_csr&~BICSR_ARB_MASK) | 538 BICSR_ARB_HIGH; 539 probeuba((struct uba_regs *)biv, (struct uba_regs *)bip, 540 (caddr_t)UMEM8200(node)); 541 #endif /* NUBA */ 542 break; 543 544 case BIDT_MS820: 545 printf("mcr%d at node %x\n", nmcr, node); 546 if (nmcr >= MAXNMCR) { 547 printf("%d mcr's", ++nmcr); 548 goto unconfig; 549 } 550 mcraddr[nmcr++] = (caddr_t)biv; 551 biv->biic.bi_intrdes = 1 << mastercpu; 552 biv->biic.bi_csr |= BICSR_SEIE | BICSR_HEIE; 553 break; 554 555 case BIDT_KDB50: 556 if (numkdb >= NKDB) { 557 printf("%d kdb's", ++numkdb); 558 goto unconfig; 559 } 560 #if NKDB > 0 561 printf("kdb%d at node %x\n", numkdb, node); 562 kdbconfig(numkdb, (struct biiregs *)biv, 563 (struct biiregs *)bip, 564 (int)&scb[0].scb_ipl15[node] - (int)&scb[0]); 565 scb[0].scb_ipl15[node] = 566 scbentry(kdbintv[numkdb], SCB_ISTACK); 567 kdbfind(numkdb); 568 #endif 569 numkdb++; 570 break; 571 572 case BIDT_DEBNA: 573 case BIDT_DEBNK: 574 printf("debna/debnk ethernet"); 575 goto unsupp; 576 577 default: 578 printf("node type 0x%x ", dtype); 579 unsupp: 580 printf(" unsupported (at node %x)\n", node); 581 break; 582 unconfig: 583 printf(" not configured (at node %x)\n", node); 584 continue; 585 } 586 #ifdef DO_EINTRCSR 587 biv->biic.bi_eintrcsr = BIEIC_IPL17 | 588 (int)&scb[0].scb_bierr - (int)&scb[0]; 589 /* but bi reset will need to restore this */ 590 #endif 591 } 592 if (numuba > NUBA) 593 numuba = NUBA; 594 if (numkdb > NKDB) 595 numkdb = NKDB; 596 if (nmcr > MAXNMCR) 597 nmcr = MAXNMCR; 598 } 599 600 #if NKDB > 0 601 /* 602 * Find drives attached to a particular KDB50. 603 */ 604 kdbfind(kdbnum) 605 int kdbnum; 606 { 607 extern struct uba_driver kdbdriver; 608 register struct uba_device *ui; 609 register struct uba_driver *udp = &kdbdriver; 610 int t; 611 612 for (ui = ubdinit; ui->ui_driver; ui++) { 613 /* ui->ui_ubanum is trash */ 614 if (ui->ui_driver != udp || ui->ui_alive || 615 ui->ui_ctlr != kdbnum && ui->ui_ctlr != '?') 616 continue; 617 t = ui->ui_ctlr; 618 ui->ui_ctlr = kdbnum; 619 if ((*udp->ud_slave)(ui) == 0) { 620 ui->ui_ctlr = t; 621 continue; 622 } 623 ui->ui_alive = 1; 624 ui->ui_ubanum = -1; 625 626 /* make these invalid so we can see if someone uses them */ 627 /* might as well make each one different too */ 628 ui->ui_hd = (struct uba_hd *)0xc0000010; 629 ui->ui_addr = (caddr_t)0xc0000014; 630 ui->ui_physaddr = (caddr_t)0xc0000018; 631 ui->ui_mi = (struct uba_ctlr *)0xc000001c; 632 633 if (ui->ui_dk && dkn < DK_NDRIVE) 634 ui->ui_dk = dkn++; 635 else 636 ui->ui_dk = -1; 637 /* ui_type comes from driver */ 638 udp->ud_dinfo[ui->ui_unit] = ui; 639 printf("%s%d at %s%d slave %d\n", 640 udp->ud_dname, ui->ui_unit, 641 udp->ud_mname, ui->ui_ctlr, ui->ui_slave); 642 (*udp->ud_attach)(ui); 643 } 644 } 645 #endif /* NKDB > 0 */ 646 #endif /* NBI > 0 */ 647 648 #if NMBA > 0 649 struct mba_device *mbaconfig(); 650 /* 651 * Find devices attached to a particular mba 652 * and look for each device found in the massbus 653 * initialization tables. 654 */ 655 mbafind(nxv, nxp) 656 struct nexus *nxv, *nxp; 657 { 658 register struct mba_regs *mdp; 659 register struct mba_drv *mbd; 660 register struct mba_device *mi; 661 register struct mba_slave *ms; 662 int dn, dt, sn; 663 struct mba_device fnd; 664 665 mdp = (struct mba_regs *)nxv; 666 mba_hd[nummba].mh_mba = mdp; 667 mba_hd[nummba].mh_physmba = (struct mba_regs *)nxp; 668 setscbnex(mbaintv[nummba]); 669 mdp->mba_cr = MBCR_INIT; 670 mdp->mba_cr = MBCR_IE; 671 fnd.mi_mba = mdp; 672 fnd.mi_mbanum = nummba; 673 for (mbd = mdp->mba_drv, dn = 0; mbd < &mdp->mba_drv[8]; mbd++, dn++) { 674 if ((mbd->mbd_ds&MBDS_DPR) == 0) 675 continue; 676 mdp->mba_sr |= MBSR_NED; /* si kludge */ 677 dt = mbd->mbd_dt & 0xffff; 678 if (dt == 0) 679 continue; 680 if (mdp->mba_sr&MBSR_NED) 681 continue; /* si kludge */ 682 if (dt == MBDT_MOH) 683 continue; 684 fnd.mi_drive = dn; 685 #define qeq(a, b) ( a == b || a == '?' ) 686 if ((mi = mbaconfig(&fnd, dt)) && (dt & MBDT_TAP)) 687 for (sn = 0; sn < 8; sn++) { 688 mbd->mbd_tc = sn; 689 for (ms = mbsinit; ms->ms_driver; ms++) 690 if (ms->ms_driver == mi->mi_driver && 691 ms->ms_alive == 0 && 692 qeq(ms->ms_ctlr, mi->mi_unit) && 693 qeq(ms->ms_slave, sn) && 694 (*ms->ms_driver->md_slave)(mi, ms, sn)) { 695 printf("%s%d at %s%d slave %d\n" 696 , ms->ms_driver->md_sname 697 , ms->ms_unit 698 , mi->mi_driver->md_dname 699 , mi->mi_unit 700 , sn 701 ); 702 ms->ms_alive = 1; 703 ms->ms_ctlr = mi->mi_unit; 704 ms->ms_slave = sn; 705 break; 706 } 707 } 708 } 709 } 710 711 /* 712 * Have found a massbus device; 713 * see if it is in the configuration table. 714 * If so, fill in its data. 715 */ 716 struct mba_device * 717 mbaconfig(ni, type) 718 register struct mba_device *ni; 719 register int type; 720 { 721 register struct mba_device *mi; 722 register short *tp; 723 register struct mba_hd *mh; 724 725 for (mi = mbdinit; mi->mi_driver; mi++) { 726 if (mi->mi_alive) 727 continue; 728 tp = mi->mi_driver->md_type; 729 for (mi->mi_type = 0; *tp; tp++, mi->mi_type++) 730 if (*tp == (type&MBDT_TYPE)) 731 goto found; 732 continue; 733 found: 734 #define match(fld) (ni->fld == mi->fld || mi->fld == '?') 735 if (!match(mi_drive) || !match(mi_mbanum)) 736 continue; 737 printf("%s%d at mba%d drive %d", 738 mi->mi_driver->md_dname, mi->mi_unit, 739 ni->mi_mbanum, ni->mi_drive); 740 mi->mi_alive = 1; 741 mh = &mba_hd[ni->mi_mbanum]; 742 mi->mi_hd = mh; 743 mh->mh_mbip[ni->mi_drive] = mi; 744 mh->mh_ndrive++; 745 mi->mi_mba = ni->mi_mba; 746 mi->mi_drv = &mi->mi_mba->mba_drv[ni->mi_drive]; 747 mi->mi_mbanum = ni->mi_mbanum; 748 mi->mi_drive = ni->mi_drive; 749 /* 750 * If drive has never been seen before, 751 * give it a dkn for statistics. 752 */ 753 if (mi->mi_driver->md_info[mi->mi_unit] == 0) { 754 mi->mi_driver->md_info[mi->mi_unit] = mi; 755 if (mi->mi_dk && dkn < DK_NDRIVE) 756 mi->mi_dk = dkn++; 757 else 758 mi->mi_dk = -1; 759 } 760 (*mi->mi_driver->md_attach)(mi); 761 printf("\n"); 762 return (mi); 763 } 764 return (0); 765 } 766 #endif 767 768 /* 769 * Fixctlrmask fixes the masks of the driver ctlr routines 770 * which otherwise save r10 and r11 where the interrupt and br 771 * level are passed through. 772 */ 773 fixctlrmask() 774 { 775 register struct uba_ctlr *um; 776 register struct uba_device *ui; 777 register struct uba_driver *ud; 778 #define phys(a,b) ((b)(((int)(a))&0x7fffffff)) 779 780 for (um = ubminit; ud = phys(um->um_driver, struct uba_driver *); um++) 781 *phys(ud->ud_probe, short *) &= ~0xc00; 782 for (ui = ubdinit; ud = phys(ui->ui_driver, struct uba_driver *); ui++) 783 *phys(ud->ud_probe, short *) &= ~0xc00; 784 } 785 786 #ifdef QBA 787 /* 788 * Configure a Q-bus. 789 */ 790 probeqbus(qb) 791 struct qbus *qb; 792 { 793 register struct uba_hd *uhp = &uba_hd[numuba]; 794 795 ioaccess((caddr_t)qb->qb_map, Nexmap[0], 796 qb->qb_memsize * sizeof (struct pte)); 797 uhp->uh_type = qb->qb_type; 798 uhp->uh_uba = (struct uba_regs *)0xc0000000; /* no uba adaptor regs */ 799 uhp->uh_mr = (struct pte *)&nexus[0]; 800 /* 801 * The map registers start right at 20088000 on the 802 * ka630, so we have to subtract out the 2k offset to make the 803 * pointers work.. 804 */ 805 uhp->uh_physuba = (struct uba_regs *)(((u_long)qb->qb_map)-0x800); 806 807 uhp->uh_memsize = qb->qb_memsize; 808 ioaccess(qb->qb_maddr, UMEMmap[numuba], uhp->uh_memsize * NBPG); 809 uhp->uh_mem = umem[numuba]; 810 811 /* 812 * The I/O page is mapped to the 8K of the umem address space 813 * immediately after the memory section that is mapped. 814 */ 815 ioaccess(qb->qb_iopage, UMEMmap[numuba] + uhp->uh_memsize, 816 UBAIOPAGES * NBPG); 817 uhp->uh_iopage = umem[numuba] + (uhp->uh_memsize * NBPG); 818 819 unifind(uhp, qb->qb_iopage); 820 } 821 #endif 822 823 #if NUBA > 0 824 probeuba(vubp, pubp, pumem) 825 struct uba_regs *vubp, *pubp; 826 caddr_t pumem; 827 { 828 register struct uba_hd *uhp = &uba_hd[numuba]; 829 830 /* 831 * Save virtual and physical addresses of adaptor. 832 */ 833 switch (cpu) { 834 #ifdef DW780 835 case VAX_8600: 836 case VAX_780: 837 uhp->uh_type = DW780; 838 break; 839 #endif 840 #ifdef DW750 841 case VAX_750: 842 uhp->uh_type = DW750; 843 break; 844 #endif 845 #ifdef DW730 846 case VAX_730: 847 uhp->uh_type = DW730; 848 break; 849 #endif 850 #ifdef DWBUA 851 case VAX_8200: 852 uhp->uh_type = DWBUA; 853 break; 854 #endif 855 default: 856 panic("unknown UBA type"); 857 /*NOTREACHED*/ 858 } 859 uhp->uh_uba = vubp; 860 uhp->uh_physuba = pubp; 861 uhp->uh_mr = vubp->uba_map; 862 uhp->uh_memsize = UBAPAGES; 863 864 ioaccess(pumem, UMEMmap[numuba], (UBAPAGES + UBAIOPAGES) * NBPG); 865 uhp->uh_mem = umem[numuba]; 866 uhp->uh_iopage = umem[numuba] + (uhp->uh_memsize * NBPG); 867 868 unifind(uhp, pumem + (uhp->uh_memsize * NBPG)); 869 } 870 871 /* 872 * Find devices on a UNIBUS. 873 * Uses per-driver routine to set <br,cvec> into <r11,r10>, 874 * and then fills in the tables, with help from a per-driver 875 * slave initialization routine. 876 */ 877 unifind(uhp0, pumem) 878 struct uba_hd *uhp0; 879 caddr_t pumem; 880 { 881 #ifndef lint 882 register int rbr, rcvec; /* MUST BE r11, r10 */ 883 #else 884 /* 885 * Lint doesn't realize that these 886 * can be initialized asynchronously 887 * when devices interrupt. 888 */ 889 register int rbr = 0, rcvec = 0; 890 #endif 891 register struct uba_device *ui; 892 register struct uba_ctlr *um; 893 register struct uba_hd *uhp = uhp0; 894 u_short *reg, *ap, addr; 895 struct uba_driver *udp; 896 int i, (**ivec)(); 897 caddr_t ualloc; 898 extern quad catcher[128]; 899 extern int br, cvec; 900 #if DW780 || DWBUA 901 struct uba_regs *vubp = uhp->uh_uba; 902 #endif 903 904 /* 905 * Initialize the UNIBUS, by freeing the map 906 * registers and the buffered data path registers 907 */ 908 uhp->uh_map = (struct map *) 909 malloc((u_long)(UAMSIZ * sizeof (struct map)), M_DEVBUF, 910 M_NOWAIT); 911 if (uhp->uh_map == 0) 912 panic("no mem for unibus map"); 913 bzero((caddr_t)uhp->uh_map, (unsigned)(UAMSIZ * sizeof (struct map))); 914 ubainitmaps(uhp); 915 916 /* 917 * Initialize space for the UNIBUS interrupt vectors. 918 * On the 8600, can't use first slot in UNIvec 919 * (the vectors for the second SBI overlap it); 920 * move each set of vectors forward. 921 */ 922 #if VAX8600 923 if (cpu == VAX_8600) 924 uhp->uh_vec = UNIvec[numuba + 1]; 925 else 926 #endif 927 uhp->uh_vec = UNIvec[numuba]; 928 for (i = 0; i < 128; i++) 929 uhp->uh_vec[i] = scbentry(&catcher[i], SCB_ISTACK); 930 /* 931 * Set last free interrupt vector for devices with 932 * programmable interrupt vectors. Use is to decrement 933 * this number and use result as interrupt vector. 934 */ 935 uhp->uh_lastiv = 0x200; 936 937 #ifdef DWBUA 938 if (uhp->uh_type == DWBUA) 939 BUA(vubp)->bua_offset = (int)uhp->uh_vec - (int)&scb[0]; 940 #endif 941 942 #ifdef DW780 943 if (uhp->uh_type == DW780) { 944 vubp->uba_sr = vubp->uba_sr; 945 vubp->uba_cr = UBACR_IFS|UBACR_BRIE; 946 } 947 #endif 948 /* 949 * First configure devices that have unibus memory, 950 * allowing them to allocate the correct map registers. 951 */ 952 ubameminit(numuba); 953 /* 954 * Grab some memory to record the umem address space we allocate, 955 * so we can be sure not to place two devices at the same address. 956 * 957 * We could use just 1/8 of this (we only want a 1 bit flag) but 958 * we are going to give it back anyway, and that would make the 959 * code here bigger (which we can't give back), so ... 960 * 961 * One day, someone will make a unibus with something other than 962 * an 8K i/o address space, & screw this totally. 963 */ 964 ualloc = (caddr_t)malloc((u_long)(8 * 1024), M_TEMP, M_NOWAIT); 965 if (ualloc == (caddr_t)0) 966 panic("no mem for unifind"); 967 bzero(ualloc, 8*1024); 968 969 /* 970 * Map the first page of UNIBUS i/o 971 * space to the first page of memory 972 * for devices which will need to dma 973 * output to produce an interrupt. 974 */ 975 *(int *)(&uhp->uh_mr[0]) = UBAMR_MRV; 976 977 #define ubaddr(uhp, off) (u_short *)((int)(uhp)->uh_iopage + ubdevreg(off)) 978 /* 979 * Check each unibus mass storage controller. 980 * For each one which is potentially on this uba, 981 * see if it is really there, and if it is record it and 982 * then go looking for slaves. 983 */ 984 for (um = ubminit; udp = um->um_driver; um++) { 985 if (um->um_ubanum != numuba && um->um_ubanum != '?' || 986 um->um_alive) 987 continue; 988 addr = (u_short)um->um_addr; 989 /* 990 * use the particular address specified first, 991 * or if it is given as "0", of there is no device 992 * at that address, try all the standard addresses 993 * in the driver til we find it 994 */ 995 for (ap = udp->ud_addr; addr || (addr = *ap++); addr = 0) { 996 997 if (ualloc[ubdevreg(addr)]) 998 continue; 999 reg = ubaddr(uhp, addr); 1000 if (badaddr((caddr_t)reg, 2)) 1001 continue; 1002 #ifdef DW780 1003 if (uhp->uh_type == DW780 && vubp->uba_sr) { 1004 vubp->uba_sr = vubp->uba_sr; 1005 continue; 1006 } 1007 #endif 1008 cvec = 0x200; 1009 rcvec = 0x200; 1010 i = (*udp->ud_probe)(reg, um->um_ctlr, um); 1011 #ifdef DW780 1012 if (uhp->uh_type == DW780 && vubp->uba_sr) { 1013 vubp->uba_sr = vubp->uba_sr; 1014 continue; 1015 } 1016 #endif 1017 if (i == 0) 1018 continue; 1019 printf("%s%d at uba%d csr %o ", 1020 udp->ud_mname, um->um_ctlr, numuba, addr); 1021 if (rcvec == 0) { 1022 printf("zero vector\n"); 1023 continue; 1024 } 1025 if (rcvec == 0x200) { 1026 printf("didn't interrupt\n"); 1027 continue; 1028 } 1029 printf("vec %o, ipl %x\n", rcvec, rbr); 1030 csralloc(ualloc, addr, i); 1031 um->um_alive = 1; 1032 um->um_ubanum = numuba; 1033 um->um_hd = uhp; 1034 um->um_addr = (caddr_t)reg; 1035 udp->ud_minfo[um->um_ctlr] = um; 1036 for (rcvec /= 4, ivec = um->um_intr; *ivec; rcvec++, ivec++) 1037 uhp->uh_vec[rcvec] = scbentry(*ivec, SCB_ISTACK); 1038 for (ui = ubdinit; ui->ui_driver; ui++) { 1039 int t; 1040 1041 if (ui->ui_driver != udp || ui->ui_alive || 1042 ui->ui_ctlr != um->um_ctlr && ui->ui_ctlr != '?' || 1043 ui->ui_ubanum != numuba && ui->ui_ubanum != '?') 1044 continue; 1045 t = ui->ui_ctlr; 1046 ui->ui_ctlr = um->um_ctlr; 1047 if ((*udp->ud_slave)(ui, reg) == 0) 1048 ui->ui_ctlr = t; 1049 else { 1050 ui->ui_alive = 1; 1051 ui->ui_ubanum = numuba; 1052 ui->ui_hd = uhp; 1053 ui->ui_addr = (caddr_t)reg; 1054 ui->ui_physaddr = pumem + ubdevreg(addr); 1055 if (ui->ui_dk && dkn < DK_NDRIVE) 1056 ui->ui_dk = dkn++; 1057 else 1058 ui->ui_dk = -1; 1059 ui->ui_mi = um; 1060 /* ui_type comes from driver */ 1061 udp->ud_dinfo[ui->ui_unit] = ui; 1062 printf("%s%d at %s%d slave %d", 1063 udp->ud_dname, ui->ui_unit, 1064 udp->ud_mname, um->um_ctlr, ui->ui_slave); 1065 (*udp->ud_attach)(ui); 1066 printf("\n"); 1067 } 1068 } 1069 break; 1070 } 1071 } 1072 /* 1073 * Now look for non-mass storage peripherals. 1074 */ 1075 for (ui = ubdinit; udp = ui->ui_driver; ui++) { 1076 if (ui->ui_ubanum != numuba && ui->ui_ubanum != '?' || 1077 ui->ui_alive || ui->ui_slave != -1) 1078 continue; 1079 addr = (u_short)ui->ui_addr; 1080 1081 for (ap = udp->ud_addr; addr || (addr = *ap++); addr = 0) { 1082 1083 if (ualloc[ubdevreg(addr)]) 1084 continue; 1085 reg = ubaddr(uhp, addr); 1086 if (badaddr((caddr_t)reg, 2)) 1087 continue; 1088 #ifdef DW780 1089 if (uhp->uh_type == DW780 && vubp->uba_sr) { 1090 vubp->uba_sr = vubp->uba_sr; 1091 continue; 1092 } 1093 #endif 1094 rcvec = 0x200; 1095 cvec = 0x200; 1096 i = (*udp->ud_probe)(reg, ui); 1097 #ifdef DW780 1098 if (uhp->uh_type == DW780 && vubp->uba_sr) { 1099 vubp->uba_sr = vubp->uba_sr; 1100 continue; 1101 } 1102 #endif 1103 if (i == 0) 1104 continue; 1105 printf("%s%d at uba%d csr %o ", 1106 ui->ui_driver->ud_dname, ui->ui_unit, numuba, addr); 1107 if (rcvec == 0) { 1108 printf("zero vector\n"); 1109 continue; 1110 } 1111 if (rcvec == 0x200) { 1112 printf("didn't interrupt\n"); 1113 continue; 1114 } 1115 printf("vec %o, ipl %x\n", rcvec, rbr); 1116 csralloc(ualloc, addr, i); 1117 ui->ui_hd = uhp; 1118 for (rcvec /= 4, ivec = ui->ui_intr; *ivec; rcvec++, ivec++) 1119 uhp->uh_vec[rcvec] = scbentry(*ivec, SCB_ISTACK); 1120 ui->ui_alive = 1; 1121 ui->ui_ubanum = numuba; 1122 ui->ui_addr = (caddr_t)reg; 1123 ui->ui_physaddr = pumem + ubdevreg(addr); 1124 ui->ui_dk = -1; 1125 /* ui_type comes from driver */ 1126 udp->ud_dinfo[ui->ui_unit] = ui; 1127 (*udp->ud_attach)(ui); 1128 break; 1129 } 1130 } 1131 1132 #ifdef DW780 1133 if (uhp->uh_type == DW780) 1134 uhp->uh_uba->uba_cr = UBACR_IFS | UBACR_BRIE | 1135 UBACR_USEFIE | UBACR_SUEFIE | 1136 (uhp->uh_uba->uba_cr & 0x7c000000); 1137 #endif 1138 numuba++; 1139 1140 #ifdef AUTO_DEBUG 1141 printf("Unibus allocation map"); 1142 for (i = 0; i < 8*1024; ) { 1143 register n, m; 1144 1145 if ((i % 128) == 0) { 1146 printf("\n%6o:", i); 1147 for (n = 0; n < 128; n++) 1148 if (ualloc[i+n]) 1149 break; 1150 if (n == 128) { 1151 i += 128; 1152 continue; 1153 } 1154 } 1155 1156 for (n = m = 0; n < 16; n++) { 1157 m <<= 1; 1158 m |= ualloc[i++]; 1159 } 1160 1161 printf(" %4x", m); 1162 } 1163 printf("\n"); 1164 #endif 1165 1166 free(ualloc, M_TEMP); 1167 } 1168 #endif /* NUBA */ 1169 1170 /* 1171 * Mark addresses starting at "addr" and continuing 1172 * "size" bytes as allocated in the map "ualloc". 1173 * Warn if the new allocation overlaps a previous allocation. 1174 */ 1175 static 1176 csralloc(ualloc, addr, size) 1177 caddr_t ualloc; 1178 u_short addr; 1179 register int size; 1180 { 1181 register caddr_t p; 1182 int warned = 0; 1183 1184 p = &ualloc[ubdevreg(addr+size)]; 1185 while (--size >= 0) { 1186 if (*--p && !warned) { 1187 printf( 1188 "WARNING: device registers overlap those for a previous device!\n"); 1189 warned = 1; 1190 } 1191 *p = 1; 1192 } 1193 } 1194 1195 /* 1196 * Make an IO register area accessible at physical address physa 1197 * by mapping kernel ptes starting at pte. 1198 */ 1199 ioaccess(physa, pte, size) 1200 caddr_t physa; 1201 register struct pte *pte; 1202 int size; 1203 { 1204 register int i = btoc(size); 1205 register unsigned v = btop(physa); 1206 1207 do 1208 *(int *)pte++ = PG_V|PG_KW|v++; 1209 while (--i > 0); 1210 mtpr(TBIA, 0); 1211 } 1212 1213 /* 1214 * Configure swap space and related parameters. 1215 */ 1216 swapconf() 1217 { 1218 register struct swdevt *swp; 1219 register int nblks; 1220 1221 for (swp = swdevt; swp->sw_dev; swp++) 1222 if (bdevsw[major(swp->sw_dev)].d_psize) { 1223 nblks = 1224 (*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev); 1225 if (nblks != -1 && 1226 (swp->sw_nblks == 0 || swp->sw_nblks > nblks)) 1227 swp->sw_nblks = nblks; 1228 } 1229 dumpconf(); 1230 } 1231 1232 #define DOSWAP /* Change swdevt, argdev, and dumpdev too */ 1233 u_long bootdev; /* should be dev_t, but not until 32 bits */ 1234 1235 static char devname[][2] = { 1236 'h','p', /* 0 = hp */ 1237 0,0, /* 1 = ht */ 1238 'u','p', /* 2 = up */ 1239 'r','k', /* 3 = hk */ 1240 0,0, /* 4 = sw */ 1241 0,0, /* 5 = tm */ 1242 0,0, /* 6 = ts */ 1243 0,0, /* 7 = mt */ 1244 0,0, /* 8 = tu */ 1245 'r','a', /* 9 = ra */ 1246 0,0, /* 10 = ut */ 1247 'r','b', /* 11 = rb */ 1248 0,0, /* 12 = uu */ 1249 0,0, /* 13 = rx */ 1250 'r','l', /* 14 = rl */ 1251 0,0, /* 15 = tmscp */ 1252 'k','r', /* 16 = ra on kdb50 */ 1253 }; 1254 1255 #define PARTITIONMASK 0x7 1256 #define PARTITIONSHIFT 3 1257 1258 /* 1259 * Attempt to find the device from which we were booted. 1260 * If we can do so, and not instructed not to do so, 1261 * change rootdev to correspond to the load device. 1262 */ 1263 setroot() 1264 { 1265 int majdev, mindev, unit, part, controller, adaptor; 1266 dev_t temp, orootdev; 1267 struct swdevt *swp; 1268 1269 if (boothowto & RB_DFLTROOT || 1270 (bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC) 1271 return; 1272 majdev = B_TYPE(bootdev); 1273 if (majdev >= sizeof(devname) / sizeof(devname[0])) 1274 return; 1275 adaptor = B_ADAPTOR(bootdev); 1276 controller = B_CONTROLLER(bootdev); 1277 part = B_PARTITION(bootdev); 1278 unit = B_UNIT(bootdev); 1279 if (majdev == 0) { /* MBA device */ 1280 #if NMBA > 0 1281 register struct mba_device *mbap; 1282 int mask; 1283 1284 /* 1285 * The MBA number used at boot time is not necessarily the same as the 1286 * MBA number used by the kernel. In order to change the rootdev we need to 1287 * convert the boot MBA number to the kernel MBA number. The address space 1288 * for an MBA used by the boot code is 0x20010000 + 0x2000 * MBA_number 1289 * on the 78? and 86?0, 0xf28000 + 0x2000 * MBA_number on the 750. 1290 * Therefore we can search the mba_hd table for the MBA that has the physical 1291 * address corresponding to the boot MBA number. 1292 */ 1293 #define PHYSADRSHFT 13 1294 #define PHYSMBAMASK780 0x7 1295 #define PHYSMBAMASK750 0x3 1296 1297 switch (cpu) { 1298 1299 case VAX_780: 1300 case VAX_8600: 1301 default: 1302 mask = PHYSMBAMASK780; 1303 break; 1304 1305 case VAX_750: 1306 mask = PHYSMBAMASK750; 1307 break; 1308 } 1309 for (mbap = mbdinit; mbap->mi_driver; mbap++) 1310 if (mbap->mi_alive && mbap->mi_drive == unit && 1311 (((long)mbap->mi_hd->mh_physmba >> PHYSADRSHFT) 1312 & mask) == adaptor) 1313 break; 1314 if (mbap->mi_driver == 0) 1315 return; 1316 mindev = mbap->mi_unit; 1317 #else 1318 return; 1319 #endif 1320 } else { 1321 register struct uba_device *ubap; 1322 1323 for (ubap = ubdinit; ubap->ui_driver; ubap++) 1324 if (ubap->ui_alive && ubap->ui_slave == unit && 1325 ubap->ui_ctlr == controller && 1326 ubap->ui_ubanum == adaptor && 1327 ubap->ui_driver->ud_dname[0] == devname[majdev][0] && 1328 ubap->ui_driver->ud_dname[1] == devname[majdev][1]) 1329 break; 1330 1331 if (ubap->ui_driver == 0) 1332 return; 1333 mindev = ubap->ui_unit; 1334 } 1335 mindev = (mindev << PARTITIONSHIFT) + part; 1336 orootdev = rootdev; 1337 rootdev = makedev(majdev, mindev); 1338 /* 1339 * If the original rootdev is the same as the one 1340 * just calculated, don't need to adjust the swap configuration. 1341 */ 1342 if (rootdev == orootdev) 1343 return; 1344 1345 printf("Changing root device to %c%c%d%c\n", 1346 devname[majdev][0], devname[majdev][1], 1347 mindev >> PARTITIONSHIFT, part + 'a'); 1348 1349 #ifdef DOSWAP 1350 mindev &= ~PARTITIONMASK; 1351 for (swp = swdevt; swp->sw_dev; swp++) { 1352 if (majdev == major(swp->sw_dev) && 1353 mindev == (minor(swp->sw_dev) & ~PARTITIONMASK)) { 1354 temp = swdevt[0].sw_dev; 1355 swdevt[0].sw_dev = swp->sw_dev; 1356 swp->sw_dev = temp; 1357 break; 1358 } 1359 } 1360 if (swp->sw_dev == 0) 1361 return; 1362 1363 /* 1364 * If argdev and dumpdev were the same as the old primary swap 1365 * device, move them to the new primary swap device. 1366 */ 1367 if (temp == dumpdev) 1368 dumpdev = swdevt[0].sw_dev; 1369 if (temp == argdev) 1370 argdev = swdevt[0].sw_dev; 1371 #endif 1372 } 1373