17836SJohn.Forte@Sun.COM /* 27836SJohn.Forte@Sun.COM * CDDL HEADER START 37836SJohn.Forte@Sun.COM * 47836SJohn.Forte@Sun.COM * The contents of this file are subject to the terms of the 57836SJohn.Forte@Sun.COM * Common Development and Distribution License (the "License"). 67836SJohn.Forte@Sun.COM * You may not use this file except in compliance with the License. 77836SJohn.Forte@Sun.COM * 87836SJohn.Forte@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97836SJohn.Forte@Sun.COM * or http://www.opensolaris.org/os/licensing. 107836SJohn.Forte@Sun.COM * See the License for the specific language governing permissions 117836SJohn.Forte@Sun.COM * and limitations under the License. 127836SJohn.Forte@Sun.COM * 137836SJohn.Forte@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 147836SJohn.Forte@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157836SJohn.Forte@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 167836SJohn.Forte@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 177836SJohn.Forte@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 187836SJohn.Forte@Sun.COM * 197836SJohn.Forte@Sun.COM * CDDL HEADER END 207836SJohn.Forte@Sun.COM */ 217836SJohn.Forte@Sun.COM /* 2212314SJames.Moore@Sun.COM * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 237836SJohn.Forte@Sun.COM */ 247836SJohn.Forte@Sun.COM #ifndef _PORTIF_H 257836SJohn.Forte@Sun.COM #define _PORTIF_H 267836SJohn.Forte@Sun.COM 277836SJohn.Forte@Sun.COM /* 287836SJohn.Forte@Sun.COM * Definitions for stmf local ports and port providers. 297836SJohn.Forte@Sun.COM */ 307836SJohn.Forte@Sun.COM 317836SJohn.Forte@Sun.COM #include <sys/stmf_defines.h> 327836SJohn.Forte@Sun.COM 337836SJohn.Forte@Sun.COM #ifdef __cplusplus 347836SJohn.Forte@Sun.COM extern "C" { 357836SJohn.Forte@Sun.COM #endif 367836SJohn.Forte@Sun.COM 377836SJohn.Forte@Sun.COM typedef struct stmf_dbuf_store { 387836SJohn.Forte@Sun.COM void *ds_stmf_private; 397836SJohn.Forte@Sun.COM void *ds_port_private; 407836SJohn.Forte@Sun.COM 417836SJohn.Forte@Sun.COM stmf_data_buf_t *(*ds_alloc_data_buf)(struct scsi_task *task, 427836SJohn.Forte@Sun.COM uint32_t size, uint32_t *pminsize, uint32_t flags); 4312314SJames.Moore@Sun.COM 4412314SJames.Moore@Sun.COM void (*ds_free_data_buf)( 4512314SJames.Moore@Sun.COM struct stmf_dbuf_store *ds, stmf_data_buf_t *dbuf); 4612314SJames.Moore@Sun.COM 4712314SJames.Moore@Sun.COM stmf_status_t (*ds_setup_dbuf)(struct scsi_task *task, 4812314SJames.Moore@Sun.COM stmf_data_buf_t *dbuf, uint32_t flags); 4912314SJames.Moore@Sun.COM 5012314SJames.Moore@Sun.COM void (*ds_teardown_dbuf)( 5112314SJames.Moore@Sun.COM struct stmf_dbuf_store *ds, stmf_data_buf_t *dbuf); 527836SJohn.Forte@Sun.COM } stmf_dbuf_store_t; 537836SJohn.Forte@Sun.COM 547836SJohn.Forte@Sun.COM #define PORTIF_REV_1 0x00010000 557836SJohn.Forte@Sun.COM 567836SJohn.Forte@Sun.COM typedef struct stmf_local_port { 577836SJohn.Forte@Sun.COM void *lport_stmf_private; 587836SJohn.Forte@Sun.COM void *lport_port_private; 597836SJohn.Forte@Sun.COM 607836SJohn.Forte@Sun.COM uint32_t lport_abort_timeout; 617836SJohn.Forte@Sun.COM 627836SJohn.Forte@Sun.COM struct scsi_devid_desc *lport_id; 637836SJohn.Forte@Sun.COM char *lport_alias; 647836SJohn.Forte@Sun.COM struct stmf_port_provider *lport_pp; 657836SJohn.Forte@Sun.COM struct stmf_dbuf_store *lport_ds; 667836SJohn.Forte@Sun.COM /* lport ops */ 677836SJohn.Forte@Sun.COM stmf_status_t (*lport_xfer_data)(struct scsi_task *task, 687836SJohn.Forte@Sun.COM struct stmf_data_buf *dbuf, uint32_t ioflags); 697836SJohn.Forte@Sun.COM stmf_status_t (*lport_send_status)(struct scsi_task *task, 707836SJohn.Forte@Sun.COM uint32_t ioflags); 717836SJohn.Forte@Sun.COM void (*lport_task_free)(struct scsi_task *task); 727836SJohn.Forte@Sun.COM stmf_status_t (*lport_abort)(struct stmf_local_port *lport, 737836SJohn.Forte@Sun.COM int abort_cmd, void *arg, uint32_t flags); 747836SJohn.Forte@Sun.COM void (*lport_task_poll)(struct scsi_task *task); 757836SJohn.Forte@Sun.COM void (*lport_ctl)(struct stmf_local_port *lport, 767836SJohn.Forte@Sun.COM int cmd, void *arg); 777836SJohn.Forte@Sun.COM stmf_status_t (*lport_info)(uint32_t cmd, 787836SJohn.Forte@Sun.COM struct stmf_local_port *lport, void *arg, uint8_t *buf, 797836SJohn.Forte@Sun.COM uint32_t *bufsizep); 807836SJohn.Forte@Sun.COM void (*lport_event_handler)( 817836SJohn.Forte@Sun.COM struct stmf_local_port *lport, int eventid, void *arg, 827836SJohn.Forte@Sun.COM uint32_t flags); 837836SJohn.Forte@Sun.COM } stmf_local_port_t; 847836SJohn.Forte@Sun.COM 85*12750SNattuvetty.Bhavyan@Sun.COM typedef struct stmf_remote_port { 86*12750SNattuvetty.Bhavyan@Sun.COM struct scsi_transport_id *rport_tptid; 87*12750SNattuvetty.Bhavyan@Sun.COM uint16_t rport_tptid_sz; 88*12750SNattuvetty.Bhavyan@Sun.COM } stmf_remote_port_t; 89*12750SNattuvetty.Bhavyan@Sun.COM 90*12750SNattuvetty.Bhavyan@Sun.COM typedef struct stmf_dflt_scsi_tptid { 91*12750SNattuvetty.Bhavyan@Sun.COM #if defined(_BIT_FIELDS_LTOH) 92*12750SNattuvetty.Bhavyan@Sun.COM uint8_t protocol_id : 4, 93*12750SNattuvetty.Bhavyan@Sun.COM resbits : 2, 94*12750SNattuvetty.Bhavyan@Sun.COM format_code : 2; 95*12750SNattuvetty.Bhavyan@Sun.COM #elif defined(_BIT_FIELDS_HTOL) 96*12750SNattuvetty.Bhavyan@Sun.COM uint8_t format_code : 2, 97*12750SNattuvetty.Bhavyan@Sun.COM resbits : 2, 98*12750SNattuvetty.Bhavyan@Sun.COM protocol_id : 4; 99*12750SNattuvetty.Bhavyan@Sun.COM #else 100*12750SNattuvetty.Bhavyan@Sun.COM #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 101*12750SNattuvetty.Bhavyan@Sun.COM #endif /* _BIT_FIELDS_LTOH */ 102*12750SNattuvetty.Bhavyan@Sun.COM uint8_t rsvbyte1; 103*12750SNattuvetty.Bhavyan@Sun.COM uint8_t ident_len[2]; 104*12750SNattuvetty.Bhavyan@Sun.COM char ident[1]; 105*12750SNattuvetty.Bhavyan@Sun.COM } stmf_dflt_scsi_tptid_t; 1067836SJohn.Forte@Sun.COM /* 1077836SJohn.Forte@Sun.COM * abort cmd 1087836SJohn.Forte@Sun.COM */ 1097836SJohn.Forte@Sun.COM #define STMF_LPORT_ABORT_TASK 0x40 1107836SJohn.Forte@Sun.COM 1117836SJohn.Forte@Sun.COM typedef struct stmf_port_provider { 1127836SJohn.Forte@Sun.COM void *pp_stmf_private; 1137836SJohn.Forte@Sun.COM void *pp_provider_private; 1147836SJohn.Forte@Sun.COM 1157836SJohn.Forte@Sun.COM uint32_t pp_portif_rev; /* Currently PORTIF_REV_1 */ 1167836SJohn.Forte@Sun.COM int pp_instance; 1177836SJohn.Forte@Sun.COM char *pp_name; 1187836SJohn.Forte@Sun.COM void (*pp_cb)(struct stmf_port_provider *pp, 1197836SJohn.Forte@Sun.COM int cmd, void *arg, uint32_t flags); 1207836SJohn.Forte@Sun.COM } stmf_port_provider_t; 1217836SJohn.Forte@Sun.COM 1227836SJohn.Forte@Sun.COM #define STMF_SESSION_ID_NONE ((uint64_t)0) 1237836SJohn.Forte@Sun.COM 1247836SJohn.Forte@Sun.COM typedef struct stmf_scsi_session { 1257836SJohn.Forte@Sun.COM void *ss_stmf_private; 1267836SJohn.Forte@Sun.COM void *ss_port_private; 1277836SJohn.Forte@Sun.COM 1287836SJohn.Forte@Sun.COM struct scsi_devid_desc *ss_rport_id; 1297836SJohn.Forte@Sun.COM char *ss_rport_alias; 1307836SJohn.Forte@Sun.COM struct stmf_local_port *ss_lport; 1317836SJohn.Forte@Sun.COM uint64_t ss_session_id; 132*12750SNattuvetty.Bhavyan@Sun.COM struct stmf_remote_port *ss_rport; 1337836SJohn.Forte@Sun.COM } stmf_scsi_session_t; 1347836SJohn.Forte@Sun.COM 1357836SJohn.Forte@Sun.COM stmf_status_t stmf_register_port_provider(stmf_port_provider_t *pp); 1367836SJohn.Forte@Sun.COM stmf_status_t stmf_deregister_port_provider(stmf_port_provider_t *pp); 1377836SJohn.Forte@Sun.COM stmf_status_t stmf_register_local_port(stmf_local_port_t *lportp); 1387836SJohn.Forte@Sun.COM stmf_status_t stmf_deregister_local_port(stmf_local_port_t *lport); 1397836SJohn.Forte@Sun.COM stmf_status_t stmf_register_scsi_session(stmf_local_port_t *lport, 1407836SJohn.Forte@Sun.COM stmf_scsi_session_t *ss); 1417836SJohn.Forte@Sun.COM void stmf_deregister_scsi_session(stmf_local_port_t *lport, 1427836SJohn.Forte@Sun.COM stmf_scsi_session_t *ss); 14310725SJohn.Forte@Sun.COM void stmf_set_port_standby(stmf_local_port_t *lport, uint16_t rtpid); 14411116SJohn.Forte@Sun.COM void stmf_set_port_alua(stmf_local_port_t *lport); 1457836SJohn.Forte@Sun.COM 1467836SJohn.Forte@Sun.COM #ifdef __cplusplus 1477836SJohn.Forte@Sun.COM } 1487836SJohn.Forte@Sun.COM #endif 1497836SJohn.Forte@Sun.COM 1507836SJohn.Forte@Sun.COM #endif /* _PORTIF_H */ 151