Enable __HAVE_DEVICE_REGISTER and add a ofw_device_register to shark_machdep.c
This works for booting diskless. It should work for booting off ide but that is untested for the moment.
This commit is contained in:
parent
d98bf28b13
commit
ea16c1ada3
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: autoconf.c,v 1.35 2000/06/03 16:48:59 matt Exp $ */
|
/* $NetBSD: autoconf.c,v 1.36 2000/06/06 20:17:34 matt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994-1998 Mark Brinicombe.
|
* Copyright (c) 1994-1998 Mark Brinicombe.
|
||||||
|
@ -60,6 +60,7 @@
|
||||||
#ifdef SHARK
|
#ifdef SHARK
|
||||||
#include <arm32/shark/sequoia.h>
|
#include <arm32/shark/sequoia.h>
|
||||||
extern void ofrootfound __P((void));
|
extern void ofrootfound __P((void));
|
||||||
|
extern void ofw_device_register __P((struct device *, void *aux));
|
||||||
extern void startrtclock __P((void));
|
extern void startrtclock __P((void));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -217,4 +218,12 @@ cpu_configure()
|
||||||
(void)spl0();
|
(void)spl0();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
device_register(struct device *dev, void *aux)
|
||||||
|
{
|
||||||
|
#if defined(OFWGENCFG) || defined(SHARK)
|
||||||
|
/* Temporary for SHARK! */
|
||||||
|
ofw_device_register(dev, aux);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
/* End of autoconf.c */
|
/* End of autoconf.c */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: types.h,v 1.10 2000/02/13 05:20:45 mark Exp $ */
|
/* $NetBSD: types.h,v 1.11 2000/06/06 20:17:35 matt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 The Regents of the University of California.
|
* Copyright (c) 1990 The Regents of the University of California.
|
||||||
|
@ -76,5 +76,6 @@ typedef unsigned long long u_int64_t;
|
||||||
typedef int32_t register_t;
|
typedef int32_t register_t;
|
||||||
|
|
||||||
#define __HAVE_NWSCONS
|
#define __HAVE_NWSCONS
|
||||||
|
#define __HAVE_DEVICE_REGISTER
|
||||||
|
|
||||||
#endif /* _ARM32_TYPES_H_ */
|
#endif /* _ARM32_TYPES_H_ */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: ofw.c,v 1.23 1999/09/17 19:59:39 thorpej Exp $ */
|
/* $NetBSD: ofw.c,v 1.24 2000/06/06 20:17:36 matt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 1997
|
* Copyright 1997
|
||||||
|
@ -542,6 +542,9 @@ ofw_getbootinfo(bp_pp, ba_pp)
|
||||||
|
|
||||||
*bp_pp = bootpathv;
|
*bp_pp = bootpathv;
|
||||||
*ba_pp = bootargsv;
|
*ba_pp = bootargsv;
|
||||||
|
#ifdef DIAGNOSTIC
|
||||||
|
printf("bootpath=<%s>, bootargs=<%s>\n", bootpathv, bootargsv);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
vm_offset_t
|
vm_offset_t
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: shark_machdep.c,v 1.15 2000/03/24 17:05:32 ws Exp $ */
|
/* $NetBSD: shark_machdep.c,v 1.16 2000/06/06 20:17:36 matt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 1997
|
* Copyright 1997
|
||||||
|
@ -70,8 +70,23 @@
|
||||||
#include <dev/ofw/openfirm.h>
|
#include <dev/ofw/openfirm.h>
|
||||||
#include <machine/ofw.h>
|
#include <machine/ofw.h>
|
||||||
#include <machine/isa_machdep.h>
|
#include <machine/isa_machdep.h>
|
||||||
|
#include <dev/isa/isavar.h>
|
||||||
|
#include <dev/ofisa/ofisavar.h>
|
||||||
#include <arm32/shark/sequoia.h>
|
#include <arm32/shark/sequoia.h>
|
||||||
|
|
||||||
|
#include "wd.h"
|
||||||
|
#include "cd.h"
|
||||||
|
#include "sd.h"
|
||||||
|
|
||||||
|
#if NWD > 0 || NSD > 0 || NCD > 0
|
||||||
|
#include <dev/ata/atavar.h>
|
||||||
|
#endif
|
||||||
|
#if NSD > 0 || NCD > 0
|
||||||
|
#include <dev/scsipi/scsi_all.h>
|
||||||
|
#include <dev/scsipi/scsipi_all.h>
|
||||||
|
#include <dev/scsipi/scsipiconf.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Imported variables
|
* Imported variables
|
||||||
*/
|
*/
|
||||||
|
@ -369,3 +384,84 @@ ofrootfound(void)
|
||||||
if (!config_rootfound("ofbus", &aa))
|
if (!config_rootfound("ofbus", &aa))
|
||||||
panic("ofw root ofbus not configured");
|
panic("ofw root ofbus not configured");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ofw_device_register(struct device *dev, void *aux)
|
||||||
|
{
|
||||||
|
static struct device *parent;
|
||||||
|
#if NSD > 0 || NCD > 0
|
||||||
|
static struct device *scsipidev;
|
||||||
|
#endif
|
||||||
|
static char *boot_component;
|
||||||
|
struct ofbus_attach_args *oba;
|
||||||
|
const char *cd_name = dev->dv_cfdata->cf_driver->cd_name;
|
||||||
|
char name[64];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (boot_component == NULL)
|
||||||
|
boot_component = boot_file;
|
||||||
|
|
||||||
|
if (booted_device != NULL
|
||||||
|
|| boot_component == NULL
|
||||||
|
|| boot_component[0] == '\0')
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!strcmp(cd_name, "ofbus") || !strcmp(cd_name, "ofisa")) {
|
||||||
|
oba = aux;
|
||||||
|
} else if (parent == NULL) {
|
||||||
|
return;
|
||||||
|
} else if (parent == dev->dv_parent
|
||||||
|
&& !strcmp(parent->dv_cfdata->cf_driver->cd_name, "ofisa")) {
|
||||||
|
struct ofisa_attach_args *aa = aux;
|
||||||
|
oba = &aa->oba;
|
||||||
|
#if NWD > 0 || NSD > 0 || NCD > 0
|
||||||
|
} else if (parent == dev->dv_parent
|
||||||
|
&& !strcmp(parent->dv_cfdata->cf_driver->cd_name, "wdc")) {
|
||||||
|
#if NSD > 0 || NCD > 0
|
||||||
|
if (!strcmp(cd_name, "atapibus")) {
|
||||||
|
scsipidev = dev;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if NWD > 0
|
||||||
|
if (!strcmp(cd_name, "wd")) {
|
||||||
|
struct ata_atapi_attach *aa = aux;
|
||||||
|
char *cp = strchr(boot_component, '@');
|
||||||
|
if (cp != NULL
|
||||||
|
&& aa->aa_drv_data->drive == strtoul(cp+1, NULL, 16)
|
||||||
|
&& aa->aa_channel == 0) {
|
||||||
|
booted_device = dev;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
#endif /* NWD > 0 */
|
||||||
|
#if NSD > 0 || NCD > 0
|
||||||
|
} else if (scsipidev == dev->dv_parent
|
||||||
|
&& (!strcmp(cd_name, "sd") || !strcmp(cd_name, "cd"))) {
|
||||||
|
struct scsipibus_attach_args *sa = aux;
|
||||||
|
char *cp = strchr(boot_component, '@');
|
||||||
|
if (cp != NULL
|
||||||
|
&& sa->sa_sc_link->type == BUS_ATAPI
|
||||||
|
&& sa->sa_sc_link->scsipi_atapi.channel == 0
|
||||||
|
&& sa->sa_sc_link->scsipi_atapi.drive == strtoul(cp+1, NULL, 16)) {
|
||||||
|
booted_device = dev;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
#endif /* NSD > 0 || NCD > 0 */
|
||||||
|
#endif /* NWD > 0 || NSD > 0 || NCD > 0 */
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
(void) of_packagename(oba->oba_phandle, name, sizeof name);
|
||||||
|
i = strlen(name);
|
||||||
|
if (!strncmp(name, &boot_component[1], i)
|
||||||
|
&& (boot_component[i+1] == '/' || boot_component[i+1] == '\0')) {
|
||||||
|
boot_component += i + 1;
|
||||||
|
if (boot_component[0] == '/') {
|
||||||
|
parent = dev;
|
||||||
|
} else {
|
||||||
|
booted_device = dev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue