summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2010-04-26 19:13:10 +0000
committermarius <marius@FreeBSD.org>2010-04-26 19:13:10 +0000
commit8fbd99ea26952e9cb598f137750ba9347dd7e8f4 (patch)
treef2b4987c2fd20ad165e2f29ce5c93dc8c75617c7 /sys
parent4604894eafad21a2dacc84fa97997544a753bc84 (diff)
downloadFreeBSD-src-8fbd99ea26952e9cb598f137750ba9347dd7e8f4.zip
FreeBSD-src-8fbd99ea26952e9cb598f137750ba9347dd7e8f4.tar.gz
Add OF_getscsinitid(), a helper similar to OF_getetheraddr() but for
obtaining the initiator ID to be used for SPI controllers from the Open Firmware device tree.
Diffstat (limited to 'sys')
-rw-r--r--sys/sparc64/include/ofw_machdep.h1
-rw-r--r--sys/sparc64/sparc64/ofw_machdep.c15
-rw-r--r--sys/sun4v/include/ofw_machdep.h1
3 files changed, 16 insertions, 1 deletions
diff --git a/sys/sparc64/include/ofw_machdep.h b/sys/sparc64/include/ofw_machdep.h
index 625b131..658d9c7 100644
--- a/sys/sparc64/include/ofw_machdep.h
+++ b/sys/sparc64/include/ofw_machdep.h
@@ -36,6 +36,7 @@ typedef uint64_t cell_t;
int OF_decode_addr(phandle_t, int, int *, bus_addr_t *);
void OF_getetheraddr(device_t, u_char *);
+u_int OF_getscsinitid(device_t);
void cpu_shutdown(void *);
int ofw_entry(void *);
void ofw_exit(void *);
diff --git a/sys/sparc64/sparc64/ofw_machdep.c b/sys/sparc64/sparc64/ofw_machdep.c
index 07f95e2..88ee072 100644
--- a/sys/sparc64/sparc64/ofw_machdep.c
+++ b/sys/sparc64/sparc64/ofw_machdep.c
@@ -1,6 +1,6 @@
/*-
* Copyright (c) 2001 by Thomas Moestl <tmm@FreeBSD.org>.
- * Copyright (c) 2005 - 2009 by Marius Strobl <marius@FreeBSD.org>.
+ * Copyright (c) 2005 - 2010 by Marius Strobl <marius@FreeBSD.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -68,6 +68,19 @@ OF_getetheraddr(device_t dev, u_char *addr)
bcopy(&idp.id_ether, addr, ETHER_ADDR_LEN);
}
+u_int
+OF_getscsinitid(device_t dev)
+{
+ phandle_t node;
+ uint32_t id;
+
+ for (node = ofw_bus_get_node(dev); node != 0; node = OF_parent(node))
+ if (OF_getprop(node, "scsi-initiator-id", &id,
+ sizeof(id)) > 0)
+ return (id);
+ return (7);
+}
+
static __inline uint32_t
phys_hi_mask_space(const char *bus, uint32_t phys_hi)
{
diff --git a/sys/sun4v/include/ofw_machdep.h b/sys/sun4v/include/ofw_machdep.h
index 625b131..658d9c7 100644
--- a/sys/sun4v/include/ofw_machdep.h
+++ b/sys/sun4v/include/ofw_machdep.h
@@ -36,6 +36,7 @@ typedef uint64_t cell_t;
int OF_decode_addr(phandle_t, int, int *, bus_addr_t *);
void OF_getetheraddr(device_t, u_char *);
+u_int OF_getscsinitid(device_t);
void cpu_shutdown(void *);
int ofw_entry(void *);
void ofw_exit(void *);
OpenPOWER on IntegriCloud