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*716c1805SNattuvetty Bhavyan * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 23fcf3ce44SJohn Forte */ 24fcf3ce44SJohn Forte #ifndef _STMF_DEFINES_H 25fcf3ce44SJohn Forte #define _STMF_DEFINES_H 26fcf3ce44SJohn Forte 27fcf3ce44SJohn Forte #ifdef __cplusplus 28fcf3ce44SJohn Forte extern "C" { 29fcf3ce44SJohn Forte #endif 30fcf3ce44SJohn Forte 31fcf3ce44SJohn Forte #define BIT_0 0x1 32fcf3ce44SJohn Forte #define BIT_1 0x2 33fcf3ce44SJohn Forte #define BIT_2 0x4 34fcf3ce44SJohn Forte #define BIT_3 0x8 35fcf3ce44SJohn Forte #define BIT_4 0x10 36fcf3ce44SJohn Forte #define BIT_5 0x20 37fcf3ce44SJohn Forte #define BIT_6 0x40 38fcf3ce44SJohn Forte #define BIT_7 0x80 39fcf3ce44SJohn Forte #define BIT_8 0x100 40fcf3ce44SJohn Forte #define BIT_9 0x200 41fcf3ce44SJohn Forte #define BIT_10 0x400 42fcf3ce44SJohn Forte #define BIT_11 0x800 43fcf3ce44SJohn Forte #define BIT_12 0x1000 44fcf3ce44SJohn Forte #define BIT_13 0x2000 45fcf3ce44SJohn Forte #define BIT_14 0x4000 46fcf3ce44SJohn Forte #define BIT_15 0x8000 47fcf3ce44SJohn Forte #define BIT_16 0x10000 48fcf3ce44SJohn Forte #define BIT_17 0x20000 49fcf3ce44SJohn Forte #define BIT_18 0x40000 50fcf3ce44SJohn Forte #define BIT_19 0x80000 51fcf3ce44SJohn Forte #define BIT_20 0x100000 52fcf3ce44SJohn Forte #define BIT_21 0x200000 53fcf3ce44SJohn Forte #define BIT_22 0x400000 54fcf3ce44SJohn Forte #define BIT_23 0x800000 55fcf3ce44SJohn Forte #define BIT_24 0x1000000 56fcf3ce44SJohn Forte #define BIT_25 0x2000000 57fcf3ce44SJohn Forte #define BIT_26 0x4000000 58fcf3ce44SJohn Forte #define BIT_27 0x8000000 59fcf3ce44SJohn Forte #define BIT_28 0x10000000 60fcf3ce44SJohn Forte #define BIT_29 0x20000000 61fcf3ce44SJohn Forte #define BIT_30 0x40000000 62fcf3ce44SJohn Forte #define BIT_31 0x80000000 63fcf3ce44SJohn Forte 64fcf3ce44SJohn Forte /* 65fcf3ce44SJohn Forte * stmf status definitions 66fcf3ce44SJohn Forte */ 67fcf3ce44SJohn Forte typedef uint64_t stmf_status_t; 68fcf3ce44SJohn Forte #define STMF_SUCCESS ((uint64_t)0) 69fcf3ce44SJohn Forte #define STMF_FAILURE ((uint64_t)0x1000000000000000) 70fcf3ce44SJohn Forte #define STMF_TARGET_FAILURE ((uint64_t)0x2000000000000000) 71fcf3ce44SJohn Forte #define STMF_LU_FAILURE ((uint64_t)0x3000000000000000) 72fcf3ce44SJohn Forte #define STMF_FSC(x) (((uint64_t)(x)) << 32) 73fcf3ce44SJohn Forte #define STMF_GET_FSC(x) ((((uint64_t)(x)) >> 32) & 0xFFFFFF) 74fcf3ce44SJohn Forte #define STMF_RETRY_BIT ((uint64_t)0x0080000000000000) 75fcf3ce44SJohn Forte #define STMF_BUSY (STMF_FAILURE | STMF_RETRY_BIT | STMF_FSC(0)) 76fcf3ce44SJohn Forte #define STMF_NOT_FOUND (STMF_FAILURE | STMF_FSC(1)) 77fcf3ce44SJohn Forte #define STMF_INVALID_ARG (STMF_FAILURE | STMF_FSC(2)) 78fcf3ce44SJohn Forte #define STMF_LUN_TAKEN (STMF_FAILURE | STMF_FSC(3)) 79fcf3ce44SJohn Forte #define STMF_ABORTED (STMF_FAILURE | STMF_FSC(5)) 80fcf3ce44SJohn Forte #define STMF_ABORT_SUCCESS (STMF_FAILURE | STMF_FSC(6)) 81fcf3ce44SJohn Forte #define STMF_ALLOC_FAILURE (STMF_FAILURE | STMF_FSC(7)) 82fcf3ce44SJohn Forte #define STMF_ALREADY (STMF_FAILURE | STMF_FSC(8)) 83fcf3ce44SJohn Forte #define STMF_TIMEOUT (STMF_FAILURE | STMF_FSC(9)) 84fcf3ce44SJohn Forte #define STMF_NOT_SUPPORTED (STMF_FAILURE | STMF_FSC(10)) 854f486358SNattuvetty Bhavyan #define STMF_BADSTATE (STMF_FAILURE | STMF_FSC(11)) 86fcf3ce44SJohn Forte 87fcf3ce44SJohn Forte #define GET_BYTE_OFFSET(ptr, off) (((uint8_t *)(ptr)) + (off)) 88fcf3ce44SJohn Forte #define GET_STRUCT_SIZE(s) ((sizeof (s) + 7) & 0xfffffff8) 89fcf3ce44SJohn Forte #define READ_SCSI16(addr, type) ((((type)(((uint8_t *)(addr))[0])) \ 90fcf3ce44SJohn Forte << 8) |\ 91fcf3ce44SJohn Forte ((type)(((uint8_t *)(addr))[1]))) 92fcf3ce44SJohn Forte #define READ_SCSI21(addr, type) ((((type)(((uint8_t *)(addr))[0] & \ 93fcf3ce44SJohn Forte 0x1F)) << 16)\ 94fcf3ce44SJohn Forte | (READ_SCSI16(addr+1, type))) 95fcf3ce44SJohn Forte #define READ_SCSI32(addr, type) (((READ_SCSI16(addr, type)) << 16) |\ 96fcf3ce44SJohn Forte (READ_SCSI16((addr+2), type))) 97fcf3ce44SJohn Forte #define READ_SCSI64(addr, type) (((READ_SCSI32(addr, type)) << 32) |\ 98fcf3ce44SJohn Forte (READ_SCSI32((addr+4), type))) 99fcf3ce44SJohn Forte #define PTR2INT(p, t) ((t)((ulong_t)(p))) 100fcf3ce44SJohn Forte #define INT2PTR(i, t) ((t)((ulong_t)(i))) 101fcf3ce44SJohn Forte 102fcf3ce44SJohn Forte /* 103fcf3ce44SJohn Forte * CDB definitions that don't exist in commands.h 104fcf3ce44SJohn Forte */ 105fcf3ce44SJohn Forte #define SCMD_SYNCHRONIZE_CACHE_G4 0x91 106fcf3ce44SJohn Forte 107fcf3ce44SJohn Forte /* 108fcf3ce44SJohn Forte * Common key, asc, ascq for stmf_scsilib_send_status 109fcf3ce44SJohn Forte */ 1108fe96085Stim szeto #define STMF_SAA_MEDIUM_NOT_PRESENT 0X023A00 11145039663SJohn Forte #define STMF_SAA_LU_NO_ACCESS_TRANSITION 0X02040A 11245039663SJohn Forte #define STMF_SAA_LU_NO_ACCESS_STANDBY 0X02040B 11345039663SJohn Forte #define STMF_SAA_LU_NO_ACCESS_UNAVAIL 0X02040C 114fcf3ce44SJohn Forte #define STMF_SAA_WRITE_ERROR 0x030C00 115fcf3ce44SJohn Forte #define STMF_SAA_READ_ERROR 0x031100 1168fe96085Stim szeto #define STMF_SAA_OPERATION_IN_PROGRESS 0x050016 1178fe96085Stim szeto #define STMF_SAA_INVALID_FIELD_IN_CMD_IU 0x050E03 1188fe96085Stim szeto #define STMF_SAA_PARAM_LIST_LENGTH_ERROR 0x051A00 119fcf3ce44SJohn Forte #define STMF_SAA_INVALID_OPCODE 0x052000 120fcf3ce44SJohn Forte #define STMF_SAA_INVALID_LU 0x052009 121fcf3ce44SJohn Forte #define STMF_SAA_LBA_OUT_OF_RANGE 0x052100 122fcf3ce44SJohn Forte #define STMF_SAA_INVALID_FIELD_IN_CDB 0x052400 1238fe96085Stim szeto #define STMF_SAA_INVALID_FIELD_IN_PARAM_LIST 0x052600 1248fe96085Stim szeto #define STMF_SAA_INVALID_RELEASE_OF_PR 0x052604 1258fe96085Stim szeto #define STMF_SAA_MEDIUM_REMOVAL_PREVENTED 0x055302 1268fe96085Stim szeto #define STMF_SAA_INSUFFICIENT_REG_RESOURCES 0x055504 127fcf3ce44SJohn Forte #define STMF_SAA_POR 0x062900 1288fe96085Stim szeto #define STMF_SAA_MODE_PARAMETERS_CHANGED 0x062A01 12945039663SJohn Forte #define STMF_SAA_ASYMMETRIC_ACCESS_CHANGED 0x062A06 13045039663SJohn Forte #define STMF_SAA_CAPACITY_DATA_HAS_CHANGED 0x062A09 1318fe96085Stim szeto #define STMF_SAA_REPORT_LUN_DATA_HAS_CHANGED 0x063F0E 1328fe96085Stim szeto #define STMF_SAA_WRITE_PROTECTED 0X072700 133fcf3ce44SJohn Forte 134fcf3ce44SJohn Forte struct stmf_lu_provider; 135fcf3ce44SJohn Forte struct stmf_lu; 136fcf3ce44SJohn Forte struct stmf_port_provider; 137fcf3ce44SJohn Forte struct stmf_local_port; 138*716c1805SNattuvetty Bhavyan struct stmf_remote_port; 139fcf3ce44SJohn Forte struct stmf_scsi_session; 140fcf3ce44SJohn Forte struct scsi_task; 141fcf3ce44SJohn Forte struct scsi_devid_desc; 142*716c1805SNattuvetty Bhavyan struct scsi_transport_id; 143fcf3ce44SJohn Forte struct stmf_data_buf; 144fcf3ce44SJohn Forte struct stmf_lun_map; 145fcf3ce44SJohn Forte struct scsi_devid_desc; 146fcf3ce44SJohn Forte 147fcf3ce44SJohn Forte #ifdef __cplusplus 148fcf3ce44SJohn Forte } 149fcf3ce44SJohn Forte #endif 150fcf3ce44SJohn Forte 151fcf3ce44SJohn Forte #endif /* _STMF_DEFINES_H */ 152