/*
* 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: 8500 - 8999
* Shared common messages: 1 - 1999
*/
/* #define _POSIX_SOURCE 1 */
/* Includes */
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <nl_types.h>
#include <strings.h>
#include <l_common.h>
#include <stgcom.h>
#include <l_error.h>
#include <rom.h>
#include <a_state.h>
#include <a5k.h>
/* Global variables */
extern uchar_t g_switch_to_alpa[];
extern uchar_t g_sf_alpa_to_switch[];
/*
* This function checks if the passed char pointer has WWN_SIZE nulls (zeroes).
*
* This is only a convenience function.
*
* INPUT:
* wwn_ptr - pointer to a character string of length WWN_SIZE
* It is expected to be holding the WWN
* Ex: A WWN like 508002000000ddc1 is expected to be stored as
* the following 8 bytes -
* 0x50, 0x80, 0x00, 0x20, ... etc
*
* RETURNS:
* 0 - if there is atleast one of WWN_SIZE bytes is != '\0'
* non-zero - if all WWN_SIZE bytes are '\0'
*/
int
{
int i;
for (i = 0; i < WWN_SIZE; i++) {
return (0);
}
return (1);
}
/*
* the given ses_path.
*
* INPUT:
* ses_path - pointer to the ses_path
* map - pointer to the map
* dtype - dtype of the device whose path is to be constructed
*
* OUTPUT:
* dev_path - pointer to the device path of type dtype and with tid
* - Caller has to free this after use
*
* RETURNS:
* 0 - on success
* non-zero - otherwise
*/
int
{
int found = 0;
return (L_INVALID_PATH_FORMAT);
}
case FC_TOP_PRIVATE_LOOP:
break;
}
*dev_path = '\0';
return (L_INVALID_LOOP_MAP);
}
/* Make sure that the port WWN is valid */
priv_port.sf_port_wwn)) {
*dev_path = '\0';
return (L_INVLD_WWN_FORMAT);
}
return (err);
}
wwn) == 0) {
found = 1;
break;
}
}
if (found) {
} else {
return (L_INVALID_PATH);
}
} else {
"/ssd@w%s,0:c", wwn);
} else {
"/ses@w%s,0:c", wwn);
}
/* TBD: Must find path, not just use :c */
}
break;
case FC_TOP_FABRIC:
case FC_TOP_PUBLIC_LOOP:
/* First lets get the PA from the ses path passed in */
return (err);
}
/*
* Now we go through every entry in the map and match the
* area and domain ids with the PA of the passed ses path.
* If we find a match, we then match the low order byte
*/
i++, dev_addr_ptr++) {
if ((this_pid & AREA_DOMAIN_ID) ==
(ses_pid & AREA_DOMAIN_ID)) {
break;
}
}
*dev_path = '\0';
return (L_INVALID_LOOP_MAP);
}
/* Make sure that the port WWN is valid */
*dev_path = '\0';
return (L_INVLD_WWN_FORMAT);
}
return (err);
}
wwn) == 0) {
found = 1;
}
}
if (found) {
} else {
return (L_INVALID_PATH);
}
} else {
} else {
}
/* TBD: Must find path, not just use :c */
}
return (errno);
}
break;
case FC_TOP_PT_PT:
return (L_PT_PT_FC_TOP_NOT_SUPPORTED);
default:
return (L_UNEXPECTED_FC_TOPOLOGY);
} /* End of switch on port_topology */
return (0);
}
/*
* checks for null wwn to a disk.
* and returns -1 if found, 0
* otherwise.
*
* OUTPUT:
* char *ses_path
*
* RETURNS:
* 0 if OK
* non-zero otherwise
*/
int
{
return (L_INVALID_PATH_FORMAT);
}
/*
* verify and continue only if the argv
* has a format like box,{f/r}<slot #>.
* Otherwise, return to the caller.
* The only way to address null wwn disk
* is using the box,{f/r}<slot#> format.
*/
/* add support for new {f/r/s}<slot#> support for DPM */
} else {
return (0);
}
/*
* Get the list of enclosures
* connected to the system.
*/
return (L_NO_ENCL_LIST_FOUND);
}
/*
* The following method is safer to get an ses path
* to the enclosure than calling l_get_ses_path(),
* with physical path to null WWN disk.
* Because, l_get_ses_path uses the disk's
* al_pa to get the box id and then ses path
* to the box. When a disk has null wwn, it may
* not have a valid al_pa, and hard address.
* There is a possibility that l_get_ses_path()
* not returning ses path to the correct enclosure.
*/
break;
}
}
/* free the box list */
(void) l_free_box_list(&boxlist);
verbose) != 0) {
return (L_GET_STATUS_FAILED);
}
if (path_struct->f_flag) {
(void) strcpy(node_wwn_s,
} else {
(void) strcpy(node_wwn_s,
}
W_DPRINTF("Found ses path: %s\n"
/* check for null WWN */
return (0); /* Non-null wwn */
}
return (1);
}
return (0);
}
/*
* If OVERALL_STATUS is sent as the "func",
* the code pointer must be valid (non NULL).
* Otherwise NULL is a valid input for the code pointer.
*
* RETURNS:
* 0 if OK
* non-zero otherwise
*/
int
struct l_state_struct *l_state,
{
unsigned short page_len;
return (L_INVALID_PATH_FORMAT);
}
return (L_MALLOC_FAILED);
}
(void) g_destroy_data(page_buf);
return (L_OPEN_PATH_FAIL);
}
L_PAGE_2, verbose_flag)) != 0) {
(void) g_destroy_data(page_buf);
return (err);
}
&rear_index)) != 0) {
(void) g_destroy_data(page_buf);
return (err);
}
/* Skip global element */
front_index++;
strlen(DAK_OFF_NAME)) == 0) ||
strlen(DAK_OFF_NAME)) == 0)) {
} else
rear_index++;
if (f_flag) {
} else {
}
switch (func) {
case OVERALL_STATUS:
return (L_INVALID_ARG);
}
switch (todo) {
case INSERT_DEVICE:
(void) g_destroy_data(page_buf);
return (0);
case REMOVE_DEVICE:
(void) g_destroy_data(page_buf);
return (0);
}
/* NOTREACHED */
case SET_RQST_INSRT:
break;
case SET_RQST_RMV:
break;
case SET_FAULT:
break;
case SET_DRV_ON:
break;
}
(void) g_destroy_data(page_buf);
return (err);
}
/*
* Finds whether device id (tid) exists in the
* Arbitrated loop map or not.
*
* INPUT:
* ses_path - pointer to a ses path
* tid - the target id of the device we want to check on
* - only the low order 8 bits has the tid
* map - pointer to a map of the system
* verbose_flag - self explanatory
*
* OUTPUT:
* dev_path - the device path of the device with "tid".
* Caller is responsible for freeing it
*
* RETURNS:
* 1 if device present
* 0 otherwise
*/
int
int verbose_flag, char **dev_path)
{
return (0);
return (L_NO_SES_PATH);
}
case FC_TOP_PRIVATE_LOOP:
i++, dev_addr_ptr++) {
if (dev_addr_ptr->gfc_port_dev.
break;
}
}
}
return (0);
/*
* Make sure that the port WWN is valid
*/
priv_port.sf_port_wwn)) {
return (0);
}
for (j = 0, k = 0; j < WWN_SIZE; j++) {
snib = (c & 0x0f);
}
wwn[k] = '\0';
break;
case FC_TOP_PUBLIC_LOOP:
case FC_TOP_FABRIC:
/*
* Get the phys address (port id) of this ses device
*/
return (err);
i++, dev_addr_ptr++) {
DTYPE_ESI) {
/*
* We have a device. First match the area and
* domain ids and if they match, then see if
* the 8bit tid matches the last 8 bits of
* 'this_pid'
*/
if ((this_pid & AREA_DOMAIN_ID) ==
(ses_pid & AREA_DOMAIN_ID)) {
if (tid == g_sf_alpa_to_switch[
this_pid & 0xFF])
break;
}
}
}
return (0);
/*
* Make sure that the port WWN is valid
*/
return (0);
}
for (j = 0, k = 0; j < WWN_SIZE; j++) {
snib = (c & 0x0f);
}
wwn[k] = '\0';
break;
case FC_TOP_PT_PT:
return (L_PT_PT_FC_TOP_NOT_SUPPORTED);
default:
return (L_UNEXPECTED_FC_TOPOLOGY);
} /* End of switch on port_topology */
return (err);
}
break;
}
}
return (L_MALLOC_FAILED);
}
} else {
return (0);
}
} else {
P_DPRINTF(" l_device_present: wwn=%s, sf_path=%s\n",
return (L_MALLOC_FAILED);
}
}
return (0);
}
return (1);
}
/*
* onlines the given list of devices
* and free up the allocated memory.
*
* RETURNS:
* N/A
*/
static void
{
(void) g_destroy_data(dl1);
}
}
/*
* offlines all the disks in a
* SENA enclosure.
*
* RETURNS:
* 0 if O.K.
* non-zero otherwise
*/
int
struct wwn_list_struct *wwn_list,
int force_flag, int verbose_flag)
{
int i, err;
if (hotplug_sena == NULL) {
return (L_INVALID_PATH_FORMAT);
}
return (L_MALLOC_FAILED);
}
/* Get global status for this Photon */
while (dl_ses) {
break;
}
(void) l_free_lstate(&l_state);
return (L_ENCL_INVALID_PATH);
}
(void) l_free_lstate(&l_state);
return (L_MALLOC_FAILED);
}
(void) g_destroy_data(dev_path);
(void) l_free_lstate(&l_state);
return (L_MALLOC_FAILED);
}
(void) g_destroy_data(dev_path);
}
(void) g_destroy_data(dl);
(void) l_free_lstate(&l_state);
return (err);
}
force_flag)) != 0) {
(void) g_destroy_data(dev_path);
(void) g_destroy_data(dl);
(void) l_free_lstate(&l_state);
return (err);
}
} else {
}
(void) g_destroy_data(dev_path);
}
(void) l_free_lstate(&l_state);
return (L_MALLOC_FAILED);
}
(void) g_destroy_data(dev_path);
(void) l_free_lstate(&l_state);
return (L_MALLOC_FAILED);
}
(void) g_destroy_data(dev_path);
}
(void) g_destroy_data(dl);
(void) l_free_lstate(&l_state);
return (err);
}
force_flag)) != 0) {
(void) g_destroy_data(dev_path);
(void) g_destroy_data(dl);
(void) l_free_lstate(&l_state);
return (err);
}
} else {
}
(void) g_destroy_data(dev_path);
}
}
(void) l_free_lstate(&l_state);
return (0);
}
/*
* prepares a char string
* containing the name of the
* device which will be hotplugged.
*
* RETURNS:
* N/A
*/
void
{
int enc_type = 0;
char *physpath;
return;
}
}
}
/* If either of the above fail, we use the default value of 0 */
switch (enc_type) {
case DAK_ENC_TYPE:
} else {
"Drive in \"%s\" slot %d"), box_name,
}
break;
default:
} else {
}
break;
}
}