Nuke __BROKEN_DK_ESTABLISH, and add __HAVE_DEVICE_REGISTER.

This commit is contained in:
scw 2000-07-25 20:52:27 +00:00
parent 714a495a4a
commit 2f335ce72b
8 changed files with 127 additions and 78 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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

View File

@ -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)))
/*

View File

@ -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 */
}
/*

View File

@ -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 <m68k/types.h>
#define __BROKEN_DK_ESTABLISH
#define __HAVE_DEVICE_REGISTER
#endif

View File

@ -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 <machine/autoconf.h>
#include <machine/pte.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
#ifdef MVME147
#include <mvme68k/dev/pccreg.h>
#endif
#if defined(MVME167) || defined(MVME177)
#include <mvme68k/dev/pcctworeg.h>
#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 : "<unknown>");
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;
}
}

View File

@ -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