From 2f335ce72b79b64632b818a54398b9b02d22fbe4 Mon Sep 17 00:00:00 2001 From: scw Date: Tue, 25 Jul 2000 20:52:27 +0000 Subject: [PATCH] Nuke __BROKEN_DK_ESTABLISH, and add __HAVE_DEVICE_REGISTER. --- sys/arch/mvme68k/dev/if_ie.c | 6 +- sys/arch/mvme68k/dev/if_le.c | 6 +- sys/arch/mvme68k/dev/ncrsc_pcctwo.c | 14 +--- sys/arch/mvme68k/dev/pcctworeg.h | 6 +- sys/arch/mvme68k/dev/wdsc.c | 10 +-- sys/arch/mvme68k/include/types.h | 4 +- sys/arch/mvme68k/mvme68k/autoconf.c | 119 +++++++++++++++++++++++++++- sys/arch/mvme68k/mvme68k/disksubr.c | 40 +--------- 8 files changed, 127 insertions(+), 78 deletions(-) diff --git a/sys/arch/mvme68k/dev/if_ie.c b/sys/arch/mvme68k/dev/if_ie.c index c48f7489312e..106bc28b1782 100644 --- a/sys/arch/mvme68k/dev/if_ie.c +++ b/sys/arch/mvme68k/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ie.c,v 1.5 2000/06/29 08:04:03 mrg Exp $ */ +/* $NetBSD: if_ie.c,v 1.6 2000/07/25 20:52:27 scw Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -338,10 +338,6 @@ ie_pcctwo_attach(parent, self, args) /* Attach the MI back-end */ i82586_attach(sc, "onboard", ethaddr, NULL, 0, 0); - /* Are we the boot device? */ - if (PCCTWO_PADDR(pa->pa_offset) == bootaddr) - booted_device = self; - /* Finally, hook the hardware interrupt */ pcc2_reg_write(sys_pcctwo, PCC2REG_ETH_ICSR, 0); pcctwointr_establish(PCCTWOV_LANC_IRQ, i82586_intr, pa->pa_ipl, sc); diff --git a/sys/arch/mvme68k/dev/if_le.c b/sys/arch/mvme68k/dev/if_le.c index 1db648e2660c..34c678feb8df 100644 --- a/sys/arch/mvme68k/dev/if_le.c +++ b/sys/arch/mvme68k/dev/if_le.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le.c,v 1.21 2000/03/18 22:33:03 scw Exp $ */ +/* $NetBSD: if_le.c,v 1.22 2000/07/25 20:52:27 scw Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -224,10 +224,6 @@ le_pcc_attach(parent, self, aux) am7990_config(&lsc->sc_am7990); - /* Are we the boot device? */ - if (PCC_PADDR(pa->pa_offset) == bootaddr) - booted_device = self; - pccintr_establish(PCCV_LE, am7990_intr, pa->pa_ipl, sc); pcc_reg_write(sys_pcc, PCCREG_LANCE_INTR_CTRL, diff --git a/sys/arch/mvme68k/dev/ncrsc_pcctwo.c b/sys/arch/mvme68k/dev/ncrsc_pcctwo.c index 78508fe3ebe3..006af734b950 100644 --- a/sys/arch/mvme68k/dev/ncrsc_pcctwo.c +++ b/sys/arch/mvme68k/dev/ncrsc_pcctwo.c @@ -1,4 +1,4 @@ -/* $NetBSD: ncrsc_pcctwo.c,v 1.4 2000/03/18 22:33:03 scw Exp $ */ +/* $NetBSD: ncrsc_pcctwo.c,v 1.5 2000/07/25 20:52:28 scw Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -122,7 +122,6 @@ ncrsc_pcctwo_attach(parent, self, args) struct siop_softc *sc; bus_space_handle_t bush; int clk, ctest7; - int tmp; pa = (struct pcctwo_attach_args *) args; sc = (struct siop_softc *) self; @@ -174,18 +173,7 @@ ncrsc_pcctwo_attach(parent, self, args) pcc2_reg_write(sys_pcctwo, PCC2REG_SCSI_ICSR, pa->pa_ipl | PCCTWO_ICR_IEN); - /* - * Attach all scsi units on us, watching for boot device - * (see dk_establish). - */ - tmp = bootpart; - - if (PCCTWO_PADDR(pa->pa_offset) != bootaddr) - bootpart = -1; /* Invalid flag to dk_establish */ - (void) config_found(self, &sc->sc_link, scsiprint); - - bootpart = tmp; /* Restore old value */ } static int diff --git a/sys/arch/mvme68k/dev/pcctworeg.h b/sys/arch/mvme68k/dev/pcctworeg.h index d0186be1e4fc..eb2f1343deb5 100644 --- a/sys/arch/mvme68k/dev/pcctworeg.h +++ b/sys/arch/mvme68k/dev/pcctworeg.h @@ -1,4 +1,4 @@ -/* $NetBSD: pcctworeg.h,v 1.4 2000/03/18 22:33:03 scw Exp $ */ +/* $NetBSD: pcctworeg.h,v 1.5 2000/07/25 20:52:28 scw Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -45,6 +45,8 @@ /* * Offsets to the various devices which hang off the PCCChip2. + * Note that these are offsets from the base of the PCCChip2's + * own registers. */ #define PCCTWO_REG_OFF 0x00000 /* Offset of PCCChip2's own registers */ #define PCCTWO_LPT_OFF 0x00000 /* Offset of parallel port registers */ @@ -60,7 +62,7 @@ * (The physical address of the boot device's registers are passed in * from the Boot ROM) */ -#define PCCTWO_PADDR(off) ((void *)(0xfff40000u + (off))) +#define PCCTWO_PADDR(off) ((void *)(0xfff42000u + (off))) /* diff --git a/sys/arch/mvme68k/dev/wdsc.c b/sys/arch/mvme68k/dev/wdsc.c index 22a53c5ae8c6..e783cc00f38e 100644 --- a/sys/arch/mvme68k/dev/wdsc.c +++ b/sys/arch/mvme68k/dev/wdsc.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdsc.c,v 1.17 2000/03/18 22:33:05 scw Exp $ */ +/* $NetBSD: wdsc.c,v 1.18 2000/07/25 20:52:29 scw Exp $ */ /* * Copyright (c) 1996 Steve Woodford @@ -173,15 +173,7 @@ wdsc_pcc_attach(pdp, dp, auxp) pcc_reg_write(sys_pcc, PCCREG_SCSI_INTR_CTRL, sc->sc_ipl | PCC_IENABLE | PCC_ICLEAR); - /* - * Attach all scsi units on us, watching for boot device - * (see dk_establish). - */ - tmp = bootpart; - if (PCC_PADDR(pa->pa_offset) != bootaddr) - bootpart = -1; /* invalid flag to dk_establish */ (void)config_found(dp, &sc->sc_link, scsiprint); - bootpart = tmp; /* restore old value */ } /* diff --git a/sys/arch/mvme68k/include/types.h b/sys/arch/mvme68k/include/types.h index be056b6a1507..3cc8a9d9603e 100644 --- a/sys/arch/mvme68k/include/types.h +++ b/sys/arch/mvme68k/include/types.h @@ -1,10 +1,10 @@ -/* $NetBSD: types.h,v 1.6 2000/07/23 20:51:18 scw Exp $ */ +/* $NetBSD: types.h,v 1.7 2000/07/25 20:52:30 scw Exp $ */ #ifndef _MACHINE_TYPES_H_ #define _MACHINE_TYPES_H_ #include -#define __BROKEN_DK_ESTABLISH +#define __HAVE_DEVICE_REGISTER #endif diff --git a/sys/arch/mvme68k/mvme68k/autoconf.c b/sys/arch/mvme68k/mvme68k/autoconf.c index 76a27c14a107..349ae638e2f0 100644 --- a/sys/arch/mvme68k/mvme68k/autoconf.c +++ b/sys/arch/mvme68k/mvme68k/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.25 2000/07/20 20:40:39 scw Exp $ */ +/* $NetBSD: autoconf.c,v 1.26 2000/07/25 20:52:30 scw Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -63,6 +63,17 @@ #include #include +#include +#include +#include + +#ifdef MVME147 +#include +#endif +#if defined(MVME167) || defined(MVME177) +#include +#endif + struct device *booted_device; /* boot device */ @@ -85,8 +96,110 @@ void cpu_rootconf() { - printf("boot device: %s\n", + printf("boot device: %s", (booted_device) ? booted_device->dv_xname : ""); - setroot(booted_device, 0); + if (bootpart) + printf(" (partition %d)\n", bootpart); + else + printf("\n"); + + setroot(booted_device, bootpart); +} + +void +device_register(dev, aux) + struct device *dev; + void *aux; +{ + static struct device *controller; + static int foundboot; + struct device *parent; + struct cfdriver *cd; + + if (foundboot) + return; + + parent = dev->dv_parent; + cd = dev->dv_cfdata->cf_driver; + + if (controller == NULL && parent) { + struct cfdriver *pcd = parent->dv_cfdata->cf_driver; + + switch (machineid) { +#ifdef MVME147 + case MVME_147: + /* + * We currently only support booting from the 147's + * onboard scsi and ethernet. So ensure this + * device's parent is the PCC driver. + */ + if (strcmp(pcd->cd_name, "pcc")) + return; + + if (bootaddr == PCC_PADDR(PCC_WDSC_OFF) && + strcmp(cd->cd_name, "wdsc") == 0) { + controller = dev; + return; + } + + if (bootaddr == PCC_PADDR(PCC_LE_OFF) && + strcmp(cd->cd_name, "le") == 0) { + booted_device = dev; + foundboot = 1; + return; + } + + break; +#endif /* MVME_147 */ + +#if defined(MVME167) || defined(MVME177) + case MVME_167: + case MVME_177: + /* + * We currently only support booting from the 167's + * onboard scsi and ethernet. So ensure this + * device's parent is the PCCTWO driver. + */ + if (strcmp(pcd->cd_name, "pcctwo")) + return; + + if (bootaddr == PCCTWO_PADDR(PCCTWO_NCRSC_OFF) && + strcmp(cd->cd_name, "ncrsc") == 0) { + controller = dev; + return; + } + + if (bootaddr == PCCTWO_PADDR(PCCTWO_IE_OFF) && + strcmp(cd->cd_name, "ie") == 0) { + booted_device = dev; + foundboot = 1; + return; + } + + break; +#endif /* MVME_167 || MVME_177 */ + + default: + break; + } + + return; + } + + /* + * Find out which device on the scsibus we booted from + */ + if (strcmp(cd->cd_name, "sd") == 0 || + strcmp(cd->cd_name, "cd") == 0 || + strcmp(cd->cd_name, "st") == 0) { + struct scsipibus_attach_args *sa = aux; + + if (parent->dv_parent != controller || + bootdevlun != sa->sa_sc_link->scsipi_scsi.target) + return; + + booted_device = dev; + foundboot = 1; + } } diff --git a/sys/arch/mvme68k/mvme68k/disksubr.c b/sys/arch/mvme68k/mvme68k/disksubr.c index 4036a3338c1d..08e2496be38d 100644 --- a/sys/arch/mvme68k/mvme68k/disksubr.c +++ b/sys/arch/mvme68k/mvme68k/disksubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: disksubr.c,v 1.18 2000/03/18 22:33:06 scw Exp $ */ +/* $NetBSD: disksubr.c,v 1.19 2000/07/25 20:52:31 scw Exp $ */ /* * Copyright (c) 1995 Dale Rahn. @@ -58,44 +58,6 @@ static void printlp __P((struct disklabel *lp, char *str)); static void printclp __P((struct cpu_disklabel *clp, char *str)); #endif -void -dk_establish(dk, dev) - struct disk *dk; - struct device *dev; -{ - struct scsibus_softc *sbsc; - int target, lun; - - if (bootpart == -1) /* ignore flag from controller driver? */ - return; - - /* - * scsi: sd,cd - */ - - if (strncmp("sd", dev->dv_xname, 2) == 0 || - strncmp("cd", dev->dv_xname, 2) == 0) { - - sbsc = (struct scsibus_softc *)dev->dv_parent; - target = bootctrllun % 8; /* XXX: 147 only */ - lun = bootdevlun; /* XXX: 147, untested */ - - /* - * XXX: on the 167: - * ignore bootctrllun - * target = bootdevlun / 10 - * lun = bootdevlun % 10 - */ - - if (sbsc->sc_link[target][lun] != NULL && - sbsc->sc_link[target][lun]->device_softc == (void *)dev) { - booted_device = dev; - return; - } - } - - return; -} /* * Attempt to read a disk label from a device