1fcf3ce44SJohn Forte /* 2fcf3ce44SJohn Forte * CDDL HEADER START 3fcf3ce44SJohn Forte * 4fcf3ce44SJohn Forte * The contents of this file are subject to the terms of the 5fcf3ce44SJohn Forte * Common Development and Distribution License (the "License"). 6fcf3ce44SJohn Forte * You may not use this file except in compliance with the License. 7fcf3ce44SJohn Forte * 8fcf3ce44SJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9fcf3ce44SJohn Forte * or http://www.opensolaris.org/os/licensing. 10fcf3ce44SJohn Forte * See the License for the specific language governing permissions 11fcf3ce44SJohn Forte * and limitations under the License. 12fcf3ce44SJohn Forte * 13fcf3ce44SJohn Forte * When distributing Covered Code, include this CDDL HEADER in each 14fcf3ce44SJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15fcf3ce44SJohn Forte * If applicable, add the following below this CDDL HEADER, with the 16fcf3ce44SJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying 17fcf3ce44SJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner] 18fcf3ce44SJohn Forte * 19fcf3ce44SJohn Forte * CDDL HEADER END 20fcf3ce44SJohn Forte */ 21fcf3ce44SJohn Forte /* 22*45039663SJohn Forte * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23fcf3ce44SJohn Forte * Use is subject to license terms. 24fcf3ce44SJohn Forte */ 25fcf3ce44SJohn Forte #ifndef _LPIF_H 26fcf3ce44SJohn Forte #define _LPIF_H 27fcf3ce44SJohn Forte 28fcf3ce44SJohn Forte /* 29fcf3ce44SJohn Forte * Definitions for stmf LUs and lu providers. 30fcf3ce44SJohn Forte */ 31fcf3ce44SJohn Forte 32fcf3ce44SJohn Forte #include <sys/stmf_defines.h> 33*45039663SJohn Forte #include <sys/stmf.h> 34fcf3ce44SJohn Forte 35fcf3ce44SJohn Forte #ifdef __cplusplus 36fcf3ce44SJohn Forte extern "C" { 37fcf3ce44SJohn Forte #endif 38fcf3ce44SJohn Forte 39fcf3ce44SJohn Forte #define LPIF_REV_1 0x00010000 40*45039663SJohn Forte #define LPIF_REV_2 0x00020000 41fcf3ce44SJohn Forte 42fcf3ce44SJohn Forte typedef struct stmf_lu { 43fcf3ce44SJohn Forte void *lu_stmf_private; 44fcf3ce44SJohn Forte void *lu_provider_private; 45fcf3ce44SJohn Forte 46fcf3ce44SJohn Forte struct scsi_devid_desc *lu_id; 47fcf3ce44SJohn Forte char *lu_alias; /* optional */ 48fcf3ce44SJohn Forte struct stmf_lu_provider *lu_lp; 49fcf3ce44SJohn Forte uint32_t lu_abort_timeout; /* In seconds */ 50fcf3ce44SJohn Forte 51fcf3ce44SJohn Forte /* SAM Device Server Class */ 52fcf3ce44SJohn Forte stmf_status_t (*lu_task_alloc)(struct scsi_task *task); 53fcf3ce44SJohn Forte void (*lu_new_task)(struct scsi_task *task, 54fcf3ce44SJohn Forte struct stmf_data_buf *initial_dbuf); 55fcf3ce44SJohn Forte void (*lu_dbuf_xfer_done)(struct scsi_task *task, 56fcf3ce44SJohn Forte struct stmf_data_buf *dbuf); 57fcf3ce44SJohn Forte /* 58fcf3ce44SJohn Forte * If completion confirmation is not requested, status xfer done 59fcf3ce44SJohn Forte * is called after the transport has confirmed that status has been 60fcf3ce44SJohn Forte * sent. If completion confirmation is requested then the HBA will 61fcf3ce44SJohn Forte * request a completion confirmation from the host and upon receiving 62fcf3ce44SJohn Forte * the same, this entry point will be called. 63fcf3ce44SJohn Forte */ 64fcf3ce44SJohn Forte void (*lu_send_status_done)(struct scsi_task *task); 65fcf3ce44SJohn Forte void (*lu_task_free)(struct scsi_task *task); 66fcf3ce44SJohn Forte stmf_status_t (*lu_abort)(struct stmf_lu *lu, 67fcf3ce44SJohn Forte int abort_cmd, void *arg, uint32_t flags); 68fcf3ce44SJohn Forte void (*lu_task_poll)(struct scsi_task *task); 69fcf3ce44SJohn Forte void (*lu_ctl)(struct stmf_lu *lu, int cmd, 70fcf3ce44SJohn Forte void *arg); 71fcf3ce44SJohn Forte stmf_status_t (*lu_info)(uint32_t cmd, struct stmf_lu *lu, 72fcf3ce44SJohn Forte void *arg, uint8_t *buf, uint32_t *bufsizep); 73fcf3ce44SJohn Forte void (*lu_event_handler)(struct stmf_lu *lu, 74fcf3ce44SJohn Forte int eventid, void *arg, uint32_t flags); 75*45039663SJohn Forte void *lu_proxy_reg_arg; 76*45039663SJohn Forte uint32_t lu_proxy_reg_arg_len; 77fcf3ce44SJohn Forte } stmf_lu_t; 78fcf3ce44SJohn Forte 79fcf3ce44SJohn Forte /* 80fcf3ce44SJohn Forte * Abort cmd 81fcf3ce44SJohn Forte */ 82fcf3ce44SJohn Forte #define STMF_LU_ABORT_TASK 1 83fcf3ce44SJohn Forte #define STMF_LU_RESET_STATE 2 84fcf3ce44SJohn Forte #define STMF_LU_ITL_HANDLE_REMOVED 3 85fcf3ce44SJohn Forte 86fcf3ce44SJohn Forte /* 87*45039663SJohn Forte * Asymmetric access state 88*45039663SJohn Forte */ 89*45039663SJohn Forte #define STMF_LU_ACTIVE 0 90*45039663SJohn Forte #define STMF_LU_STANDBY 1 91*45039663SJohn Forte 92*45039663SJohn Forte /* 93*45039663SJohn Forte * proxy register msg types 94*45039663SJohn Forte */ 95*45039663SJohn Forte #define STMF_MSG_LU_REGISTER 0 96*45039663SJohn Forte #define STMF_MSG_LU_ACTIVE 1 97*45039663SJohn Forte #define STMF_MSG_LU_DEREGISTER 2 98*45039663SJohn Forte 99*45039663SJohn Forte 100*45039663SJohn Forte #define STMF_PROXY_READ 1 101*45039663SJohn Forte #define STMF_PROXY_WRITE 2 102*45039663SJohn Forte 103*45039663SJohn Forte /* 104fcf3ce44SJohn Forte * Reasons for itl handle removal. Passed in flags. 105fcf3ce44SJohn Forte */ 106fcf3ce44SJohn Forte #define STMF_ITL_REASON_MASK 0x0f 107fcf3ce44SJohn Forte #define STMF_ITL_REASON_UNKNOWN 0x0 108fcf3ce44SJohn Forte #define STMF_ITL_REASON_DEREG_REQUEST 0x1 109fcf3ce44SJohn Forte #define STMF_ITL_REASON_USER_REQUEST 0x2 110fcf3ce44SJohn Forte #define STMF_ITL_REASON_IT_NEXUS_LOSS 0x3 111fcf3ce44SJohn Forte 112fcf3ce44SJohn Forte typedef struct stmf_lu_provider { 113fcf3ce44SJohn Forte void *lp_stmf_private; 114fcf3ce44SJohn Forte void *lp_private; 115fcf3ce44SJohn Forte 116*45039663SJohn Forte uint32_t lp_lpif_rev; /* Currently LPIF_REV_2 */ 117fcf3ce44SJohn Forte int lp_instance; 118fcf3ce44SJohn Forte char *lp_name; 119fcf3ce44SJohn Forte void (*lp_cb)(struct stmf_lu_provider *lp, 120fcf3ce44SJohn Forte int cmd, void *arg, uint32_t flags); 121*45039663SJohn Forte uint8_t lp_alua_support; 122*45039663SJohn Forte stmf_status_t (*lp_proxy_msg)(uint8_t *luid, 123*45039663SJohn Forte void *proxy_reg_arg, uint32_t proxy_reg_arg_len, uint32_t type); 124fcf3ce44SJohn Forte } stmf_lu_provider_t; 125fcf3ce44SJohn Forte 126fcf3ce44SJohn Forte stmf_status_t stmf_deregister_lu_provider(stmf_lu_provider_t *lp); 127fcf3ce44SJohn Forte stmf_status_t stmf_register_lu_provider(stmf_lu_provider_t *lp); 128fcf3ce44SJohn Forte stmf_status_t stmf_register_lu(stmf_lu_t *lup); 129fcf3ce44SJohn Forte stmf_status_t stmf_deregister_lu(stmf_lu_t *lup); 130*45039663SJohn Forte stmf_status_t stmf_set_lu_access(stmf_lu_t *lup, uint8_t access_state); 131*45039663SJohn Forte stmf_status_t stmf_proxy_scsi_cmd(scsi_task_t *, stmf_data_buf_t *dbuf); 132*45039663SJohn Forte int stmf_is_standby_port(scsi_task_t *); 133fcf3ce44SJohn Forte 134fcf3ce44SJohn Forte #ifdef __cplusplus 135fcf3ce44SJohn Forte } 136fcf3ce44SJohn Forte #endif 137fcf3ce44SJohn Forte 138fcf3ce44SJohn Forte #endif /* _LPIF_H */ 139