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 /* 223fb517f7SJames Moore * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 23*09409df0SJeff Biseda * Copyright (c) 2013 by Delphix. All rights reserved. 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> 3345039663SJohn 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 4045039663SJohn 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); 7545039663SJohn Forte void *lu_proxy_reg_arg; 7645039663SJohn Forte uint32_t lu_proxy_reg_arg_len; 773fb517f7SJames Moore void (*lu_dbuf_free)(struct scsi_task *task, 783fb517f7SJames Moore struct stmf_data_buf *dbuf); 79fcf3ce44SJohn Forte } stmf_lu_t; 80fcf3ce44SJohn Forte 81fcf3ce44SJohn Forte /* 82fcf3ce44SJohn Forte * Abort cmd 83fcf3ce44SJohn Forte */ 84fcf3ce44SJohn Forte #define STMF_LU_ABORT_TASK 1 85fcf3ce44SJohn Forte #define STMF_LU_RESET_STATE 2 86fcf3ce44SJohn Forte #define STMF_LU_ITL_HANDLE_REMOVED 3 87fcf3ce44SJohn Forte 88fcf3ce44SJohn Forte /* 8945039663SJohn Forte * Asymmetric access state 9045039663SJohn Forte */ 9145039663SJohn Forte #define STMF_LU_ACTIVE 0 9245039663SJohn Forte #define STMF_LU_STANDBY 1 9345039663SJohn Forte 9445039663SJohn Forte /* 9545039663SJohn Forte * proxy register msg types 9645039663SJohn Forte */ 9745039663SJohn Forte #define STMF_MSG_LU_REGISTER 0 9845039663SJohn Forte #define STMF_MSG_LU_ACTIVE 1 9945039663SJohn Forte #define STMF_MSG_LU_DEREGISTER 2 10045039663SJohn Forte 10145039663SJohn Forte 10245039663SJohn Forte #define STMF_PROXY_READ 1 10345039663SJohn Forte #define STMF_PROXY_WRITE 2 10445039663SJohn Forte 10545039663SJohn Forte /* 106fcf3ce44SJohn Forte * Reasons for itl handle removal. Passed in flags. 107fcf3ce44SJohn Forte */ 108fcf3ce44SJohn Forte #define STMF_ITL_REASON_MASK 0x0f 109fcf3ce44SJohn Forte #define STMF_ITL_REASON_UNKNOWN 0x0 110fcf3ce44SJohn Forte #define STMF_ITL_REASON_DEREG_REQUEST 0x1 111fcf3ce44SJohn Forte #define STMF_ITL_REASON_USER_REQUEST 0x2 112fcf3ce44SJohn Forte #define STMF_ITL_REASON_IT_NEXUS_LOSS 0x3 113fcf3ce44SJohn Forte 114fcf3ce44SJohn Forte typedef struct stmf_lu_provider { 115fcf3ce44SJohn Forte void *lp_stmf_private; 116fcf3ce44SJohn Forte void *lp_private; 117fcf3ce44SJohn Forte 11845039663SJohn Forte uint32_t lp_lpif_rev; /* Currently LPIF_REV_2 */ 119fcf3ce44SJohn Forte int lp_instance; 120fcf3ce44SJohn Forte char *lp_name; 121fcf3ce44SJohn Forte void (*lp_cb)(struct stmf_lu_provider *lp, 122fcf3ce44SJohn Forte int cmd, void *arg, uint32_t flags); 12345039663SJohn Forte uint8_t lp_alua_support; 12445039663SJohn Forte stmf_status_t (*lp_proxy_msg)(uint8_t *luid, 12545039663SJohn Forte void *proxy_reg_arg, uint32_t proxy_reg_arg_len, uint32_t type); 126fcf3ce44SJohn Forte } stmf_lu_provider_t; 127fcf3ce44SJohn Forte 128fcf3ce44SJohn Forte stmf_status_t stmf_deregister_lu_provider(stmf_lu_provider_t *lp); 129fcf3ce44SJohn Forte stmf_status_t stmf_register_lu_provider(stmf_lu_provider_t *lp); 130fcf3ce44SJohn Forte stmf_status_t stmf_register_lu(stmf_lu_t *lup); 131fcf3ce44SJohn Forte stmf_status_t stmf_deregister_lu(stmf_lu_t *lup); 13245039663SJohn Forte stmf_status_t stmf_set_lu_access(stmf_lu_t *lup, uint8_t access_state); 13345039663SJohn Forte stmf_status_t stmf_proxy_scsi_cmd(scsi_task_t *, stmf_data_buf_t *dbuf); 13445039663SJohn Forte int stmf_is_standby_port(scsi_task_t *); 135fcf3ce44SJohn Forte 136fcf3ce44SJohn Forte #ifdef __cplusplus 137fcf3ce44SJohn Forte } 138fcf3ce44SJohn Forte #endif 139fcf3ce44SJohn Forte 140fcf3ce44SJohn Forte #endif /* _LPIF_H */ 141