9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * CDDL HEADER START
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * The contents of this file are subject to the terms of the
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Common Development and Distribution License (the "License").
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * You may not use this file except in compliance with the License.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * See the License for the specific language governing permissions
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * and limitations under the License.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * When distributing Covered Code, include this CDDL HEADER in each
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * If applicable, add the following below this CDDL HEADER, with the
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * fields enclosed by brackets "[]" replaced with your own identifying
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * information: Portions Copyright [yyyy] [name of copyright owner]
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * CDDL HEADER END
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Use is subject to license terms.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Discover an HBA node with mtaching path.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * The di_node_t argument should be the root of the device tree.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * This routine assumes the locks have been taken
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* Skip stub(instance -1) nodes */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* still continue to see if there is matching one. */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim (void) snprintf(fulldevpath, MAXPATHLEN, "%s%s", DEVICES_DIR,
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* add the hba to the hba list */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* succeed to refresh the adapater. */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* Found a node. No need to walk any more. */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Refreshes information about an HBA
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Note: This routine holds the locks in write mode
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * during most of the processing, and as such, will cause
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * all other threads to block on entry into the library
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * until the refresh is complete. An optimization would be
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * to put fine-grain locking in for the open_handle structures.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim const char ROUTINE[] = "Sun_sasRefreshInformation";
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* take a lock for hbas and handles during rerfresh. */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim log(LOG_DEBUG, ROUTINE, "Invalid handle %08lx", handle);
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* now we know the associated hba exists in the global list. */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* Grab device tree */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim if ((root = di_init("/", DINFOCACHE)) == DI_NODE_NIL) {
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim "Unable to load device tree for reason \"%s\"",
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim wa.flag = (boolean_t *)calloc(1, sizeof (boolean_t));
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* found the matching hba node and refresh hba ports and targets. */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* no matching HBA. */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* All done, release the locks */