Add wdc.
This commit is contained in:
parent
b517a9d3d8
commit
c232b5d803
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: autoconf.c,v 1.6 1998/10/14 12:18:20 tsubai Exp $ */
|
/* $NetBSD: autoconf.c,v 1.7 1998/12/10 20:49:17 tsubai Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||||
|
@ -37,15 +37,18 @@
|
||||||
#include <sys/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
|
|
||||||
|
#include <machine/autoconf.h>
|
||||||
|
#include <machine/bus.h>
|
||||||
|
#include <machine/pio.h>
|
||||||
|
#include <machine/stdarg.h>
|
||||||
|
|
||||||
|
#include <dev/ofw/openfirm.h>
|
||||||
|
#include <dev/pci/pcivar.h>
|
||||||
#include <dev/scsipi/scsi_all.h>
|
#include <dev/scsipi/scsi_all.h>
|
||||||
#include <dev/scsipi/scsipi_all.h>
|
#include <dev/scsipi/scsipi_all.h>
|
||||||
#include <dev/scsipi/scsiconf.h>
|
#include <dev/scsipi/scsiconf.h>
|
||||||
#include <dev/ofw/openfirm.h>
|
#include <dev/ata/atavar.h>
|
||||||
#include <dev/pci/pcivar.h>
|
#include <dev/ic/wdcvar.h>
|
||||||
|
|
||||||
#include <machine/powerpc.h>
|
|
||||||
#include <machine/pio.h>
|
|
||||||
#include <machine/autoconf.h>
|
|
||||||
|
|
||||||
extern int cold;
|
extern int cold;
|
||||||
|
|
||||||
|
@ -98,35 +101,68 @@ cpu_rootconf()
|
||||||
void
|
void
|
||||||
findroot()
|
findroot()
|
||||||
{
|
{
|
||||||
int chosen, len;
|
int chosen, node, pnode;
|
||||||
int targ;
|
u_int targ, lun = 0; /* XXX lun */
|
||||||
int lun = 0; /* XXX */
|
|
||||||
struct device *dv;
|
struct device *dv;
|
||||||
char p[64];
|
char *controller, *addr, p[64];
|
||||||
|
|
||||||
chosen = OF_finddevice("/chosen");
|
booted_device = NULL;
|
||||||
if (chosen == -1)
|
|
||||||
|
if ((chosen = OF_finddevice("/chosen")) == -1)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
bzero(p, sizeof(p));
|
bzero(p, sizeof(p));
|
||||||
len = OF_getprop(chosen, "bootpath", p, sizeof(p));
|
if (OF_getprop(chosen, "bootpath", p, sizeof(p)) == -1)
|
||||||
if (len < 0 || len >= sizeof(p))
|
goto out;
|
||||||
|
if ((addr = strrchr(p, '@')) == NULL) /* XXX fd:0 case... */
|
||||||
|
goto out;
|
||||||
|
targ = addr[1] - '0';
|
||||||
|
booted_partition = 0; /* booted_partition = addr[3] - '0'; */
|
||||||
|
|
||||||
|
if ((node = OF_finddevice(p)) == -1)
|
||||||
|
goto out;
|
||||||
|
if ((pnode = OF_parent(node)) == -1)
|
||||||
|
goto out;
|
||||||
|
bzero(p, sizeof(p));
|
||||||
|
if (OF_getprop(pnode, "name", p, sizeof(p)) == -1)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* XXX for now... */
|
controller = "";
|
||||||
if (strncmp(p, "scsi/sd", 7) != 0)
|
if (strcmp(p, "53c94") == 0) controller = "esp";
|
||||||
goto out;
|
if (strcmp(p, "mesh") == 0) controller = "mesh";
|
||||||
|
if (strcmp(p, "ide") == 0) controller = "wdc";
|
||||||
booted_partition = p[len - 2] - '0';
|
if (strcmp(p, "ata") == 0) controller = "wdc";
|
||||||
targ = p[len - 4] - '0';
|
if (strcmp(p, "ATA") == 0) controller = "wdc";
|
||||||
|
|
||||||
for (dv = alldevs.tqh_first; dv; dv=dv->dv_list.tqe_next) {
|
for (dv = alldevs.tqh_first; dv; dv=dv->dv_list.tqe_next) {
|
||||||
if (strncmp(dv->dv_xname, "scsibus0", 8) == 0) { /* XXX */
|
if (dv->dv_class != DV_DISK)
|
||||||
struct scsibus_softc *sdv = (void *)dv;
|
continue;
|
||||||
|
|
||||||
|
if (strncmp(dv->dv_xname, "sd", 2) == 0) {
|
||||||
|
struct scsibus_softc *sdv = (void *)dv->dv_parent;
|
||||||
|
|
||||||
|
/* sd? at scsibus at esp/mesh */
|
||||||
|
if (strncmp(dv->dv_parent->dv_parent->dv_xname,
|
||||||
|
controller, strlen(controller)) != 0)
|
||||||
|
continue;
|
||||||
|
if (targ > 7 || lun > 7)
|
||||||
|
goto out;
|
||||||
if (sdv->sc_link[targ][lun] == NULL)
|
if (sdv->sc_link[targ][lun] == NULL)
|
||||||
continue;
|
continue;
|
||||||
booted_device = sdv->sc_link[targ][lun]->device_softc;
|
booted_device = dv;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strncmp(dv->dv_xname, "wd", 2) == 0) {
|
||||||
|
struct wdc_softc *wdv = (void *)dv->dv_parent;
|
||||||
|
|
||||||
|
if (strncmp(dv->dv_parent->dv_xname,
|
||||||
|
controller, strlen(controller)) != 0)
|
||||||
|
continue;
|
||||||
|
if (targ >= wdv->nchannels
|
||||||
|
|| wdv->channels == NULL
|
||||||
|
|| wdv->channels[targ] == NULL)
|
||||||
|
continue;
|
||||||
|
booted_device = dv;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,8 +171,6 @@ out:
|
||||||
dk_cleanup();
|
dk_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <machine/stdarg.h>
|
|
||||||
|
|
||||||
int
|
int
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
OF_interpret(char *cmd, int nreturns, ...)
|
OF_interpret(char *cmd, int nreturns, ...)
|
||||||
|
|
Loading…
Reference in New Issue