3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24 #ifndef _FCT_H
25 #define _FCT_H
26
27 /*
28 * Definitions for common FC Target.
29 */
30 #include <sys/note.h>
31 #include <sys/stmf_defines.h>
32 #include <sys/fct_defines.h>
33 #include <sys/portif.h>
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 typedef enum fct_struct_id {
40 FCT_STRUCT_LOCAL_PORT = 1,
41 FCT_STRUCT_REMOTE_PORT,
42 FCT_STRUCT_CMD_RCVD_ELS,
350 #define FCT_STATE_OFFLINING 3
351
352 /*
353 * fct ctl commands. These should not conflict with stmf ctl commands
354 */
355 #define FCT_CMD_PORT_ONLINE (STMF_LPORT_CTL_CMDS | 0x01)
356 #define FCT_CMD_PORT_ONLINE_COMPLETE (STMF_LPORT_CTL_CMDS | 0x02)
357 #define FCT_CMD_PORT_OFFLINE (STMF_LPORT_CTL_CMDS | 0x03)
358 #define FCT_CMD_PORT_OFFLINE_COMPLETE (STMF_LPORT_CTL_CMDS | 0x04)
359 #define FCT_ACK_PORT_ONLINE_COMPLETE (STMF_LPORT_CTL_CMDS | 0x05)
360 #define FCT_ACK_PORT_OFFLINE_COMPLETE (STMF_LPORT_CTL_CMDS | 0x06)
361 #define FCT_CMD_FORCE_LIP (STMF_LPORT_CTL_CMDS | 0x07)
362
363 /*
364 * IO flags for cmd flow.
365 */
366 #define FCT_IOF_FCA_DONE 0x10000
367 #define FCT_IOF_FORCE_FCA_DONE 0x20000
368
369 /*
370 * Fill CTIU preample
371 */
372 #ifdef lint
373 #define FCT_FILL_CTIU_PREAMPLE(x_payload, x_ctop) _NOTE(EMPTY)
374 #else
375 #define FCT_FILL_CTIU_PREAMPLE(x_payload, x_ctop) \
376 do { \
377 x_payload[0] = 0x02; \
378 x_payload[4] = 0xFC; \
379 x_payload[5] = 0x02; \
380 x_payload[8] = 0xFF & (x_ctop >> 8); \
381 x_payload[9] = 0xFF & (x_ctop); \
382 } while (0)
383 #endif
384
385 uint64_t fct_netbuf_to_value(uint8_t *buf, uint8_t nbytes);
386 void fct_value_to_netbuf(uint64_t value, uint8_t *buf, uint8_t nbytes);
387 void *fct_alloc(fct_struct_id_t struct_id, int additional_size, int flags);
388 void fct_free(void *ptr);
389 fct_cmd_t *fct_scsi_task_alloc(struct fct_local_port *port,
390 uint16_t rp_handle, uint32_t rportid, uint8_t *lun,
391 uint16_t cdb_length, uint16_t task_ext);
392 fct_status_t fct_register_local_port(fct_local_port_t *port);
393 fct_status_t fct_deregister_local_port(fct_local_port_t *port);
394 void fct_handle_event(fct_local_port_t *port, int event_id,
395 uint32_t event_flags, caddr_t arg);
396 void fct_post_rcvd_cmd(fct_cmd_t *cmd, stmf_data_buf_t *dbuf);
397 void fct_queue_cmd_for_termination(fct_cmd_t *cmd, fct_status_t s);
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
24 */
25 #ifndef _FCT_H
26 #define _FCT_H
27
28 /*
29 * Definitions for common FC Target.
30 */
31 #include <sys/note.h>
32 #include <sys/stmf_defines.h>
33 #include <sys/fct_defines.h>
34 #include <sys/portif.h>
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 typedef enum fct_struct_id {
41 FCT_STRUCT_LOCAL_PORT = 1,
42 FCT_STRUCT_REMOTE_PORT,
43 FCT_STRUCT_CMD_RCVD_ELS,
351 #define FCT_STATE_OFFLINING 3
352
353 /*
354 * fct ctl commands. These should not conflict with stmf ctl commands
355 */
356 #define FCT_CMD_PORT_ONLINE (STMF_LPORT_CTL_CMDS | 0x01)
357 #define FCT_CMD_PORT_ONLINE_COMPLETE (STMF_LPORT_CTL_CMDS | 0x02)
358 #define FCT_CMD_PORT_OFFLINE (STMF_LPORT_CTL_CMDS | 0x03)
359 #define FCT_CMD_PORT_OFFLINE_COMPLETE (STMF_LPORT_CTL_CMDS | 0x04)
360 #define FCT_ACK_PORT_ONLINE_COMPLETE (STMF_LPORT_CTL_CMDS | 0x05)
361 #define FCT_ACK_PORT_OFFLINE_COMPLETE (STMF_LPORT_CTL_CMDS | 0x06)
362 #define FCT_CMD_FORCE_LIP (STMF_LPORT_CTL_CMDS | 0x07)
363
364 /*
365 * IO flags for cmd flow.
366 */
367 #define FCT_IOF_FCA_DONE 0x10000
368 #define FCT_IOF_FORCE_FCA_DONE 0x20000
369
370 /*
371 * Fill CTIU preamble
372 */
373 #ifdef lint
374 #define FCT_FILL_CTIU_PREAMBLE(x_payload, x_ctop) _NOTE(EMPTY)
375 #else
376 #define FCT_FILL_CTIU_PREAMBLE(x_payload, x_ctop) \
377 do { \
378 x_payload[0] = 0x01; \
379 x_payload[4] = 0xFC; \
380 x_payload[5] = 0x02; \
381 x_payload[8] = 0xFF & (x_ctop >> 8); \
382 x_payload[9] = 0xFF & (x_ctop); \
383 } while (0)
384 #endif
385
386 uint64_t fct_netbuf_to_value(uint8_t *buf, uint8_t nbytes);
387 void fct_value_to_netbuf(uint64_t value, uint8_t *buf, uint8_t nbytes);
388 void *fct_alloc(fct_struct_id_t struct_id, int additional_size, int flags);
389 void fct_free(void *ptr);
390 fct_cmd_t *fct_scsi_task_alloc(struct fct_local_port *port,
391 uint16_t rp_handle, uint32_t rportid, uint8_t *lun,
392 uint16_t cdb_length, uint16_t task_ext);
393 fct_status_t fct_register_local_port(fct_local_port_t *port);
394 fct_status_t fct_deregister_local_port(fct_local_port_t *port);
395 void fct_handle_event(fct_local_port_t *port, int event_id,
396 uint32_t event_flags, caddr_t arg);
397 void fct_post_rcvd_cmd(fct_cmd_t *cmd, stmf_data_buf_t *dbuf);
398 void fct_queue_cmd_for_termination(fct_cmd_t *cmd, fct_status_t s);
|