1 /* 2 * CDDL HEADER START 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 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 #ifndef _LPIF_H 26 #define _LPIF_H 27 28 /* 29 * Definitions for stmf LUs and lu providers. 30 */ 31 32 #include <sys/stmf_defines.h> 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 #define LPIF_REV_1 0x00010000 39 40 typedef struct stmf_lu { 41 void *lu_stmf_private; 42 void *lu_provider_private; 43 44 struct scsi_devid_desc *lu_id; 45 char *lu_alias; /* optional */ 46 struct stmf_lu_provider *lu_lp; 47 uint32_t lu_abort_timeout; /* In seconds */ 48 49 /* SAM Device Server Class */ 50 stmf_status_t (*lu_task_alloc)(struct scsi_task *task); 51 void (*lu_new_task)(struct scsi_task *task, 52 struct stmf_data_buf *initial_dbuf); 53 void (*lu_dbuf_xfer_done)(struct scsi_task *task, 54 struct stmf_data_buf *dbuf); 55 /* 56 * If completion confirmation is not requested, status xfer done 57 * is called after the transport has confirmed that status has been 58 * sent. If completion confirmation is requested then the HBA will 59 * request a completion confirmation from the host and upon receiving 60 * the same, this entry point will be called. 61 */ 62 void (*lu_send_status_done)(struct scsi_task *task); 63 void (*lu_task_free)(struct scsi_task *task); 64 stmf_status_t (*lu_abort)(struct stmf_lu *lu, 65 int abort_cmd, void *arg, uint32_t flags); 66 void (*lu_task_poll)(struct scsi_task *task); 67 void (*lu_ctl)(struct stmf_lu *lu, int cmd, 68 void *arg); 69 stmf_status_t (*lu_info)(uint32_t cmd, struct stmf_lu *lu, 70 void *arg, uint8_t *buf, uint32_t *bufsizep); 71 void (*lu_event_handler)(struct stmf_lu *lu, 72 int eventid, void *arg, uint32_t flags); 73 } stmf_lu_t; 74 75 /* 76 * Abort cmd 77 */ 78 #define STMF_LU_ABORT_TASK 1 79 #define STMF_LU_RESET_STATE 2 80 #define STMF_LU_ITL_HANDLE_REMOVED 3 81 82 /* 83 * Reasons for itl handle removal. Passed in flags. 84 */ 85 #define STMF_ITL_REASON_MASK 0x0f 86 #define STMF_ITL_REASON_UNKNOWN 0x0 87 #define STMF_ITL_REASON_DEREG_REQUEST 0x1 88 #define STMF_ITL_REASON_USER_REQUEST 0x2 89 #define STMF_ITL_REASON_IT_NEXUS_LOSS 0x3 90 91 typedef struct stmf_lu_provider { 92 void *lp_stmf_private; 93 void *lp_private; 94 95 uint32_t lp_lpif_rev; /* Currently LPIF_REV_1 */ 96 int lp_instance; 97 char *lp_name; 98 void (*lp_cb)(struct stmf_lu_provider *lp, 99 int cmd, void *arg, uint32_t flags); 100 } stmf_lu_provider_t; 101 102 stmf_status_t stmf_deregister_lu_provider(stmf_lu_provider_t *lp); 103 stmf_status_t stmf_register_lu_provider(stmf_lu_provider_t *lp); 104 stmf_status_t stmf_register_lu(stmf_lu_t *lup); 105 stmf_status_t stmf_deregister_lu(stmf_lu_t *lup); 106 107 #ifdef __cplusplus 108 } 109 #endif 110 111 #endif /* _LPIF_H */ 112