fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
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 *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
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 *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*LINTLIBRARY*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This module is part of the photon library
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * I18N message number ranges
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This file: 8000 - 8499
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Shared common messages: 1 - 1999
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Includes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdlib.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdio.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/file.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/types.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/param.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <fcntl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <unistd.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <errno.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <string.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/scsi/scsi.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <nl_types.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <strings.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/ddi.h> /* for max */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <l_common.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stgcom.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <l_error.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <a_state.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <a5k.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Defines */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define VERBPRINT if (verbose) (void) printf
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * take all paths supplied by dl offline.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 = No error.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * *bsy_res_flag_p: 1 = The device is "busy".
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * In pre-2.6 we just return success
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forted_offline_drive(struct dlist *dl, int *bsy_res_flag_p, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar dev_path1[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedevctl_hdl_t devhdl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* for each path attempt to take it offline */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (; dl != NULL; dl = dl->next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* save a copy of the pathname */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(dev_path1, dl->dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* attempt to acquire the device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((devhdl = devctl_device_acquire(dev_path1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DC_EXCL)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (errno != EBUSY) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_ACQUIRE_FAIL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* attempt to offline the drive */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (devctl_device_offline(devhdl) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *bsy_res_flag_p = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) devctl_release(devhdl);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte E_DPRINTF(" d_offline_drive: Offline succeeded:/n "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n", dev_path1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* offline succeeded -- release handle acquired above */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) devctl_release(devhdl);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check to see if any of the disks that are attached
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to the selected port on this backplane are reserved or busy.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * INPUTS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 = No error.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * *bsy_res_flag_p: 1 = The device is "busy".
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortel_check_busy_reserv_bp(char *ses_path, int front_flag,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int port_a_flag, int *bsy_res_flag_p, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint err, i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_state *l_state = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct dlist *p_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((l_state = (L_state *)calloc(1, sizeof (L_state))) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_MALLOC_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_status(ses_path, l_state, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < (int)l_state->total_num_drv/2; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((front_flag &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_state->drv_front[i].g_disk_state.d_state_flags[port_a_flag] &
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte L_RESERVED)) || (!front_flag &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_state->drv_rear[i].g_disk_state.d_state_flags[port_a_flag] &
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte L_RESERVED))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *bsy_res_flag_p = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < (int)l_state->total_num_drv/2; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get list of all paths to the requested port. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (front_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (port_a_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_port_multipath(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->drv_front[i].g_disk_state.port_a_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &p_list, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_port_multipath(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->drv_front[i].g_disk_state.port_b_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &p_list, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (port_a_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_port_multipath(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->drv_rear[i].g_disk_state.port_a_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &p_list, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_port_multipath(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->drv_rear[i].g_disk_state.port_b_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &p_list, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = d_offline_drive(p_list,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bsy_res_flag_p, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_multipath(p_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_multipath(p_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Request the enclosure services controller (IB)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to set the LRC (Loop Redundancy Circuit) to the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bypassed/enabled state for the backplane specified by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the a and f flag and the enclosure or pathname.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortel_bp_bypass_enable(char *ses_path, int bypass_flag, int port_a_flag,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int front_flag, int force_flag, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fd, i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint nobj = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteses_objarg obj;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteses_object *all_objp = NULL, *all_objp_save = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint found = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteBp_elem_st *bp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar msg[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint bsy_res_flag = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ses_path == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_NO_SES_PATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check for reservation and busy for all disks on this
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * backplane.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!force_flag && bypass_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_check_busy_reserv_bp(ses_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte front_flag, port_a_flag, &bsy_res_flag, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bsy_res_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_BP_BUSY_RESERVED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fd = g_object_open(ses_path, O_NDELAY | O_RDWR)) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (errno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ioctl(fd, SESIOC_GETNOBJ, (caddr_t)&nobj) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (errno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (nobj == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_IB_NO_ELEM_FOUND);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte E_DPRINTF(" l_ib_bypass_bp: Number of SES objects: 0x%x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nobj);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* alloc some memory for the objmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((all_objp = g_zalloc((nobj + 1) * sizeof (ses_object))) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (errno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte all_objp_save = all_objp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ioctl(fd, SESIOC_GETOBJMAP, (caddr_t)all_objp) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(all_objp_save);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (errno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < nobj; i++, all_objp++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte E_DPRINTF(" ID 0x%x\t Element type 0x%x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte all_objp->obj_id, all_objp->elem_type);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (all_objp->elem_type == ELM_TYP_BP) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte found++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (found == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(all_objp_save);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_NO_BP_ELEM_FOUND);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We found the backplane element.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (verbose) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the status for backplane #0 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte obj.obj_id = all_objp->obj_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ioctl(fd, SESIOC_GETOBJSTAT, (caddr_t)&obj) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(all_objp_save);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (errno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(8000,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Front backplane status: "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bp = (struct bp_element_status *)&obj.cstat[0];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_element_msg_string(bp->code, msg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s\n", msg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bp->byp_a_enabled || bp->en_bypass_a) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(130, "Bypass A enabled"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ".\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bp->byp_b_enabled || bp->en_bypass_b) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(129, "Bypass B enabled"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ".\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte all_objp++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte obj.obj_id = all_objp->obj_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte all_objp--;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ioctl(fd, SESIOC_GETOBJSTAT, (caddr_t)&obj) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(all_objp_save);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (errno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(8001,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Rear backplane status: "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bp = (struct bp_element_status *)&obj.cstat[0];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_element_msg_string(bp->code, msg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s\n", msg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bp->byp_a_enabled || bp->en_bypass_a) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(130, "Bypass A enabled"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ".\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bp->byp_b_enabled || bp->en_bypass_b) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(129, "Bypass B enabled"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ".\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the current status */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!front_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte all_objp++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte obj.obj_id = all_objp->obj_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ioctl(fd, SESIOC_GETOBJSTAT, (caddr_t)&obj) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(all_objp_save);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (errno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Do the requested action. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bp = (struct bp_element_status *)&obj.cstat[0];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bp->select = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bp->code = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (port_a_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bp->en_bypass_a = bypass_flag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bp->en_bypass_b = bypass_flag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (getenv("_LUX_E_DEBUG") != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(" Sending this structure to ID 0x%x"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " of type 0x%x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte obj.obj_id, all_objp->elem_type);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < 4; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(" Byte %d 0x%x\n", i,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte obj.cstat[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ioctl(fd, SESIOC_SETOBJSTAT, (caddr_t)&obj) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(all_objp_save);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (errno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(all_objp_save);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This function will request the enclosure services
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * controller (IB) to set the LRC (Loop Redundancy Circuit) to the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bypassed/enabled state for the device specified by the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * enclosure,dev or pathname and the port specified by the a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * flag.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortel_dev_bypass_enable(struct path_struct *path_struct, int bypass_flag,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int force_flag, int port_a_flag, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegfc_map_t map;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar ses_path[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t *page_buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint err, fd, front_index, rear_index, offset;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint pathcnt = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteunsigned short page_len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct device_element *elem;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_state *l_state = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct device_element status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint bsy_flag = 0, i, f_flag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct dlist *p_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar temppath[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemp_pathlist_t pathlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint p_pw = 0, p_on = 0, p_st = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_PATH_FORMAT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((l_state = (L_state *)calloc(1, sizeof (L_state))) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_MALLOC_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte map.dev_addr = (gfc_port_dev_info_t *)NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(temppath, path_struct->p_physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strstr(path_struct->p_physical_path, SCSI_VHCI) != NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (!g_get_pathlist(temppath, &pathlist))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathcnt = pathlist.path_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte p_pw = p_on = p_st = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < pathcnt; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pathlist.path_info[i].path_state <
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MAXPATHSTATE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(pathlist.path_info[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte p_pw = i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pathlist.path_info[i].path_state ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MDI_PATHINFO_STATE_ONLINE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte p_on = i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pathlist.path_info[i].path_state ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MDI_PATHINFO_STATE_STANDBY) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte p_st = i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(pathlist.path_info[p_pw].path_addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* matching input pwwn */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(temppath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[p_pw].path_hba);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (pathlist.path_info[p_on].path_state ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MDI_PATHINFO_STATE_ONLINE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* on_line path */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(temppath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[p_on].path_hba);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* standby or path0 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(temppath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[p_st].path_hba);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(pathlist.path_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcat(temppath, FC_CTLR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Need to get a valid location, front/rear & slot.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The path_struct will return a valid slot
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and the IB path or a disk path.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!path_struct->ib_path_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_dev_map(temppath, &map, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_ses_path(path_struct->p_physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ses_path, &map, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free((void *)map.dev_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(ses_path, path_struct->p_physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!path_struct->slot_valid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((map.dev_addr == (gfc_port_dev_info_t *)NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((err = g_get_dev_map(temppath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &map, verbose)) != 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_ses_path(path_struct->p_physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ses_path, &map, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free((void *)map.dev_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_status(ses_path, l_state, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free((void *)map.dev_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* We are passing the disks path */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_slot(path_struct, l_state, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free((void *)map.dev_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (map.dev_addr != (gfc_port_dev_info_t *)NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free((void *)map.dev_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((page_buf = (uchar_t *)malloc(MAX_REC_DIAG_LENGTH)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (errno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fd = g_object_open(ses_path, O_NDELAY | O_RDWR)) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (errno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_envsen_page(fd, page_buf, MAX_REC_DIAG_LENGTH,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte L_PAGE_2, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte page_len = (page_buf[2] << 8 | page_buf[3]) + HEADER_LEN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get index to the disk we are interested in */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_status(ses_path, l_state, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Now that we have the status check to see if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * busy or reserved, if bypassing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((!(force_flag | path_struct->ib_path_flag)) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bypass_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i = path_struct->slot;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte f_flag = path_struct->f_flag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check for reservation and busy
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((f_flag &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_state->drv_front[i].g_disk_state.d_state_flags[port_a_flag] &
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte L_RESERVED)) || (!f_flag &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_state->drv_rear[i].g_disk_state.d_state_flags[port_a_flag] &
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte L_RESERVED))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_BP_RESERVED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (f_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (port_a_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_port_multipath(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->drv_front[i].g_disk_state.port_a_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &p_list, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_port_multipath(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->drv_front[i].g_disk_state.port_b_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &p_list, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (port_a_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_port_multipath(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->drv_rear[i].g_disk_state.port_a_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &p_list, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_port_multipath(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->drv_rear[i].g_disk_state.port_b_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &p_list, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = d_offline_drive(p_list,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &bsy_flag, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_multipath(p_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_multipath(p_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bsy_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_BP_BUSY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_disk_element_index(l_state, &front_index,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &rear_index)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (g_get_inquiry(ses_path, &inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_SCSI_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Skip global element */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte front_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strncmp((char *)&inq.inq_pid[0], DAK_OFF_NAME,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strlen(DAK_OFF_NAME)) == 0) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strncmp((char *)&inq.inq_pid[0], DAK_PROD_STR,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strlen(DAK_PROD_STR)) == 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rear_index += (MAX_DRIVES_DAK/2) + 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rear_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->f_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = (8 + (front_index + path_struct->slot)*4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = (8 + (rear_index + path_struct->slot)*4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem = (struct device_element *)(page_buf + offset);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * now do requested action.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy((const void *)elem, (void *)&status,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (struct device_element)); /* save status */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(elem, sizeof (struct device_element));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->select = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->dev_off = status.dev_off;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->en_bypass_a = status.en_bypass_a;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->en_bypass_b = status.en_bypass_b;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Do requested action */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (port_a_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->en_bypass_a = bypass_flag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->en_bypass_b = bypass_flag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (getenv("_LUX_E_DEBUG") != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dump(" l_dev_bypass_enable: Updating LRC circuit state:\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Device Status Element ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uchar_t *)elem, sizeof (struct device_element),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HEX_ONLY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " for device at location:"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " enclosure:%s slot:%d %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->ib_tbl.enclosure_name,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->slot,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->f_flag ? "front" : "rear");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_scsi_send_diag_cmd(fd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uchar_t *)page_buf, page_len)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Issue a Loop Port enable Primitive sequence
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to the device specified by the pathname.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forted_p_enable(char *path, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Issue a Loop Port Bypass Primitive sequence
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to the device specified by the pathname. This requests the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * device to set its L_Port into the bypass mode.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forted_p_bypass(char *path, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}