+#if NBI > 0
+/*
+ * Probe BI node space.
+ *
+ * THIS DEPENDS ON BI SPACE == NEXUS SPACE
+ * THIS WILL NOT WORK FOR MULTIPLE BIs
+ */
+probe_bi(p)
+ register struct bibus *p;
+{
+ register struct bi_node *biv, *bip;
+ register int node;
+ short dtype;
+
+ /* must ignore BI errors while configuring */
+ bip = p->pbi_base;
+ ioaccess((caddr_t)bip, Nexmap[0], sizeof(*bip) * NNODEBI);/* XXX */
+ printf("vaxbi0 at address 0x%x\n", bip);
+ biv = (struct bi_node *) &nexus[0]; /* XXX */
+ for (node = 0; node < NNODEBI; node++, bip++, biv++) {
+ if (badaddr((caddr_t)biv, 4))
+ continue;
+ bi_nodes |= 1 << node; /* XXX */
+ dtype = biv->biic.bi_dtype;
+ /* clear bus errors */
+ biv->biic.bi_ber = ~(BIBER_MBZ|BIBER_NMR|BIBER_UPEN);
+ switch (dtype) {
+
+ case BIDT_KA820: {
+ /* is this right?? */
+ int cp5 = biv->biic.bi_revs & 0x8000 ? '5' : '0';
+
+ if (node != mastercpu) {
+ printf("slave ka82%c cpu", cp5);
+ goto unsupp;
+ }
+ printf("ka82%c cpu at node %x\n", cp5, node);
+ biv->biic.bi_intrdes = 1 << mastercpu;
+ biv->biic.bi_csr |= BICSR_SEIE | BICSR_HEIE;
+ break;
+ }
+
+ case BIDT_DWBUA:
+ if (numuba >= NUBA || /*XXX*/numuba > 2) {
+ printf("%d uba's", ++numuba);
+ goto unconfig;
+ }
+#if NUBA > 0
+ printf("uba%d at node %x\n", numuba, node);
+
+ /*
+ * Run a self test reset to drop any `old' errors,
+ * so that they cannot cause a BI bus error.
+ */
+ (void) bi_selftest(&biv->biic);
+
+ /*
+ * Enable interrupts. DWBUAs must have
+ * high priority.
+ */
+ biv->biic.bi_intrdes = 1 << mastercpu;
+ biv->biic.bi_csr = (biv->biic.bi_csr&~BICSR_ARB_MASK) |
+ BICSR_ARB_HIGH;
+ probeuba((struct uba_regs *)biv, (struct uba_regs *)bip,
+ (caddr_t)UMEM8200(node));
+#endif /* NUBA */
+ break;
+
+ case BIDT_MS820:
+ printf("mcr%d at node %x\n", nmcr, node);
+ if (nmcr >= MAXNMCR) {
+ printf("%d mcr's", ++nmcr);
+ goto unconfig;
+ }
+ mcraddr[nmcr++] = (caddr_t)biv;
+ biv->biic.bi_intrdes = 1 << mastercpu;
+ biv->biic.bi_csr |= BICSR_SEIE | BICSR_HEIE;
+ break;
+
+ case BIDT_KDB50:
+ if (numkdb >= NKDB) {
+ printf("%d kdb's", ++numkdb);
+ goto unconfig;
+ }
+#if NKDB > 0
+ printf("kdb%d at node %x\n", numkdb, node);
+ kdbconfig(numkdb, (struct biiregs *)biv,
+ (struct biiregs *)bip,
+ (int)&scb[0].scb_ipl15[node] - (int)&scb[0]);
+ scb[0].scb_ipl15[node] =
+ scbentry(kdbintv[numkdb], SCB_ISTACK);
+ kdbfind(numkdb);
+#endif
+ numkdb++;
+ break;
+
+ case BIDT_DEBNA:
+ case BIDT_DEBNK:
+ printf("debna/debnk ethernet");
+ goto unsupp;
+
+ default:
+ printf("node type 0x%x ", dtype);
+unsupp:
+ printf(" unsupported (at node %x)\n", node);
+ break;
+unconfig:
+ printf(" not configured (at node %x)\n", node);
+ continue;
+ }
+#ifdef DO_EINTRCSR
+ biv->biic.bi_eintrcsr = BIEIC_IPL17 |
+ (int)&scb[0].scb_bierr - (int)&scb[0];
+ /* but bi reset will need to restore this */
+#endif
+ }
+ if (numuba > NUBA)
+ numuba = NUBA;
+ if (numkdb > NKDB)
+ numkdb = NKDB;
+ if (nmcr > MAXNMCR)
+ nmcr = MAXNMCR;
+}
+
+#if NKDB > 0
+/*
+ * Find drives attached to a particular KDB50.
+ */
+kdbfind(kdbnum)
+ int kdbnum;
+{
+ extern struct uba_driver kdbdriver;
+ register struct uba_device *ui;
+ register struct uba_driver *udp = &kdbdriver;
+ int t;
+
+ for (ui = ubdinit; ui->ui_driver; ui++) {
+ /* ui->ui_ubanum is trash */
+ if (ui->ui_driver != udp || ui->ui_alive ||
+ ui->ui_ctlr != kdbnum && ui->ui_ctlr != '?')
+ continue;
+ t = ui->ui_ctlr;
+ ui->ui_ctlr = kdbnum;
+ if ((*udp->ud_slave)(ui) == 0) {
+ ui->ui_ctlr = t;
+ continue;
+ }
+ ui->ui_alive = 1;
+ ui->ui_ubanum = -1;
+
+ /* make these invalid so we can see if someone uses them */
+ /* might as well make each one different too */
+ ui->ui_hd = (struct uba_hd *)0xc0000010;
+ ui->ui_addr = (caddr_t)0xc0000014;
+ ui->ui_physaddr = (caddr_t)0xc0000018;
+ ui->ui_mi = (struct uba_ctlr *)0xc000001c;
+
+ if (ui->ui_dk && dkn < DK_NDRIVE)
+ ui->ui_dk = dkn++;
+ else
+ ui->ui_dk = -1;
+ /* ui_type comes from driver */
+ udp->ud_dinfo[ui->ui_unit] = ui;
+ printf("%s%d at %s%d slave %d\n",
+ udp->ud_dname, ui->ui_unit,
+ udp->ud_mname, ui->ui_ctlr, ui->ui_slave);
+ (*udp->ud_attach)(ui);
+ }
+}
+#endif /* NKDB > 0 */
+#endif /* NBI > 0 */
+