fct.h revision 162fafd3d0764eb6022fe01ce970de8775eda209
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _FCT_H
#define _FCT_H
/*
* Definitions for common FC Target.
*/
#include <sys/stmf_defines.h>
#include <sys/fct_defines.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum fct_struct_id {
typedef struct fct_remote_port {
void *rp_fct_private;
void *rp_fca_private;
struct fct_local_port *rp_port;
char rp_nwwn_str[FC_WWN_BUFLEN];
char rp_pwwn_str[FC_WWN_BUFLEN];
#define FCT_HANDLE_NONE 0xffff
typedef struct fct_cmd {
void *cmd_fct_private;
void *cmd_fca_private;
void *cmd_specific;
struct fct_local_port *cmd_port;
/* During cmd porting this can be set to NULL */
struct fct_remote_port *cmd_rp;
/* To link cmds together for handling things like ABTS. */
/* During cmd posting this can be set to FCT_HANDLE_NONE */
} fct_cmd_t;
/*
* fcmd_cmd_handle: Bit definitions.
* 31 23 15 7 0
* +--------------+------------+------------+------------+
* | V |uniq_cntr |fca specific| cmd slot index |
* +--------------+------------+------------+------------+
* V = handle valid.
*/
#define CMD_HANDLE_SLOT_INDEX(x) ((x) & 0xffff)
#define CMD_HANDLE_VALID(x) ((x) & 0x80000000)
enum fct_cmd_types {
FCT_CMD_FCP_XCHG = 0x0001,
FCT_CMD_RCVD_ELS = 0x0002,
FCT_CMD_SOL_ELS = 0x0004,
FCT_CMD_RCVD_ABTS = 0x0008,
FCT_CMD_SOL_CT = 0x0010,
FCT_CMD_TYPE_ALL = 0xffff
};
typedef struct fct_els {
} fct_els_t;
typedef struct fct_sol_ct {
} fct_sol_ct_t;
typedef struct fct_rcvd_abts {
/*
* abts state
*/
#define ABTS_STATE_RECEIVED 0
#define ABTS_STATE_RESPONDED 1
#define ABTS_STATE_COMPLETED 2
#define ABTS_STATE_ABORT_REQUESTED 3
#define ABTS_STATE_ABORT_COMPLETED 4
#define FCHBA_MANUFACTURER_LEN 64
#define FCHBA_SERIAL_NUMBER_LEN 64
#define FCHBA_MODEL_LEN 256
#define FCHBA_MODEL_DESCRIPTION_LEN 256
#define FCHBA_HARDWARE_VERSION_LEN 256
#define FCHBA_DRIVER_VERSION_LEN 256
#define FCHBA_OPTION_ROM_VERSION_LEN 256
#define FCHBA_FIRMWARE_VERSION_LEN 256
#define FCHBA_DRIVER_NAME_LEN 256
#define FCHBA_SYMB_NAME_LEN 255
typedef struct fct_port_attrs {
char model[FCHBA_MODEL_LEN];
char driver_name[FCHBA_DRIVER_NAME_LEN];
typedef struct fct_port_link_status {
typedef struct fct_dbuf_store {
void *fds_fct_private;
void *fds_fca_private;
struct stmf_dbuf_store *fds_ds;
#define FCT_FCA_MODREV_1 1
typedef struct fct_local_port {
void *port_fct_private;
void *port_fca_private;
char port_nwwn_str[FC_WWN_BUFLEN];
char port_pwwn_str[FC_WWN_BUFLEN];
char *port_default_alias;
char *port_sym_node_name;
char *port_sym_port_name;
/* in milliseconds */
struct fct_flogi_xchg *fx);
void (*port_populate_hba_details)(
int port_fca_version;
/*
* Common struct used during FLOGI exchange.
*/
typedef struct fct_flogi_xchg {
rsvd2:31;
typedef struct fct_link_info {
/*
* FCA sets this bit to indicate that fct does not need to do FLOGI
* because either FCA did the FLOGI or it determined that its a private
* loop. Setting this bit by FCA is optional.
*/
/* FCA sets this bit to indicate that it did FLOGI */
/* FCT sets this bit to indicate that it did FLOGI */
/* The fields below are only valid if someone did a successful flogi */
typedef struct fct_port_stat {
/*
* port topology
*/
#define PORT_TOPOLOGY_UNKNOWN 0
#define PORT_TOPOLOGY_PT_TO_PT 1
#define PORT_TOPOLOGY_PRIVATE_LOOP 2
#define PORT_TOPOLOGY_PUBLIC_LOOP 6
#define PORT_TOPOLOGY_FABRIC_PT_TO_PT 5
#define PORT_TOPOLOGY_FABRIC_BIT 4
((li)->port_fct_flogi_done))
/*
* port speed
*/
#define PORT_SPEED_UNKNOWN 0
#define PORT_SPEED_1G 1
#define PORT_SPEED_2G 2
#define PORT_SPEED_4G 4
#define PORT_SPEED_8G 8
#define PORT_SPEED_10G 16
/*
* Abort commands
*/
#define FCT_TERMINATE_CMD 1
/*
* FCT port states.
*/
#define FCT_STATE_OFFLINE 0
#define FCT_STATE_ONLINING 1
#define FCT_STATE_ONLINE 2
#define FCT_STATE_OFFLINING 3
/*
* fct ctl commands. These should not conflict with stmf ctl commands
*/
/*
* IO flags for cmd flow.
*/
#define FCT_IOF_FCA_DONE 0x10000
#define FCT_IOF_FORCE_FCA_DONE 0x20000
/*
* Fill CTIU preample
*/
#ifdef lint
#else
do { \
x_payload[0] = 0x02; \
} while (0)
#endif
char *additional_info);
char *additional_info);
#ifdef __cplusplus
}
#endif
#endif /* _FCT_H */