diag.c revision fcf3ce441efd61da9bb2884968af01cb7c1452cc
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*LINTLIBRARY*/
/*
* This module is part of the photon library
*/
/*
* I18N message number ranges
* This file: 8000 - 8499
* Shared common messages: 1 - 1999
*/
/* Includes */
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <nl_types.h>
#include <strings.h>
#include <l_common.h>
#include <stgcom.h>
#include <l_error.h>
#include <a_state.h>
#include <a5k.h>
/* Defines */
/*
* take all paths supplied by dl offline.
*
* RETURNS:
* 0 = No error.
* *bsy_res_flag_p: 1 = The device is "busy".
*
* In pre-2.6 we just return success
*/
static int
{
char dev_path1[MAXPATHLEN];
/* for each path attempt to take it offline */
/* save a copy of the pathname */
/* attempt to acquire the device */
return (L_ACQUIRE_FAIL);
}
}
/* attempt to offline the drive */
if (devctl_device_offline(devhdl) != 0) {
*bsy_res_flag_p = 1;
(void) devctl_release(devhdl);
return (0);
}
E_DPRINTF(" d_offline_drive: Offline succeeded:/n "
"%s\n", dev_path1);
/* offline succeeded -- release handle acquired above */
(void) devctl_release(devhdl);
}
return (0);
}
/*
* Check to see if any of the disks that are attached
* to the selected port on this backplane are reserved or busy.
*
* INPUTS:
* RETURNS:
* 0 = No error.
* *bsy_res_flag_p: 1 = The device is "busy".
*/
int
{
int err, i;
return (L_MALLOC_FAILED);
}
(void) l_free_lstate(&l_state);
return (err);
}
if ((front_flag &&
L_RESERVED)) || (!front_flag &&
L_RESERVED))) {
*bsy_res_flag_p = 1;
(void) l_free_lstate(&l_state);
return (0);
}
}
/* Get list of all paths to the requested port. */
if (front_flag) {
if (port_a_flag) {
if ((err = g_get_port_multipath(
(void) l_free_lstate(&l_state);
return (err);
}
} else {
if ((err = g_get_port_multipath(
(void) l_free_lstate(&l_state);
return (err);
}
}
} else {
if (port_a_flag) {
if ((err = g_get_port_multipath(
(void) l_free_lstate(&l_state);
return (err);
}
} else {
if ((err = g_get_port_multipath(
(void) l_free_lstate(&l_state);
return (err);
}
}
}
bsy_res_flag_p, verbose)) {
(void) g_free_multipath(p_list);
(void) l_free_lstate(&l_state);
return (err);
}
(void) g_free_multipath(p_list);
}
(void) l_free_lstate(&l_state);
return (0);
}
/*
* Request the enclosure services controller (IB)
* to set the LRC (Loop Redundancy Circuit) to the
* the a and f flag and the enclosure or pathname.
*/
int
{
int fd, i;
int nobj = 0;
int found = 0;
Bp_elem_st *bp;
char msg[MAXPATHLEN];
int bsy_res_flag = 0;
int err;
return (L_NO_SES_PATH);
}
/*
* Check for reservation and busy for all disks on this
* backplane.
*/
if (!force_flag && bypass_flag) {
return (err);
}
if (bsy_res_flag) {
return (L_BP_BUSY_RESERVED);
}
}
return (errno);
}
return (errno);
}
if (nobj == 0) {
return (L_IB_NO_ELEM_FOUND);
}
E_DPRINTF(" l_ib_bypass_bp: Number of SES objects: 0x%x\n",
nobj);
/* alloc some memory for the objmap */
return (errno);
}
(void) g_destroy_data(all_objp_save);
return (errno);
}
E_DPRINTF(" ID 0x%x\t Element type 0x%x\n",
found++;
break;
}
}
if (found == 0) {
(void) g_destroy_data(all_objp_save);
return (L_NO_BP_ELEM_FOUND);
}
/*
* We found the backplane element.
*/
if (verbose) {
/* Get the status for backplane #0 */
(void) g_destroy_data(all_objp_save);
return (errno);
}
" Front backplane status: "));
}
}
all_objp++;
all_objp--;
(void) g_destroy_data(all_objp_save);
return (errno);
}
" Rear backplane status: "));
}
}
}
/* Get the current status */
if (!front_flag) {
all_objp++;
}
(void) g_destroy_data(all_objp_save);
return (errno);
}
/* Do the requested action. */
if (port_a_flag) {
} else {
}
(void) printf(" Sending this structure to ID 0x%x"
" of type 0x%x\n",
for (i = 0; i < 4; i++) {
(void) printf(" Byte %d 0x%x\n", i,
}
}
(void) g_destroy_data(all_objp_save);
return (errno);
}
(void) g_destroy_data(all_objp_save);
return (0);
}
/*
* This function will request the enclosure services
* controller (IB) to set the LRC (Loop Redundancy Circuit) to the
* enclosure,dev or pathname and the port specified by the a
* flag.
*/
int
{
char ses_path[MAXPATHLEN];
int pathcnt = 1;
unsigned short page_len;
struct device_element *elem;
struct device_element status;
char temppath[MAXPATHLEN];
if (path_struct == NULL) {
return (L_INVALID_PATH_FORMAT);
}
return (L_MALLOC_FAILED);
}
for (i = 0; i < pathcnt; i++) {
MAXPATHSTATE) {
p_pw = i;
break;
}
p_on = i;
}
p_st = i;
}
}
}
/* matching input pwwn */
/* on_line path */
} else {
/* standby or path0 */
}
}
/*
*
* The path_struct will return a valid slot
* and the IB path or a disk path.
*/
if (!path_struct->ib_path_flag) {
(void) l_free_lstate(&l_state);
return (err);
}
(void) l_free_lstate(&l_state);
return (err);
}
} else {
}
if (!path_struct->slot_valid) {
(void) l_free_lstate(&l_state);
return (err);
}
(void) l_free_lstate(&l_state);
return (err);
}
(void) l_free_lstate(&l_state);
return (err);
}
/* We are passing the disks path */
(void) l_free_lstate(&l_state);
return (err);
}
}
}
(void) l_free_lstate(&l_state);
return (errno);
}
(void) g_destroy_data(page_buf);
(void) l_free_lstate(&l_state);
return (errno);
}
(void) g_destroy_data(page_buf);
(void) l_free_lstate(&l_state);
return (err);
}
/* Get index to the disk we are interested in */
(void) g_destroy_data(page_buf);
(void) l_free_lstate(&l_state);
return (err);
}
/*
* Now that we have the status check to see if
* busy or reserved, if bypassing.
*/
bypass_flag) {
i = path_struct->slot;
/*
* Check for reservation and busy
*/
if ((f_flag &&
L_RESERVED)) || (!f_flag &&
L_RESERVED))) {
(void) g_destroy_data(page_buf);
(void) l_free_lstate(&l_state);
return (L_BP_RESERVED);
}
if (f_flag) {
if (port_a_flag) {
if ((err = g_get_port_multipath(
(void) g_destroy_data(page_buf);
(void) l_free_lstate(&l_state);
return (err);
}
} else {
if ((err = g_get_port_multipath(
(void) g_destroy_data(page_buf);
(void) l_free_lstate(&l_state);
return (err);
}
}
} else {
if (port_a_flag) {
if ((err = g_get_port_multipath(
(void) g_destroy_data(page_buf);
(void) l_free_lstate(&l_state);
return (err);
}
} else {
if ((err = g_get_port_multipath(
(void) g_destroy_data(page_buf);
(void) l_free_lstate(&l_state);
return (err);
}
}
}
(void) g_free_multipath(p_list);
(void) g_destroy_data(page_buf);
(void) l_free_lstate(&l_state);
return (err);
}
(void) g_free_multipath(p_list);
if (bsy_flag) {
(void) g_destroy_data(page_buf);
(void) l_free_lstate(&l_state);
return (L_BP_BUSY);
}
}
&rear_index)) {
(void) g_destroy_data(page_buf);
(void) l_free_lstate(&l_state);
return (err);
}
return (L_SCSI_ERROR);
}
/* Skip global element */
front_index++;
strlen(DAK_OFF_NAME)) == 0) ||
strlen(DAK_PROD_STR)) == 0)) {
} else {
rear_index++;
}
if (path_struct->f_flag) {
} else {
}
/*
* now do requested action.
*/
sizeof (struct device_element)); /* save status */
/* Do requested action */
if (port_a_flag) {
} else {
}
g_dump(" l_dev_bypass_enable: Updating LRC circuit state:\n"
" Device Status Element ",
HEX_ONLY);
" enclosure:%s slot:%d %s\n",
}
(void) g_destroy_data(page_buf);
(void) l_free_lstate(&l_state);
return (err);
}
(void) g_destroy_data(page_buf);
(void) l_free_lstate(&l_state);
return (0);
}
/*
* Issue a Loop Port enable Primitive sequence
* to the device specified by the pathname.
*/
int
/*ARGSUSED*/
{
return (0);
}
/*
* Issue a Loop Port Bypass Primitive sequence
* to the device specified by the pathname. This requests the
* device to set its L_Port into the bypass mode.
*/
int
/*ARGSUSED*/
{
return (0);
}