summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-03-27 07:23:34 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-03-27 07:23:34 +0000
commit98d5812b7f24f29b21c0299b16992d85163504a6 (patch)
treeadeb21ae452aa2348e8c69e27bdd38e045f3a5a6 /sys/arch
parenta24732ffd98571ad476b1589b0be60c9e0f3fad4 (diff)
grok LSILogic,sas controllers in bootpath; as well, become aware that (at
least) "scsi" controllers give a target/port number, not a kernel sd#. So, translate. We might later want to do the same translation for IDE as well, but perhaps not until after people test a bit more; ok dlg
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/macppc/macppc/autoconf.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/sys/arch/macppc/macppc/autoconf.c b/sys/arch/macppc/macppc/autoconf.c
index f94b782232d..e304cb5089c 100644
--- a/sys/arch/macppc/macppc/autoconf.c
+++ b/sys/arch/macppc/macppc/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.22 2005/12/27 18:31:09 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.23 2007/03/27 07:23:33 deraadt Exp $ */
/*
* Copyright (c) 1996, 1997 Per Fogelstrom
* Copyright (c) 1995 Theo de Raadt
@@ -37,7 +37,7 @@
* from: Utah Hdr: autoconf.c 1.31 91/01/21
*
* from: @(#)autoconf.c 8.1 (Berkeley) 6/10/93
- * $Id: autoconf.c,v 1.22 2005/12/27 18:31:09 miod Exp $
+ * $Id: autoconf.c,v 1.23 2007/03/27 07:23:33 deraadt Exp $
*/
/*
@@ -60,6 +60,12 @@
#include <machine/autoconf.h>
#include <machine/powerpc.h>
+#include <sys/disk.h>
+#include <scsi/scsi_all.h>
+#include <scsi/scsi_disk.h>
+#include <scsi/scsiconf.h>
+#include <scsi/sdvar.h>
+
struct device *parsedisk(char *, int, int, dev_t *);
void setroot(void);
void dumpconf(void);
@@ -271,10 +277,10 @@ setroot()
}
/* Lookup boot device from boot if not set by configuration */
- if(bootdv == NULL) {
+ if (bootdv == NULL) {
bootdv = parsedisk(bootdev, strlen(bootdev), 0, &temp);
}
- if(bootdv == NULL) {
+ if (bootdv == NULL) {
printf("boot device: lookup '%s' failed.\n", bootdev);
boothowto |= RB_ASKNAME; /* Don't Panic :-) */
/* boothowto |= RB_SINGLE; */
@@ -495,6 +501,7 @@ findtype(char **s)
{ "/mac-io@", NULL, T_BUS },
{ "/mac-io", NULL, T_BUS },
{ "/@", NULL, T_BUS },
+ { "/LSILogic,sas@", "sd", T_SCSI },
{ "/scsi@", "sd", T_SCSI },
{ "/ide", "wd", T_IDE },
{ "/ata", "wd", T_IDE },
@@ -532,7 +539,7 @@ findtype(char **s)
void
makebootdev(char *bp)
{
- int unit;
+ int unit, ptype;
char *dev, *cp;
struct devmap *dp;
@@ -555,9 +562,26 @@ makebootdev(char *bp)
dev = dp->dev;
while(*cp && *cp != '/')
cp++;
+ ptype = dp->type;
dp = findtype(&cp);
if (dp->att && dp->type == T_DISK) {
unit = getpno(&cp);
+ if (ptype == T_SCSI) {
+ struct device *dv;
+ struct sd_softc *sd;
+
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
+ if (dv->dv_class != DV_DISK ||
+ strcmp(dv->dv_cfdata->cf_driver->cd_name, "sd"))
+ continue;
+ sd = (struct sd_softc *)dv;
+ if (sd->sc_link->target != unit)
+ continue;
+ snprintf(bootdev, sizeof bootdev,
+ "%s%c", dv->dv_xname, 'a');
+ return;
+ }
+ }
snprintf(bootdev, sizeof bootdev, "%s%d%c", dev, unit, 'a');
return;
}