fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*LINTLIBRARY*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This module is part of the photon library
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * I18N message number ranges
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This file: 8000 - 8499
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Shared common messages: 1 - 1999
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Includes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Defines */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * take all paths supplied by dl offline.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 = No error.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * *bsy_res_flag_p: 1 = The device is "busy".
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * In pre-2.6 we just return success
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forted_offline_drive(struct dlist *dl, int *bsy_res_flag_p, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* for each path attempt to take it offline */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* save a copy of the pathname */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* attempt to acquire the device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* attempt to offline the drive */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte E_DPRINTF(" d_offline_drive: Offline succeeded:/n "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* offline succeeded -- release handle acquired above */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check to see if any of the disks that are attached
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to the selected port on this backplane are reserved or busy.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 = No error.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * *bsy_res_flag_p: 1 = The device is "busy".
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortel_check_busy_reserv_bp(char *ses_path, int front_flag,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int port_a_flag, int *bsy_res_flag_p, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((l_state = (L_state *)calloc(1, sizeof (L_state))) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_status(ses_path, l_state, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < (int)l_state->total_num_drv/2; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_state->drv_front[i].g_disk_state.d_state_flags[port_a_flag] &
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_state->drv_rear[i].g_disk_state.d_state_flags[port_a_flag] &
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < (int)l_state->total_num_drv/2; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get list of all paths to the requested port. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Request the enclosure services controller (IB)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to set the LRC (Loop Redundancy Circuit) to the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bypassed/enabled state for the backplane specified by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the a and f flag and the enclosure or pathname.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortel_bp_bypass_enable(char *ses_path, int bypass_flag, int port_a_flag,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteses_object *all_objp = NULL, *all_objp_save = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check for reservation and busy for all disks on this
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * backplane.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte front_flag, port_a_flag, &bsy_res_flag, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fd = g_object_open(ses_path, O_NDELAY | O_RDWR)) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ioctl(fd, SESIOC_GETNOBJ, (caddr_t)&nobj) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte E_DPRINTF(" l_ib_bypass_bp: Number of SES objects: 0x%x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* alloc some memory for the objmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((all_objp = g_zalloc((nobj + 1) * sizeof (ses_object))) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ioctl(fd, SESIOC_GETOBJMAP, (caddr_t)all_objp) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We found the backplane element.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the status for backplane #0 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ioctl(fd, SESIOC_GETOBJSTAT, (caddr_t)&obj) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Front backplane status: "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ioctl(fd, SESIOC_GETOBJSTAT, (caddr_t)&obj) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Rear backplane status: "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the current status */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ioctl(fd, SESIOC_GETOBJSTAT, (caddr_t)&obj) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Do the requested action. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(" Sending this structure to ID 0x%x"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " of type 0x%x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < 4; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ioctl(fd, SESIOC_SETOBJSTAT, (caddr_t)&obj) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This function will request the enclosure services
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * controller (IB) to set the LRC (Loop Redundancy Circuit) to the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bypassed/enabled state for the device specified by the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * enclosure,dev or pathname and the port specified by the a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortel_dev_bypass_enable(struct path_struct *path_struct, int bypass_flag,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((l_state = (L_state *)calloc(1, sizeof (L_state))) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(temppath, path_struct->p_physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strstr(path_struct->p_physical_path, SCSI_VHCI) != NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < pathcnt; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* matching input pwwn */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (pathlist.path_info[p_on].path_state ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* on_line path */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* standby or path0 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Need to get a valid location, front/rear & slot.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The path_struct will return a valid slot
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and the IB path or a disk path.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_dev_map(temppath, &map, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_ses_path(path_struct->p_physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(ses_path, path_struct->p_physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((map.dev_addr == (gfc_port_dev_info_t *)NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_ses_path(path_struct->p_physical_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_status(ses_path, l_state, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* We are passing the disks path */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_slot(path_struct, l_state, verbose)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (map.dev_addr != (gfc_port_dev_info_t *)NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((page_buf = (uchar_t *)malloc(MAX_REC_DIAG_LENGTH)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fd = g_object_open(ses_path, O_NDELAY | O_RDWR)) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_envsen_page(fd, page_buf, MAX_REC_DIAG_LENGTH,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte page_len = (page_buf[2] << 8 | page_buf[3]) + HEADER_LEN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get index to the disk we are interested in */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_status(ses_path, l_state, verbose)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Now that we have the status check to see if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * busy or reserved, if bypassing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((!(force_flag | path_struct->ib_path_flag)) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check for reservation and busy
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_state->drv_front[i].g_disk_state.d_state_flags[port_a_flag] &
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_state->drv_rear[i].g_disk_state.d_state_flags[port_a_flag] &
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_disk_element_index(l_state, &front_index,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Skip global element */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strncmp((char *)&inq.inq_pid[0], DAK_OFF_NAME,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = (8 + (front_index + path_struct->slot)*4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = (8 + (rear_index + path_struct->slot)*4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem = (struct device_element *)(page_buf + offset);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * now do requested action.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (struct device_element)); /* save status */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Do requested action */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_dump(" l_dev_bypass_enable: Updating LRC circuit state:\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Device Status Element ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, " for device at location:"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " enclosure:%s slot:%d %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Issue a Loop Port enable Primitive sequence
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to the device specified by the pathname.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Issue a Loop Port Bypass Primitive sequence
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to the device specified by the pathname. This requests the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * device to set its L_Port into the bypass mode.