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 _STMF_H
25 #define _STMF_H
26
27 #include <sys/stmf_defines.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 typedef enum stmf_struct_id {
34 STMF_STRUCT_LU_PROVIDER = 1,
35 STMF_STRUCT_PORT_PROVIDER,
36 STMF_STRUCT_STMF_LOCAL_PORT,
37 STMF_STRUCT_STMF_LU,
38 STMF_STRUCT_SCSI_SESSION,
39 STMF_STRUCT_SCSI_TASK,
40 STMF_STRUCT_DATA_BUF,
41 STMF_STRUCT_DBUF_STORE,
42 STMF_MAX_STRUCT_IDS
367 uint32_t *pminsize, uint32_t flags);
368 void stmf_free_dbuf(scsi_task_t *task, stmf_data_buf_t *dbuf);
369 stmf_status_t stmf_setup_dbuf(scsi_task_t *task, stmf_data_buf_t *dbuf,
370 uint32_t flags);
371 void stmf_teardown_dbuf(scsi_task_t *task, stmf_data_buf_t *dbuf);
372 stmf_status_t stmf_xfer_data(scsi_task_t *task, stmf_data_buf_t *dbuf,
373 uint32_t ioflags);
374 stmf_status_t stmf_send_scsi_status(scsi_task_t *task, uint32_t ioflags);
375 void stmf_data_xfer_done(scsi_task_t *task, stmf_data_buf_t *dbuf,
376 uint32_t iof);
377 void stmf_send_status_done(scsi_task_t *task, stmf_status_t s, uint32_t iof);
378 void stmf_task_lu_done(scsi_task_t *task);
379 void stmf_abort(int abort_cmd, scsi_task_t *task, stmf_status_t s, void *arg);
380 void stmf_task_lu_aborted(scsi_task_t *task, stmf_status_t s, uint32_t iof);
381 void stmf_task_lport_aborted(scsi_task_t *task, stmf_status_t s, uint32_t iof);
382 stmf_status_t stmf_task_poll_lu(scsi_task_t *task, uint32_t timeout);
383 stmf_status_t stmf_task_poll_lport(scsi_task_t *task, uint32_t timeout);
384 stmf_status_t stmf_ctl(int cmd, void *obj, void *arg);
385 stmf_status_t stmf_register_itl_handle(struct stmf_lu *lu, uint8_t *lun,
386 struct stmf_scsi_session *ss, uint64_t session_id, void *itl_handle);
387 stmf_status_t stmf_deregister_itl_handle(struct stmf_lu *lu, uint8_t *lun,
388 struct stmf_scsi_session *ss, uint64_t session_id, void *itl_handle);
389 stmf_status_t stmf_deregister_all_lu_itl_handles(struct stmf_lu *lu);
390 stmf_status_t stmf_get_itl_handle(struct stmf_lu *lu, uint8_t *lun,
391 struct stmf_scsi_session *ss, uint64_t session_id, void **itl_handle_retp);
392 stmf_data_buf_t *stmf_handle_to_buf(scsi_task_t *task, uint8_t h);
393 stmf_status_t stmf_lu_add_event(struct stmf_lu *lu, int eventid);
394 stmf_status_t stmf_lu_remove_event(struct stmf_lu *lu, int eventid);
395 stmf_status_t stmf_lport_add_event(struct stmf_local_port *lport, int eventid);
396 stmf_status_t stmf_lport_remove_event(struct stmf_local_port *lport,
397 int eventid);
398 void stmf_wwn_to_devid_desc(struct scsi_devid_desc *sdid, uint8_t *wwn,
399 uint8_t protocol_id);
400 stmf_status_t stmf_scsilib_uniq_lu_id(uint32_t company_id,
401 struct scsi_devid_desc *lu_id);
402 stmf_status_t stmf_scsilib_uniq_lu_id2(uint32_t company_id, uint32_t host_id,
403 struct scsi_devid_desc *lu_id);
404 void stmf_scsilib_send_status(scsi_task_t *task, uint8_t st, uint32_t saa);
405 uint32_t stmf_scsilib_prepare_vpd_page83(scsi_task_t *task, uint8_t *page,
406 uint32_t page_len, uint8_t byte0, uint32_t vpd_mask);
407 uint16_t stmf_scsilib_get_lport_rtid(struct scsi_devid_desc *devid);
408 struct scsi_devid_desc *stmf_scsilib_get_devid_desc(uint16_t rtpid);
|
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 (c) 2013 by Delphix. All rights reserved.
24 */
25 #ifndef _STMF_H
26 #define _STMF_H
27
28 #include <sys/stmf_defines.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 typedef enum stmf_struct_id {
35 STMF_STRUCT_LU_PROVIDER = 1,
36 STMF_STRUCT_PORT_PROVIDER,
37 STMF_STRUCT_STMF_LOCAL_PORT,
38 STMF_STRUCT_STMF_LU,
39 STMF_STRUCT_SCSI_SESSION,
40 STMF_STRUCT_SCSI_TASK,
41 STMF_STRUCT_DATA_BUF,
42 STMF_STRUCT_DBUF_STORE,
43 STMF_MAX_STRUCT_IDS
368 uint32_t *pminsize, uint32_t flags);
369 void stmf_free_dbuf(scsi_task_t *task, stmf_data_buf_t *dbuf);
370 stmf_status_t stmf_setup_dbuf(scsi_task_t *task, stmf_data_buf_t *dbuf,
371 uint32_t flags);
372 void stmf_teardown_dbuf(scsi_task_t *task, stmf_data_buf_t *dbuf);
373 stmf_status_t stmf_xfer_data(scsi_task_t *task, stmf_data_buf_t *dbuf,
374 uint32_t ioflags);
375 stmf_status_t stmf_send_scsi_status(scsi_task_t *task, uint32_t ioflags);
376 void stmf_data_xfer_done(scsi_task_t *task, stmf_data_buf_t *dbuf,
377 uint32_t iof);
378 void stmf_send_status_done(scsi_task_t *task, stmf_status_t s, uint32_t iof);
379 void stmf_task_lu_done(scsi_task_t *task);
380 void stmf_abort(int abort_cmd, scsi_task_t *task, stmf_status_t s, void *arg);
381 void stmf_task_lu_aborted(scsi_task_t *task, stmf_status_t s, uint32_t iof);
382 void stmf_task_lport_aborted(scsi_task_t *task, stmf_status_t s, uint32_t iof);
383 stmf_status_t stmf_task_poll_lu(scsi_task_t *task, uint32_t timeout);
384 stmf_status_t stmf_task_poll_lport(scsi_task_t *task, uint32_t timeout);
385 stmf_status_t stmf_ctl(int cmd, void *obj, void *arg);
386 stmf_status_t stmf_register_itl_handle(struct stmf_lu *lu, uint8_t *lun,
387 struct stmf_scsi_session *ss, uint64_t session_id, void *itl_handle);
388 stmf_status_t stmf_deregister_all_lu_itl_handles(struct stmf_lu *lu);
389 stmf_status_t stmf_get_itl_handle(struct stmf_lu *lu, uint8_t *lun,
390 struct stmf_scsi_session *ss, uint64_t session_id, void **itl_handle_retp);
391 stmf_data_buf_t *stmf_handle_to_buf(scsi_task_t *task, uint8_t h);
392 stmf_status_t stmf_lu_add_event(struct stmf_lu *lu, int eventid);
393 stmf_status_t stmf_lu_remove_event(struct stmf_lu *lu, int eventid);
394 stmf_status_t stmf_lport_add_event(struct stmf_local_port *lport, int eventid);
395 stmf_status_t stmf_lport_remove_event(struct stmf_local_port *lport,
396 int eventid);
397 void stmf_wwn_to_devid_desc(struct scsi_devid_desc *sdid, uint8_t *wwn,
398 uint8_t protocol_id);
399 stmf_status_t stmf_scsilib_uniq_lu_id(uint32_t company_id,
400 struct scsi_devid_desc *lu_id);
401 stmf_status_t stmf_scsilib_uniq_lu_id2(uint32_t company_id, uint32_t host_id,
402 struct scsi_devid_desc *lu_id);
403 void stmf_scsilib_send_status(scsi_task_t *task, uint8_t st, uint32_t saa);
404 uint32_t stmf_scsilib_prepare_vpd_page83(scsi_task_t *task, uint8_t *page,
405 uint32_t page_len, uint8_t byte0, uint32_t vpd_mask);
406 uint16_t stmf_scsilib_get_lport_rtid(struct scsi_devid_desc *devid);
407 struct scsi_devid_desc *stmf_scsilib_get_devid_desc(uint16_t rtpid);
|