Author: marius
Date: Mon May 10 18:47:54 2010
New Revision: 207864
URL: http://svn.freebsd.org/changeset/base/207864

Log:
  MFC: r207243
  
  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:
  stable/7/sys/sparc64/include/ofw_machdep.h
  stable/7/sys/sparc64/sparc64/ofw_machdep.c
  stable/7/sys/sun4v/include/ofw_machdep.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/include/ofw_machdep.h
==============================================================================
--- stable/7/sys/sparc64/include/ofw_machdep.h  Mon May 10 18:47:52 2010        
(r207863)
+++ stable/7/sys/sparc64/include/ofw_machdep.h  Mon May 10 18:47:54 2010        
(r207864)
@@ -32,6 +32,7 @@
 
 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 *);
 void openfirmware_exit(void *);
 

Modified: stable/7/sys/sparc64/sparc64/ofw_machdep.c
==============================================================================
--- stable/7/sys/sparc64/sparc64/ofw_machdep.c  Mon May 10 18:47:52 2010        
(r207863)
+++ stable/7/sys/sparc64/sparc64/ofw_machdep.c  Mon May 10 18:47:54 2010        
(r207864)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2001 by Thomas Moestl <[email protected]>.
- * Copyright (c) 2005 - 2009 by Marius Strobl <[email protected]>.
+ * Copyright (c) 2005 - 2010 by Marius Strobl <[email protected]>.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -69,6 +69,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: stable/7/sys/sun4v/include/ofw_machdep.h
==============================================================================
--- stable/7/sys/sun4v/include/ofw_machdep.h    Mon May 10 18:47:52 2010        
(r207863)
+++ stable/7/sys/sun4v/include/ofw_machdep.h    Mon May 10 18:47:54 2010        
(r207864)
@@ -32,6 +32,7 @@
 
 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 *);
 void openfirmware_exit(void *);
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to