/*
* 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 _FC_PORTIF_H
#define _FC_PORTIF_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* To remove the port WWN from the orphan list; An orphan list
* scan typically happens during ONLINE processing (after a LIP
* in Public loop or link reset) or during RSCN validation.
*/
/*
* Show a limited tolerance on the number of LOGOs that an
* from the port driver's data base. The tolerance counter
* is reset after each link reset.
*/
/*
* ns_flags field definitions in struct
* fctl_ns_req_t
*/
/*
* Values for the fp_soft_state field in the fc_local_port_t struct.
*
* Notice below that in two cases, suspend and pm-suspend,there
* is no usage of _IN_, which means the bits will stay even after
* suspend/pm-suspend is complete they are cleared at the time of
*/
/*
* FP_SOFT_IN_DETACH is set in fp_detach_handler(), which is called from
* fp_detach() for the DDI_DETACH flag. FP_SOFT_IN_DETACH is checked in
* numerous places. It is never explicitly cleared -- apparently the code
* relies on ddi_softstate_free(9F) to clear it.
*/
/*
* FP_SOFT_SUSPEND is set in fp_suspend_handler() and cleared in
* fp_resume_handler. It is tested in a number of placed in fp and fctl,
* including fp_job_handler().
*/
/*
* FP_SOFT_POWER_DOWN is set in fp_power_down() and cleared in fp_power_up().
*/
/*
* Instruct the port driver to just accept logins from these addresses
*/
/*
* Bit definitions for fp_options field in fc_local_port_t
* structure for Feature and Hack additions to make
* the driver code a real hairball.
*/
/*
* Values for fp_pm_level in the fc_local_port_t struct. Tracks current PM
* level for the local port.
*/
#define FP_PM_PORT_DOWN 0
/*
* FC port compoment for PM. Used with pm_raise_power() and friends.
*/
#define FP_PM_COMPONENT 0
/*
* Structure for issuing a work request to the per-instance "job handler"
* thread. Primarily allocated/initialized by fctl_alloc_job() and freed by
* fctl_dealloc_job(). fctl keeps a kmem_cache of these structs anchored by the
* fctl_job_cache global variable. The cache is created at fctl's _init(9E) and
* destroyed at fctl's _fini(9E). See also fctl_cache_constructor()
* and fctl_cache_destructor().
*/
typedef struct job_request {
/*
* ID code for the job or task to be performed. Set by fctl_alloc_job()
* and read by fp_job_handler().
*/
int job_code;
/*
* Completion status of the request. Typically FC_SUCCESS or
* FC_FAILURE, but may make use of other error code values (such as
* FC_OFFLINE, FC_BADCMD, FC_NO_MAP, and friends). The complete set
* of values is not clearly specified.
*/
int job_result;
/* Execution control flags (defined below) */
int job_flags;
/*
* This allows multiple concurrent operations using the same
* job_request_t struct, such as a PLOGI to a group of remote ports
* (see fp_plogi_group()).
*
* This is why this scheme needs the job_mutex to protect
* the job_counter variable, plus the additional job_port_sema for
* synchronizing thread(s).
*/
int job_counter;
/*
* Pointer for singly-liked list of outstanding job_request structs,
* maintained on a per-instance basis by the fp_port_head and
* fp_port_tail pointers in the fc_local_port_t struct.
*/
#if !defined(__lint)
#endif /* __lint */
/*
* Values for the job_code field in the job_request_t struct.
*/
/* Prepare the local port and the driver softstate for a DDI_DETACH. */
/* Handle an unsolicited request in the job thread */
/*
* This is used for requests that will not actually be dispatched to the job
* thread.
*/
/*
* Bitmask values for the job_flags field in the job_request_t struct.
*
* JOB_TYPE_FCTL_ASYNC is set in various places in fp and fctl. If set then
* fctl_jobdone() will call the completion function in the job_comp field and
* deallocate the job_request_t struct. If not set then fctl_jobdone() will
* sema_v() the job_fctl_sema to wake up any waiting thread. This bit is also
* checked in fc_ulp_login(): if *clear* then fc_ulp_login() will call
* fctl_jobwait() in order to block the calling thread in the job_fctl_sema, and
* then call fctl_dealloc_job() after fctl_jobwait() returns.
*
* JOB_TYPE_FP_ASYNC is set in various places in fp. If set then fp_jobdone()
* will call fctl_jobdone(); if clear then fp_jobdone() will sema_v() the
* job_port_sema in the job_request_t. fp_port_shutdown() also looks for
* JOB_TYPE_FP_ASYNC. Just to keep thing interesting, JOB_TYPE_FP_ASYNC is
* also set in fp_validate_area_domain() and cleared in fp_fcio_login() and
* fp_ns_get_devcount()
*
* The apparent purpose of all this is to allow nested job requests to
* occur in parallel.
*
* JOB_CANCEL_ULP_NOTIFICATION appears to be intended to the number of
* state change callbacks that are reported to ULPs when mutiple state
* changes are being processed in parallel.
*/
typedef struct fc_port_clist {
#if !defined(__lint)
#endif /* __lint */
/*
* The cmd_size and resp_size shouldn't include the CT HEADER.
*
* For commands like GAN, the ns_resp_size should indicate the
* total number of bytes allocated in the ns_resp_buf to get all
* the NS objects.
*/
typedef struct fctl_ns_req {
int ns_result;
#if !defined(__lint)
#endif /* __lint */
/*
* Orphan list of Port WWNs
*/
typedef struct fc_orphan {
} fc_orphan_t;
{ \
(x_flag)); \
} else { \
} \
}
{ \
(x_flag)); \
} else { \
} \
}
#if !defined(__lint)
#endif /* __lint */
struct modlinkage *linkage);
struct modlinkage *linkage);
void fctl_ulp_statec_cb(void *arg);
#ifdef __cplusplus
}
#endif
#endif /* _FC_PORTIF_H */