fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* The i18n catalog */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Cannot operate in the locale requested. "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Continuing in the default C locale\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_catd = catopen("a5k_g_fc_i18n_cat", NL_CAT_LOCALE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Given an error number, this functions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * calls the get_errString() to print a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * corresponding error message to the stderr.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get_errString() always returns an error
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * message, even in case of undefined error number.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * So, there is no need to check for a NULL pointer
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * while printing the error message to the stdout.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS: N/A
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* free the allocated memory for error string */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(path_class, 0, sizeof (path_class));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fd = open("/devices/scsi_vhci:devctl", O_RDWR)) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_errString(L_OPEN_PATH_FAIL, "/devices/scsi_vhci:devctl");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte get_slash_devices_from_osDevName(argv[path_index++],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strstr(path_phys, "/devices/scsi_vhci") == NULL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strcpy(iocsc.client, path_phys + strlen("/devices"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Now chop off the trailing ":xxx" portion if present */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((trailingMinor = strrchr(iocsc.client, ':')) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ioctl(fd, SCSI_VHCI_SWITCH_TO_CNTLR, &iocsc) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *physical = NULL, *slash_OSDeviceName = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* loadLibrary print out error msg */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (path_index = 0; argv[path_index] != NULL; path_index++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sscanf(argv[path_index], "%016llx", &wwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_errString(L_INVALID_PATH, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Convert the paths to phsyical paths */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte physical = get_slash_devices_from_osDevName(argv[path_index],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_errString(L_INVALID_PATH, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (adapterIndex = 0; adapterIndex < count; adapterIndex ++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = HBA_GetAdapterName(adapterIndex, (char *)&name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* May have been DR'd */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* May have been DR'd */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Should never happen */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Loop over all HBA Ports */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (portIndex = 0; portIndex < hbaAttrs.NumberOfPorts;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte slash_OSDeviceName = get_slash_devices_from_osDevName(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte portAttrs.OSDeviceName, STANDARD_DEVNAME_HANDLING);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!fetch_mappings(handle, portAttrs.PortWWN, &map)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * matchr_mapping checks the arg
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * so we pass argv here.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mapIndex = match_mappings(argv[path_index], map);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Reset the local loop here (fcio_ibuf = 0).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Reset a remote loop on the Fabric by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * passing its node wwn (fcio_len = sizeof(nwwn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and fcio_ibuf = (caddr_t)&nwwn) to the port driver.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (ntries = 0; ntries < RETRY_FCIO_IOCTL; ntries++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When port is offlined, qlc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * returns the FC_OFFLINE error and errno
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is set to EIO.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We do want to ignore this error,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * especially when an enclosure is
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * removed from the loop.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* wait WAIT_FCIO_IOCTL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Error: %s. fc_error = %d (0x%x)\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break; /* ioctl succeeds. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break; /* for HBA port for loop */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_errString(L_INVALID_PATH, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid adm_bypass_enable(char **argv, int bypass_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint hotplug_e(int todo, char **argv, int verbose_flag, int force_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesetboot(unsigned int yes, unsigned int verbose, char *fname)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint hotplug(int todo, char **argv, int verbose_flag, int force_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fcal_update(unsigned int verbose, char *file) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint q_qlgc_update(unsigned int verbose, char *file) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint emulex_fcode_reader(int fcode_fd, char *pattern, char *pattern_value,