From 5ce41ef1f265dc67a5084e1dbe670bca719a5b43 Mon Sep 17 00:00:00 2001 From: eeh Date: Mon, 8 Nov 1999 05:05:26 +0000 Subject: [PATCH] Fix boot device detection code. --- sys/arch/sparc64/include/autoconf.h | 21 ++---------------- sys/arch/sparc64/sparc64/autoconf.c | 33 +++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/sys/arch/sparc64/include/autoconf.h b/sys/arch/sparc64/include/autoconf.h index 52fa0c22b1bb..0752f36e8738 100644 --- a/sys/arch/sparc64/include/autoconf.h +++ b/sys/arch/sparc64/include/autoconf.h @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.h,v 1.7 1999/03/18 03:23:53 eeh Exp $ */ +/* $NetBSD: autoconf.h,v 1.8 1999/11/08 05:05:26 eeh Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -116,6 +116,7 @@ struct mainbus_attach_args { u_int *ma_address; /* "address" properties -- 32 bits */ u_int *ma_interrupts; /* "interrupts" properties */ struct bootpath *ma_bp; /* used for locating boot device */ + int ma_upaid; /* UPA bus ID */ int ma_node; /* PROM handle */ int ma_nreg; /* Counts for those properties */ int ma_naddress; @@ -153,24 +154,6 @@ int matchbyname __P((struct device *, struct cfdata *cf, void *aux)); */ char *clockfreq __P((long freq)); -#if 0 -/* - * Memory description arrays. Shared between pmap.c and autoconf.c; no - * one else should use this (except maybe mem.c, e.g., if we fix the VM to - * handle discontiguous physical memory). - */ -struct memarr { - u_int addr; - u_int len; -}; -int makememarr(struct memarr *, int max, int which); -#define MEMARR_AVAILPHYS 0 -#define MEMARR_TOTALPHYS 1 - -/* Pass a string to the FORTH interpreter. May fail silently. */ -void rominterpret __P((char *)); -#endif - /* Openprom V2 style boot path */ struct bootpath { char name[16]; /* name of this node */ diff --git a/sys/arch/sparc64/sparc64/autoconf.c b/sys/arch/sparc64/sparc64/autoconf.c index 41d7163b99e3..8915851841e0 100644 --- a/sys/arch/sparc64/sparc64/autoconf.c +++ b/sys/arch/sparc64/sparc64/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.22 1999/09/17 20:07:15 thorpej Exp $ */ +/* $NetBSD: autoconf.c,v 1.23 1999/11/08 05:05:26 eeh Exp $ */ /* * Copyright (c) 1996 @@ -403,7 +403,6 @@ altbootpath_store(storep, bp) retval = save; if (storep) save = bp; - return (retval); } /* END TEMP */ @@ -514,6 +513,27 @@ cpu_rootconf() bp = nbootpath == 0 ? NULL : &bootpath[nbootpath-1]; bootdv = bp == NULL ? NULL : bp->dev; bootpartition = bp == NULL ? 0 : bp->val[2]; +#if 1 + /* + * Old bootpath code no longer works now that SCSI autoconfiguration + * can be delayed. device_register() is the One True Way. + */ + bootdv = altbootdev; +#else + if (bootdv != altbootdev) { + int c; + printf("device_register boot device mismatch\n"); + printf("\tbootdv=%s\n", + bootdv==NULL?"NOT FOUND":bootdv->dv_xname); + printf("\taltbootdev=%s\n", + altbootdev==NULL?"NOT FOUND":altbootdev->dv_xname); + printf("RETURN to continue "); + cnpollc(1); + while ((c = cngetc()) != '\r' && c != '\n'); + printf("\n"); + cnpollc(0); + } +#endif setroot(bootdv, bootpartition); } @@ -658,6 +678,9 @@ extern struct sparc_bus_space_tag mainbus_space_tag; node = findroot(); + /* Establish the first component of the boot path */ + altbootpath_store(1, bootpath); + /* the first early device to be configured is the cpu */ { /* XXX - what to do on multiprocessor machines? */ @@ -712,6 +735,7 @@ extern struct sparc_bus_space_tag mainbus_space_tag; ma.ma_dmatag = &mainbus_dma_tag; ma.ma_name = getpropstringA(node, "name", namebuf); ma.ma_node = node; + ma.ma_upaid = getpropint(node, "upa-portid", -1); if (getprop(node, "reg", sizeof(*ma.ma_reg), &ma.ma_nreg, (void**)&ma.ma_reg) != 0) @@ -1027,6 +1051,7 @@ static struct { int class; } bus_class_tab[] = { { "mainbus", BUSCLASS_MAINBUS }, + { "upa", BUSCLASS_MAINBUS }, { "obio", BUSCLASS_OBIO }, { "iommu", BUSCLASS_IOMMU }, { "sbus", BUSCLASS_SBUS }, @@ -1035,7 +1060,7 @@ static struct { { "dma", BUSCLASS_SBUS }, { "espdma", BUSCLASS_SBUS }, { "ledma", BUSCLASS_SBUS }, - { "psycho", BUSCLASS_MAINBUS }, + { "psycho", BUSCLASS_PCI }, { "simba", BUSCLASS_PCI }, { "pciide", BUSCLASS_PCI }, { "vme", BUSCLASS_VME } @@ -1090,7 +1115,7 @@ instance_match(dev, aux, bp) switch (bus_class(dev)) { case BUSCLASS_MAINBUS: ma = aux; - if (bp->val[0] == ma->ma_address) + if (bp->val[0] == ma->ma_upaid) return (1); break; case BUSCLASS_SBUS: