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
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LUX_SF_INST_SHIFT4MINOR 6
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LUX_SF_MINOR2INST(x) (x >> LUX_SF_INST_SHIFT4MINOR)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdlib.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdio.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/file.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/errno.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/types.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/stat.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/param.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <kstat.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/mkdev.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <locale.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <nl_types.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <fcntl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <unistd.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <strings.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <ctype.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <dirent.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <limits.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdarg.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <termio.h> /* For password */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <signal.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/scsi/scsi.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/scsi/generic/commands.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <l_common.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <l_error.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stgcom.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <a_state.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <devid.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <g_state.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "common.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern char *dtype[];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern char *whoami;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int Options;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int OPTION_A;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int OPTION_B;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int OPTION_C;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int OPTION_D;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int OPTION_E;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int OPTION_F;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int OPTION_L;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int OPTION_P;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int OPTION_R;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int OPTION_T;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int OPTION_V;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int OPTION_Z;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int OPTION_Y;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int OPTION_CAPF;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int PVERBOSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int SAVE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int EXPERT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic struct termios termios;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int termio_fd;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void pho_display_config(char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void dpm_display_config(char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void n_rem_list_entry(uchar_t, struct gfc_map *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte WWN_list **);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void n_rem_list_entry_fabric(int, struct gfc_map *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte WWN_list **);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void n_rem_wwn_entry(uchar_t *, WWN_list **);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void display_disk_info(L_inquiry, L_disk_state,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Path_struct *, struct mode_page *, int, char *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void display_lun_info(L_disk_state, Path_struct *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct mode_page *, int, WWN_list *, char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void display_fc_disk(struct path_struct *, char *, gfc_map_t *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte L_inquiry, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void adm_display_err(char *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void temperature_messages(struct l_state_struct *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ctlr_messages(struct l_state_struct *, int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fan_messages(struct l_state_struct *, int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ps_messages(struct l_state_struct *, int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void abnormal_condition_display(struct l_state_struct *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void loop_messages(struct l_state_struct *, int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void revision_msg(struct l_state_struct *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void mb_messages(struct l_state_struct *, int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void back_plane_messages(struct l_state_struct *, int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void dpm_SSC100_messages(struct l_state_struct *, int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void mb_messages(struct l_state_struct *, int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void back_plane_messages(struct l_state_struct *, int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void dpm_SSC100_messages(struct l_state_struct *, int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void trans_decode(Trans_elem_st *trans);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void trans_messages(struct l_state_struct *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void adm_print_pathlist(char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void display_path_info(char *, char *, WWN_list *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void copy_wwn_data_to_str(char *, const uchar_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void adm_mplist_free(struct mplist_struct *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int lun_display(Path_struct *path_struct, L_inquiry inq_struct,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int verbose);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int non_encl_fc_disk_display(Path_struct *path_struct,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte L_inquiry inq_struct, int verbose);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int get_enclStatus(char *phys_path, char *encl_name, int off_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int get_host_controller_pwwn(char *hba_path, uchar_t *pwwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int get_lun_capacity(char *devpath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct scsi_capacity_16 *cap_data);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int get_path_status(char *devpath, int *status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int get_FC4_host_controller_pwwn(char *hba_path, uchar_t *pwwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the device's state from the SENA IB and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * checks whether device is offlined, bypassed
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or if the slot is empty and prints it to the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * stdout.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 O.K.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * non-zero otherwise
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteprint_devState(char *devname, char *ppath, int fr_flag, int slot,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int verbose_flag)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_state l_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i, elem_index = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t device_off, ib_status_code, bypass_a_en, bypass_b_en;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteBp_elem_st bpf, bpr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_status(ppath, &l_state, verbose_flag)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, ppath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < (int)l_state.ib_tbl.config.enc_num_elem; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state.ib_tbl.config.type_hdr[i].type == ELM_TYP_BP) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index += l_state.ib_tbl.config.type_hdr[i].num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &(l_state.ib_tbl.p2_s.element[elem_index]),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&bpf, sizeof (bpf));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &(l_state.ib_tbl.p2_s.element[elem_index + 1]),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&bpr, sizeof (bpr));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fr_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte device_off = l_state.drv_front[slot].ib_status.dev_off;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bypass_a_en = l_state.drv_front[slot].ib_status.bypass_a_en;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bypass_b_en = l_state.drv_front[slot].ib_status.bypass_b_en;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ib_status_code = l_state.drv_front[slot].ib_status.code;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte device_off = l_state.drv_rear[slot].ib_status.dev_off;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bypass_a_en = l_state.drv_rear[slot].ib_status.bypass_a_en;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bypass_b_en = l_state.drv_rear[slot].ib_status.bypass_b_en;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ib_status_code = l_state.drv_rear[slot].ib_status.code;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (device_off) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2000,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s is offlined and bypassed.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Could not get device specific"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " information.\n\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte devname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (bypass_a_en && bypass_b_en) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2001,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s is bypassed (Port:AB).\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Could not get device specific"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " information.\n\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte devname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ib_status_code == S_NOT_INSTALLED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2002,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Slot %s is empty.\n\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte devname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (((bpf.code != S_NOT_INSTALLED) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((bpf.byp_a_enabled || bpf.en_bypass_a) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (bpf.byp_b_enabled || bpf.en_bypass_b))) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((bpr.code != S_NOT_INSTALLED) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((bpr.byp_a_enabled || bpr.en_bypass_a) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (bpr.byp_b_enabled || bpr.en_bypass_b)))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2003,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Backplane(Port:AB) is bypassed.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Could not get device specific"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " information for"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s.\n\n"), devname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte devname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
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 *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS: N/A
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteprint_errString(int errnum, char *devpath)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *errStr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte errStr = g_get_errString(errnum);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (devpath == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s \n\n", errStr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s - %s.\n\n", errStr, devpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* free the allocated memory for error string */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (errStr != NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) free(errStr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * adm_inquiry() Display the inquiry information for
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * a SENA enclosure(s) or disk(s).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_inquiry(char **argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry80 inq80;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesize_t serial_len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint path_index = 0, retval = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint slot, f_r, err = 0, argpwwn, argnwwn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar inq_path[MAXNAMELEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path_phys = NULL, *ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *path_struct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteWWN_list *wwn_list, *wwn_list_ptr, *list_start;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar last_logical_path[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (argv[path_index] != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(argv[path_index], &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(inq_path, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((ptr = strstr(inq_path, ",")) != NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((*(ptr + 1) == 'f') || (*(ptr + 1) == 'r') ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*(ptr +1) == 's'))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ptr = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte slot = path_struct->slot;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte f_r = path_struct->f_flag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(inq_path, &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = print_devState(argv[path_index],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->p_physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte f_r, slot, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(112, "Error: Invalid pathname (%s)"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(argv[path_index], "/") != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_inquiry(path_phys, &inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte serial_len = sizeof (inq80.inq_serial);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_serial_number(path_phys, inq80.inq_serial,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &serial_len)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_inq_data(argv[path_index], path_phys, inq,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inq80.inq_serial, serial_len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_wwn_list(&wwn_list, 0)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_sort_wwn_list(&wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte list_start = wwn_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argpwwn = argnwwn = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(last_logical_path, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (wwn_list_ptr = wwn_list; wwn_list_ptr != NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list_ptr = wwn_list_ptr->wwn_next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcasecmp(wwn_list_ptr->port_wwn_s, path_struct->argv) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte list_start = wwn_list_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argpwwn = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (strcasecmp(wwn_list_ptr->node_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte list_start = wwn_list_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argnwwn = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(argpwwn || argnwwn)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if the wwn list is null or the arg device not found
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * from the wwn list, still go ahead to issue inquiry.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_inquiry(path_phys, &inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte serial_len = sizeof (inq80.inq_serial);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_serial_number(path_phys, inq80.inq_serial,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &serial_len)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_inq_data(argv[path_index], path_phys, inq,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inq80.inq_serial, serial_len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_wwn_list(&wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (wwn_list_ptr = list_start; wwn_list_ptr != NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list_ptr = wwn_list_ptr->wwn_next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argpwwn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcasecmp(wwn_list_ptr->port_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list_ptr->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (argnwwn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcasecmp(wwn_list_ptr->node_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(wwn_list_ptr->logical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_logical_path) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list_ptr->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(last_logical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list_ptr->logical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_inquiry(path_phys, &inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte serial_len = sizeof (inq80.inq_serial);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_serial_number(path_phys, inq80.inq_serial,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &serial_len)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_inq_data(argv[path_index], path_phys, inq,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inq80.inq_serial, serial_len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_wwn_list(&wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (retval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FORCELIP expert function
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_forcelip(char **argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint slot, f_r, path_index = 0, err = 0, retval = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *path_struct = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path_phys = NULL, *ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar err_path[MAXNAMELEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (argv[path_index] != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(argv[path_index], &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(err_path, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((ptr = strstr(err_path, ", ")) != NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((*(ptr + 1) == 'f') || (*(ptr + 1) == 'r') ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*(ptr +1) == 's'))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ptr = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte slot = path_struct->slot;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte f_r = path_struct->f_flag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(err_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_phys, &path_struct,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = print_devState(argv[path_index],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->p_physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte f_r, slot, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, MSGSTR(112,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Error: Invalid pathname (%s)"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_force_lip(path_phys, Options & PVERBOSE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) free(path_struct);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (retval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DISPLAY function
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 O.K.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_display_config(char **argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry inq, ses_inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i, slot, f_r, path_index = 0, err = 0, opnerr = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint retval = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegfc_map_t map;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *path_struct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path_phys = NULL, *ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar ses_path[MAXPATHLEN], inq_path[MAXNAMELEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (argv[path_index] != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte VERBPRINT(MSGSTR(2108, " Displaying information for: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte map.dev_addr = (gfc_port_dev_info_t *)NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(argv[path_index], &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(argv[path_index], SCSI_VHCI) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(inq_path, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((ptr = strstr(inq_path, ",")) != NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((*(ptr + 1) == 'f') || (*(ptr + 1) == 'r') ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*(ptr +1) == 's'))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ptr = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte slot = path_struct->slot;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte f_r = path_struct->f_flag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(inq_path, &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = print_devState(argv[path_index],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->p_physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte f_r, slot, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(112,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Error: Invalid pathname (%s)"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(112,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Error: Invalid pathname (%s)"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See what kind of device we are talking to.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((opnerr = g_get_inquiry(path_phys, &inq)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (opnerr == L_OPEN_PATH_FAIL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We check only for L_OPEN_PATH_FAIL because
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * that is the only error code returned by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * g_get_inquiry() which is not got from the ioctl
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * call itself. So, we are dependent, in a way, on the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * implementation of g_get_inquiry().
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(errno, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (!g_enclDiskChk((char *)inq.inq_vid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (char *)inq.inq_pid)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = lun_display(path_struct,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inq, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (strstr((char *)inq.inq_pid, ENCLOSURE_PROD_ID) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Display SENA enclosure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n\t\t\t\t ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_chars(inq.inq_pid, sizeof (inq.inq_pid), 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Options & OPTION_R) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte adm_display_err(path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (inq.inq_dtype & DTYPE_MASK));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pho_display_config(path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((((inq.inq_dtype & DTYPE_MASK) == DTYPE_ESI)) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_get_enc_type(inq) == DAK_ENC_TYPE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Display for the Daktari/DPM
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n\t\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < sizeof (inq.inq_pid); i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%c", inq.inq_pid[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Options & OPTION_R) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte adm_display_err(path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (inq.inq_dtype & DTYPE_MASK));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dpm_display_config(path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if device is in SENA enclosure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if the slot is valid, then I know this is a SENA enclosure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and can continue
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * otherwise:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * I first get the ses_path, if this doesn't fail
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * I retrieve the inquiry data from the ses node
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and check teh PID to make sure this is a SENA
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (((inq.inq_dtype & DTYPE_MASK) == DTYPE_DIRECT) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((path_struct->slot_valid == 1) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((g_get_dev_map(path_phys, &map,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Options & PVERBOSE)) == 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_get_ses_path(path_phys, ses_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &map, Options & PVERBOSE) == 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (g_get_inquiry(ses_path, &ses_inq) == 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((strstr((char *)ses_inq.inq_pid, ENCLOSURE_PROD_ID)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte != NULL))))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Options & OPTION_R) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte adm_display_err(path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (inq.inq_dtype & DTYPE_MASK));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_fc_disk(path_struct, ses_path, &map, inq,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & PVERBOSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (strstr((char *)inq.inq_pid, "SUN_SEN") != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(argv[path_index], path_phys) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(5, "Physical Path:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n %s\n", path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2109, "DEVICE is a "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_chars(inq.inq_vid, sizeof (inq.inq_vid), 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_chars(inq.inq_pid, sizeof (inq.inq_pid), 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2110, " card."));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (inq.inq_len > 31) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(26, "Revision:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_chars(inq.inq_revision,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (inq.inq_revision), 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if device is not in SENA or SSA enclosures. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((inq.inq_dtype & DTYPE_MASK) < 0x10) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch ((inq.inq_dtype & DTYPE_MASK)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case DTYPE_DIRECT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case DTYPE_SEQUENTIAL: /* Tape */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Options & OPTION_R) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte adm_display_err(path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (inq.inq_dtype & DTYPE_MASK));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (non_encl_fc_disk_display(path_struct,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inq, Options & PVERBOSE) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2111,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Error: getting the device"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " information.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* case 0x01: same as default */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(35,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Device Type:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dtype[inq.inq_dtype & DTYPE_MASK]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((inq.inq_dtype & DTYPE_MASK) < 0x1f) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2112, " Device type: Reserved"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2113, " Device type: Unknown device"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (map.dev_addr != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free((void *)map.dev_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) free(path_struct);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (retval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Powers off a list of SENA enclosure(s)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and disk(s) which is provided by the user.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_power_off(char **argv, int off_flag)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint path_index = 0, err = 0, retval = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *path_struct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (argv[path_index] != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(argv[path_index], &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * In case we did not find the device
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * in the /devices directory.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Only valid for pathnames like box,f1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->ib_path_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_phys = path_struct->p_physical_path;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->ib_path_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We are addressing a disk using a path
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * format type box,f1.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_dev_pwr_up_down(path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct, off_flag, Options & PVERBOSE,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & OPTION_CAPF)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Is it Bypassed... try to give more
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * informtaion.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_devState(argv[path_index],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->p_physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->f_flag, path_struct->slot,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & PVERBOSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_inquiry(path_phys, &inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strstr((char *)inq.inq_pid, ENCLOSURE_PROD_ID) != 0) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strncmp((char *)inq.inq_vid, "SUN ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (inq.inq_vid)) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((inq.inq_dtype & DTYPE_MASK) == DTYPE_ESI))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (get_enclStatus(path_phys, argv[path_index],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte off_flag) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* power off SENA enclosure. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_pho_pwr_up_down(argv[path_index], path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte off_flag, Options & PVERBOSE,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & OPTION_CAPF)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((inq.inq_dtype & DTYPE_MASK) == DTYPE_DIRECT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_dev_pwr_up_down(path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct, off_flag, Options & PVERBOSE,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & OPTION_CAPF)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * SSA section:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(L_INVALID_PATH,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (retval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_bypass_enable(char **argv, int bypass_flag)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint path_index = 0, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *path_struct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(argv[path_index], &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * In case we did not find the device
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * in the /devices directory.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Only valid for pathnames like box,f1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->ib_path_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_phys = path_struct->p_physical_path;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->ib_path_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Options & OPTION_F) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte E_USEAGE();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We are addressing a disk using a path
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * format type box,f1 and no disk
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * path was found.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * So set the Force flag so no reserved/busy
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * check is performed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_dev_bypass_enable(path_struct,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bypass_flag, OPTION_CAPF,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & OPTION_A,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & PVERBOSE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_inquiry(path_phys, &inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strstr((char *)inq.inq_pid, ENCLOSURE_PROD_ID) != 0) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strncmp((char *)inq.inq_vid, "SUN ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (inq.inq_vid)) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((inq.inq_dtype & DTYPE_MASK) == DTYPE_ESI))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((!((Options & OPTION_F) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Options & OPTION_R))) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((Options & OPTION_R) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Options & OPTION_F))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte E_USEAGE();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_bp_bypass_enable(path_phys, bypass_flag,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & OPTION_A,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & OPTION_F,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & OPTION_CAPF,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & PVERBOSE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((inq.inq_dtype & DTYPE_MASK) == DTYPE_DIRECT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Options & OPTION_F) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte E_USEAGE();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_dev_bypass_enable(path_struct,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bypass_flag, Options & OPTION_CAPF,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & OPTION_A,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & PVERBOSE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * adm_download() Download subsystem microcode.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Path must point to a LUX IB.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_download(char **argv, char *file_name)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint path_index = 0, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *path_struct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (argv[path_index] != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See what kind of device we are talking to.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(argv[path_index], &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_inquiry(path_phys, &inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strstr((char *)inq.inq_pid, ENCLOSURE_PROD_ID) != 0) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strncmp((char *)inq.inq_vid, "SUN ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (inq.inq_vid)) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((inq.inq_dtype & DTYPE_MASK) == DTYPE_ESI))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_download(path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte file_name, (Options & SAVE),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Options & PVERBOSE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (err == L_OPEN_PATH_FAIL) ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]: file_name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(112, "Error: Invalid pathname (%s)"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * display_link_status() Reads and displays the link status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_link_status(char **argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAL_rls *rls = NULL, *n;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint path_index = 0, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *path_struct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (argv[path_index] != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(argv[path_index], &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_rdls(path_phys, &rls, Options & PVERBOSE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n = rls;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (n != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2007, "\nLink Error Status "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "information for loop:%s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n->driver_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2008, "al_pa lnk fail "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " sync loss signal loss sequence err"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " invalid word CRC\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (n) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((n->payload.rls_linkfail == 0xffffffff) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (n->payload.rls_syncfail == 0xffffffff) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (n->payload.rls_sigfail == 0xffffffff) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (n->payload.rls_primitiverr == 0xffffffff) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (n->payload.rls_invalidword == 0xffffffff) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (n->payload.rls_invalidcrc == 0xffffffff)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%x\t%-12d%-12d%-14d%-15d%-15d%-12d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n->al_ha,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n->payload.rls_linkfail,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n->payload.rls_syncfail,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n->payload.rls_sigfail,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n->payload.rls_primitiverr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n->payload.rls_invalidword,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n->payload.rls_invalidcrc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%x\t%-12u%-12u%-14u%-15u%-15u%-12u\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n->al_ha,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n->payload.rls_linkfail,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n->payload.rls_syncfail,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n->payload.rls_sigfail,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n->payload.rls_primitiverr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n->payload.rls_invalidword,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n->payload.rls_invalidcrc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n = n->next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2009, "NOTE: These LESB counts are not"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " cleared by a reset, only power cycles.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "These counts must be compared"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " to previously read counts.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ib_present_chk() Check to see if IB 0 or 1 is present in the box.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 1 if ib present
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 otherwise
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteib_present_chk(struct l_state_struct *l_state, int which_one)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteCtlr_elem_st ctlr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint elem_index = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint result = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < (int)l_state->ib_tbl.config.enc_num_elem; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index++; /* skip global */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state->ib_tbl.config.type_hdr[i].type == ELM_TYP_IB) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &l_state->ib_tbl.p2_s.element[elem_index + which_one],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&ctlr, sizeof (ctlr));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ctlr.code == S_NOT_INSTALLED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte result = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index += l_state->ib_tbl.config.type_hdr[i].num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (result);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * print_individual_state() Print individual disk status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteprint_individual_state(int status, int port)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status & L_OPEN_FAIL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " (");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(28, "Open Failed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ") ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (status & L_NOT_READY) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " (");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(20, "Not Ready"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ") ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (status & L_NOT_READABLE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "(");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(88, "Not Readable"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ") ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (status & L_SPUN_DWN_D) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " (");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(68, "Spun Down"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ") ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (status & L_SCSI_ERR) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " (");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(70, "SCSI Error"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ") ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (status & L_RESERVED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (port == PORT_A) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2010,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " (Rsrv cnflt:A) "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (port == PORT_B) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2011,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " (Rsrv cnflt:B) "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2012,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " (Reserve cnflt)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (status & L_NO_LABEL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "(");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(92, "No UNIX Label"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ") ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * display_disk_msg() Displays status for
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * an individual SENA device.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_disk_msg(struct l_disk_state_struct *dsk_ptr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct l_state_struct *l_state, Bp_elem_st *bp, int front_flag)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint loop_flag = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint a_and_b = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint state_a = 0, state_b = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dsk_ptr->ib_status.code == S_NOT_INSTALLED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(30, "Not Installed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dsk_ptr->ib_status.fault ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dsk_ptr->ib_status.fault_req) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "(");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2013, "Faulted"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ") ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (dsk_ptr->ib_status.ident ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dsk_ptr->ib_status.rdy_to_ins ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dsk_ptr->ib_status.rmv) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2014,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "(LED Blinking) "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (dsk_ptr->ib_status.dev_off) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2015, "Off"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dsk_ptr->ib_status.fault || dsk_ptr->ib_status.fault_req) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "(");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2016, "Faulted"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ") ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (dsk_ptr->ib_status.bypass_a_en &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dsk_ptr->ib_status.bypass_b_en) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2017,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "(Bypassed:AB)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (dsk_ptr->ib_status.bypass_a_en) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2018,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "(Bypassed: A)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (dsk_ptr->ib_status.bypass_b_en) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2019,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "(Bypassed: B)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2020, "On"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dsk_ptr->ib_status.fault || dsk_ptr->ib_status.fault_req) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " (");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2021, "Faulted"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ") ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (dsk_ptr->ib_status.bypass_a_en &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dsk_ptr->ib_status.bypass_b_en) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2022, "(Bypassed:AB)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ib_present_chk(l_state, 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dsk_ptr->ib_status.bypass_a_en) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Before printing that the port is bypassed
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * verify that there is an IB for this port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If not then don't print.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2023, "(Bypassed: A)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ib_present_chk(l_state, 1) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dsk_ptr->ib_status.bypass_b_en) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2024, "(Bypassed: B)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((bp->code != S_NOT_INSTALLED) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((bp->byp_a_enabled || bp->en_bypass_a) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !(bp->byp_b_enabled || bp->en_bypass_b))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2025,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " (Bypassed BP: A)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((bp->code != S_NOT_INSTALLED) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((bp->byp_b_enabled || bp->en_bypass_b) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !(bp->byp_a_enabled || bp->en_bypass_a))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2026,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "(Bypassed BP: B)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((bp->code != S_NOT_INSTALLED) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((bp->byp_a_enabled || bp->en_bypass_a) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (bp->byp_b_enabled || bp->en_bypass_b))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2027,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "(Bypassed BP:AB)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_a = dsk_ptr->g_disk_state.d_state_flags[PORT_A];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_b = dsk_ptr->g_disk_state.d_state_flags[PORT_B];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte a_and_b = state_a & state_b;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dsk_ptr->l_state_flag & L_NO_LOOP) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2028,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " (Loop not accessible)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte loop_flag = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (dsk_ptr->l_state_flag & L_INVALID_WWN) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2029,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " (Invalid WWN) "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (dsk_ptr->l_state_flag & L_INVALID_MAP) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2030,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " (Login failed) "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (dsk_ptr->l_state_flag & L_NO_PATH_FOUND) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2031,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " (No path found)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (a_and_b) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_individual_state(a_and_b, PORT_A_B);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (state_a && (!state_b)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_individual_state(state_a, PORT_A);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((!state_a) && state_b) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_individual_state(state_b, PORT_B);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (state_a || state_b) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* NOTE: Double state - should do 2 lines. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_individual_state(state_a | state_b,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PORT_A_B);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " (");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(29, "O.K."));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ") ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (loop_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (strlen(dsk_ptr->g_disk_state.node_wwn_s)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dsk_ptr->g_disk_state.node_wwn_s);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (front_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pho_display_config() Displays device status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information for a SENA enclosure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepho_display_config(char *path_phys)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_state l_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteBp_elem_st bpf, bpr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i, j, elem_index = 0, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get global status */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_status(path_phys, &l_state,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Options & PVERBOSE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Look for abnormal status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state.ib_tbl.p2_s.ui.ab_cond) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte abnormal_condition_display(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2032, " DISK STATUS \n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "SLOT FRONT DISKS (Node WWN) "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " REAR DISKS (Node WWN)\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Print the status for each disk
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < (int)l_state.ib_tbl.config.enc_num_elem; j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state.ib_tbl.config.type_hdr[j].type == ELM_TYP_BP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index += l_state.ib_tbl.config.type_hdr[j].num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &(l_state.ib_tbl.p2_s.element[elem_index]),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&bpf, sizeof (bpf));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &(l_state.ib_tbl.p2_s.element[elem_index + 1]),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&bpr, sizeof (bpr));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < (int)l_state.total_num_drv/2; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%-2d ", i);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_disk_msg(&l_state.drv_front[i], &l_state, &bpf, 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_disk_msg(&l_state.drv_rear[i], &l_state, &bpr, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Display the subsystem status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2242,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " SUBSYSTEM STATUS\nFW Revision:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_chars(l_state.ib_tbl.config.prod_revision,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (l_state.ib_tbl.config.prod_revision), 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2034, " Box ID:%d"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state.ib_tbl.box_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(90, "Node WWN:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < 8; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%1.2x",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state.ib_tbl.config.enc_node_wwn[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Make sure NULL terminated although it is supposed to be */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strlen((const char *)l_state.ib_tbl.enclosure_name) <=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (l_state.ib_tbl.enclosure_name)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2035, " Enclosure Name:%s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state.ib_tbl.enclosure_name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get and print CONTROLLER messages */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < (int)l_state.ib_tbl.config.enc_num_elem; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index++; /* skip global */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (l_state.ib_tbl.config.type_hdr[i].type) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ELM_TYP_PS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ps_messages(&l_state, i, elem_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ELM_TYP_FT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fan_messages(&l_state, i, elem_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ELM_TYP_BP:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte back_plane_messages(&l_state, i, elem_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ELM_TYP_IB:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ctlr_messages(&l_state, i, elem_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ELM_TYP_LN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * NOTE: I just use the Photon's message
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * string here and don't look at the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * language code. The string includes
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the language name.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state.ib_tbl.config.type_hdr[i].text_len != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s\t",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state.ib_tbl.config.text[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ELM_TYP_LO: /* Loop configuration */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte loop_messages(&l_state, i, elem_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ELM_TYP_MB: /* Loop configuration */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb_messages(&l_state, i, elem_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Calculate the index to each element.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index += l_state.ib_tbl.config.type_hdr[i].num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dpm_display_config() Displays device status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information for a DAKTARI enclosure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedpm_display_config(char *path_phys)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_state l_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteBp_elem_st bpf, bpr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i, j, elem_index = 0, err = 0, count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get global status */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_status(path_phys, &l_state,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Options & PVERBOSE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Look for abnormal status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state.ib_tbl.p2_s.ui.ab_cond) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte abnormal_condition_display(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2247, " DISK STATUS \n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "SLOT DISKS (Node WWN) \n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Print the status for each disk
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < (int)l_state.ib_tbl.config.enc_num_elem; j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state.ib_tbl.config.type_hdr[j].type == ELM_TYP_BP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index += l_state.ib_tbl.config.type_hdr[j].num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &(l_state.ib_tbl.p2_s.element[elem_index]),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&bpf, sizeof (bpf));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &(l_state.ib_tbl.p2_s.element[elem_index + 1]),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&bpr, sizeof (bpr));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0, count = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i < (int)l_state.total_num_drv/2;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i++, count++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%-2d ", count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_disk_msg(&l_state.drv_front[i], &l_state, &bpf, 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < (int)l_state.total_num_drv/2; i++, count++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%-2d ", count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_disk_msg(&l_state.drv_rear[i], &l_state, &bpf, 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Display the subsystem status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2033,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\t\tSUBSYSTEM STATUS\nFW Revision:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < sizeof (l_state.ib_tbl.config.prod_revision); i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%c",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state.ib_tbl.config.prod_revision[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2034, " Box ID:%d"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state.ib_tbl.box_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(90, "Node WWN:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < 8; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%1.2x",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state.ib_tbl.config.enc_node_wwn[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Make sure NULL terminated although it is supposed to be */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strlen((const char *)l_state.ib_tbl.enclosure_name) <=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (l_state.ib_tbl.enclosure_name)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2035, " Enclosure Name:%s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state.ib_tbl.enclosure_name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get and print CONTROLLER messages */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < (int)l_state.ib_tbl.config.enc_num_elem; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index++; /* skip global */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (l_state.ib_tbl.config.type_hdr[i].type) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ELM_TYP_PS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ps_messages(&l_state, i, elem_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ELM_TYP_FT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fan_messages(&l_state, i, elem_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ELM_TYP_BP:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dpm_SSC100_messages(&l_state, i, elem_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ELM_TYP_IB:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ctlr_messages(&l_state, i, elem_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ELM_TYP_LN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * NOTE: I just use the Photon's message
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * string here and don't look at the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * language code. The string includes
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the language name.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state.ib_tbl.config.type_hdr[i].text_len != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s\t",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state.ib_tbl.config.text[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ELM_TYP_LO: /* Loop configuration */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte loop_messages(&l_state, i, elem_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ELM_TYP_MB: /* Loop configuration */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb_messages(&l_state, i, elem_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ELM_TYP_FL:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte trans_messages(&l_state, 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Calculate the index to each element.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index += l_state.ib_tbl.config.type_hdr[i].num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Change the FPM (Front Panel Module) password of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * subsystem associated with the IB addressed by the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * enclosure or pathname to name.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteintfix(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (termio_fd) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte termios.c_lflag |= ECHO;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ioctl(termio_fd, TCSETS, &termios);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(SIGINT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * up_password() Changes the password for SENA enclosure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteup_password(char **argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint path_index = 0, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar password[1024];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar input[1024];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i, j, matched, equal;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid (*sig)();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *path_struct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((termio_fd = open("/dev/tty", O_RDONLY)) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2036, "Error: tty open failed.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ioctl(termio_fd, TCGETS, &termios);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sig = sigset(SIGINT, (void (*)())intfix);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Make sure path valid and is to a PHO
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * before bothering operator.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(argv[path_index], &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_inquiry(path_phys, &inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strstr((char *)inq.inq_pid, ENCLOSURE_PROD_ID) == 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (!(strncmp((char *)inq.inq_vid, "SUN ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (inq.inq_vid)) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((inq.inq_dtype & DTYPE_MASK) == DTYPE_ESI)))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Again this is like the ssaadm code in that the name
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is still not defined before this code must be released.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2037, "Error: Enclosure is not a %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ENCLOSURE_PROD_ID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2038,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Changing FPM password for subsystem %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte equal = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (!equal) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memset(input, 0, sizeof (input));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memset(password, 0, sizeof (password));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2039, "New password: "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte termios.c_lflag &= ~ECHO;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ioctl(termio_fd, TCSETS, &termios);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) gets(input);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2040, "\nRe-enter new password: "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) gets(password);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte termios.c_lflag |= ECHO;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ioctl(termio_fd, TCSETS, &termios);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; input[i]; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!isdigit(input[i])) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2041, "\nError: Invalid password."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " The password"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " must be 4 decimal-digit characters.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i && (i != 4)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2042, "\nError: Invalid password."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " The password"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " must be 4 decimal-digit characters.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; password[j]; j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!isdigit(password[j])) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2043, "\nError: Invalid password."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " The password"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " must be 4 decimal-digit characters.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i != j) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte matched = -1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else for (i = matched = 0; password[i]; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (password[i] == input[i]) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte matched++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((matched != -1) && (matched == i)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte equal = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2044, "\npassword: They don't match;"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " try again.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sscanf(input, "%s", password);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) signal(SIGINT, sig); /* restore signal handler */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Send new password to IB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_new_password(path_phys, input)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Call g_failover to process failover command
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_failover(char **argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint path_index = 0, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar pathclass[20];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(pathclass, 0, sizeof (pathclass));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(pathclass, argv[path_index++]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strcmp(pathclass, "primary") != 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strcmp(pathclass, "secondary") != 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2300, "Incorrect pathclass\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (argv[path_index] != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_phys = g_get_physical_name(argv[path_index++]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((path_phys == NULL) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strstr(path_phys, SCSI_VHCI) == NULL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2301, "Incorrect pathname\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_failover(path_phys, pathclass)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * up_encl_name() Update the enclosures logical name.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteup_encl_name(char **argv, int argc)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i, rval, al_pa, path_index = 0, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteBox_list *b_list = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t node_wwn[WWN_SIZE], port_wwn[WWN_SIZE];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar wwn1[(WWN_SIZE*2)+1], name[1024], *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *path_struct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(name, 0, sizeof (name));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&inq, 0, sizeof (inq));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sscanf(argv[path_index++], "%s", name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; name[i]; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((!isalnum(name[i]) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((name[i] != '#') &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (name[i] != '-') &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (name[i] != '_') &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (name[i] != '.'))) || i >= 16) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2045, "Error: Invalid enclosure name.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, MSGSTR(2046,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Usage: %s [-v] subcommand {a name consisting of"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " 1-16 alphanumeric characters}"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " {enclosure... | pathname...}\n"), whoami);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((Options & PVERBOSE) && (argc != 5)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (!(Options & PVERBOSE) && (argc != 4))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(114, "Error: Incorrect number of arguments.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, MSGSTR(2047,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Usage: %s [-v] subcommand {a name consisting of"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " 1-16 alphanumeric characters}"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " {enclosure... | pathname...}\n"), whoami);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(argv[path_index], &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Make sure we are talking to an IB.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_inquiry(path_phys, &inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strstr((char *)inq.inq_pid, ENCLOSURE_PROD_ID) == 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (!(strncmp((char *)inq.inq_vid, "SUN ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (inq.inq_vid)) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((inq.inq_dtype & DTYPE_MASK) == DTYPE_ESI)))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Again this is like the ssaadm code in that the name
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is still not defined before this code must be released.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2048, "Error: Pathname does not point to a %s"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " enclosure\n"), ENCLOSURE_PROD_NAME);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_wwn(path_phys, port_wwn, node_wwn, &al_pa,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & PVERBOSE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < WWN_SIZE; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(&wwn1[i << 1], "%02x", node_wwn[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_box_list(&b_list, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (b_list == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(93, "No %s enclosures found "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "in /dev/es\n"), ENCLOSURE_PROD_NAME);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (l_duplicate_names(b_list, wwn1, name,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & PVERBOSE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2049, "Warning: The name you selected, %s,"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " is already being used.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Please choose a unique name.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "You can use the \"probe\" subcommand to"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " see all of the enclosure names.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_box_list(&b_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_box_list(&b_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Send new name to IB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rval = l_new_name(path_phys, name)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(rval, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Options & PVERBOSE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2050, "The enclosure has been renamed to %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteget_enclStatus(char *phys_path, char *encl_name, int off_flag)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint found_pwrOnDrv = 0, slot;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint found_pwrOffDrv = 0, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_state l_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_status(phys_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &l_state, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, encl_name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (off_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (slot = 0; slot < l_state.total_num_drv/2;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte slot++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((l_state.drv_front[slot].ib_status.code !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte S_NOT_INSTALLED) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (!l_state.drv_front[slot].ib_status.dev_off)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((l_state.drv_rear[slot].ib_status.code !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte S_NOT_INSTALLED) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (!l_state.drv_rear[slot].ib_status.dev_off))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte found_pwrOnDrv++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!found_pwrOnDrv) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2051,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Notice: Drives in enclosure"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " \"%s\" have already been"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " powered off.\n\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte encl_name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (slot = 0; slot < l_state.total_num_drv/2;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte slot++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((l_state.drv_front[slot].ib_status.code !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte S_NOT_INSTALLED) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_state.drv_front[slot].ib_status.dev_off)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((l_state.drv_rear[slot].ib_status.code !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte S_NOT_INSTALLED) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_state.drv_rear[slot].ib_status.dev_off))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte found_pwrOffDrv++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!found_pwrOffDrv) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2052,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Notice: Drives in enclosure"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " \"%s\" have already been"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " powered on.\n\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte encl_name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * adm_led() The led_request subcommand requests the subsystem
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to display the current state or turn off, on, or blink
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the yellow LED associated with the disk specified by the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * enclosure or pathname.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_led(char **argv, int led_action)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint path_index = 0, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegfc_map_t map;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteDev_elem_st status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *path_struct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint enc_t = 0; /* enclosure type */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar ses_path[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry ses_inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (argv[path_index] != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(argv[path_index], &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Make sure we have a device path. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->ib_path_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_phys = path_struct->p_physical_path;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!path_struct->ib_path_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_inquiry(path_phys, &inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((inq.inq_dtype & DTYPE_MASK) != DTYPE_DIRECT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2053,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Error: pathname must be to a disk device.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s\n"), argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See if we are in fact talking to a loop or not.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_dev_map(path_phys, &map,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Options & PVERBOSE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (led_action == L_LED_ON) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, MSGSTR(2054,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "The led_on functionality is not applicable "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "to this subsystem.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_led(path_struct, led_action, &status,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Options & PVERBOSE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check to see if we have a daktari */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_get_ses_path(path_phys, ses_path, &map,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Options & PVERBOSE)) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (g_get_inquiry(ses_path, &ses_inq) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enc_t = l_get_enc_type(ses_inq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (led_action) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case L_LED_STATUS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status.fault || status.fault_req) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!path_struct->slot_valid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2055, "LED state is ON for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device:\n %s\n"), path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (enc_t == DAK_ENC_TYPE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->f_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2236, "LED state is ON for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device in location: slot %d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2236, "LED state is ON for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device in location: slot %d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->slot +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (MAX_DRIVES_DAK/2));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (path_struct->f_flag) ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2056, "LED state is ON for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device in location: front,slot %d\n")
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte : MSGSTR(2057, "LED state is ON for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device in location: rear,slot %d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (status.ident || status.rdy_to_ins ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status.rmv) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!path_struct->slot_valid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2058,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "LED state is BLINKING for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device:\n %s\n"), path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (enc_t == DAK_ENC_TYPE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->f_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2237,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "LED state is BLINKING for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device in location: slot %d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2237,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "LED state is BLINKING for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device in location: slot %d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->slot + (MAX_DRIVES_DAK/2));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (path_struct->f_flag) ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2059, "LED state is BLINKING for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device in location: front,slot %d\n")
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte : MSGSTR(2060, "LED state is BLINKING for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device in location: rear,slot %d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!path_struct->slot_valid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2061, "LED state is OFF for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device:\n %s\n"), path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (enc_t == DAK_ENC_TYPE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->f_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2238,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "LED state is OFF for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device in location: slot %d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2238,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "LED state is OFF for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device in location: slot %d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->slot + MAX_DRIVES_DAK/2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (path_struct->f_flag) ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2062, "LED state is OFF for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device in location: front,slot %d\n")
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte : MSGSTR(2063, "LED state is OFF for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device in location: rear,slot %d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free((void *)map.dev_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dump() Dump information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedump(char **argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t *buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint path_index = 0, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar hdr_buf[MAXNAMELEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteRec_diag_hdr *hdr, *hdr_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *path_struct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get big buffer
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((hdr = (struct rec_diag_hdr *)calloc(1, MAX_REC_DIAG_LENGTH)) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(L_MALLOC_FAILED, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte buf = (uchar_t *)hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (argv[path_index] != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(argv[path_index], &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_inquiry(path_phys, &inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_dump(MSGSTR(2065, "INQUIRY data: "),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uchar_t *)&inq, 5 + inq.inq_len, HEX_ASCII);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(buf, 0, MAX_REC_DIAG_LENGTH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_envsen(path_phys, buf, MAX_REC_DIAG_LENGTH,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Options & PVERBOSE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2066, "\t\tEnvironmental Sense Information\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dump all pages.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte hdr_ptr = hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (hdr_ptr->page_len != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(hdr_buf, MSGSTR(2067, "Page %d: "),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte hdr_ptr->page_code);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_dump(hdr_buf, (uchar_t *)hdr_ptr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HEADER_LEN + hdr_ptr->page_len, HEX_ASCII);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte hdr_ptr += ((HEADER_LEN + hdr_ptr->page_len) /
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (struct rec_diag_hdr));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) free(buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * display_socal_stats() Display socal driver kstat information.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_socal_stats(int port, char *socal_path, struct socal_stats *fc_stats)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint header_flag = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar status_msg_buf[MAXNAMELEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint num_status_entries;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2068,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\tInformation for FC Loop on port %d of"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " FC100/S Host Adapter\n\tat path: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port, socal_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fc_stats->version > 1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(32,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Information from %s"), fc_stats->drvr_name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*fc_stats->node_wwn != NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*fc_stats->port_wwn[port] != NULL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(104,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Host Adapter WWN's: Node:%s"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Port:%s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->node_wwn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->port_wwn[port]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*fc_stats->fw_revision != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(105,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Host Adapter Firmware Revision: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->fw_revision);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fc_stats->parity_chk_enabled != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2069,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " This Host Adapter checks S-Bus parity.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2070,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Version Resets Req_Q_Intrpts Qfulls"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Unsol_Resps Lips\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " %4d%8d%11d%13d%10d%7d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->version,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->resets,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->reqq_intrs,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->qfulls,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->pstats[port].unsol_resps,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->pstats[port].lips);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2071,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Els_rcvd Abts"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Abts_ok Offlines Loop_onlines Onlines\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " %4d%9d%10d%9d%13d%10d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->pstats[port].els_rcvd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->pstats[port].abts,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->pstats[port].abts_ok,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->pstats[port].offlines,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->pstats[port].online_loops,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->pstats[port].onlines);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* If any status conditions exist then display */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fc_stats->version > 1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte num_status_entries = FC_STATUS_ENTRIES;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte num_status_entries = 64;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < num_status_entries; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fc_stats->pstats[port].resp_status[i] != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (header_flag++ == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2072,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Fibre Channel Transport status:\n "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Status Value"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Count\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_format_fc_status_msg(status_msg_buf,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_stats->pstats[port].resp_status[i], i);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status_msg_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * display_sf_stats() Display sf driver kstat information.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This routine is called by private loop device only
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_sf_stats(char *path_phys, int dtype, struct sf_stats *sf_stats)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i, al_pa, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegfc_map_t map;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t node_wwn[WWN_SIZE];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t port_wwn[WWN_SIZE];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegfc_port_dev_info_t *dev_addr_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (sf_stats->version > 1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(32,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Information from %s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->drvr_name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2073, "\n\t\tInformation from sf driver:\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2074,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Version Lip_count Lip_fail"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Alloc_fail #_cmds "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Throttle_limit Pool_size\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " %4d%9d%12d%11d%10d%11d%12d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->version,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->lip_count,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->lip_failures,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->cralloc_failures,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->ncmds,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->throttle_limit,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->cr_pool_size);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2075,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\n\t\tTARGET ERROR INFORMATION:\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2076,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "AL_PA Els_fail Timouts Abts_fail"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Tsk_m_fail "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Data_ro_mis Dl_len_mis Logouts\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_dev_map(path_phys, &map, (Options & PVERBOSE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dtype == DTYPE_DIRECT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_wwn(path_phys, port_wwn, node_wwn, &al_pa,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & PVERBOSE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* for san toleration, only need to modify the code */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* such that the current sf_al_map structure replaced */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* by the new gfc_map structure for private loop device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0, dev_addr_list = map.dev_addr; i < map.count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i++, dev_addr_list++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dev_addr_list->gfc_port_dev.priv_port.sf_al_pa
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == al_pa) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%3x%10d%8d%10d%11d%13d%11d%9d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte al_pa,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->tstats[i].els_failures,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->tstats[i].timeouts,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->tstats[i].abts_failures,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->tstats[i].task_mgmt_failures,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->tstats[i].data_ro_mismatches,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->tstats[i].dl_len_mismatches,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->tstats[i].logouts_recvd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i >= map.count) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(L_INVALID_LOOP_MAP, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0, dev_addr_list = map.dev_addr; i < map.count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i++, dev_addr_list++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%3x%10d%8d%10d%11d%13d%11d%9d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_addr_list->gfc_port_dev.priv_port.sf_al_pa,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->tstats[i].els_failures,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->tstats[i].timeouts,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->tstats[i].abts_failures,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->tstats[i].task_mgmt_failures,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->tstats[i].data_ro_mismatches,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->tstats[i].dl_len_mismatches,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_stats->tstats[i].logouts_recvd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free((void *)map.dev_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * adm_display_err() Displays enclosure specific
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * error information.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_display_err(char *path_phys, int dtype)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i, drvr_inst, sf_inst, socal_inst, port, al_pa, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *char_ptr, socal_path[MAXPATHLEN], drvr_path[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct stat sbuf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortekstat_ctl_t *kc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortekstat_t *ifp_ks, *sf_ks, *fc_ks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesf_stats_t sf_stats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesocal_stats_t fc_stats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteifp_stats_t ifp_stats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint header_flag = 0, pathcnt = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar status_msg_buf[MAXNAMELEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegfc_map_t map;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t node_wwn[WWN_SIZE], port_wwn[WWN_SIZE];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuint_t path_type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegfc_port_dev_info_t *dev_addr_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemp_pathlist_t pathlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint p_on = 0, p_st = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((kc = kstat_open()) == (kstat_ctl_t *)NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2077, " Error: can't open kstat\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(path_phys, SCSI_VHCI)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(drvr_path, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_pathlist(drvr_path, &pathlist)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathcnt = pathlist.path_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte p_on = p_st = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < pathcnt; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pathlist.path_info[i].path_state < MAXPATHSTATE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pathlist.path_info[i].path_state ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MDI_PATHINFO_STATE_ONLINE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte p_on = i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else 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 (pathlist.path_info[p_on].path_state ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MDI_PATHINFO_STATE_ONLINE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* on_line path */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(drvr_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[p_on].path_hba);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* standby or path0 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(drvr_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[p_st].path_hba);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(pathlist.path_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(drvr_path, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((char_ptr = strrchr(drvr_path, '/')) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(L_INVLD_PATH_NO_SLASH_FND,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *char_ptr = '\0'; /* Make into nexus or HBA driver path. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Each HBA and driver stack has its own structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * for this, so we have to handle each one individually.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_type = g_get_path_type(drvr_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_type) { /* Quick sanity check for valid path */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_nexus_path(drvr_path, &char_ptr)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(socal_path, char_ptr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* attach :devctl to get node stat instead of dir stat. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcat(drvr_path, FC_CTLR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (stat(drvr_path, &sbuf) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(L_LSTAT_ERROR, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte drvr_inst = minor(sbuf.st_rdev);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * first take care of ifp card.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_type & FC4_PCI_FCA) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ifp_ks = kstat_lookup(kc, "ifp",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte drvr_inst, "statistics")) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (kstat_read(kc, ifp_ks, &ifp_stats) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2082,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Error: could not read ifp%d\n"), drvr_inst);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2083,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\tInformation for FC Loop of"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " FC100/P Host Adapter\n\tat path: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte drvr_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ifp_stats.version > 1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(32,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Information from %s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ifp_stats.drvr_name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*ifp_stats.node_wwn != NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ifp_stats.port_wwn != NULL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(104,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Host Adapter WWN's: Node:%s"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Port:%s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ifp_stats.node_wwn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ifp_stats.port_wwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*ifp_stats.fw_revision != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(105,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Host Adapter Firmware Revision: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ifp_stats.fw_revision);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ifp_stats.parity_chk_enabled != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2084,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " This Host Adapter checks "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "PCI-Bus parity.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2085,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Version Lips\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " %10d%7d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ifp_stats.version,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ifp_stats.lip_count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* If any status conditions exist then display */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < FC_STATUS_ENTRIES; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ifp_stats.resp_status[i] != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (header_flag++ == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2086,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Fibre Channel Transport "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "status:\n "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Status "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Value"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Count\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_format_ifp_status_msg(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status_msg_buf,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ifp_stats.resp_status[i], i);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status_msg_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2087,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\n\t\tTARGET ERROR INFORMATION:\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2088,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "AL_PA logouts_recvd task_mgmt_failures"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " data_ro_mismatches data_len_mismatch\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_dev_map(path_phys, &map,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Options & PVERBOSE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dtype == DTYPE_DIRECT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_wwn(path_phys, port_wwn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte node_wwn, &al_pa,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & PVERBOSE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0, dev_addr_list = map.dev_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i < map.count; i++,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_addr_list++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dev_addr_list->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte priv_port.sf_al_pa
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == al_pa) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%3x%14d%18d%20d%20d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte al_pa,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ifp_stats.tstats[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte logouts_recvd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ifp_stats.tstats[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte task_mgmt_failures,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ifp_stats.tstats[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte data_ro_mismatches,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ifp_stats.tstats[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl_len_mismatches);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i >= map.count) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte L_INVALID_LOOP_MAP, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0, dev_addr_list = map.dev_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i < map.count; i++,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_addr_list++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%3x%14d%18d%20d%20d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_addr_list->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte priv_port.sf_al_pa,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ifp_stats.tstats[i].logouts_recvd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ifp_stats.tstats[i].task_mgmt_failures,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ifp_stats.tstats[i].data_ro_mismatches,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ifp_stats.tstats[i].dl_len_mismatches);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free((void *)map.dev_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (path_type & FC4_SF_XPORT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * process cards with sf xport nodes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (stat(socal_path, &sbuf) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(L_LSTAT_ERROR, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte socal_inst = minor(sbuf.st_rdev)/2;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port = socal_inst%2;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_inst = LUX_SF_MINOR2INST(minor(sbuf.st_rdev));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(sf_ks = kstat_lookup(kc, "sf", sf_inst,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "statistics"))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2078,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: could not lookup driver stats for sf%d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_inst);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(fc_ks = kstat_lookup(kc, "socal", socal_inst,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "statistics"))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2079,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: could not lookup driver stats for socal%d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte socal_inst);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (kstat_read(kc, sf_ks, &sf_stats) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2080,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: could not read driver stats for sf%d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_inst);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (kstat_read(kc, fc_ks, &fc_stats) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2081,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: could not read driver stats for socal%d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte socal_inst);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) display_socal_stats(port, socal_path, &fc_stats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) display_sf_stats(path_phys, dtype, &sf_stats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((path_type & FC_FCA_MASK) == FC_PCI_FCA) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, MSGSTR(2252,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\n WARNING!! display -r on qlc is"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " currently not supported.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, MSGSTR(2253,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\n WARNING!! display -r is not supported on path\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s\n"), drvr_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) kstat_close(kc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * adm_display_verbose_disk() Gets the mode page information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * for a SENA disk and prints that information.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_display_verbose_disk(char *path, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t *pg_buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteMode_header_10 *mode_header_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteMp_01 *pg1_buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteMp_04 *pg4_buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct mode_page *pg_hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint offset, hdr_printed = 0, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_mode_pg(path, &pg_buf, verbose)) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_header_ptr = (struct mode_header_10_struct *)(int)pg_buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg_hdr = ((struct mode_page *)((int)pg_buf +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uchar_t)sizeof (struct mode_header_10_struct) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uchar_t *)(uintptr_t)(mode_header_ptr->bdesc_length)));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = sizeof (struct mode_header_10_struct) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_header_ptr->bdesc_length;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (offset < (mode_header_ptr->length +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (mode_header_ptr->length))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (pg_hdr->code) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x01:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg1_buf = (struct mode_page_01_struct *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (int)pg_hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte P_DPRINTF(" adm_display_verbose_disk:"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Mode Sense page 1 found.\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (hdr_printed++ == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2089,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Mode Sense data:\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2090,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " AWRE:\t\t\t%d\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " ARRE:\t\t\t%d\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Read Retry Count:\t\t"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%d\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Write Retry Count:\t\t"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg1_buf->awre,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg1_buf->arre,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg1_buf->read_retry_count,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg1_buf->write_retry_count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MODEPAGE_GEOMETRY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg4_buf = (struct mode_page_04_struct *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (int)pg_hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte P_DPRINTF(" adm_display_verbose_disk:"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Mode Sense page 4 found.\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (hdr_printed++ == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2091,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Mode Sense data:\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pg4_buf->rpm) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2092,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Medium rotation rate:\t"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%d RPM\n"), pg4_buf->rpm);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset += pg_hdr->length + sizeof (struct mode_page);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg_hdr = ((struct mode_page *)((int)pg_buf +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uchar_t)offset));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (getenv("_LUX_P_DEBUG") != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Print out the port_wwn or node_wwn
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteprint_wwn(FILE *fd, uchar_t *pn_wwn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(fd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %1.2x%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pn_wwn[0], pn_wwn[1], pn_wwn[2], pn_wwn[3],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pn_wwn[4], pn_wwn[5], pn_wwn[6], pn_wwn[7]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Print out the fabric dev port_id, hard_addr, port_wwn and node_wwn
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteprint_fabric_prop(int pos, uchar_t *port_wwn, uchar_t *node_wwn, int port_addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int hard_addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%-4d %-6x %-6x ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pos, port_addr, hard_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_wwn(stdout, port_wwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_wwn(stdout, node_wwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Print out the private loop dev port_id, hard_addr, port_wwn and node_wwn
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteprint_private_loop_prop(int pos, uchar_t *port_wwn, uchar_t *node_wwn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int port_addr, int hard_addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%-3d %-2x %-2x %-2x ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pos, port_addr, g_sf_alpa_to_switch[port_addr], hard_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_wwn(stdout, port_wwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_wwn(stdout, node_wwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get the device map from
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fc nexus driver and prints the map.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedump_map(char **argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i = 0, path_index = 0, pathcnt = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint limited_map_flag = 0, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *path_struct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct lilpmap limited_map;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuint_t dev_type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar temp2path[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemp_pathlist_t pathlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint p_pw = 0, p_on = 0, p_st = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegfc_dev_t map_root, map_dev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint *port_addr, *hard_addr, pos = 0, count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t *hba_port_wwn, *port_wwn, *node_wwn, *dtype_prop;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuint_t map_topo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (argv[path_index] != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(argv[path_index], &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(path_phys, SCSI_VHCI) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* obtain phci */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(temp2path, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_pathlist(temp2path, &pathlist)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
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(temp2path,
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(temp2path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[p_on].path_hba);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* standby or path0 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(temp2path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[p_st].path_hba);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(pathlist.path_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcat(temp2path, FC_CTLR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(temp2path, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((dev_type = g_get_path_type(temp2path)) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(L_INVALID_PATH,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((map_root = g_dev_map_init(temp2path, &err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MAP_FORMAT_LILP)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dev_type & FC_FCA_MASK) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This did not work so try the FCIO_GETMAP
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * type ioctl.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_limited_map(path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &limited_map, (Options & PVERBOSE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte limited_map_flag++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (limited_map_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2093,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Host Adapter AL_PA: %x\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte limited_map.lilp_myalpa);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2094,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Pos AL_PA\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < (uint_t)limited_map.lilp_length; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%-3d %-2x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i, limited_map.lilp_list[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_dev_prop_lookup_bytes(map_root,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PORT_WWN_PROP, &count, &hba_port_wwn)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dev_map_fini(map_root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_map_topology(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte map_root, &map_topo)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((map_dev = g_get_first_dev(map_root, &err)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err == L_NO_SUCH_DEV_FOUND) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dev_map_fini(map_root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2308, " No devices are found on %s.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dev_map_fini(map_root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (map_topo) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_FABRIC:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_PUBLIC_LOOP:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_PT_PT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2095, "Pos Port_ID Hard_Addr Port WWN"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Node WWN Type\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (map_dev) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_dev_prop_lookup_ints(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte map_dev, PORT_ADDR_PROP, &port_addr)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dev_map_fini(map_root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_dev_prop_lookup_bytes(map_dev,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PORT_WWN_PROP, &count, &port_wwn)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dev_map_fini(map_root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_dev_prop_lookup_bytes(map_dev,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NODE_WWN_PROP, &count, &node_wwn)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dev_map_fini(map_root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_dev_prop_lookup_ints(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte map_dev, HARD_ADDR_PROP, &hard_addr)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dev_map_fini(map_root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_fabric_prop(pos++, port_wwn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte node_wwn, *port_addr, *hard_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_dev_prop_lookup_bytes(map_dev,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte INQ_DTYPE_PROP, &count, &dtype_prop)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2307, " Failed to get the type.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_fabric_dtype_prop(hba_port_wwn, port_wwn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *dtype_prop);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((map_dev = g_get_next_dev(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte map_dev, &err)) == NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (err != L_NO_SUCH_DEV_FOUND)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dev_map_fini(map_root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_PRIVATE_LOOP:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2295,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Pos AL_PA ID Hard_Addr "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Port WWN Node WWN Type\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (map_dev) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_dev_prop_lookup_ints(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte map_dev, PORT_ADDR_PROP, &port_addr)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dev_map_fini(map_root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_dev_prop_lookup_bytes(map_dev,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PORT_WWN_PROP, &count, &port_wwn)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dev_map_fini(map_root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_dev_prop_lookup_bytes(map_dev,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NODE_WWN_PROP, &count, &node_wwn)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dev_map_fini(map_root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_dev_prop_lookup_ints(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte map_dev, HARD_ADDR_PROP, &hard_addr)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dev_map_fini(map_root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_private_loop_prop(pos++, port_wwn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte node_wwn, *port_addr, *hard_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_dev_prop_lookup_bytes(map_dev,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte INQ_DTYPE_PROP, &count, &dtype_prop)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2307, " Failed to get the type.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_private_loop_dtype_prop(hba_port_wwn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port_wwn, *dtype_prop);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((map_dev = g_get_next_dev(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte map_dev, &err)) == NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (err != L_NO_SUCH_DEV_FOUND)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dev_map_fini(map_root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(L_UNEXPECTED_FC_TOPOLOGY,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[path_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dev_map_fini(map_root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte limited_map_flag = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets a list of non-SENA fcal devices
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * found on the system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * OUTPUT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * wwn_list pointer
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * NULL: No non-enclosure devices found.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * !NULL: Devices found
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * wwn_list points to a linked list of wwn's.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 O.K.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forten_get_non_encl_list(WWN_list **wwn_list_ptr, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i, j, k, err, found_ib = 0, pathcnt = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteWWN_list *wwn_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteBox_list *b_list = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegfc_map_t map;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t box_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegfc_port_dev_info_t *dev_addr_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar phci_path[MAXPATHLEN], oldphci_path[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemp_pathlist_t pathlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Only interested in devices that are not part of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * a Photon enclosure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_box_list(&b_list, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err); /* Failure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_wwn_list(&wwn_list, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_box_list(&b_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (b_list != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathcnt = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(b_list->b_physical_path, SCSI_VHCI) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(phci_path, b_list->b_physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_pathlist(phci_path, &pathlist)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathcnt = pathlist.path_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (k = 0; k < pathcnt; k++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((k > 0) && (strstr(oldphci_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[k].path_hba))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(b_list->b_physical_path, SCSI_VHCI) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_dev_map(b_list->b_physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &map, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_wwn_list(&wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_box_list(&b_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(phci_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[k].path_hba);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(oldphci_path, phci_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcat(phci_path, FC_CTLR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (g_get_dev_map(phci_path, &map, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pathcnt == 1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(pathlist.path_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (map.hba_addr.port_topology) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_FABRIC:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_PUBLIC_LOOP:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0, dev_addr_list = map.dev_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i < map.count; i++, dev_addr_list++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (found_ib = 1, j = 0; j < WWN_SIZE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (b_list->b_node_wwn[j] !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_addr_list->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pub_port.dev_nwwn.raw_wwn[j]) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte found_ib = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (found_ib) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) n_rem_list_entry_fabric(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_addr_list->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pub_port.dev_did.port_id, &map,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_PRIVATE_LOOP:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0, dev_addr_list = map.dev_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i < map.count; i++, dev_addr_list++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (found_ib = 1, j = 0; j < WWN_SIZE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (b_list->b_node_wwn[j] !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_addr_list->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte priv_port.sf_node_wwn[j]) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte found_ib = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (found_ib) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte box_id = g_sf_alpa_to_switch
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte [dev_addr_list->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte priv_port.sf_al_pa] &
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte BOX_ID_MASK;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* This function has been added */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* here only to keep from having */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* to tab over farther */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) n_rem_list_entry(box_id, &map,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wwn_list == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return the list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *wwn_list_ptr = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_PT_PT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) free((void *)map.dev_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_PT_PT_FC_TOP_NOT_SUPPORTED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) free((void *)map.dev_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_UNEXPECTED_FC_TOPOLOGY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free((void *)map.dev_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pathcnt > 1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(pathlist.path_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte b_list = b_list->box_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return the list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *wwn_list_ptr = wwn_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_box_list(&b_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * n_rem_list_entry() We found an IB so remove disks that
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * are in the Photon from the individual device list.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * OUTPUT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * wwn_list - removes the fcal disks that are in SENA enclosure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forten_rem_list_entry(uchar_t box_id, struct gfc_map *map,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct wwn_list_struct **wwn_list)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint k;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegfc_port_dev_info_t *dev_addr_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte N_DPRINTF(" n_rem_list_entry: Removing devices"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " with box_id=0x%x from device list.\n", box_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (k = 0, dev_addr_list = map->dev_addr; k < map->count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte k++, dev_addr_list++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((g_sf_alpa_to_switch[dev_addr_list->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte priv_port.sf_hard_address] & BOX_ID_MASK)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == box_id) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n_rem_wwn_entry(dev_addr_list->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte priv_port.sf_node_wwn, wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * n_rem_list_entry_fabric() We found an IB so remove disks that
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * are in the Photon from the individual device list.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * OUTPUT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * wwn_list - removes the fcal disks that are in SENA enclosure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forten_rem_list_entry_fabric(int pa, struct gfc_map *map,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct wwn_list_struct **wwn_list)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint k;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegfc_port_dev_info_t *dev_addr_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte N_DPRINTF(" n_rem_list_entry: Removing devices"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " with the same domain and area ID as"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " 0x%x PA from device list.\n", pa);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (k = 0, dev_addr_ptr = map->dev_addr; k < map->count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte k++, dev_addr_ptr++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* matching the domain and area id with input alpa, */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ignoring last 8 bits. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((dev_addr_ptr->gfc_port_dev.pub_port.dev_did.port_id |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0xff) == (pa | 0xff)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n_rem_wwn_entry(dev_addr_ptr->
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gfc_port_dev.pub_port.dev_nwwn.raw_wwn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * n_rem_wwn_entry() removes input wwn from wwn_list.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * OUTPUT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * wwn_list - removes the input wwn from wwn_list if found.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forten_rem_wwn_entry(uchar_t node_wwn[], struct wwn_list_struct **wwn_list)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint l, found_dev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteWWN_list *inner, *l1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner = *wwn_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (inner != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (found_dev = 1, l = 0; l < WWN_SIZE; l++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (inner->w_node_wwn[l] != node_wwn[l]) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte found_dev = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (found_dev) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Remove this entry from the list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (inner->wwn_prev != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner->wwn_prev->wwn_next =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner->wwn_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *wwn_list = inner->wwn_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (inner->wwn_next != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner->wwn_next->wwn_prev =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner->wwn_prev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l1 = inner;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte N_DPRINTF(" n_rem_wwn_entry: "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Removing Logical=%s "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Current=0x%x, "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Prev=0x%x, Next=0x%x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l1->logical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l1->wwn_prev,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l1->wwn_next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner = inner->wwn_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((l1->wwn_prev == NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l1->wwn_next) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) free(l1->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) free(l1->logical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) free(l1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *wwn_list = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte N_DPRINTF(" n_rem_list_entry: "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "No non-Photon "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "devices left"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " in the list.\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) free(l1->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) free(l1->logical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) free(l1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner = inner->wwn_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * non_encl_probe() Finds and displays a list of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * non-SENA fcal devices which is found on the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortenon_encl_probe()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteWWN_list *wwn_list, *wwn_listh, *inner, *l1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar lun_a[MAXPATHLEN], lun_b[MAXPATHLEN], temppath[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *tempptra, *tempptrb, *tempptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemp_pathlist_t pathlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint compare_result, retr_outer = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteddi_devid_t devid1 = NULL, devid2 = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedi_node_t root = DI_NODE_NIL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = n_get_non_encl_list(&wwn_list, (Options & PVERBOSE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_sort_wwn_list(&wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_listh = wwn_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wwn_list != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wwn_list->wwn_next != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2098, "\nFound Fibre Channel device(s):\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2099, "\nFound Fibre Channel device:\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (wwn_list != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(wwn_list->physical_path, SCSI_VHCI) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(temppath, wwn_list->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((!g_get_pathlist(temppath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pathlist)) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((tempptra = strchr(pathlist.path_info[0].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_addr, ','))) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tempptra++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(lun_a, tempptra);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(pathlist.path_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((((tempptr = strstr(wwn_list->physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SLSH_DRV_NAME_ST)) != NULL) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((tempptr = strstr(wwn_list->physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SLSH_DRV_NAME_SSD)) != NULL)) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((tempptra = strchr(tempptr, ',')) != NULL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tempptra++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(lun_a, tempptra);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(90, "Node WWN:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s ", wwn_list->node_wwn_s);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wwn_list->device_type < 0x10) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(35, "Device Type:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dtype[wwn_list->device_type]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (wwn_list->device_type < 0x1f) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2100,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Type:Reserved"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2101,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Type:Unknown"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(31, "Logical Path:%s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list->logical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Options & OPTION_P) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(5, "Physical Path:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n %s\n", wwn_list->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner = wwn_list->wwn_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (inner != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(inner->node_wwn_s, wwn_list->node_wwn_s) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (tempptra != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(inner->physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SCSI_VHCI) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(temppath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((!g_get_pathlist(temppath, &pathlist)) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((tempptrb = strchr(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[0].path_addr, ','))) !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tempptrb++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(lun_b, tempptrb);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(pathlist.path_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((((tempptr = strstr(inner->physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SLSH_DRV_NAME_ST)) != NULL) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((tempptr = strstr(inner->physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SLSH_DRV_NAME_SSD)) != NULL)) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((tempptrb = strchr(tempptr, ',')) != NULL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tempptrb++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(lun_b, tempptrb);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((tempptra == NULL) || (strcmp(lun_a, lun_b)) == 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Have we retrieved a snapshot yet?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (root == DI_NODE_NIL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((root = di_init("/", DINFOCPYALL)) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DI_NODE_NIL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2319,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\nFailed to get device tree snapshot:\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Apply devid to ssd devices only */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!retr_outer && strstr(wwn_list->physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SLSH_DRV_NAME_SSD) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_devid_get(wwn_list->physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &devid1, root, SSD_DRVR_NAME)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Try retrieve of devid only once. If it fails
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * don't try it again but print error,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * There should be a devid prop.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retr_outer = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Apply devid to block devices only.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get devid of inner path and compare
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * with outer path's devid.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strstr(inner->physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SLSH_DRV_NAME_SSD) != NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte devid1 != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_devid_get(inner->physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &devid2, root, SSD_DRVR_NAME)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte compare_result = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte compare_result = devid_compare(devid1, devid2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* devid isn't applied */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte compare_result = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (compare_result == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(wwn_list->logical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner->logical_path)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(31, "Logical Path:%s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner->logical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Options & OPTION_P) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(5,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Physical Path:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Remove this entry from the list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (inner->wwn_prev != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner->wwn_prev->wwn_next =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner->wwn_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (inner->wwn_next != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner->wwn_next->wwn_prev =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner->wwn_prev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(inner->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(inner->logical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l1 = inner;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner = inner->wwn_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) free(l1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner = inner->wwn_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* End if (compare_result == 0) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner = inner->wwn_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inner = inner->wwn_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte devid2 = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list = wwn_list->wwn_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retr_outer = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte devid1 = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* End while (wwn_list != NULL) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_wwn_list(&wwn_listh);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) di_fini(root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepho_probe()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteBox_list *b_list, *o_list, *c_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint multi_path_flag, multi_print_flag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint duplicate_names_found = 0, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte b_list = o_list = c_list = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_box_list(&b_list, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (b_list == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(93, "No %s enclosures found "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "in /dev/es\n"), ENCLOSURE_PROD_NAME);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte o_list = b_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (b_list->box_next != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2102,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Found Enclosure(s)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2103, "Found Enclosure"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ":\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (b_list != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Don't re-print multiple paths */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c_list = o_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte multi_print_flag = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (c_list != b_list) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(c_list->b_node_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte b_list->b_node_wwn_s) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte multi_print_flag = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c_list = c_list->box_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (multi_print_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte b_list = b_list->box_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2104, "%s Name:%s Node WWN:%s "),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte b_list->prod_id_s, b_list->b_name,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte b_list->b_node_wwn_s);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Print logical path on same line if not multipathed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte multi_path_flag = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c_list = o_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (c_list != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((c_list != b_list) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strcmp(c_list->b_node_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte b_list->b_node_wwn_s) == 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte multi_path_flag = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c_list = c_list->box_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (multi_path_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(31, "Logical Path:%s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte b_list->logical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Options & OPTION_P) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(5, "Physical Path:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte b_list->b_physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c_list = o_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (c_list != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((c_list != b_list) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strcmp(c_list->b_node_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte b_list->b_node_wwn_s) == 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(31, "Logical Path:%s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c_list->logical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Options & OPTION_P) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(5, "Physical Path:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c_list->b_physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c_list = c_list->box_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for duplicate names */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_duplicate_names(o_list, b_list->b_node_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (char *)b_list->b_name,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & PVERBOSE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte duplicate_names_found++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte b_list = b_list->box_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (duplicate_names_found) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2105, "\nWARNING: There are enclosures with "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "the same names.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "You can not use the \"enclosure\""
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " name to specify these subsystems.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Please use the \"enclosure_name\""
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " subcommand to select unique names.\n\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_box_list(&b_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * display_port_status() Prints the device's
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * port status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_port_status(int d_state_flag)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (d_state_flag & L_OPEN_FAIL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(28, "Open Failed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (d_state_flag & L_NOT_READY) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(20, "Not Ready"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (d_state_flag & L_NOT_READABLE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(88, "Not Readable"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (d_state_flag & L_SPUN_DWN_D) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(68, "Spun Down"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (d_state_flag & L_SCSI_ERR) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(70, "SCSI Error"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (d_state_flag & L_RESERVED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(73, "Reservation conflict"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (d_state_flag & L_NO_LABEL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(92, "No UNIX Label"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(29, "O.K."));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Displays individual SENA
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FC disk information.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Caller to this routine should free the storage due to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the use of g_get_dev_map
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_fc_disk(struct path_struct *path_struct, char *ses_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gfc_map_t *map, L_inquiry inq, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic WWN_list *wwn_list = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char path_phys[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic L_disk_state l_disk_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic L_inquiry local_inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uchar_t node_wwn[WWN_SIZE];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar same_path_phys = B_FALSE; /* To chk for repeat args */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t port_wwn[WWN_SIZE], *pg_buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar logical_path[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint al_pa, port_a_flag = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint offset, mode_data_avail = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint no_path_flag = 0, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_state l_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteMode_header_10 *mode_header_ptr = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct mode_page *pg_hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Do a quick check to see if its the same path as in last call.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * path_phys is a static array and so dont worry about its
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * initialization.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(path_phys, path_struct->p_physical_path) == 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte same_path_phys = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(path_phys, path_struct->p_physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset((char *)logical_path, 0, sizeof (logical_path));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * slot_valid is 1 when argument is of the form 'enclosure,[f|r]<n>'.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If slot_valid != 1, g_get_dev_map and l_get_ses_path would
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * already have been called
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->slot_valid == 1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the location information. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_dev_map(path_phys, map, (Options & PVERBOSE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_ses_path(path_phys, ses_path, map,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Options & PVERBOSE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get the WWN for our disk if we already haven't or if there was an
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * error earlier
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (same_path_phys == B_FALSE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_wwn(path_phys, port_wwn, node_wwn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &al_pa, (Options & PVERBOSE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_inquiry(ses_path, &local_inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, ses_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We are interested only a couple of ib_tbl fields and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * those get filled using l_get_ib_status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Note that NOT ALL of ib_tbl fields get filled here
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_ib_status(ses_path, &l_state,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, ses_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get path to all the FC disk and tape devices.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if we haven't already done so in a previous pass
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((wwn_list == NULL) && (err = g_get_wwn_list(&wwn_list, verbose))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, ses_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1); /* Failure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get the disk status if it is a different path_phys from
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * last time.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (same_path_phys == B_FALSE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&l_disk_state, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (struct l_disk_state_struct));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_disk_status(path_phys, &l_disk_state,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list, (Options & PVERBOSE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_disk_state.l_state_flag & L_NO_PATH_FOUND) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, MSGSTR(2106,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\nWARNING: No path found "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "in /dev/rdsk directory\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Please check the logical links in /dev/rdsk\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " (It may be necessary to run the \"disks\" "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "program.)\n\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Just call to get the status directly. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_port(ses_path, &port_a_flag, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, ses_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_disk_port_status(path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &l_disk_state, port_a_flag,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Options & PVERBOSE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte no_path_flag++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strlen(l_disk_state.g_disk_state.node_wwn_s) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(l_disk_state.g_disk_state.node_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte node_wwn[0], node_wwn[1], node_wwn[2], node_wwn[3],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte node_wwn[4], node_wwn[5], node_wwn[6], node_wwn[7]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get mode page information for FC device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_get_mode_pg(path_phys, &pg_buf, Options & PVERBOSE) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_header_ptr = (struct mode_header_10_struct *)(int)pg_buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg_hdr = ((struct mode_page *)((int)pg_buf +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uchar_t)sizeof (struct mode_header_10_struct) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uchar_t *)(uintptr_t)(mode_header_ptr->bdesc_length)));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = sizeof (struct mode_header_10_struct) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_header_ptr->bdesc_length;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (offset < (mode_header_ptr->length +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (mode_header_ptr->length)) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !mode_data_avail) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pg_hdr->code == MODEPAGE_CACHING) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_data_avail++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset += pg_hdr->length + sizeof (struct mode_page);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg_hdr = ((struct mode_page *)((int)pg_buf +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uchar_t)offset));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch ((inq.inq_dtype & DTYPE_MASK)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case DTYPE_DIRECT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(121, "DEVICE PROPERTIES for disk: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case DTYPE_SEQUENTIAL: /* Tape */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(2249, "DEVICE PROPERTIES for tape: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(2250, "DEVICE PROPERTIES for: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_disk_state.g_disk_state.port_a_valid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(141, "Status(Port A):"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_port_status(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_disk_state.g_disk_state.d_state_flags[PORT_A]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->f_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ib_present_chk(&l_state, 0) == 1) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_state.drv_front[path_struct->slot].ib_status.bypass_a_en)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(66,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Status(Port A):\tBYPASSED\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ib_present_chk(&l_state, 0) == 1) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_state.drv_rear[path_struct->slot].ib_status.bypass_a_en)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(66,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Status(Port A):\tBYPASSED\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_disk_state.g_disk_state.port_b_valid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(142, "Status(Port B):"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_port_status(l_disk_state.g_disk_state.d_state_flags[PORT_B]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->f_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ib_present_chk(&l_state, 1) == 1) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_state.drv_front[path_struct->slot].ib_status.bypass_b_en)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(65,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Status(Port B):\tBYPASSED\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ib_present_chk(&l_state, 1) == 1) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_state.drv_rear[path_struct->slot].ib_status.bypass_b_en)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(65,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Status(Port B):\tBYPASSED\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (no_path_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (port_a_flag != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(142, "Status(Port B):"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(141, "Status(Port A):"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_port_status(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_disk_state.g_disk_state.d_state_flags[port_a_flag]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((!l_disk_state.g_disk_state.port_a_valid) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (!l_disk_state.g_disk_state.port_b_valid)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2107, " Status:\t\t"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "No state available.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) display_disk_info(inq, l_disk_state, path_struct, pg_hdr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_data_avail, (char *)local_inq.inq_box_name, verbose);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * non_encl_fc_disk_display() Prints the device specific
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information for an individual fcal device.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortenon_encl_fc_disk_display(Path_struct *path_struct,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte L_inquiry inq_struct, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar phys_path[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t node_wwn[WWN_SIZE], port_wwn[WWN_SIZE], *pg_buf = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_disk_state l_disk_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct dlist *mlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i = 0, al_pa, offset, mode_data_avail = 0, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint path_a_found = 0, path_b_found = 0, argpwwn = 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argnwwn = 0, pathcnt = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry local_inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteMode_header_10 *mode_header_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct mode_page *pg_hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteWWN_list *wwn_list, *wwn_list_ptr, *list_start;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar temppath[MAXPATHLEN], last_logical_path[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemp_pathlist_t pathlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(phys_path, path_struct->p_physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get path to all the FC disk and tape devices. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_wwn_list(&wwn_list, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_sort_wwn_list(&wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte list_start = wwn_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(last_logical_path, phys_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (wwn_list_ptr = wwn_list; wwn_list_ptr != NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list_ptr = wwn_list_ptr->wwn_next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcasecmp(wwn_list_ptr->port_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte list_start = wwn_list_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argpwwn = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (strcasecmp(wwn_list_ptr->node_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte list_start = wwn_list_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argnwwn = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (wwn_list_ptr = list_start; wwn_list_ptr != NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list_ptr = wwn_list_ptr->wwn_next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argpwwn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcasecmp(wwn_list_ptr->port_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(phys_path, wwn_list_ptr->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_a_found = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_b_found = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_data_avail = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (argnwwn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(wwn_list_ptr->logical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_logical_path) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcasecmp(wwn_list_ptr->node_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(phys_path, wwn_list_ptr->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(last_logical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list_ptr->logical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_a_found = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_b_found = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_data_avail = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&l_disk_state, 0, sizeof (struct l_disk_state_struct));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_multipath(phys_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &(l_disk_state.g_disk_state.multipath_list),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mlist = l_disk_state.g_disk_state.multipath_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mlist == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_disk_state.l_state_flag = L_NO_PATH_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte N_DPRINTF(" non_encl_fc_disk_display: Error finding"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " multiple paths to the disk.\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_wwn_list(&wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get mode page information for FC device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_get_mode_pg(phys_path, &pg_buf, verbose) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_header_ptr = (struct mode_header_10_struct *)(int)pg_buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg_hdr = ((struct mode_page *)((int)pg_buf +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uchar_t)sizeof (struct mode_header_10_struct) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uchar_t *)(uintptr_t)(mode_header_ptr->bdesc_length)));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = sizeof (struct mode_header_10_struct) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_header_ptr->bdesc_length;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (offset < (mode_header_ptr->length +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (mode_header_ptr->length)) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !mode_data_avail) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pg_hdr->code == MODEPAGE_CACHING) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_data_avail++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset += pg_hdr->length + sizeof (struct mode_page);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg_hdr = ((struct mode_page *)((int)pg_buf +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uchar_t)offset));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch ((inq_struct.inq_dtype & DTYPE_MASK)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case DTYPE_DIRECT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(121, "DEVICE PROPERTIES for disk: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case DTYPE_SEQUENTIAL: /* Tape */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(2249, "DEVICE PROPERTIES for tape: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(2250, "DEVICE PROPERTIES for: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while ((mlist != NULL) && (!(path_a_found && path_b_found))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(phys_path, mlist->dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_inquiry(phys_path, &local_inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2114,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "non_encl_fc_disk_display: Inquiry failed\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, phys_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_multipath(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_disk_state.g_disk_state.multipath_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_wwn_list(&wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_wwn(mlist->dev_path, port_wwn, node_wwn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &al_pa, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, mlist->dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_multipath(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_disk_state.g_disk_state.multipath_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_wwn_list(&wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strlen(l_disk_state.g_disk_state.node_wwn_s) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(l_disk_state.g_disk_state.node_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte node_wwn[0], node_wwn[1], node_wwn[2], node_wwn[3],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte node_wwn[4], node_wwn[5], node_wwn[6], node_wwn[7]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_disk_port_status(phys_path, &l_disk_state,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (local_inq.inq_port) ? FC_PORT_B : FC_PORT_A,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, phys_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_multipath(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_disk_state.g_disk_state.multipath_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((!local_inq.inq_port) && (!path_a_found)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(l_disk_state.g_disk_state.port_a_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port_wwn[0], port_wwn[1], port_wwn[2], port_wwn[3],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port_wwn[4], port_wwn[5], port_wwn[6], port_wwn[7]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_a_found = l_disk_state.g_disk_state.port_a_valid = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((local_inq.inq_port) && (!path_b_found)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_b_found = l_disk_state.g_disk_state.port_b_valid = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(l_disk_state.g_disk_state.port_b_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port_wwn[0], port_wwn[1], port_wwn[2], port_wwn[3],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port_wwn[4], port_wwn[5], port_wwn[6], port_wwn[7]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strstr(mlist->dev_path, SCSI_VHCI) != NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (!l_get_disk_port_status(phys_path, &l_disk_state,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (!local_inq.inq_port) ? FC_PORT_B : FC_PORT_A,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte verbose))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(temppath, mlist->dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_pathlist(temppath, &pathlist)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathcnt = pathlist.path_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pathcnt > 1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < pathcnt; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((!path_a_found) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (path_b_found) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strstr(pathlist.path_info[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_disk_state.g_disk_state.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port_b_wwn_s) == NULL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strncpy(l_disk_state.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_disk_state.port_a_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_addr, 16);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_a_found = l_disk_state.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_disk_state.port_a_valid = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((path_a_found) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (!path_b_found) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strstr(pathlist.path_info[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_disk_state.g_disk_state.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port_a_wwn_s) == NULL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strncpy(l_disk_state.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_disk_state.port_b_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_addr, 16);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_b_found = l_disk_state.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_disk_state.port_b_valid = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((path_a_found) && (path_b_found)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(pathlist.path_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mlist = mlist->next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_disk_state.g_disk_state.port_a_valid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(141, "Status(Port A):"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_port_status(l_disk_state.g_disk_state.d_state_flags[FC_PORT_A]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_disk_state.g_disk_state.port_b_valid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(142, "Status(Port B):"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_port_status(l_disk_state.g_disk_state.d_state_flags[FC_PORT_B]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) display_disk_info(local_inq, l_disk_state, path_struct,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg_hdr, mode_data_avail, NULL, verbose);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_multipath(l_disk_state.g_disk_state.multipath_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(argpwwn || argnwwn)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_wwn_list(&wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * display_disk_info() Prints the device specific information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * for any FC_AL disk device.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_disk_info(L_inquiry inq, L_disk_state l_disk_state,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Path_struct *path_struct, struct mode_page *pg_hdr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int mode_data_avail, char *name_buf, int options)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefloat num_blks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct dlist *mlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint port_a, port_b;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct my_mode_caching *pg8_buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry enc_inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *enc_phys_path;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *enc_path_struct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint enc_type = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry80 inq80;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesize_t serial_len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte serial_len = sizeof (inq80.inq_serial);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = g_get_serial_number(path_struct->p_physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inq80.inq_serial, &serial_len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_errString(err, path_struct->p_physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(3, "Vendor:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_chars(inq.inq_vid, sizeof (inq.inq_vid), 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2115, "\n Product ID:\t\t"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_chars(inq.inq_pid, sizeof (inq.inq_pid), 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2116, "\n WWN(Node):\t\t%s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_disk_state.g_disk_state.node_wwn_s);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_disk_state.g_disk_state.port_a_valid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2117, "\n WWN(Port A):\t\t%s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_disk_state.g_disk_state.port_a_wwn_s);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_disk_state.g_disk_state.port_b_valid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2118, "\n WWN(Port B):\t\t%s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_disk_state.g_disk_state.port_b_wwn_s);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2119, "Revision:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_chars(inq.inq_revision, sizeof (inq.inq_revision), 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(17, "Serial Num:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_chars(inq80.inq_serial, serial_len, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte num_blks = l_disk_state.g_disk_state.num_blocks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (num_blks) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte num_blks /= 2048; /* get Mbytes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(60,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Unformatted capacity:\t%6.3f MBytes"), num_blks);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_disk_state.g_disk_state.persistent_reserv_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2120, " Persistent Reserve:\t"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_disk_state.g_disk_state.persistent_active) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(39, "Active"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_disk_state.g_disk_state.persistent_registered) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2121, "Found Registered Keys"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(87, "Not being used"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mode_data_avail) && (pg_hdr->code == MODEPAGE_CACHING)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg8_buf = (struct my_mode_caching *)(int)pg_hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pg8_buf->wce) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2122,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Write Cache:\t\t"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Enabled\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pg8_buf->rcd == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2123,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Read Cache:\t\t"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Enabled\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2320,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Minimum prefetch:"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\t0x%x\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Maximum prefetch:"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\t0x%x\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg8_buf->min_prefetch,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg8_buf->max_prefetch);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When /dev/rdsk/cxtxdxsx form of input is specified
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * for display command the initial library version didn't
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * display Location information. The change is made
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to display the same Location info as the non-library version.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (name_buf != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(2125, " Location:\t\t"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->slot_valid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We have to do another inquiry on the enclosure (name_buf)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to determine if this device is within a daktari, or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * a two sided device.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!l_convert_name(name_buf, &enc_phys_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &enc_path_struct, 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!g_get_inquiry(enc_phys_path, &enc_inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enc_type = l_get_enc_type(enc_inq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* If either of the above fail, we just assume the default */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(enc_phys_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(enc_path_struct);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (enc_type == DAK_ENC_TYPE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->f_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2239,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "In slot %d in the enclosure named: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->slot, name_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2239,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "In slot %d in the enclosure named: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->slot + (MAX_DRIVES_DAK/2),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte name_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else { /* Default enclosure type */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, path_struct->f_flag ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2126,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "In slot %d in the Front of the enclosure named: %s\n")
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte : MSGSTR(2127,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "In slot %d in the Rear of the enclosure named: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->slot, name_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2228,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "In the enclosure named: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte name_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " %s\t\t%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(35, "Device Type:"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dtype[inq.inq_dtype & DTYPE_MASK]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mlist = l_disk_state.g_disk_state.multipath_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2128, " Path(s):\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(mlist->dev_path, SCSI_VHCI) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " %s\n %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mlist->logical_path, mlist->dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) adm_print_pathlist(mlist->dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (mlist) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " %s\n %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mlist->logical_path, mlist->dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mlist = mlist->next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Options & OPTION_V) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->slot_valid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port_a = PORT_A;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port_b = PORT_B;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port_a = FC_PORT_A;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port_b = FC_PORT_B;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Only bother if the state is O.K. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((l_disk_state.g_disk_state.port_a_valid) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_disk_state.g_disk_state.d_state_flags[port_a] == 0))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte adm_display_verbose_disk(path_struct->p_physical_path, options);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if ((l_disk_state.g_disk_state.port_b_valid) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_disk_state.g_disk_state.d_state_flags[port_b] == 0))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte adm_display_verbose_disk(path_struct->p_physical_path, options);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * temp_decode() Display temperature bytes 1-3 state.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetemp_decode(Temp_elem_st *temp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (temp->ot_fail) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2129,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ": FAILURE - Over Temperature"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (temp->ut_fail) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2130,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ": FAILURE - Under Temperature"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (temp->ot_warn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2131,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ": WARNING - Over Temperature"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (temp->ut_warn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2132,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ": WARNING - Under Temperature"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * disp_degree() Display temperature in Degrees Celsius.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisp_degree(Temp_elem_st *temp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte t = temp->degrees;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte t -= 20; /* re-adjust */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * NL_Comment
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The %c is the degree symbol.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ":%1.2d%cC ", t, 186);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * trans_decode() Display tranceivers state.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetrans_decode(Trans_elem_st *trans)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (trans->disabled) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ": ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(34,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Disabled"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (trans->lol) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2133,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ": Not receiving a signal"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (trans->lsr_fail) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2134,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ": Laser failed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * trans_messages() Display tranceiver status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * NOTE: The decoding of the status assumes that the elements
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * are in order with the first two elements are for the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * "A" IB. It also assumes the tranceivers are numbered
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 and 1.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetrans_messages(struct l_state_struct *l_state, int ib_a_flag)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteTrans_elem_st trans;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i, j, k;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint count = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint elem_index = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get and print messages */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < (int)l_state->ib_tbl.config.enc_num_elem; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state->ib_tbl.config.type_hdr[i].type == ELM_TYP_FL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state->ib_tbl.config.type_hdr[i].text_len != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n\t\t%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->ib_tbl.config.text[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte count = k = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j <
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (int)l_state->ib_tbl.config.type_hdr[i].num; j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Only display the status for the selected IB.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((count < 2 && ib_a_flag) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (count >= 2 && !ib_a_flag)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &l_state->ib_tbl.p2_s.element[elem_index + j],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&trans, sizeof (trans));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (k == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t\t%d ", k);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n\t\t%d ", k);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (trans.code == S_OK) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(29, "O.K."));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((trans.code == S_CRITICAL) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (trans.code == S_NONCRITICAL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2135, "Failed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte trans_decode(&trans);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (trans.code == S_NOT_INSTALLED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(30, "Not Installed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (trans.code == S_NOT_AVAILABLE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(34, "Disabled"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(4, "Unknown status"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte k++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte count++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Calculate the index to each element.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index += l_state->ib_tbl.config.type_hdr[i].num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * temperature_messages() Display temperature status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetemperature_messages(struct l_state_struct *l_state, int rear_flag)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteTemp_elem_st temp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i, j, last_ok = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint all_ok = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint elem_index = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get and print messages */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < (int)l_state->ib_tbl.config.enc_num_elem; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index++; /* skip global */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state->ib_tbl.config.type_hdr[i].type == ELM_TYP_TS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!rear_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rear_flag = 1; /* only do front or rear backplane */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state->ib_tbl.config.type_hdr[i].text_len != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t %s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->ib_tbl.config.text[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check global status and if not all O.K.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * then print individually.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)&l_state->ib_tbl.p2_s.element[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&temp, sizeof (temp));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j <
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (int)l_state->ib_tbl.config.type_hdr[i].num; j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &l_state->ib_tbl.p2_s.element[elem_index + j],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&temp, sizeof (temp));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((j == 0) && (temp.code == S_OK) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (!(temp.ot_fail || temp.ot_warn ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte temp.ut_fail || temp.ut_warn))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n\t %d", j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((j == 6) && (temp.code == S_OK) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte all_ok) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n\t %d", j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (last_ok && (temp.code == S_OK)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%d", j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n\t\t%d", j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (temp.code == S_OK) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte disp_degree(&temp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (temp.ot_fail || temp.ot_warn ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte temp.ut_fail || temp.ut_warn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte temp_decode(&temp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte all_ok = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_ok = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_ok++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (temp.code == S_CRITICAL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(122, "Critical failure"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_ok = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte all_ok = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (temp.code == S_NONCRITICAL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(89, "Non-Critical Failure"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_ok = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte all_ok = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (temp.code == S_NOT_INSTALLED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(30, "Not Installed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_ok = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte all_ok = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (temp.code == S_NOT_AVAILABLE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(34, "Disabled"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_ok = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte all_ok = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(4, "Unknown status"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_ok = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte all_ok = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (all_ok) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2136, " (All temperatures are "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "NORMAL.)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte all_ok = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rear_flag = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem_index += l_state->ib_tbl.config.type_hdr[i].num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ib_decode() Display IB byte 3 state.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteib_decode(Ctlr_elem_st *ctlr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ctlr->overtemp_alart) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2137,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " - IB Over Temperature Alert "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ctlr->ib_loop_1_fail) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2138,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " - IB Loop 1 has failed "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ctlr->ib_loop_0_fail) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2139,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " - IB Loop 0 has failed "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mb_messages() Display motherboard
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * (interconnect assembly) messages.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemb_messages(struct l_state_struct *l_state, int index, int elem_index)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteInterconnect_st interconnect;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state->ib_tbl.config.type_hdr[index].text_len != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->ib_tbl.config.text[index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < (int)l_state->ib_tbl.config.type_hdr[index].num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &l_state->ib_tbl.p2_s.element[elem_index + j],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&interconnect, sizeof (interconnect));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (interconnect.code == S_OK) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(29, "O.K."));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (interconnect.code == S_NOT_INSTALLED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(30, "Not Installed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (interconnect.code == S_CRITICAL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (interconnect.eprom_fail != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2140,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Critical Failure: EEPROM failure"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2141,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Critical Failure: Unknown failure"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (interconnect.code == S_NONCRITICAL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (interconnect.eprom_fail != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2142,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Non-Critical Failure: EEPROM failure"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2143,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Non-Critical Failure: Unknown failure"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (interconnect.code == S_NOT_AVAILABLE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(34, "Disabled"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(4, "Unknown status"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * back_plane_messages() Display back_plane messages
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * including the temperature's.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteback_plane_messages(struct l_state_struct *l_state, int index, int elem_index)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteBp_elem_st bp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar status_string[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state->ib_tbl.config.type_hdr[index].text_len != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->ib_tbl.config.text[index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < (int)l_state->ib_tbl.config.type_hdr[index].num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &l_state->ib_tbl.p2_s.element[elem_index + j],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&bp, sizeof (bp));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (j == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2144, "\tFront Backplane: "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2145, "\tRear Backplane: "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_element_msg_string(bp.code, status_string);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s", status_string);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bp.code != S_NOT_INSTALLED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((bp.byp_a_enabled || bp.en_bypass_a) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !(bp.byp_b_enabled || bp.en_bypass_b)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " (");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(130, "Bypass A enabled"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ")");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((bp.byp_b_enabled || bp.en_bypass_b) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !(bp.byp_a_enabled || bp.en_bypass_a)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " (");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(129, "Bypass B enabled"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ")");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* This case covers where a and b are bypassed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (bp.byp_b_enabled || bp.en_bypass_b) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2146, " (Bypass's A & B enabled)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte temperature_messages(l_state, j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dpm_SSC100_messages() Display SSC100 messages
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * including the temperature's.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedpm_SSC100_messages(struct l_state_struct *l_state, int index, int elem_index)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteBp_elem_st bp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar status_string[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state->ib_tbl.config.type_hdr[index].text_len != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->ib_tbl.config.text[index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < (int)l_state->ib_tbl.config.type_hdr[index].num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &l_state->ib_tbl.p2_s.element[elem_index + j],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&bp, sizeof (bp));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2246, " SSC100 #%d: "), j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_element_msg_string(bp.code, status_string);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s", status_string);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bp.code != S_NOT_INSTALLED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((bp.byp_a_enabled || bp.en_bypass_a) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !(bp.byp_b_enabled || bp.en_bypass_b)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " (");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(130, "Bypass A enabled"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ")");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((bp.byp_b_enabled || bp.en_bypass_b) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !(bp.byp_a_enabled || bp.en_bypass_a)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " (");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(129, "Bypass B enabled"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ")");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* This case covers where a and b are bypassed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (bp.byp_b_enabled || bp.en_bypass_b) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2146, " (Bypass's A & B enabled)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte temperature_messages(l_state, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * loop_messages() Display loop messages.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteloop_messages(struct l_state_struct *l_state, int index, int elem_index)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteLoop_elem_st loop;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state->ib_tbl.config.type_hdr[index].text_len != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->ib_tbl.config.text[index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < (int)l_state->ib_tbl.config.type_hdr[index].num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &l_state->ib_tbl.p2_s.element[elem_index + j],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&loop, sizeof (loop));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (j == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (loop.code == S_NOT_INSTALLED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2147, "Loop A is not installed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (loop.split) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2148,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Loop A is configured as two separate loops."));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2149,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Loop A is configured as a single loop."));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (loop.code == S_NOT_INSTALLED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2150, "Loop B is not installed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (loop.split) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2151,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Loop B is configured as two separate loops."));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2152,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Loop B is configured as a single loop."));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ctlr_messages() Display ESI Controller status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortectlr_messages(struct l_state_struct *l_state, int index, int elem_index)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteCtlr_elem_st ctlr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint ib_a_flag = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state->ib_tbl.config.type_hdr[index].text_len != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->ib_tbl.config.text[index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < (int)l_state->ib_tbl.config.type_hdr[index].num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &l_state->ib_tbl.p2_s.element[elem_index + j],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&ctlr, sizeof (ctlr));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (j == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2153, "\tA: "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2154, "\tB: "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ib_a_flag = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ctlr.code == S_OK) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(29, "O.K."));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* If any byte 3 bits set display */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ib_decode(&ctlr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Display Version message */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Display the tranciver module state for this
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * IB.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte trans_messages(l_state, ib_a_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ctlr.code == S_CRITICAL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(122, "Critical failure"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ib_decode(&ctlr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ctlr.code == S_NONCRITICAL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(89, "Non-Critical Failure"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ib_decode(&ctlr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ctlr.code == S_NOT_INSTALLED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(30, "Not Installed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ctlr.code == S_NOT_AVAILABLE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(34, "Disabled"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(4, "Unknown status"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fan_decode() Display Fans bytes 1-3 state.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefan_decode(Fan_elem_st *fan)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fan->fail) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2155,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ":Yellow LED is on"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fan->speed == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2156,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ":Fan stopped"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (fan->speed < S_HI_SPEED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2157,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ":Fan speed Low"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2158,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ":Fan speed Hi"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fan_messages() Display Fan status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefan_messages(struct l_state_struct *l_state, int hdr_index, int elem_index)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteFan_elem_st fan;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get and print messages */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state->ib_tbl.config.type_hdr[hdr_index].text_len != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->ib_tbl.config.text[hdr_index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < (int)l_state->ib_tbl.config.type_hdr[hdr_index].num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &l_state->ib_tbl.p2_s.element[elem_index + j],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&fan, sizeof (fan));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t%d ", j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fan.code == S_OK) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(29, "O.K."));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (fan.code == S_CRITICAL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(122, "Critical failure"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fan_decode(&fan);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (fan.code == S_NONCRITICAL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(89, "Non-Critical Failure"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fan_decode(&fan);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (fan.code == S_NOT_INSTALLED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(30, "Not Installed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (fan.code == S_NOT_AVAILABLE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(34, "Disabled"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(4, "Unknown status"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ps_decode() Display Power Supply bytes 1-3 state.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteps_decode(Ps_elem_st *ps)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ps->dc_over) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2159,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ": DC Voltage too high"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ps->dc_under) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2160,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ": DC Voltage too low"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ps->dc_over_i) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2161,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ": DC Current too high"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ps->ovrtmp_fail || ps->temp_warn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2162,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ": Temperature too high"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ps->ac_fail) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2163,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ": AC Failed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ps->dc_fail) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2164,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ": DC Failed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * revision_msg() Print the revision message from page 7.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterevision_msg(struct l_state_struct *l_state, int index)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strlen((const char *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->ib_tbl.p7_s.element_desc[index].desc_string)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "(%s)",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->ib_tbl.p7_s.element_desc[index].desc_string);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ps_messages() Display Power Supply status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteps_messages(struct l_state_struct *l_state, int index, int elem_index)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePs_elem_st ps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get and print Power Supply messages */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state->ib_tbl.config.type_hdr[index].text_len != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->ib_tbl.config.text[index]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < (int)l_state->ib_tbl.config.type_hdr[index].num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) bcopy((const void *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &l_state->ib_tbl.p2_s.element[elem_index + j],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&ps, sizeof (ps));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\t%d ", j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ps.code == S_OK) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(29, "O.K."));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ps.code == S_CRITICAL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(122, "Critical failure"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ps_decode(&ps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ps.code == S_NONCRITICAL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(89, "Non-Critical Failure"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ps_decode(&ps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ps.code == S_NOT_INSTALLED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(30, "Not Installed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ps.code == S_NOT_AVAILABLE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(34, "Disabled"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte revision_msg(l_state, elem_index + j);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(4, "Unknown status"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * abnormal_condition() Display any abnormal condition messages.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteabnormal_condition_display(struct l_state_struct *l_state)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state->ib_tbl.p2_s.ui.crit) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2165, " "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "CRITICAL CONDITION DETECTED\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state->ib_tbl.p2_s.ui.non_crit) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2166, " "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "WARNING: NON-CRITICAL CONDITION DETECTED\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_state->ib_tbl.p2_s.ui.invop) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2167, " "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "WARNING: Invalid Operation bit set.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\tThis means an Enclosure Control page"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " or an Array Control page with an invalid\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\tformat has previously been transmitted to the"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Enclosure Services card by a\n\tSend Diagnostic"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " SCSI command.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * adm_start() Spin up the given list
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of SENA devices.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_start(char **argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *path_struct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint err = 0, retval = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (*argv != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(*argv, &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, *argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (argv)++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte VERBPRINT(MSGSTR(101, "Issuing start to:\n %s\n"), *argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_start(path_phys)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, *argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (argv)++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (argv)++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (retval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * adm_stop() Spin down a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * given list of SENA devices.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_stop(char **argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *path_struct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint err = 0, retval = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (*argv != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(*argv, &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, *argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (argv)++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * scsi stop is not supported for tape drives.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The scsi unload op code for tape is the same as a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * scsi stop for disk so this command will eject the tape.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If an eject is the desired behavior then remove the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * following if block. ('mt offline' will give you
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the same eject functionality).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(path_phys, SLSH_DRV_NAME_ST)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte errno = ENOTSUP;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(0, path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (argv)++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte VERBPRINT(MSGSTR(100, "Issuing stop to:\n %s\n"), *argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_stop(path_phys, 1)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, *argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (argv)++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (argv)++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (retval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * On a SOC+ chip, the port is either put into (offline) or pulled out
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of (online) a loopback mode since the laser cannot be turned on or off.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * As of this writing, this feature is yet to be supported by the ifp
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * driver on a QLogic card.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * INPUT :
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Command line args and flag - LUX_P_ONLINE or LUX_P_OFFLINE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The path that is passed has to be the physical path to the port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * For example :
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * /devices/sbus@2,0/SUNW,socal@2,0:0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * /devices/io-unit@f,e0200000/sbi@0,0/SUNW,socal@2,0:0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * /devices/pci@1f,4000/SUNW,ifp@2:devctl
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS :
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Nothing
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_port_offline_online(char *argv[], int flag)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int err, retval = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *nexus_path_ptr = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Path_struct *path_struct = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (*argv != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(*argv, &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, *argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the nexus path - need this to print messages */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_nexus_path(path_phys, &nexus_path_ptr)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, *argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto cleanup_and_go;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (flag == LUX_P_OFFLINE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_port_offline(nexus_path_ptr))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, nexus_path_ptr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto cleanup_and_go;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2223, "Port %s has been disabled\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nexus_path_ptr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (flag == LUX_P_ONLINE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_port_online(nexus_path_ptr))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, nexus_path_ptr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto cleanup_and_go;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2224, "Port %s has been enabled\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nexus_path_ptr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2225,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Unknown action requested "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "on port - %d\nIgnoring."),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecleanup_and_go:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(path_struct);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(nexus_path_ptr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (retval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Expert level subcommand 'luxadm -e port'
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * which displays all FC ports on a host and state information for
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * connectivity (CONNECTED or NOT CONNECTED) indicating whether there
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * are devices attached to the port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Sample output for ifp:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * /devices/pci@1f,4000/SUNW,ifp@2:devctl CONNECTED
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * /devices/pci@1f,2000/SUNW,ifp@1:devctl NOT CONNECTED
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Sample output for socal:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * /devices/sbus@2,0/SUNW,socal@d,10000:0 CONNECTED
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * /devices/sbus@2,0/SUNW,socal@d,10000:1 NOT CONNECTED
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * /devices/sbus@2,0/SUNW,socal@2,0:0 NOT CONNECTED
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * /devices/sbus@2,0/SUNW,socal@2,0:1 CONNECTED
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Note: for socal the path returned is not a devctl path as there is no
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * devctl path for socal.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Sample output for fp:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * /devices/sbus@2,0/SUNW,qlc@5/fp@0,0:devctl CONNECTED
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * /devices/sbus@2,0/SUNW,qlc@4/fp@1,0:devctl CONNECTED
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_display_port(int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If another port driver needs to be searched, add it here
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte static char *portdrvr_list[] = {"socal",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "fp",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "ifp",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NULL};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte portlist_t portlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int x = 0, err = 0, retval = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int port_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte portlist.hbacnt = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Look for all HBA ports as listed in portdrvr_list[]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (portdrvr_list[x]) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_port_path(portdrvr_list[x], &portlist)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != L_PORT_DRIVER_NOT_FOUND &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err != L_PHYS_PATH_NOT_FOUND) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, portdrvr_list[x]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte x++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * For each port path found get the connection state.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If there are devices attached the state is considered connected.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (x = 0; x < portlist.hbacnt; x++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_port_state(portlist.physpath[x],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &port_state, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, portlist.physpath[x]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, "%-65s ", portlist.physpath[x]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (port_state == PORT_CONNECTED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2233,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "CONNECTED\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2234,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "NOT CONNECTED\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_free_portlist(&portlist);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (retval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Expert level subcommand 'luxadm -e external_loopback <portpath>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * internal_loopback
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * no_loopback
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Does just what you would think. Sets port in designated loopback
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * INPUT: portpath - path to device on which to set loopback mode
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * flag - loopback mode to set. Values are:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * EXT_LOOPBACK
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * INT_LOOPBACK
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * NO_LOOPBACK
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURN: 0 on success
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * non-zero on failure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_port_loopback(char *portpath, int flag)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Path_struct *path_struct = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int cmd;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_convert_name(portpath, &path_phys,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &path_struct, Options & PVERBOSE)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(33,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Error: converting"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " %s to physical path.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Invalid pathname.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte portpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, portpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case EXT_LOOPBACK:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmd = EXT_LPBACK;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case INT_LOOPBACK:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmd = INT_LPBACK;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case NO_LOOPBACK:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmd = NO_LPBACK;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2225,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Unknown action requested "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "on port - %d\nIgnoring."),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(path_struct);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_loopback_mode(path_phys, cmd)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, portpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(path_struct);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case EXT_LOOPBACK:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2230,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "External loopback mode set "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "on:\n%s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte portpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case INT_LOOPBACK:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2231,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Internal loopback mode set "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "on:\n%s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte portpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case NO_LOOPBACK:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2232,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Loopback mode unset "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "on:\n%s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte portpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2248, "Undefined command\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(path_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(path_struct);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * To print the pathlist and mpxio path attributes
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_print_pathlist(char *dev_path)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i, pathcnt = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mp_pathlist_t pathlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int retval = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char temppath[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char wwns[(WWN_SIZE *2) +1];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t wwn_data[WWN_SIZE];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int state, ext_state = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *path_state[5];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_state[0] = MSGSTR(2400, "INIT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_state[1] = MSGSTR(2401, "ONLINE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_state[2] = MSGSTR(2402, "STANDBY");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_state[3] = MSGSTR(2403, "FAULT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_state[4] = MSGSTR(2404, "OFFLINE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(temppath, dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retval = g_get_pathlist(temppath, &pathlist);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (retval != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(retval, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathcnt = pathlist.path_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < pathcnt; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2303, " Controller \t%s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[i].path_hba);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2304, " Device Address\t\t%s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[i].path_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = get_host_controller_pwwn(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[i].path_hba,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uchar_t *)&wwn_data)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != ENOTSUP) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[i].path_hba);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!err) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte copy_wwn_data_to_str(wwns, wwn_data);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2326, " Host controller port WWN\t%s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwns);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2305, " Class\t\t\t%s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[i].path_class);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pathlist.path_info[i].path_state < MAXPATHSTATE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2306, " State\t\t\t%s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_state[pathlist.path_info[i].path_state]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_stms_get_path_state(dev_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[i].path_hba, &state,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &ext_state)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist.path_info[i].path_hba);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ext_state & MDI_PATHINFO_STATE_USER_DISABLE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == MDI_PATHINFO_STATE_USER_DISABLE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ext_state = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2327,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " I/Os disabled on this %s path\n\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_state[pathlist.path_info[i].path_state]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Free memory for per path info properties */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(pathlist.path_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * compare_multipath
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * compares path with all paths in pathlist
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If there is a match, 0 is returned, otherwise 1 is returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecompare_multipath(char *path, struct mplist_struct *pathlist)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (pathlist != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strncmp(path, pathlist->devpath, MAXPATHLEN) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathlist = pathlist->next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lun_display() Prints the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information for an individual lun.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortelun_display(Path_struct *path_struct, L_inquiry inq_struct, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar phys_path[MAXPATHLEN], last_logical_path[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t *pg_buf = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_disk_state l_disk_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct dlist *mlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint offset, mode_data_avail, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteMode_header_10 *mode_header_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct mode_page *pg_hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteWWN_list *wwn_list, *list_start, *wwn_list_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteWWN_list *wwn_list_find;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint found = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint argpwwn = 0, argnwwn = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct mplist_struct *mplistp, *mpl, *mpln;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct dlist *dlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strcpy(phys_path, path_struct->p_physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strcpy(last_logical_path, phys_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mplistp = mpl = mpln = (struct mplist_struct *)NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get path to all the FC disk and tape devices.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If there is no slash in the argument in this routine, we assume
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * it is a wwn argument.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(path_struct->argv, "/") != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_devices_get_all(&wwn_list)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_wwn_list(&wwn_list, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_sort_wwn_list(&wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte list_start = wwn_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (wwn_list_ptr = wwn_list; wwn_list_ptr != NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list_ptr = wwn_list_ptr->wwn_next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcasecmp(wwn_list_ptr->port_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte list_start = wwn_list_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argpwwn = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (strcasecmp(wwn_list_ptr->node_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte list_start = wwn_list_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argnwwn = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (wwn_list_ptr = list_start; wwn_list_ptr != NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list_ptr = wwn_list_ptr->wwn_next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argpwwn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcasecmp(wwn_list_ptr->port_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(phys_path, wwn_list_ptr->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (argnwwn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(wwn_list_ptr->logical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_logical_path) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcasecmp(wwn_list_ptr->node_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(phys_path, wwn_list_ptr->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(last_logical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list_ptr->logical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argnwwn || argpwwn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (compare_multipath(wwn_list_ptr->logical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mplistp) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_data_avail = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&l_disk_state, 0, sizeof (struct l_disk_state_struct));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Don't call g_get_multipath if this is a SCSI_VHCI device
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dlist gets alloc'ed here to retain the free at the end
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(phys_path, SCSI_VHCI) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_multipath(phys_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &(l_disk_state.g_disk_state.multipath_list),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mlist = l_disk_state.g_disk_state.multipath_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mlist == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_disk_state.l_state_flag = L_NO_PATH_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte N_DPRINTF(" lun_display: Error finding"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " multiple paths to the disk.\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_wwn_list(&wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_NO_VALID_PATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Search for match on physical path name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (wwn_list_find = list_start; wwn_list_find != NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list_find = wwn_list_find->wwn_next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strncmp(wwn_list_find->physical_path, phys_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strlen(wwn_list_find->physical_path))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte found++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!found) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_NO_VALID_PATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte found = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((dlist = (struct dlist *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte calloc(1, sizeof (struct dlist))) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_MALLOC_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((dlist->logical_path = (char *)calloc(1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strlen(wwn_list_find->logical_path) + 1)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_MALLOC_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((dlist->dev_path = (char *)calloc(1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strlen(phys_path) + 1)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_MALLOC_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strncpy(dlist->logical_path, wwn_list_find->logical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strlen(wwn_list_find->logical_path));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strncpy(dlist->dev_path, phys_path, strlen(phys_path));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_disk_state.g_disk_state.multipath_list = dlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argnwwn || argpwwn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (mlist = l_disk_state.g_disk_state.multipath_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mlist != NULL; mlist = mlist->next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* add the path to the list for compare */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpl = (struct mplist_struct *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte calloc(1, sizeof (struct mplist_struct)))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte adm_mplist_free(mplistp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_MALLOC_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpl->devpath = (char *)calloc(1, MAXPATHLEN+1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpl->devpath == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte adm_mplist_free(mplistp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_MALLOC_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strncpy(mpl->devpath, mlist->logical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strlen(mlist->logical_path));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mplistp == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mplistp = mpln = mpl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpln->next = mpl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpln = mpl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get mode page information for FC device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_get_mode_pg(phys_path, &pg_buf, verbose) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_header_ptr = (struct mode_header_10_struct *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)pg_buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = sizeof (struct mode_header_10_struct) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_header_ptr->bdesc_length;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg_hdr = (struct mode_page *)&pg_buf[offset];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (offset < (mode_header_ptr->length +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (mode_header_ptr->length)) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !mode_data_avail) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pg_hdr->code == MODEPAGE_CACHING) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_data_avail++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset += pg_hdr->length + sizeof (struct mode_page);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg_hdr = (struct mode_page *)&pg_buf[offset];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch ((inq_struct.inq_dtype & DTYPE_MASK)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case DTYPE_DIRECT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(121, "DEVICE PROPERTIES for disk: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case DTYPE_SEQUENTIAL: /* Tape */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(2249, "DEVICE PROPERTIES for tape: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(2250, "DEVICE PROPERTIES for: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) display_lun_info(l_disk_state, path_struct, pg_hdr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode_data_avail, wwn_list, phys_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_multipath(l_disk_state.g_disk_state.multipath_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(argpwwn || argnwwn)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* End for wwn_list_ptr = list_start... */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_wwn_list(&wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte adm_mplist_free(mplistp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * display_lun_info() Prints the device specific information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * for a lun.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_lun_info(L_disk_state l_disk_state, Path_struct *path_struct,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct mode_page *pg_hdr, int mode_data_avail, WWN_list
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *wwn_list, char *phys_path)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefloat lunMbytes;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct scsi_capacity_16 cap_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct dlist *mlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct my_mode_caching *pg8_buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortehrtime_t start_time, end_time;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *envdb = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint peripheral_qual;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry80 inq80;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesize_t serial_len = sizeof (inq80.inq_serial);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((envdb = getenv("_LUX_T_DEBUG")) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte start_time = gethrtime();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memset(&cap_data, 0, sizeof (cap_data));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_inquiry(phys_path, &inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_errString(err, phys_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_serial_number(phys_path, inq80.inq_serial,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &serial_len)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_errString(err, phys_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * check to see if the peripheral qualifier is zero
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if it is non-zero, we will return with an error.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte peripheral_qual = inq.inq_dtype & ~DTYPE_MASK;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (peripheral_qual != DPQ_POSSIBLE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, MSGSTR(2254, "\n Error: Logical Unit "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "(%s) is not available.\n"), phys_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(3, "Vendor:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, "\t\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_chars(inq.inq_vid, sizeof (inq.inq_vid), 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(2115, "\n Product ID:\t\t"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_chars(inq.inq_pid, sizeof (inq.inq_pid), 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(2119, "Revision:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, "\t\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_chars(inq.inq_revision, sizeof (inq.inq_revision), 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(17, "Serial Num:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, "\t\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_chars(inq80.inq_serial, serial_len, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((inq.inq_dtype & DTYPE_MASK) == DTYPE_DIRECT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = get_lun_capacity(phys_path, &cap_data)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_errString(err, phys_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cap_data.sc_capacity > 0 && cap_data.sc_lbasize > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lunMbytes = cap_data.sc_capacity + 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lunMbytes *= cap_data.sc_lbasize;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lunMbytes /= (float)(1024*1024);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, "\n ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(60,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Unformatted capacity:\t%6.3f MBytes"), lunMbytes);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mode_data_avail) && (pg_hdr->code == MODEPAGE_CACHING)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg8_buf = (struct my_mode_caching *)(void *)pg_hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pg8_buf->wce) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(2122, " Write Cache:\t\t"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Enabled\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pg8_buf->rcd == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(2123, " Read Cache:\t\t"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Enabled\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(2124, " Minimum prefetch:"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\t0x%x\n Maximum prefetch:\t0x%x\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg8_buf->min_prefetch,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg8_buf->max_prefetch);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, " %s\t\t%s\n", MSGSTR(35, "Device Type:"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dtype[inq.inq_dtype & DTYPE_MASK]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, MSGSTR(2128, " Path(s):\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mlist = l_disk_state.g_disk_state.multipath_list) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, MSGSTR(2323, "Error: No paths found (%s)"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path_struct->argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(mlist->dev_path, SCSI_VHCI) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, " %s\n %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mlist->logical_path, mlist->dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte adm_print_pathlist(mlist->dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * first display user's requested path
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This will avoid duplicate inquiries as well
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (mlist = l_disk_state.g_disk_state.multipath_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mlist != NULL; mlist = mlist->next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strcmp(mlist->dev_path, path_struct->p_physical_path))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_path_info(mlist->dev_path, mlist->logical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Now display rest of paths
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * skipping one already displayed
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (mlist = l_disk_state.g_disk_state.multipath_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mlist != NULL; mlist = mlist->next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strcmp(mlist->dev_path, path_struct->p_physical_path))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_inquiry(mlist->dev_path, &inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_errString(err, mlist->dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_path_info(mlist->dev_path, mlist->logical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (envdb != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte end_time = gethrtime();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, " display_lun_info: "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\t\tTime = %lld millisec\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (end_time - start_time)/1000000);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * display_path_info() Prints the path specific information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * for a lun.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Note: Only applies to ssd nodes currently
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * none.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_path_info(char *devpath, char *logicalpath, WWN_list *wwn_list)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteWWN_list *wwn_list_walk;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t wwn_data[WWN_SIZE];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar wwns[(WWN_SIZE *2) +1];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar drvr_path[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *cptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, " %s\n", logicalpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, " %s\n", devpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, " %s\t\t", MSGSTR(2321, "LUN path port WWN:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Walk the wwn list passed in and print the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * port wwn matching the device path
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (wwn_list_walk = wwn_list; wwn_list_walk != NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn_list_walk = wwn_list_walk->wwn_next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(wwn_list_walk->physical_path, devpath) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, "%s", wwn_list_walk->port_wwn_s);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * newline here in case port wwn not found
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte drvr_path[0] = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcat(drvr_path, devpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((cptr = strstr(drvr_path, SLSH_DRV_NAME_SSD)) != NULL) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((cptr = strstr(drvr_path, SLSH_DRV_NAME_ST)) != NULL)) {;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *cptr = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, MSGSTR(2324, "Error: Incorrect path (%s)\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte drvr_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *cptr = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = get_host_controller_pwwn(drvr_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uchar_t *)&wwn_data)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_errString(err, drvr_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte copy_wwn_data_to_str(wwns, wwn_data);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, " %s\t%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2322, "Host controller port WWN:"), wwns);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Determine path status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = get_path_status(devpath, &status)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_errString(err, devpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, " %s\t\t", MSGSTR(2329, "Path status:"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_port_status(status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Retrieves the lun capacity
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteget_lun_capacity(char *devpath, struct scsi_capacity_16 *cap_data)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fd;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (devpath == NULL || cap_data == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_PATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fd = g_object_open(devpath, O_RDONLY | O_NDELAY)) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_OPEN_PATH_FAIL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_scsi_read_capacity_1016_cmd(fd, cap_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (struct scsi_capacity_16));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Retrieves the reservation status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteget_path_status(char *devpath, int *status)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fd, mystatus = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (devpath == NULL || status == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_PATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *status = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fd = g_object_open(devpath, O_RDONLY | O_NDELAY)) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_OPEN_PATH_FAIL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mystatus = g_scsi_tur(fd)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mystatus & L_SCSI_ERROR) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((mystatus & ~L_SCSI_ERROR) == STATUS_CHECK)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *status = L_NOT_READY;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((mystatus & L_SCSI_ERROR) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((mystatus & ~L_SCSI_ERROR) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte STATUS_RESERVATION_CONFLICT)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *status = L_RESERVED;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *status = L_SCSI_ERR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Description:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Retrieves the port wwn associated with the hba node
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * hba_path: /devices/pci@8,600000/SUNW,qlc@4/fp@0,0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pwwn: ptr to a uchar_t array of size WWN_SIZE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteget_host_controller_pwwn(char *hba_path, uchar_t *pwwn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *cptr, *portptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint found = 0, err, devlen;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar my_hba_path[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedi_node_t node;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedi_prom_prop_t promprop;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t *port_wwn_data = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint di_ret;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedi_prom_handle_t ph;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *promname;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t *promdata;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuint_t path_type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefc_port_dev_t hba_port;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (hba_path == NULL || pwwn == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_PATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((path_type = g_get_path_type(hba_path)) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_PATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ifp nodes do not have a port-wwn prom property
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * so handle them via FC4 device map
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_type & FC4_XPORT_MASK) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = get_FC4_host_controller_pwwn(hba_path, pwwn)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* For Leadville path get the port wwn through g_get_host param. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((path_type & FC_GEN_XPORT) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((path_type & FC_FCA_MASK) == FC_FCA_MASK)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * For Leadville path, get the port wwn through
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * g_get_host param. This is a general solution
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to support 3rd party vendor Leadville FCA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte my_hba_path[0] = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strlcat(my_hba_path, hba_path, sizeof (my_hba_path));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(my_hba_path, sizeof (my_hba_path), "%s%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte hba_path, FC_CTLR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_host_params(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte my_hba_path, &hba_port, 0)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memcpy(pwwn, &hba_port.dev_pwwn.raw_wwn[0],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte WWN_SIZE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((path_type & FC_FCA_MASK) == FC_PCI_FCA) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get port WWN through prom property
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte my_hba_path[0] = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strlcat(my_hba_path, hba_path, sizeof (my_hba_path));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sanity check for /devices mount point
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strlen(my_hba_path) > (devlen = strlen("/devices"))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cptr = &my_hba_path[devlen];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_PATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Now strip off the trailing "/fp@"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((portptr = strstr(cptr, "/fp@")) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *portptr = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((node = di_init(cptr, DINFOCPYALL)) == DI_NODE_NIL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_DEV_SNAPSHOT_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (di_nodeid(node) == DI_SID_NODEID) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte di_ret = di_prop_lookup_bytes(DDI_DEV_T_ANY, node,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "port-wwn", &port_wwn_data);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (di_ret == -1 || port_wwn_data == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte di_fini(node);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_NO_WWN_PROP_FOUND);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memcpy(pwwn, port_wwn_data, WWN_SIZE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte found++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (di_nodeid(node) == DI_PROM_NODEID) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ph = di_prom_init()) == DI_PROM_HANDLE_NIL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte di_fini(node);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_PROM_INIT_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (promprop = di_prom_prop_next(ph, node,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DI_PROM_PROP_NIL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte promprop != DI_PROM_PROP_NIL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte promprop = di_prom_prop_next(ph, node, promprop)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((promname = di_prom_prop_name(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte promprop)) != NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strcmp(promname, "port-wwn") == 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (di_prom_prop_data(promprop,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &promdata) == WWN_SIZE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Found port-wwn */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memcpy(pwwn, promdata, WWN_SIZE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte found++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte di_prom_fini(ph);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte di_fini(node);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (found) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_PATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_PATH_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Description:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Retrieve pwwn via SFIOCGMAP
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteget_FC4_host_controller_pwwn(char *hba_path, uchar_t *pwwn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesf_al_map_t sf_map;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar my_hba_path[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fd;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (hba_path == NULL || pwwn == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_PATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(my_hba_path, sizeof (my_hba_path), "%s%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte hba_path, FC_CTLR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fd = g_object_open(my_hba_path, O_NDELAY | O_RDONLY)) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (errno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memset(&sf_map, 0, sizeof (sf_al_map_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ioctl(fd, SFIOCGMAP, &sf_map) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_SFIOCGMAP_IOCTL_FAIL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (sf_map.sf_count == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_SFIOCGMAP_IOCTL_FAIL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memcpy(pwwn, &sf_map.sf_hba_addr.sf_port_wwn[0], WWN_SIZE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * from_ptr: ptr to uchar_t array of size WWN_SIZE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to_ptr: char ptr to string of size WWN_SIZE*2+1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecopy_wwn_data_to_str(char *to_ptr, const uchar_t *from_ptr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((to_ptr == NULL) || (from_ptr == NULL))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sprintf(to_ptr, "%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x%1.2x",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte from_ptr[0], from_ptr[1], from_ptr[2], from_ptr[3],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte from_ptr[4], from_ptr[5], from_ptr[6], from_ptr[7]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Frees a previously allocated mplist_struct
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_mplist_free(struct mplist_struct *mplistp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct mplist_struct *mplistn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (mplistp != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mplistn = mplistp->next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mplistp->devpath != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(mplistp->devpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mplistp->devpath = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(mplistp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mplistp = mplistn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_reserve(char *path)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((path_phys =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_get_physical_name(path)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: ", whoami);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(112, "Error: Invalid pathname (%s)"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_reserve(path_phys)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadm_release(char *path)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *path_phys = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((path_phys =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_get_physical_name(path)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: ", whoami);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(112, "Error: Invalid pathname (%s)"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_release(path_phys)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortei18n_catopen() {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_i18n_catopen();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint adm_check_file(char **path, int flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_check_file(*path, flag)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) print_errString(err, *path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2212, "Download file O.K. \n\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Print out private loop dev dtype
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteprint_private_loop_dtype_prop(uchar_t *hba_port_wwn, uchar_t *port_wwn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t dtype_prop)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((dtype_prop & DTYPE_MASK) < 0x10) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " 0x%-2x (%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (dtype_prop & DTYPE_MASK), dtype[(dtype_prop & DTYPE_MASK)]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((dtype_prop & DTYPE_MASK) < 0x1f) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSGSTR(2243, " 0x%-2x (Reserved"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (dtype_prop & DTYPE_MASK));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2245,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " 0x%-2x (Unknown Type"), (dtype_prop & DTYPE_MASK));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check to see if this is the HBA */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wwnConversion(hba_port_wwn) == wwnConversion(port_wwn)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* MATCH */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, MSGSTR(2244,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ",Host Bus Adapter)\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, ")\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}