Bring in the support to boot from ide drives. This is from dec_eb164.c.

This is needed for newer firmware and to boot from slave drives.
This commit is contained in:
veego 2000-02-05 22:22:41 +00:00
parent 541c31000e
commit 5b4e17169b
1 changed files with 53 additions and 23 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_550.c,v 1.5 1999/12/03 22:48:22 thorpej Exp $ */ /* $NetBSD: dec_550.c,v 1.6 2000/02/05 22:22:41 veego Exp $ */
/* /*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University. * Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dec_550.c,v 1.5 1999/12/03 22:48:22 thorpej Exp $"); __KERNEL_RCSID(0, "$NetBSD: dec_550.c,v 1.6 2000/02/05 22:22:41 veego Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -60,6 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: dec_550.c,v 1.5 1999/12/03 22:48:22 thorpej Exp $");
#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/ata/atavar.h>
/* Write this to Pyxis General Purpose Output to turn off the power. */ /* Write this to Pyxis General Purpose Output to turn off the power. */
#define DEC_550_PYXIS_GPO_POWERDOWN 0x00000400 #define DEC_550_PYXIS_GPO_POWERDOWN 0x00000400
@ -71,6 +72,8 @@ __KERNEL_RCSID(0, "$NetBSD: dec_550.c,v 1.5 1999/12/03 22:48:22 thorpej Exp $");
#endif #endif
static int comcnrate = CONSPEED; static int comcnrate = CONSPEED;
#define DR_VERBOSE(f) while (0)
void dec_550_init __P((void)); void dec_550_init __P((void));
static void dec_550_cons_init __P((void)); static void dec_550_cons_init __P((void));
static void dec_550_device_register __P((struct device *, void *)); static void dec_550_device_register __P((struct device *, void *));
@ -157,8 +160,8 @@ dec_550_device_register(dev, aux)
struct device *dev; struct device *dev;
void *aux; void *aux;
{ {
static int found, initted, scsiboot, netboot; static int found, initted, scsiboot, ideboot, netboot;
static struct device *pcidev, *scsidev; static struct device *pcidev, *scsipidev;
struct bootdev_data *b = bootdev_data; struct bootdev_data *b = bootdev_data;
struct device *parent = dev->dv_parent; struct device *parent = dev->dv_parent;
struct cfdata *cf = dev->dv_cfdata; struct cfdata *cf = dev->dv_cfdata;
@ -170,10 +173,15 @@ dec_550_device_register(dev, aux)
if (!initted) { if (!initted) {
scsiboot = (strcmp(b->protocol, "SCSI") == 0); scsiboot = (strcmp(b->protocol, "SCSI") == 0);
netboot = (strcmp(b->protocol, "BOOTP") == 0); netboot = (strcmp(b->protocol, "BOOTP") == 0);
#if 0 /*
printf("scsiboot = %d, netboot = %d\n", scsiboot, netboot); * Add an extra check to boot from ide drives:
#endif * Newer SRM firmware use the protocol identifier IDE,
initted =1; * older SRM firmware use the protocol identifier SCSI.
*/
ideboot = (strcmp(b->protocol, "IDE") == 0);
DR_VERBOSE(printf("scsiboot = %d, ideboot = %d, netboot = %d\n",
scsiboot, ideboot, netboot));
initted = 1;
} }
if (pcidev == NULL) { if (pcidev == NULL) {
@ -186,14 +194,13 @@ dec_550_device_register(dev, aux)
return; return;
pcidev = dev; pcidev = dev;
#if 0 DR_VERBOSE(printf("\npcidev = %s\n",
printf("\npcidev = %s\n", pcidev->dv_xname); pcidev->dv_xname));
#endif
return; return;
} }
} }
if (scsiboot && (scsidev == NULL)) { if ((ideboot || scsiboot) && (scsipidev == NULL)) {
if (parent != pcidev) if (parent != pcidev)
return; return;
else { else {
@ -204,10 +211,9 @@ dec_550_device_register(dev, aux)
/* XXX function? */ /* XXX function? */
scsidev = dev; scsipidev = dev;
#if 0 DR_VERBOSE(printf("\nscsipidev = %s\n",
printf("\nscsidev = %s\n", scsidev->dv_xname); scsipidev->dv_xname));
#endif
return; return;
} }
} }
@ -218,7 +224,7 @@ dec_550_device_register(dev, aux)
!strcmp(cd->cd_name, "cd"))) { !strcmp(cd->cd_name, "cd"))) {
struct scsipibus_attach_args *sa = aux; struct scsipibus_attach_args *sa = aux;
if (parent->dv_parent != scsidev) if (parent->dv_parent != scsipidev)
return; return;
if (b->unit / 100 != sa->sa_sc_link->scsipi_scsi.target) if (b->unit / 100 != sa->sa_sc_link->scsipi_scsi.target)
@ -242,9 +248,34 @@ dec_550_device_register(dev, aux)
/* we've found it! */ /* we've found it! */
booted_device = dev; booted_device = dev;
#if 0 DR_VERBOSE(printf("\nbooted_device = %s\n",
printf("\nbooted_device = %s\n", booted_device->dv_xname); booted_device->dv_xname));
#endif found = 1;
}
/*
* Support to boot from IDE drives.
*/
if ((ideboot || scsiboot) && !strcmp(cd->cd_name, "wd")) {
struct ata_atapi_attach *aa_link = aux;
if ((strncmp("pciide", parent->dv_xname, 6) != 0)) {
return;
} else {
if (parent != scsipidev)
return;
}
DR_VERBOSE(printf("\nAtapi info: drive: %d, channel %d\n",
aa_link->aa_drv_data->drive, aa_link->aa_channel));
DR_VERBOSE(printf("Bootdev info: unit: %d, channel: %d\n",
b->unit, b->channel));
if (b->unit != aa_link->aa_drv_data->drive ||
b->channel != aa_link->aa_channel)
return;
/* we've found it! */
booted_device = dev;
DR_VERBOSE(printf("booted_device = %s\n",
booted_device->dv_xname));
found = 1; found = 1;
} }
@ -260,9 +291,8 @@ dec_550_device_register(dev, aux)
/* XXX function? */ /* XXX function? */
booted_device = dev; booted_device = dev;
#if 0 DR_VERBOSE(printf("\nbooted_device = %s\n",
printf("\nbooted_device = %s\n", booted_device->dv_xname); booted_device->dv_xname));
#endif
found = 1; found = 1;
return; return;
} }