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