summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);