common.h 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.
*/
/*
* PHOTON CONFIGURATION MANAGER
* Common definitions
*/
/*
* I18N message number ranges
* This file: 12500 - 12999
* Shared common messages: 1 - 1999
*/
#ifndef _COMMON_H
#define _COMMON_H
/*
* Include any headers you depend on.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*#ifdef _BIG_ENDIAN
#define htonll(x) (x)
#define ntohll(x) (x)
#else
#define htonll(x) ((((unsigned long long)htonl(x)) << 32) + htonl(x >> 32))
#define ntohll(x) ((((unsigned long long)ntohl(x)) << 32) + ntohl(x >> 32))
#endif*/
extern char *p_error_msg_ptr;
#ifdef __x86
#include <nl_types.h>
#endif
/* Defines */
"Usage: %s [-v] subcommand [option...]" \
" {enclosure[,dev]... | pathname...}\n"), \
whoami); \
"Usage: %s [-v] -e subcommand [option...]" \
" {enclosure[,dev]... | pathname...}\n"), \
whoami); \
#define L_ERR_PRINT \
if (p_error_msg_ptr == NULL) { \
} else { \
} \
} else { \
} \
/* Display extended mode page information. */
#ifndef MODEPAGE_CACHING
#define MODEPAGE_CACHING 0x08
#endif
/* Primary commands */
#define ENCLOSURE_NAMES 100
#define DISPLAY 101
#define DOWNLOAD 102
#define FAILOVER 500
#define INQUIRY 105
#define LED 107
#define LED_ON 108
#define LED_OFF 109
#define LED_BLINK 110
#define POWER_ON 111
#define PASSWORD 112
#define PROBE 113
#define RELEASE 210
#define RESERVE 211
#define START 213
#define STOP 214
/* Device hotplugging */
#define REPLACE_DEVICE 150
#define DEV_ONLINE 155
#define DEV_OFFLINE 156
#define DEV_GETSTATE 157
#define DEV_RESET 158
#define BUS_QUIESCE 160
#define BUS_UNQUIESCE 161
#define BUS_GETSTATE 162
#define BUS_RESET 163
#define BUS_RESETALL 164
#define SKIP 111
#define QUIT 222
#define L_LED_STATUS 0x00
#define L_LED_RQST_IDENTIFY 0x01
#define L_LED_ON 0x02
#define L_LED_OFF 0x04
/* Enclosure Specific */
/* Expert commands */
#define RDLS 215
#define P_BYPASS 218
#define P_ENABLE 219
#define BYPASS 220
#define ENABLE 221
#define FORCELIP 222
#define LUX_P_OFFLINE 223
#define LUX_P_ONLINE 224
#define EXT_LOOPBACK 225
#define INT_LOOPBACK 226
#define NO_LOOPBACK 227
#define CREATE_FAB 228
/* Undocumented commands */
#define DUMP 300
/* Undocumented diagnostic subcommands */
#define SYSDUMP 350
/* SSA - for adm_download */
/* #define SSAFIRMWARE_FILE "/usr/lib/firmware/ssa/ssafirmware" */
/* Global variables */
extern char *whoami;
extern int Options;
extern const int OPTION_A;
extern const int OPTION_B;
extern const int OPTION_C;
extern const int OPTION_D;
extern const int OPTION_E;
extern const int OPTION_F;
extern const int OPTION_L;
extern const int OPTION_P;
extern const int OPTION_R;
extern const int OPTION_T;
extern const int OPTION_V;
extern const int OPTION_Z;
extern const int OPTION_Y;
extern const int OPTION_CAPF;
extern const int PVERBOSE;
extern const int SAVE;
extern const int EXPERT;
/* used to set the behavior of get_slash_devices_from_osDevName. */
#define STANDARD_DEVNAME_HANDLING 1
#define NOT_IGNORE_DANGLING_LINK 2
#include <hbaapi.h>
#ifndef __x86
#include <g_state.h>
#include <stgcom.h>
#include <l_common.h>
#else
typedef struct l_inquiry_inq_2 {
#if defined(_BIT_FIELDS_HTOL)
#else
#endif /* _BIT_FIELDS_HTOL */
} L_inq_2;
typedef struct l_inquiry_inq_3 {
#if defined(_BIT_FIELDS_HTOL)
#else
#endif /* _BIT_FIELDS_HTOL */
} L_inq_3;
typedef struct l_inquiry_struct {
/*
* byte 0
*
* Bits 7-5 are the Peripheral Device Qualifier
* Bits 4-0 are the Peripheral Device Type
*
*/
/* byte 1 */
#if defined(_BIT_FIELDS_HTOL)
#else
#endif /* _BIT_FIELDS_HTOL */
/* byte 2 */
#if defined(_BIT_FIELDS_HTOL)
#else
#endif /* _BIT_FIELDS_HTOL */
/* byte 3 */
#if defined(_BIT_FIELDS_HTOL)
: 1, /* reserved */
#else
: 1, /* reserved */
#endif /* _BIT_FIELDS_HTOL */
/* bytes 4-7 */
#if defined(_BIT_FIELDS_HTOL)
#else
: 2; /* reserved */
#endif /* _BIT_FIELDS_HTOL */
union {
} ui;
/* bytes 8-35 */
/*
* Bytes 36-55 are vendor-specific parameter bytes
*/
/* SSA specific definitions */
/* bytes 36 - 39 */
#define inq_ven_specific_1 inq_firmware_rev
/* bytes 40 - 51 */
/* bytes 52-53 */
/* byte 54, 55 */
/*
* Bytes 56-95 are reserved.
*/
/*
* 96 to 'n' are vendor-specific parameter bytes
*/
} L_inquiry;
#define HEX_ONLY 0 /* Print Hex only */
/* NOTE: These command op codes are not defined in commands.h */
#define SCMD_SYNC_CACHE 0x35
#define SCMD_LOG_SENSE 0x4d
#define SCMD_PERS_RESERV_IN 0x5e
#define SCMD_PERS_RESERV_OUT 0x5f
typedef struct rls_payload {
typedef struct l_inquiry00_struct {
#if defined(_BIT_FIELDS_LTOH)
dtype :5;
#else
qual :3;
#endif /* _BIT_FIELDS_LTOH */
} L_inquiry00;
#define MIN(a, b) (a < b ? a : b)
#define RETRY_FCIO_IOCTL 360
#endif /* __x86 */
int adm_display_config(char **argv);
void adm_failover(char **argv);
void pho_probe();
void non_encl_probe();
void up_password(char **argv);
int adm_forcelip(char **argv);
void display_link_status(char **argv);
int read_repos_file(char *repos_filename);
int adm_inquiry(char **argv);
int adm_display_port(int verbose);
int adm_reserve(char *path);
int adm_release(char *path);
void i18n_catopen();
void dump_hex_data(char *, uchar_t *, int, int);
void print_errString(int, char *);
void print_chars(uchar_t *, int, int);
char *get_errString(int errornum);
/* routines in fchba*.c files */
int fchba_display_port(int verbose);
int *path_count);
int scsi_release(char *path);
int scsi_reserve(char *path);
int loadLibrary();
#ifdef __cplusplus
}
#endif
#endif /* _COMMON_H */