xref: /titanic_54/usr/src/uts/common/sys/fct.h (revision fcf3ce441efd61da9bb2884968af01cb7c1452cc)
1*fcf3ce44SJohn Forte /*
2*fcf3ce44SJohn Forte  * CDDL HEADER START
3*fcf3ce44SJohn Forte  *
4*fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5*fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6*fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7*fcf3ce44SJohn Forte  *
8*fcf3ce44SJohn Forte  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*fcf3ce44SJohn Forte  * or http://www.opensolaris.org/os/licensing.
10*fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11*fcf3ce44SJohn Forte  * and limitations under the License.
12*fcf3ce44SJohn Forte  *
13*fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14*fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16*fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17*fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18*fcf3ce44SJohn Forte  *
19*fcf3ce44SJohn Forte  * CDDL HEADER END
20*fcf3ce44SJohn Forte  */
21*fcf3ce44SJohn Forte /*
22*fcf3ce44SJohn Forte  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*fcf3ce44SJohn Forte  * Use is subject to license terms.
24*fcf3ce44SJohn Forte  */
25*fcf3ce44SJohn Forte #ifndef	_FCT_H
26*fcf3ce44SJohn Forte #define	_FCT_H
27*fcf3ce44SJohn Forte 
28*fcf3ce44SJohn Forte /*
29*fcf3ce44SJohn Forte  * Definitions for common FC Target.
30*fcf3ce44SJohn Forte  */
31*fcf3ce44SJohn Forte #include <sys/note.h>
32*fcf3ce44SJohn Forte #include <sys/stmf_defines.h>
33*fcf3ce44SJohn Forte #include <sys/fct_defines.h>
34*fcf3ce44SJohn Forte #include <sys/portif.h>
35*fcf3ce44SJohn Forte 
36*fcf3ce44SJohn Forte #ifdef	__cplusplus
37*fcf3ce44SJohn Forte extern "C" {
38*fcf3ce44SJohn Forte #endif
39*fcf3ce44SJohn Forte 
40*fcf3ce44SJohn Forte typedef enum fct_struct_id {
41*fcf3ce44SJohn Forte 	FCT_STRUCT_LOCAL_PORT = 1,
42*fcf3ce44SJohn Forte 	FCT_STRUCT_REMOTE_PORT,
43*fcf3ce44SJohn Forte 	FCT_STRUCT_CMD_RCVD_ELS,
44*fcf3ce44SJohn Forte 	FCT_STRUCT_CMD_SOL_ELS,
45*fcf3ce44SJohn Forte 	FCT_STRUCT_CMD_SOL_CT,
46*fcf3ce44SJohn Forte 	FCT_STRUCT_CMD_RCVD_ABTS,
47*fcf3ce44SJohn Forte 	FCT_STRUCT_CMD_FCP_XCHG,
48*fcf3ce44SJohn Forte 	FCT_STRUCT_DBUF_STORE,
49*fcf3ce44SJohn Forte 
50*fcf3ce44SJohn Forte 	FCT_MAX_STRUCT_IDS
51*fcf3ce44SJohn Forte } fct_struct_id_t;
52*fcf3ce44SJohn Forte 
53*fcf3ce44SJohn Forte typedef struct fct_remote_port {
54*fcf3ce44SJohn Forte 	void		*rp_fct_private;
55*fcf3ce44SJohn Forte 	void		*rp_fca_private;
56*fcf3ce44SJohn Forte 
57*fcf3ce44SJohn Forte 	struct fct_local_port *rp_port;
58*fcf3ce44SJohn Forte 	uint8_t		rp_nwwn[FC_WWN_LEN];
59*fcf3ce44SJohn Forte 	uint8_t		rp_pwwn[FC_WWN_LEN];
60*fcf3ce44SJohn Forte 	uint32_t	rp_id;		/* 8 or 24 bit */
61*fcf3ce44SJohn Forte 	uint32_t	rp_hard_address;
62*fcf3ce44SJohn Forte 	uint16_t	rp_handle;
63*fcf3ce44SJohn Forte } fct_remote_port_t;
64*fcf3ce44SJohn Forte 
65*fcf3ce44SJohn Forte #define	FCT_HANDLE_NONE	0xffff
66*fcf3ce44SJohn Forte 
67*fcf3ce44SJohn Forte typedef struct fct_cmd {
68*fcf3ce44SJohn Forte 	void		*cmd_fct_private;
69*fcf3ce44SJohn Forte 	void		*cmd_fca_private;
70*fcf3ce44SJohn Forte 	void		*cmd_specific;
71*fcf3ce44SJohn Forte 
72*fcf3ce44SJohn Forte 	struct fct_local_port	*cmd_port;
73*fcf3ce44SJohn Forte 
74*fcf3ce44SJohn Forte 	/* During cmd porting this can be set to NULL */
75*fcf3ce44SJohn Forte 	struct fct_remote_port	*cmd_rp;
76*fcf3ce44SJohn Forte 
77*fcf3ce44SJohn Forte 	/* To link cmds together for handling things like ABTS. */
78*fcf3ce44SJohn Forte 	struct fct_cmd	*cmd_link;
79*fcf3ce44SJohn Forte 	uint8_t		cmd_type;
80*fcf3ce44SJohn Forte 	uint8_t		cmd_rsvd1;
81*fcf3ce44SJohn Forte 
82*fcf3ce44SJohn Forte 	/* During cmd posting this can be set to FCT_HANDLE_NONE */
83*fcf3ce44SJohn Forte 	uint16_t	cmd_rp_handle;
84*fcf3ce44SJohn Forte 	uint32_t	cmd_handle;
85*fcf3ce44SJohn Forte 	uint32_t	cmd_rportid;
86*fcf3ce44SJohn Forte 	uint32_t	cmd_lportid;
87*fcf3ce44SJohn Forte 	uint32_t	cmd_rsvd2;
88*fcf3ce44SJohn Forte 	uint16_t	cmd_oxid;
89*fcf3ce44SJohn Forte 	uint16_t	cmd_rxid;
90*fcf3ce44SJohn Forte 	fct_status_t	cmd_comp_status;
91*fcf3ce44SJohn Forte } fct_cmd_t;
92*fcf3ce44SJohn Forte 
93*fcf3ce44SJohn Forte /*
94*fcf3ce44SJohn Forte  * fcmd_cmd_handle: Bit definitions.
95*fcf3ce44SJohn Forte  *   31		  23	       15	    7	       0
96*fcf3ce44SJohn Forte  *  +--------------+------------+------------+------------+
97*fcf3ce44SJohn Forte  *  | V |uniq_cntr |fca specific|   cmd slot index	  |
98*fcf3ce44SJohn Forte  *  +--------------+------------+------------+------------+
99*fcf3ce44SJohn Forte  * V = handle valid.
100*fcf3ce44SJohn Forte  */
101*fcf3ce44SJohn Forte #define	CMD_HANDLE_SLOT_INDEX(x)	((x) & 0xffff)
102*fcf3ce44SJohn Forte #define	CMD_HANDLE_VALID(x)		((x) & 0x80000000)
103*fcf3ce44SJohn Forte 
104*fcf3ce44SJohn Forte enum fct_cmd_types {
105*fcf3ce44SJohn Forte 	FCT_CMD_FCP_XCHG =	0x0001,
106*fcf3ce44SJohn Forte 	FCT_CMD_RCVD_ELS =	0x0002,
107*fcf3ce44SJohn Forte 	FCT_CMD_SOL_ELS =	0x0004,
108*fcf3ce44SJohn Forte 	FCT_CMD_RCVD_ABTS =	0x0008,
109*fcf3ce44SJohn Forte 	FCT_CMD_SOL_CT =	0x0010,
110*fcf3ce44SJohn Forte 
111*fcf3ce44SJohn Forte 	FCT_CMD_TYPE_ALL =	0xffff
112*fcf3ce44SJohn Forte };
113*fcf3ce44SJohn Forte 
114*fcf3ce44SJohn Forte typedef struct fct_els {
115*fcf3ce44SJohn Forte 	uint16_t	els_req_size;
116*fcf3ce44SJohn Forte 	uint16_t	els_resp_size;
117*fcf3ce44SJohn Forte 	uint16_t	els_req_alloc_size;
118*fcf3ce44SJohn Forte 	uint16_t	els_resp_alloc_size;
119*fcf3ce44SJohn Forte 	uint8_t		*els_req_payload;
120*fcf3ce44SJohn Forte 	uint8_t		*els_resp_payload;
121*fcf3ce44SJohn Forte } fct_els_t;
122*fcf3ce44SJohn Forte 
123*fcf3ce44SJohn Forte typedef struct fct_sol_ct {
124*fcf3ce44SJohn Forte 	uint16_t	ct_req_size;
125*fcf3ce44SJohn Forte 	uint16_t	ct_resp_size;
126*fcf3ce44SJohn Forte 	uint16_t	ct_req_alloc_size;
127*fcf3ce44SJohn Forte 	uint16_t	ct_resp_alloc_size;
128*fcf3ce44SJohn Forte 	uint8_t		*ct_req_payload;
129*fcf3ce44SJohn Forte 	uint8_t		*ct_resp_payload;
130*fcf3ce44SJohn Forte } fct_sol_ct_t;
131*fcf3ce44SJohn Forte 
132*fcf3ce44SJohn Forte typedef struct fct_rcvd_abts {
133*fcf3ce44SJohn Forte 	uint8_t		abts_resp_rctl;	/* Can be BA_ACC or BA_RJT */
134*fcf3ce44SJohn Forte 	uint8_t		abts_state;
135*fcf3ce44SJohn Forte 	uint16_t	rsvd;
136*fcf3ce44SJohn Forte 	uint8_t		abts_resp_payload[12];
137*fcf3ce44SJohn Forte } fct_rcvd_abts_t;
138*fcf3ce44SJohn Forte 
139*fcf3ce44SJohn Forte /*
140*fcf3ce44SJohn Forte  * abts state
141*fcf3ce44SJohn Forte  */
142*fcf3ce44SJohn Forte #define	ABTS_STATE_RECEIVED		0
143*fcf3ce44SJohn Forte #define	ABTS_STATE_RESPONDED		1
144*fcf3ce44SJohn Forte #define	ABTS_STATE_COMPLETED		2
145*fcf3ce44SJohn Forte #define	ABTS_STATE_ABORT_REQUESTED	3
146*fcf3ce44SJohn Forte #define	ABTS_STATE_ABORT_COMPLETED	4
147*fcf3ce44SJohn Forte 
148*fcf3ce44SJohn Forte #define	FCHBA_MANUFACTURER_LEN		64
149*fcf3ce44SJohn Forte #define	FCHBA_SERIAL_NUMBER_LEN		64
150*fcf3ce44SJohn Forte #define	FCHBA_MODEL_LEN			256
151*fcf3ce44SJohn Forte #define	FCHBA_MODEL_DESCRIPTION_LEN	256
152*fcf3ce44SJohn Forte #define	FCHBA_HARDWARE_VERSION_LEN	256
153*fcf3ce44SJohn Forte #define	FCHBA_DRIVER_VERSION_LEN	256
154*fcf3ce44SJohn Forte #define	FCHBA_OPTION_ROM_VERSION_LEN	256
155*fcf3ce44SJohn Forte #define	FCHBA_FIRMWARE_VERSION_LEN	256
156*fcf3ce44SJohn Forte #define	FCHBA_DRIVER_NAME_LEN		256
157*fcf3ce44SJohn Forte #define	FCHBA_SYMB_NAME_LEN		255
158*fcf3ce44SJohn Forte 
159*fcf3ce44SJohn Forte typedef struct fct_port_attrs {
160*fcf3ce44SJohn Forte 	char		manufacturer[FCHBA_MANUFACTURER_LEN];
161*fcf3ce44SJohn Forte 	char		serial_number[FCHBA_SERIAL_NUMBER_LEN];
162*fcf3ce44SJohn Forte 	char		model[FCHBA_MODEL_LEN];
163*fcf3ce44SJohn Forte 	char		model_description[FCHBA_MODEL_DESCRIPTION_LEN];
164*fcf3ce44SJohn Forte 	char		hardware_version[FCHBA_HARDWARE_VERSION_LEN];
165*fcf3ce44SJohn Forte 	char		driver_version[FCHBA_DRIVER_VERSION_LEN];
166*fcf3ce44SJohn Forte 	char		option_rom_version[FCHBA_OPTION_ROM_VERSION_LEN];
167*fcf3ce44SJohn Forte 	char		firmware_version[FCHBA_FIRMWARE_VERSION_LEN];
168*fcf3ce44SJohn Forte 	char		driver_name[FCHBA_DRIVER_NAME_LEN];
169*fcf3ce44SJohn Forte 	uint32_t	vendor_specific_id;
170*fcf3ce44SJohn Forte 	uint32_t	supported_cos;
171*fcf3ce44SJohn Forte 	uint32_t	supported_speed;
172*fcf3ce44SJohn Forte 	uint32_t	max_frame_size;
173*fcf3ce44SJohn Forte } fct_port_attrs_t;
174*fcf3ce44SJohn Forte 
175*fcf3ce44SJohn Forte typedef struct fct_dbuf_store {
176*fcf3ce44SJohn Forte 	void			*fds_fct_private;
177*fcf3ce44SJohn Forte 	void			*fds_fca_private;
178*fcf3ce44SJohn Forte 	struct stmf_dbuf_store	*fds_ds;
179*fcf3ce44SJohn Forte 
180*fcf3ce44SJohn Forte 	stmf_data_buf_t *(*fds_alloc_data_buf)(struct fct_local_port *port,
181*fcf3ce44SJohn Forte 			    uint32_t size, uint32_t *pminsize, uint32_t flags);
182*fcf3ce44SJohn Forte 	void		(*fds_free_data_buf)(struct fct_dbuf_store *fds,
183*fcf3ce44SJohn Forte 			    stmf_data_buf_t *dbuf);
184*fcf3ce44SJohn Forte } fct_dbuf_store_t;
185*fcf3ce44SJohn Forte 
186*fcf3ce44SJohn Forte typedef struct fct_local_port {
187*fcf3ce44SJohn Forte 	void			*port_fct_private;
188*fcf3ce44SJohn Forte 	void			*port_fca_private;
189*fcf3ce44SJohn Forte 	stmf_local_port_t	*port_lport;
190*fcf3ce44SJohn Forte 
191*fcf3ce44SJohn Forte 	uint8_t			port_nwwn[FC_WWN_LEN];
192*fcf3ce44SJohn Forte 	uint8_t			port_pwwn[FC_WWN_LEN];
193*fcf3ce44SJohn Forte 	char			*port_default_alias;
194*fcf3ce44SJohn Forte 	char			*port_sym_node_name;
195*fcf3ce44SJohn Forte 	char			*port_sym_port_name;
196*fcf3ce44SJohn Forte 
197*fcf3ce44SJohn Forte 	stmf_port_provider_t	*port_pp;
198*fcf3ce44SJohn Forte 
199*fcf3ce44SJohn Forte 	uint32_t		port_hard_address;
200*fcf3ce44SJohn Forte 	uint16_t		port_max_logins;
201*fcf3ce44SJohn Forte 	uint16_t		port_max_xchges;
202*fcf3ce44SJohn Forte 	uint32_t		port_fca_fcp_cmd_size;
203*fcf3ce44SJohn Forte 	uint32_t		port_fca_rp_private_size;
204*fcf3ce44SJohn Forte 	uint32_t		port_fca_sol_els_private_size;
205*fcf3ce44SJohn Forte 	uint32_t		port_fca_sol_ct_private_size;
206*fcf3ce44SJohn Forte 
207*fcf3ce44SJohn Forte 	/* in milliseconds */
208*fcf3ce44SJohn Forte 	uint32_t		port_fca_abort_timeout;
209*fcf3ce44SJohn Forte 
210*fcf3ce44SJohn Forte 	fct_dbuf_store_t	*port_fds;
211*fcf3ce44SJohn Forte 	fct_status_t		(*port_get_link_info)(
212*fcf3ce44SJohn Forte 		struct fct_local_port *port, struct fct_link_info *li);
213*fcf3ce44SJohn Forte 	fct_status_t		(*port_register_remote_port)(
214*fcf3ce44SJohn Forte 		struct fct_local_port *port, struct fct_remote_port *rp,
215*fcf3ce44SJohn Forte 		struct fct_cmd *login_els);
216*fcf3ce44SJohn Forte 	fct_status_t		(*port_deregister_remote_port)(
217*fcf3ce44SJohn Forte 		struct fct_local_port *port, struct fct_remote_port *rp);
218*fcf3ce44SJohn Forte 	fct_status_t		(*port_send_cmd)(fct_cmd_t *cmd);
219*fcf3ce44SJohn Forte 	fct_status_t		(*port_xfer_scsi_data)(fct_cmd_t *cmd,
220*fcf3ce44SJohn Forte 			stmf_data_buf_t *dbuf, uint32_t flags);
221*fcf3ce44SJohn Forte 	fct_status_t		(*port_send_cmd_response)(fct_cmd_t *cmd,
222*fcf3ce44SJohn Forte 					uint32_t ioflags);
223*fcf3ce44SJohn Forte 	fct_status_t		(*port_abort_cmd)(struct fct_local_port *port,
224*fcf3ce44SJohn Forte 			fct_cmd_t *cmd, uint32_t flags);
225*fcf3ce44SJohn Forte 	void			(*port_ctl)(struct fct_local_port *port,
226*fcf3ce44SJohn Forte 						int cmd, void *arg);
227*fcf3ce44SJohn Forte 	fct_status_t		(*port_flogi_xchg)(struct fct_local_port *port,
228*fcf3ce44SJohn Forte 			struct fct_flogi_xchg *fx);
229*fcf3ce44SJohn Forte 	void			(*port_populate_hba_details)(
230*fcf3ce44SJohn Forte 		struct fct_local_port *port, struct fct_port_attrs *port_attrs);
231*fcf3ce44SJohn Forte } fct_local_port_t;
232*fcf3ce44SJohn Forte 
233*fcf3ce44SJohn Forte /*
234*fcf3ce44SJohn Forte  * Common struct used during FLOGI exchange.
235*fcf3ce44SJohn Forte  */
236*fcf3ce44SJohn Forte typedef struct fct_flogi_xchg {
237*fcf3ce44SJohn Forte 	uint8_t		fx_op;		/* ELS_OP_FLOGI or ELS_OP_ACC/RJT */
238*fcf3ce44SJohn Forte 	uint8_t		fx_rjt_reason;
239*fcf3ce44SJohn Forte 	uint8_t		fx_rjt_expl;
240*fcf3ce44SJohn Forte 	uint8_t		fx_sec_timeout;	/* Timeout in seconds */
241*fcf3ce44SJohn Forte 	uint32_t	fx_fport:1,	/* 0=N_port, 1=F_port */
242*fcf3ce44SJohn Forte 			rsvd2:31;
243*fcf3ce44SJohn Forte 	uint32_t	fx_sid;		/* 24 bit SID to use */
244*fcf3ce44SJohn Forte 	uint32_t	fx_did;		/* 24 bit DID to use */
245*fcf3ce44SJohn Forte 	uint8_t		fx_pwwn[8];
246*fcf3ce44SJohn Forte 	uint8_t		fx_nwwn[8];
247*fcf3ce44SJohn Forte } fct_flogi_xchg_t;
248*fcf3ce44SJohn Forte 
249*fcf3ce44SJohn Forte typedef struct fct_link_info {
250*fcf3ce44SJohn Forte 	uint32_t		portid;
251*fcf3ce44SJohn Forte 	uint8_t			port_topology;
252*fcf3ce44SJohn Forte 	uint8_t			port_speed;
253*fcf3ce44SJohn Forte 
254*fcf3ce44SJohn Forte 	uint8_t			rsvd:5,
255*fcf3ce44SJohn Forte 
256*fcf3ce44SJohn Forte 	/*
257*fcf3ce44SJohn Forte 	 * FCA sets this bit to indicate that fct does not need to do FLOGI
258*fcf3ce44SJohn Forte 	 * because either FCA did the FLOGI or it determined that its a private
259*fcf3ce44SJohn Forte 	 * loop. Setting this bit by FCA is optional.
260*fcf3ce44SJohn Forte 	 */
261*fcf3ce44SJohn Forte 				port_no_fct_flogi:1,
262*fcf3ce44SJohn Forte 
263*fcf3ce44SJohn Forte 	/* FCA sets this bit to indicate that it did FLOGI */
264*fcf3ce44SJohn Forte 				port_fca_flogi_done:1,
265*fcf3ce44SJohn Forte 
266*fcf3ce44SJohn Forte 	/* FCT sets this bit to indicate that it did FLOGI */
267*fcf3ce44SJohn Forte 				port_fct_flogi_done:1;
268*fcf3ce44SJohn Forte 
269*fcf3ce44SJohn Forte 	uint8_t			rsvd1;
270*fcf3ce44SJohn Forte 
271*fcf3ce44SJohn Forte 	/* The fields below are only valid if someone did a successful flogi */
272*fcf3ce44SJohn Forte 	uint8_t			port_rnwwn[8];
273*fcf3ce44SJohn Forte 	uint8_t			port_rpwwn[8];
274*fcf3ce44SJohn Forte } fct_link_info_t;
275*fcf3ce44SJohn Forte 
276*fcf3ce44SJohn Forte /*
277*fcf3ce44SJohn Forte  * port topology
278*fcf3ce44SJohn Forte  */
279*fcf3ce44SJohn Forte #define	PORT_TOPOLOGY_UNKNOWN		0
280*fcf3ce44SJohn Forte #define	PORT_TOPOLOGY_PT_TO_PT		1
281*fcf3ce44SJohn Forte #define	PORT_TOPOLOGY_PRIVATE_LOOP	2
282*fcf3ce44SJohn Forte #define	PORT_TOPOLOGY_PUBLIC_LOOP	6
283*fcf3ce44SJohn Forte #define	PORT_TOPOLOGY_FABRIC_PT_TO_PT	5
284*fcf3ce44SJohn Forte #define	PORT_TOPOLOGY_FABRIC_BIT	4
285*fcf3ce44SJohn Forte 
286*fcf3ce44SJohn Forte #define	PORT_FLOGI_DONE(li)	(((li)->port_fca_flogi_done) || \
287*fcf3ce44SJohn Forte 					((li)->port_fct_flogi_done))
288*fcf3ce44SJohn Forte 
289*fcf3ce44SJohn Forte /*
290*fcf3ce44SJohn Forte  * port speed
291*fcf3ce44SJohn Forte  */
292*fcf3ce44SJohn Forte #define	PORT_SPEED_UNKNOWN		0
293*fcf3ce44SJohn Forte #define	PORT_SPEED_1G			1
294*fcf3ce44SJohn Forte #define	PORT_SPEED_2G			2
295*fcf3ce44SJohn Forte #define	PORT_SPEED_4G			4
296*fcf3ce44SJohn Forte #define	PORT_SPEED_8G			8
297*fcf3ce44SJohn Forte 
298*fcf3ce44SJohn Forte /*
299*fcf3ce44SJohn Forte  * Abort commands
300*fcf3ce44SJohn Forte  */
301*fcf3ce44SJohn Forte #define	FCT_TERMINATE_CMD		1
302*fcf3ce44SJohn Forte 
303*fcf3ce44SJohn Forte /*
304*fcf3ce44SJohn Forte  * FCT port states.
305*fcf3ce44SJohn Forte  */
306*fcf3ce44SJohn Forte #define	FCT_STATE_OFFLINE	0
307*fcf3ce44SJohn Forte #define	FCT_STATE_ONLINING	1
308*fcf3ce44SJohn Forte #define	FCT_STATE_ONLINE	2
309*fcf3ce44SJohn Forte #define	FCT_STATE_OFFLINING	3
310*fcf3ce44SJohn Forte 
311*fcf3ce44SJohn Forte /*
312*fcf3ce44SJohn Forte  * fct ctl commands. These should not conflict with stmf ctl commands
313*fcf3ce44SJohn Forte  */
314*fcf3ce44SJohn Forte #define	FCT_CMD_PORT_ONLINE		(STMF_LPORT_CTL_CMDS | 0x01)
315*fcf3ce44SJohn Forte #define	FCT_CMD_PORT_ONLINE_COMPLETE	(STMF_LPORT_CTL_CMDS | 0x02)
316*fcf3ce44SJohn Forte #define	FCT_CMD_PORT_OFFLINE		(STMF_LPORT_CTL_CMDS | 0x03)
317*fcf3ce44SJohn Forte #define	FCT_CMD_PORT_OFFLINE_COMPLETE	(STMF_LPORT_CTL_CMDS | 0x04)
318*fcf3ce44SJohn Forte #define	FCT_ACK_PORT_ONLINE_COMPLETE	(STMF_LPORT_CTL_CMDS | 0x05)
319*fcf3ce44SJohn Forte #define	FCT_ACK_PORT_OFFLINE_COMPLETE	(STMF_LPORT_CTL_CMDS | 0x06)
320*fcf3ce44SJohn Forte 
321*fcf3ce44SJohn Forte /*
322*fcf3ce44SJohn Forte  * IO flags for cmd flow.
323*fcf3ce44SJohn Forte  */
324*fcf3ce44SJohn Forte #define	FCT_IOF_FCA_DONE		0x10000
325*fcf3ce44SJohn Forte #define	FCT_IOF_FORCE_FCA_DONE		0x20000
326*fcf3ce44SJohn Forte 
327*fcf3ce44SJohn Forte /*
328*fcf3ce44SJohn Forte  * Fill CTIU preample
329*fcf3ce44SJohn Forte  */
330*fcf3ce44SJohn Forte #ifdef	lint
331*fcf3ce44SJohn Forte #define	FCT_FILL_CTIU_PREAMPLE(x_payload, x_ctop)	_NOTE(EMPTY)
332*fcf3ce44SJohn Forte #else
333*fcf3ce44SJohn Forte #define	FCT_FILL_CTIU_PREAMPLE(x_payload, x_ctop)	\
334*fcf3ce44SJohn Forte 	do {						\
335*fcf3ce44SJohn Forte 		x_payload[0] = 0x02;			\
336*fcf3ce44SJohn Forte 		x_payload[4] = 0xFC;			\
337*fcf3ce44SJohn Forte 		x_payload[5] = 0x02;			\
338*fcf3ce44SJohn Forte 		x_payload[8] = 0xFF & (x_ctop >> 8);	\
339*fcf3ce44SJohn Forte 		x_payload[9] = 0xFF & (x_ctop);		\
340*fcf3ce44SJohn Forte 	} while (0)
341*fcf3ce44SJohn Forte #endif
342*fcf3ce44SJohn Forte 
343*fcf3ce44SJohn Forte uint64_t fct_netbuf_to_value(uint8_t *buf, uint8_t nbytes);
344*fcf3ce44SJohn Forte void fct_value_to_netbuf(uint64_t value, uint8_t *buf, uint8_t nbytes);
345*fcf3ce44SJohn Forte void *fct_alloc(fct_struct_id_t struct_id, int additional_size, int flags);
346*fcf3ce44SJohn Forte void fct_free(void *ptr);
347*fcf3ce44SJohn Forte fct_cmd_t *fct_scsi_task_alloc(struct fct_local_port *port,
348*fcf3ce44SJohn Forte     uint16_t rp_handle, uint32_t rportid, uint8_t *lun,
349*fcf3ce44SJohn Forte     uint16_t cdb_length, uint16_t task_ext);
350*fcf3ce44SJohn Forte fct_status_t fct_register_local_port(fct_local_port_t *port);
351*fcf3ce44SJohn Forte fct_status_t fct_deregister_local_port(fct_local_port_t *port);
352*fcf3ce44SJohn Forte void fct_handle_event(fct_local_port_t *port, int event_id,
353*fcf3ce44SJohn Forte     uint32_t event_flags, caddr_t arg);
354*fcf3ce44SJohn Forte void fct_post_rcvd_cmd(fct_cmd_t *cmd, stmf_data_buf_t *dbuf);
355*fcf3ce44SJohn Forte void fct_queue_cmd_for_termination(fct_cmd_t *cmd, fct_status_t s);
356*fcf3ce44SJohn Forte void fct_queue_scsi_task_for_termination(fct_cmd_t *cmd, fct_status_t s);
357*fcf3ce44SJohn Forte fct_cmd_t *fct_handle_to_cmd(fct_local_port_t *port, uint32_t fct_handle);
358*fcf3ce44SJohn Forte void fct_ctl(struct stmf_local_port *lport, int cmd, void *arg);
359*fcf3ce44SJohn Forte void fct_cmd_fca_aborted(fct_cmd_t *cmd, fct_status_t s, uint32_t ioflags);
360*fcf3ce44SJohn Forte uint16_t fct_get_rp_handle(fct_local_port_t *port, uint32_t rportid);
361*fcf3ce44SJohn Forte void fct_send_response_done(fct_cmd_t *cmd, fct_status_t s, uint32_t ioflags);
362*fcf3ce44SJohn Forte void fct_send_cmd_done(fct_cmd_t *cmd, fct_status_t s, uint32_t ioflags);
363*fcf3ce44SJohn Forte void fct_scsi_data_xfer_done(fct_cmd_t *cmd, stmf_data_buf_t *dbuf,
364*fcf3ce44SJohn Forte     uint32_t ioflags);
365*fcf3ce44SJohn Forte fct_status_t fct_port_initialize(fct_local_port_t *port, uint32_t rflags,
366*fcf3ce44SJohn Forte     char *additional_info);
367*fcf3ce44SJohn Forte fct_status_t fct_port_shutdown(fct_local_port_t *port, uint32_t rflags,
368*fcf3ce44SJohn Forte     char *additional_info);
369*fcf3ce44SJohn Forte fct_status_t fct_handle_rcvd_flogi(fct_local_port_t *port,
370*fcf3ce44SJohn Forte     fct_flogi_xchg_t *fx);
371*fcf3ce44SJohn Forte void fct_log_local_port_event(fct_local_port_t *port, char *subclass);
372*fcf3ce44SJohn Forte void fct_log_remote_port_event(fct_local_port_t *port, char *subclass,
373*fcf3ce44SJohn Forte     uint8_t *rp_pwwn, uint32_t rp_id);
374*fcf3ce44SJohn Forte 
375*fcf3ce44SJohn Forte #ifdef	__cplusplus
376*fcf3ce44SJohn Forte }
377*fcf3ce44SJohn Forte #endif
378*fcf3ce44SJohn Forte 
379*fcf3ce44SJohn Forte #endif /* _FCT_H */
380