Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Apr 2010 19:13:10 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r207243 - in head/sys: sparc64/include sparc64/sparc64 sun4v/include
Message-ID:  <201004261913.o3QJDAcp074648@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Mon Apr 26 19:13:10 2010
New Revision: 207243
URL: http://svn.freebsd.org/changeset/base/207243

Log:
  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.

Modified:
  head/sys/sparc64/include/ofw_machdep.h
  head/sys/sparc64/sparc64/ofw_machdep.c
  head/sys/sun4v/include/ofw_machdep.h

Modified: head/sys/sparc64/include/ofw_machdep.h
==============================================================================
--- head/sys/sparc64/include/ofw_machdep.h	Mon Apr 26 18:56:06 2010	(r207242)
+++ head/sys/sparc64/include/ofw_machdep.h	Mon Apr 26 19:13:10 2010	(r207243)
@@ -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 *);

Modified: head/sys/sparc64/sparc64/ofw_machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/ofw_machdep.c	Mon Apr 26 18:56:06 2010	(r207242)
+++ head/sys/sparc64/sparc64/ofw_machdep.c	Mon Apr 26 19:13:10 2010	(r207243)
@@ -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 *ad
 	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)
 {

Modified: head/sys/sun4v/include/ofw_machdep.h
==============================================================================
--- head/sys/sun4v/include/ofw_machdep.h	Mon Apr 26 18:56:06 2010	(r207242)
+++ head/sys/sun4v/include/ofw_machdep.h	Mon Apr 26 19:13:10 2010	(r207243)
@@ -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 *);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004261913.o3QJDAcp074648>