2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _G_STATE_H
2N/A#define _G_STATE_H
2N/A
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/*
2N/A * Include any headers you depend on.
2N/A */
2N/A
2N/A/*
2N/A * I18N message number ranges
2N/A * This file: 19000 - 19499
2N/A * Shared common messages: 1 - 1999
2N/A */
2N/A
2N/A#include <libdevice.h>
2N/A#include <sys/fibre-channel/fcio.h>
2N/A#include <sys/sunmdi.h>
2N/A/*
2N/A * sys/fc4/fcio.h includes sys/fc4/fcal_linkapp.h. The following #define
2N/A * keeps from actually including the contents of sys/fc4/fcal_linkapp.h
2N/A * since that file contains the same structure definitions as sys/fc4/fcio.h.
2N/A */
2N/A#define _SYS_FC4_FCAL_LINKAPP_H
2N/A#include <sys/fc4/fcio.h>
2N/A#include <sys/devctl.h>
2N/A#include <g_scsi.h>
2N/A#include <sys/scsi/generic/commands.h>
2N/A#include <libnvpair.h>
2N/A#include <libdevinfo.h>
2N/A
2N/A#define MAXPATHSTATE 5
2N/A
2N/A#include <gfc.h>
2N/A
2N/A/* hotplug defines */
2N/A#define SENA 1
2N/A#define NON_SENA 0
2N/A/* format parameters to dump() */
2N/A#define HEX_ONLY 0 /* Print Hex only */
2N/A#define HEX_ASCII 1 /* Print Hex and Ascii */
2N/A/* Persistent Reservation */
2N/A#define ACTION_READ_KEYS 0x00
2N/A#define ACTION_READ_RESERV 0x01
2N/A#define ACTION_REGISTER 0x00
2N/A#define ACTION_RESERVE 0x01
2N/A#define ACTION_RELEASE 0x02
2N/A#define ACTION_CLEAR 0x03
2N/A#define ACTION_PREEMPT 0x04
2N/A#define ACTION_PREEMPT_CLR 0x05
2N/A
2N/A/* Some constants for fabric/public loops */
2N/A#define AREA_DOMAIN_ID 0x00FFFF00
2N/A
2N/A/* Max number of retries */
2N/A#define RETRY_FCIO_IOCTL 360
2N/A#define RETRY_FCP_IOCTL 360
2N/A#define RETRY_OBJECT_OPEN 5
2N/A#define RETRY_PATHLIST 1
2N/A
2N/A/* Wait times in microseconds */
2N/A#define WAIT_FCIO_IOCTL 250000 /* 1/4 of a second */
2N/A#define WAIT_FCP_IOCTL 250000 /* 1/4 of a second */
2N/A#define WAIT_OBJECT_OPEN 10000 /* 1/100 of a sec. */
2N/A
2N/A/* Defines for VS inq_port field on standard page (bit 5 Byte 6 */
2N/A#define PATH_PRIMARY 0x0
2N/A#define PATH_FAILOVER 0x1
2N/A
2N/A/*
2N/A * Macro for deallocating memory pointed by dev_addr pointer
2N/A * of gfc_map_t structure.
2N/A * It is defined here to make available at any place from
2N/A * luxadm, liba5k and libg_fc.
2N/A *
2N/A * Note: The macro will try to free any non-NULL dev_addr.
2N/A * So, dev_addr ptr needs to be initialized to NULL.
2N/A *
2N/A * map.dev_addr = (gfc_port_dev_info_t *)NULL
2N/A * map->dev_addr = (gfc_port_dev_info_t *)NULL.
2N/A */
2N/A#define FREE_DEV_ADDR(D_PTR) if (D_PTR != NULL) {\
2N/A free((void *)D_PTR);\
2N/A D_PTR = (gfc_port_dev_info_t *)NULL;\
2N/A }
2N/A
2N/A/* Constants and macros used by the g_get_path_type() function */
2N/A#define SLASH "/"
2N/A#define DEV_PREFIX "/devices/" /* base pathname for devfs names */
2N/A#define DEV_PREFIX_LEN 9 /* Length of DEV_PREFIX string */
2N/A /* Can do a strlen and generalize */
2N/A /* but this is is easier */
2N/A#define DEVICES_DIR "/devices"
2N/A
2N/A/* Defines for minor names used to append to devfs paths */
2N/A#define SSD_MINOR_NAME ":c,raw"
2N/A#define ST_MINOR_NAME ":n"
2N/A
2N/A/* Defines for ssd driver name passed to root tree search routines */
2N/A#define SSD_DRVR_NAME "ssd"
2N/A#define ST_DRVR_NAME "st"
2N/A
2N/A/*
2N/A * Property names
2N/A */
2N/A#define PORT_WWN_PROP "port-wwn"
2N/A#define NODE_WWN_PROP "node-wwn"
2N/A#define LUN_GUID_PROP "client-guid"
2N/A#define LUN_PROP "lun"
2N/A
2N/Atypedef struct read_keys_struct {
2N/A int rk_generation;
2N/A int rk_length;
2N/A int rk_key[256];
2N/A} Read_keys;
2N/A
2N/Atypedef struct read_reserv_struct {
2N/A int rr_generation;
2N/A int rr_length;
2N/A} Read_reserv;
2N/A
2N/A/*
2N/A * mplist structure typedef to support multipath
2N/A */
2N/Atypedef struct mplist_struct {
2N/A char *devpath;
2N/A struct mplist_struct *next;
2N/A} Mplist;
2N/A
2N/A/* wwn_list_found to track previous calls to g_get_wwn */
2N/Atypedef struct wwn_list_found_struct {
2N/A uchar_t node_wwn[WWN_SIZE];
2N/A uchar_t port_wwn[WWN_SIZE];
2N/A struct wwn_list_found_struct *wwn_next;
2N/A} WWN_list_found;
2N/A
2N/A/* Function prototyes defined for libg_fc modules */
2N/A/* genf.c */
2N/Aextern void *g_zalloc(int);
2N/Aextern char *g_alloc_string(char *);
2N/Aextern void g_destroy_data(void *);
2N/Aextern void g_dump(char *, uchar_t *, int, int);
2N/Aextern int g_object_open(char *, int);
2N/Aextern char *g_scsi_find_command_name(int);
2N/Aextern void g_scsi_printerr(struct uscsi_cmd *,
2N/A struct scsi_extended_sense *, int, char msg_string[], char *);
2N/Aextern int g_get_machineArch(int *);
2N/Aextern boolean_t g_enclDiskChk(char *, char *);
2N/A
2N/A/* hot.c */
2N/Aextern void g_ll_to_str(uchar_t *, char *);
2N/Aextern void g_free_hotplug_dlist(struct hotplug_disk_list **);
2N/A
2N/A/* map.c */
2N/Aextern int g_string_to_wwn(uchar_t *, uchar_t *);
2N/Aextern int g_get_perf_statistics(char *, uchar_t *);
2N/Aextern int g_get_port_multipath(char *, struct dlist **, int);
2N/Aextern int g_device_in_map(gfc_map_t *, int);
2N/Aextern int g_start(char *);
2N/Aextern int g_stop(char *, int);
2N/Aextern int g_reserve(char *);
2N/Aextern int g_release(char *);
2N/Aextern int g_issue_fcio_ioctl(int, fcio_t *, int);
2N/Aextern void g_sort_wwn_list(struct wwn_list_struct **);
2N/Aextern void g_free_wwn_list_found(struct wwn_list_found_struct **);
2N/A
2N/A/* cmd.c */
2N/Aextern int cmd(int, struct uscsi_cmd *, int);
2N/A
2N/A/* io.c */
2N/Aextern int g_scsi_persistent_reserve_in_cmd(int, uchar_t *, int, uchar_t);
2N/Aextern int g_scsi_send_diag_cmd(int, uchar_t *, int);
2N/Aextern int g_scsi_rec_diag_cmd(int, uchar_t *, int, uchar_t);
2N/Aextern int g_scsi_writebuffer_cmd(int, int, uchar_t *, int, int, int);
2N/Aextern int g_scsi_readbuffer_cmd(int, uchar_t *, int, int);
2N/Aextern int g_scsi_inquiry_cmd(int, uchar_t *, int);
2N/Aextern int g_scsi_log_sense_cmd(int, uchar_t *, int, uchar_t);
2N/Aextern int g_scsi_mode_select_cmd(int, uchar_t *, int, uchar_t);
2N/Aextern int g_scsi_mode_sense_cmd(int, uchar_t *, int, uchar_t, uchar_t);
2N/Aextern int g_scsi_read_capacity_cmd(int, uchar_t *, int);
2N/Aextern int g_scsi_read_capacity_1016_cmd(int, struct scsi_capacity_16 *,
2N/A int);
2N/Aextern int g_scsi_release_cmd(int);
2N/Aextern int g_scsi_reserve_cmd(int);
2N/Aextern int g_scsi_start_cmd(int);
2N/Aextern int g_scsi_stop_cmd(int, int);
2N/Aextern int g_scsi_tur(int);
2N/Aextern int g_scsi_reset(int);
2N/Aextern int g_devid_get(char *, ddi_devid_t *, di_node_t root,
2N/A const char *);
2N/A
2N/A/* mpath.c */
2N/Aextern int g_get_lun_str(char *, char *, int);
2N/Aextern int g_get_lun_number(char *);
2N/Aextern int g_get_pathcount(char *);
2N/Aextern int g_devices_get_all(struct wwn_list_struct **);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _G_STATE_H */