summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64/stand/ofwboot
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2018-06-26 19:43:28 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2018-06-26 19:43:28 +0000
commit4229ecf2354e19adec6d21ca9024c89797c4c000 (patch)
tree4e8b1d2d88749868ab81affce5c45a943b2ff058 /sys/arch/sparc64/stand/ofwboot
parente5f6482a32e4d9bf37088da7629e0b0fa64eff9f (diff)
The disk specification in an Open Firmware device path depends on the bus
binding for the disk interface. For traditional SCSI is is simply a number; i.e. the disk at target 0 is specified by @0. For SAS there are several options but newer Oracle firmware no longer accepts the traditional SCSI target specification. The best alternative is the PHY number and the disk at PHY number 0 is specified by @p0. To determine which binding to use, we look up the device_type of the parent. If that is "scsi-sas", use the PHY number instead of the SCSI target. Fixes booting from softraid on SPARC T3 and later. ok claudio@, stsp@
Diffstat (limited to 'sys/arch/sparc64/stand/ofwboot')
-rw-r--r--sys/arch/sparc64/stand/ofwboot/Locore.c22
-rw-r--r--sys/arch/sparc64/stand/ofwboot/diskprobe.c11
-rw-r--r--sys/arch/sparc64/stand/ofwboot/openfirm.h3
3 files changed, 32 insertions, 4 deletions
diff --git a/sys/arch/sparc64/stand/ofwboot/Locore.c b/sys/arch/sparc64/stand/ofwboot/Locore.c
index 7b7bfc5aa1b..6342c2ccbb4 100644
--- a/sys/arch/sparc64/stand/ofwboot/Locore.c
+++ b/sys/arch/sparc64/stand/ofwboot/Locore.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: Locore.c,v 1.14 2016/09/11 17:53:26 jsing Exp $ */
+/* $OpenBSD: Locore.c,v 1.15 2018/06/26 19:43:27 kettenis Exp $ */
/* $NetBSD: Locore.c,v 1.1 2000/08/20 14:58:36 mrg Exp $ */
/*
@@ -622,6 +622,26 @@ OF_child(int phandle)
}
int
+OF_parent(int phandle)
+{
+ struct {
+ cell_t name;
+ cell_t nargs;
+ cell_t nreturns;
+ cell_t phandle;
+ cell_t parent;
+ } args;
+
+ args.name = ADR2CELL("parent");
+ args.nargs = 1;
+ args.nreturns = 1;
+ args.phandle = HDL2CELL(phandle);
+ if (openfirmware(&args) == -1)
+ return 0;
+ return args.parent;
+}
+
+int
OF_package_to_path(int phandle, char *buf, int buflen)
{
struct {
diff --git a/sys/arch/sparc64/stand/ofwboot/diskprobe.c b/sys/arch/sparc64/stand/ofwboot/diskprobe.c
index e747729cfac..568cfb7dab6 100644
--- a/sys/arch/sparc64/stand/ofwboot/diskprobe.c
+++ b/sys/arch/sparc64/stand/ofwboot/diskprobe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diskprobe.c,v 1.4 2016/01/20 16:05:15 stsp Exp $ */
+/* $OpenBSD: diskprobe.c,v 1.5 2018/06/26 19:43:27 kettenis Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis <kettenis@openbsd.org>
@@ -39,6 +39,8 @@ new_diskinfo(int node)
int ihandle = -1;
int len;
const char *unit;
+ char buf[32];
+ int parent;
int i;
dip = alloc(sizeof(*dip));
@@ -65,7 +67,12 @@ new_diskinfo(int node)
}
}
if (unit == NULL) {
- len = strlcat(dip->path, "@0", sizeof(dip->path));
+ parent = OF_parent(node);
+ if (parent && OF_getprop(parent, "device_type", buf,
+ sizeof(buf)) > 0 && strcmp(buf, "scsi-sas") == 0)
+ len = strlcat(dip->path, "@p0", sizeof(dip->path));
+ else
+ len = strlcat(dip->path, "@0", sizeof(dip->path));
if (len >= sizeof(dip->path)) {
printf("disk device path too long: %s", dip->path);
goto bad;
diff --git a/sys/arch/sparc64/stand/ofwboot/openfirm.h b/sys/arch/sparc64/stand/ofwboot/openfirm.h
index 0fe16087498..b13ad6059c7 100644
--- a/sys/arch/sparc64/stand/ofwboot/openfirm.h
+++ b/sys/arch/sparc64/stand/ofwboot/openfirm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: openfirm.h,v 1.6 2014/11/26 19:47:03 stsp Exp $ */
+/* $OpenBSD: openfirm.h,v 1.7 2018/06/26 19:43:27 kettenis Exp $ */
/* $NetBSD: openfirm.h,v 1.1 2000/08/20 14:58:42 mrg Exp $ */
/*
@@ -57,5 +57,6 @@ int OF_milliseconds(void);
void OF_chain(void *addr, u_int size, void (*entry)(), void *parm, u_int parmlen);
int OF_peer(int);
int OF_child(int);
+int OF_parent(int);
int OF_package_to_path(int, char *, int);