753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * CDDL HEADER START
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * The contents of this file are subject to the terms of the
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * Common Development and Distribution License (the "License").
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * You may not use this file except in compliance with the License.
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * See the License for the specific language governing permissions
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * and limitations under the License.
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * When distributing Covered Code, include this CDDL HEADER in each
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * If applicable, add the following below this CDDL HEADER, with the
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * fields enclosed by brackets "[]" replaced with your own identifying
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * information: Portions Copyright [yyyy] [name of copyright owner]
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * CDDL HEADER END
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * Use is subject to license terms.
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore/*LINTLIBRARY*/
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * This module is part of the photon library
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * I18N message number ranges
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * This file: 8000 - 8499
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * Shared common messages: 1 - 1999
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore/* Includes */
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore/* Defines */
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * take all paths supplied by dl offline.
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * 0 = No error.
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * *bsy_res_flag_p: 1 = The device is "busy".
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * In pre-2.6 we just return success
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moored_offline_drive(struct dlist *dl, int *bsy_res_flag_p, int verbose)
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore /* for each path attempt to take it offline */
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore /* save a copy of the pathname */
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore /* attempt to acquire the device */
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore /* attempt to offline the drive */
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore E_DPRINTF(" d_offline_drive: Offline succeeded:/n "
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore /* offline succeeded -- release handle acquired above */
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * Check to see if any of the disks that are attached
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * to the selected port on this backplane are reserved or busy.
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * 0 = No error.
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * *bsy_res_flag_p: 1 = The device is "busy".
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moorel_check_busy_reserv_bp(char *ses_path, int front_flag,
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore int port_a_flag, int *bsy_res_flag_p, int verbose)
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore if ((l_state = (L_state *)calloc(1, sizeof (L_state))) == NULL) {
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore if (err = l_get_status(ses_path, l_state, verbose)) {
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore for (i = 0; i < (int)l_state->total_num_drv/2; i++) {
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore (l_state->drv_front[i].g_disk_state.d_state_flags[port_a_flag] &
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore (l_state->drv_rear[i].g_disk_state.d_state_flags[port_a_flag] &
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore for (i = 0; i < (int)l_state->total_num_drv/2; i++) {
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore /* Get list of all paths to the requested port. */
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore l_state->drv_front[i].g_disk_state.port_a_wwn_s,
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore l_state->drv_front[i].g_disk_state.port_b_wwn_s,
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore l_state->drv_rear[i].g_disk_state.port_a_wwn_s,
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore l_state->drv_rear[i].g_disk_state.port_b_wwn_s,
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * Request the enclosure services controller (IB)
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * to set the LRC (Loop Redundancy Circuit) to the
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * bypassed/enabled state for the backplane specified by
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * the a and f flag and the enclosure or pathname.
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moorel_bp_bypass_enable(char *ses_path, int bypass_flag, int port_a_flag,
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Mooreses_object *all_objp = NULL, *all_objp_save = NULL;
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * Check for reservation and busy for all disks on this
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * backplane.
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore front_flag, port_a_flag, &bsy_res_flag, verbose)) {
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore if ((fd = g_object_open(ses_path, O_NDELAY | O_RDWR)) == -1) {
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore if (ioctl(fd, SESIOC_GETNOBJ, (caddr_t)&nobj) < 0) {
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore E_DPRINTF(" l_ib_bypass_bp: Number of SES objects: 0x%x\n",
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore /* alloc some memory for the objmap */
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore if ((all_objp = g_zalloc((nobj + 1) * sizeof (ses_object))) == NULL) {
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore if (ioctl(fd, SESIOC_GETOBJMAP, (caddr_t)all_objp) < 0) {
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore * We found the backplane element.
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore /* Get the status for backplane #0 */
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore if (ioctl(fd, SESIOC_GETOBJSTAT, (caddr_t)&obj) < 0) {
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore " Front backplane status: "));
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore bp = (struct bp_element_status *)&obj.cstat[0];
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore if (ioctl(fd, SESIOC_GETOBJSTAT, (caddr_t)&obj) < 0) {
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore " Rear backplane status: "));
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore bp = (struct bp_element_status *)&obj.cstat[0];
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore /* Get the current status */
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore if (ioctl(fd, SESIOC_GETOBJSTAT, (caddr_t)&obj) < 0) {
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore /* Do the requested action. */
753a6d457b330b1b29b2d3eefcd0831116ce950dSherry Moore bp = (struct bp_element_status *)&obj.cstat[0];
if (port_a_flag) {
return (errno);
return (L_INVALID_PATH_FORMAT);
return (L_MALLOC_FAILED);
for (i = 0; i < pathcnt; i++) {
MAXPATHSTATE) {
p_pw = i;
p_on = i;
p_st = i;
return (err);
return (err);
return (err);
return (err);
return (err);
return (err);
return (errno);
return (errno);
return (err);
return (err);
bypass_flag) {
if ((f_flag &&
L_RESERVED))) {
return (L_BP_RESERVED);
if (f_flag) {
if (port_a_flag) {
return (err);
return (err);
if (port_a_flag) {
return (err);
return (err);
return (err);
if (bsy_flag) {
return (L_BP_BUSY);
&rear_index)) {
return (err);
return (L_SCSI_ERROR);
front_index++;
rear_index++;
if (port_a_flag) {
HEX_ONLY);
return (err);