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