xref: /onnv-gate/usr/src/uts/common/sys/stmf_defines.h (revision 12750:f559965e4a2f)
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 /*
22*12750SNattuvetty.Bhavyan@Sun.COM  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
237836SJohn.Forte@Sun.COM  */
247836SJohn.Forte@Sun.COM #ifndef	_STMF_DEFINES_H
257836SJohn.Forte@Sun.COM #define	_STMF_DEFINES_H
267836SJohn.Forte@Sun.COM 
277836SJohn.Forte@Sun.COM #ifdef	__cplusplus
287836SJohn.Forte@Sun.COM extern "C" {
297836SJohn.Forte@Sun.COM #endif
307836SJohn.Forte@Sun.COM 
317836SJohn.Forte@Sun.COM #define	BIT_0	0x1
327836SJohn.Forte@Sun.COM #define	BIT_1	0x2
337836SJohn.Forte@Sun.COM #define	BIT_2	0x4
347836SJohn.Forte@Sun.COM #define	BIT_3	0x8
357836SJohn.Forte@Sun.COM #define	BIT_4	0x10
367836SJohn.Forte@Sun.COM #define	BIT_5	0x20
377836SJohn.Forte@Sun.COM #define	BIT_6	0x40
387836SJohn.Forte@Sun.COM #define	BIT_7	0x80
397836SJohn.Forte@Sun.COM #define	BIT_8	0x100
407836SJohn.Forte@Sun.COM #define	BIT_9	0x200
417836SJohn.Forte@Sun.COM #define	BIT_10	0x400
427836SJohn.Forte@Sun.COM #define	BIT_11	0x800
437836SJohn.Forte@Sun.COM #define	BIT_12	0x1000
447836SJohn.Forte@Sun.COM #define	BIT_13	0x2000
457836SJohn.Forte@Sun.COM #define	BIT_14	0x4000
467836SJohn.Forte@Sun.COM #define	BIT_15	0x8000
477836SJohn.Forte@Sun.COM #define	BIT_16	0x10000
487836SJohn.Forte@Sun.COM #define	BIT_17	0x20000
497836SJohn.Forte@Sun.COM #define	BIT_18	0x40000
507836SJohn.Forte@Sun.COM #define	BIT_19	0x80000
517836SJohn.Forte@Sun.COM #define	BIT_20	0x100000
527836SJohn.Forte@Sun.COM #define	BIT_21	0x200000
537836SJohn.Forte@Sun.COM #define	BIT_22	0x400000
547836SJohn.Forte@Sun.COM #define	BIT_23	0x800000
557836SJohn.Forte@Sun.COM #define	BIT_24	0x1000000
567836SJohn.Forte@Sun.COM #define	BIT_25	0x2000000
577836SJohn.Forte@Sun.COM #define	BIT_26	0x4000000
587836SJohn.Forte@Sun.COM #define	BIT_27	0x8000000
597836SJohn.Forte@Sun.COM #define	BIT_28	0x10000000
607836SJohn.Forte@Sun.COM #define	BIT_29	0x20000000
617836SJohn.Forte@Sun.COM #define	BIT_30	0x40000000
627836SJohn.Forte@Sun.COM #define	BIT_31	0x80000000
637836SJohn.Forte@Sun.COM 
647836SJohn.Forte@Sun.COM /*
657836SJohn.Forte@Sun.COM  * stmf status definitions
667836SJohn.Forte@Sun.COM  */
677836SJohn.Forte@Sun.COM typedef	uint64_t		stmf_status_t;
687836SJohn.Forte@Sun.COM #define	STMF_SUCCESS		((uint64_t)0)
697836SJohn.Forte@Sun.COM #define	STMF_FAILURE		((uint64_t)0x1000000000000000)
707836SJohn.Forte@Sun.COM #define	STMF_TARGET_FAILURE	((uint64_t)0x2000000000000000)
717836SJohn.Forte@Sun.COM #define	STMF_LU_FAILURE		((uint64_t)0x3000000000000000)
727836SJohn.Forte@Sun.COM #define	STMF_FSC(x)		(((uint64_t)(x)) << 32)
737836SJohn.Forte@Sun.COM #define	STMF_GET_FSC(x)		((((uint64_t)(x)) >> 32) & 0xFFFFFF)
747836SJohn.Forte@Sun.COM #define	STMF_RETRY_BIT		((uint64_t)0x0080000000000000)
757836SJohn.Forte@Sun.COM #define	STMF_BUSY		(STMF_FAILURE | STMF_RETRY_BIT | STMF_FSC(0))
767836SJohn.Forte@Sun.COM #define	STMF_NOT_FOUND		(STMF_FAILURE | STMF_FSC(1))
777836SJohn.Forte@Sun.COM #define	STMF_INVALID_ARG	(STMF_FAILURE | STMF_FSC(2))
787836SJohn.Forte@Sun.COM #define	STMF_LUN_TAKEN		(STMF_FAILURE | STMF_FSC(3))
797836SJohn.Forte@Sun.COM #define	STMF_ABORTED		(STMF_FAILURE | STMF_FSC(5))
807836SJohn.Forte@Sun.COM #define	STMF_ABORT_SUCCESS	(STMF_FAILURE | STMF_FSC(6))
817836SJohn.Forte@Sun.COM #define	STMF_ALLOC_FAILURE	(STMF_FAILURE | STMF_FSC(7))
827836SJohn.Forte@Sun.COM #define	STMF_ALREADY		(STMF_FAILURE | STMF_FSC(8))
837836SJohn.Forte@Sun.COM #define	STMF_TIMEOUT		(STMF_FAILURE | STMF_FSC(9))
847836SJohn.Forte@Sun.COM #define	STMF_NOT_SUPPORTED	(STMF_FAILURE | STMF_FSC(10))
8511698SNattuvetty.Bhavyan@Sun.COM #define	STMF_BADSTATE		(STMF_FAILURE | STMF_FSC(11))
867836SJohn.Forte@Sun.COM 
877836SJohn.Forte@Sun.COM #define	GET_BYTE_OFFSET(ptr, off)	(((uint8_t *)(ptr)) + (off))
887836SJohn.Forte@Sun.COM #define	GET_STRUCT_SIZE(s)		((sizeof (s) + 7) & 0xfffffff8)
897836SJohn.Forte@Sun.COM #define	READ_SCSI16(addr, type)		((((type)(((uint8_t *)(addr))[0])) \
907836SJohn.Forte@Sun.COM 								<< 8) |\
917836SJohn.Forte@Sun.COM 					((type)(((uint8_t *)(addr))[1])))
927836SJohn.Forte@Sun.COM #define	READ_SCSI21(addr, type)		((((type)(((uint8_t *)(addr))[0] & \
937836SJohn.Forte@Sun.COM 								0x1F)) << 16)\
947836SJohn.Forte@Sun.COM 					    | (READ_SCSI16(addr+1, type)))
957836SJohn.Forte@Sun.COM #define	READ_SCSI32(addr, type)		(((READ_SCSI16(addr, type)) << 16) |\
967836SJohn.Forte@Sun.COM 					    (READ_SCSI16((addr+2), type)))
977836SJohn.Forte@Sun.COM #define	READ_SCSI64(addr, type)		(((READ_SCSI32(addr, type)) << 32) |\
987836SJohn.Forte@Sun.COM 					    (READ_SCSI32((addr+4), type)))
997836SJohn.Forte@Sun.COM #define	PTR2INT(p, t)	((t)((ulong_t)(p)))
1007836SJohn.Forte@Sun.COM #define	INT2PTR(i, t)	((t)((ulong_t)(i)))
1017836SJohn.Forte@Sun.COM 
1027836SJohn.Forte@Sun.COM /*
1037836SJohn.Forte@Sun.COM  * CDB definitions that don't exist in commands.h
1047836SJohn.Forte@Sun.COM  */
1057836SJohn.Forte@Sun.COM #define	SCMD_SYNCHRONIZE_CACHE_G4		0x91
1067836SJohn.Forte@Sun.COM 
1077836SJohn.Forte@Sun.COM /*
1087836SJohn.Forte@Sun.COM  * Common key, asc, ascq for stmf_scsilib_send_status
1097836SJohn.Forte@Sun.COM  */
1109585STim.Szeto@Sun.COM #define	STMF_SAA_MEDIUM_NOT_PRESENT		0X023A00
11110725SJohn.Forte@Sun.COM #define	STMF_SAA_LU_NO_ACCESS_TRANSITION	0X02040A
11210725SJohn.Forte@Sun.COM #define	STMF_SAA_LU_NO_ACCESS_STANDBY		0X02040B
11310725SJohn.Forte@Sun.COM #define	STMF_SAA_LU_NO_ACCESS_UNAVAIL		0X02040C
1147836SJohn.Forte@Sun.COM #define	STMF_SAA_WRITE_ERROR			0x030C00
1157836SJohn.Forte@Sun.COM #define	STMF_SAA_READ_ERROR			0x031100
1169585STim.Szeto@Sun.COM #define	STMF_SAA_OPERATION_IN_PROGRESS		0x050016
1179585STim.Szeto@Sun.COM #define	STMF_SAA_INVALID_FIELD_IN_CMD_IU	0x050E03
1189585STim.Szeto@Sun.COM #define	STMF_SAA_PARAM_LIST_LENGTH_ERROR	0x051A00
1197836SJohn.Forte@Sun.COM #define	STMF_SAA_INVALID_OPCODE			0x052000
1207836SJohn.Forte@Sun.COM #define	STMF_SAA_INVALID_LU			0x052009
1217836SJohn.Forte@Sun.COM #define	STMF_SAA_LBA_OUT_OF_RANGE		0x052100
1227836SJohn.Forte@Sun.COM #define	STMF_SAA_INVALID_FIELD_IN_CDB		0x052400
1239585STim.Szeto@Sun.COM #define	STMF_SAA_INVALID_FIELD_IN_PARAM_LIST	0x052600
1249585STim.Szeto@Sun.COM #define	STMF_SAA_INVALID_RELEASE_OF_PR		0x052604
1259585STim.Szeto@Sun.COM #define	STMF_SAA_MEDIUM_REMOVAL_PREVENTED	0x055302
1269585STim.Szeto@Sun.COM #define	STMF_SAA_INSUFFICIENT_REG_RESOURCES	0x055504
1277836SJohn.Forte@Sun.COM #define	STMF_SAA_POR				0x062900
12810725SJohn.Forte@Sun.COM #define	STMF_SAA_MODE_PARAMETERS_CHANGED	0x062A01
12910725SJohn.Forte@Sun.COM #define	STMF_SAA_ASYMMETRIC_ACCESS_CHANGED	0x062A06
1307836SJohn.Forte@Sun.COM #define	STMF_SAA_CAPACITY_DATA_HAS_CHANGED	0x062A09
1319585STim.Szeto@Sun.COM #define	STMF_SAA_REPORT_LUN_DATA_HAS_CHANGED	0x063F0E
1329585STim.Szeto@Sun.COM #define	STMF_SAA_WRITE_PROTECTED		0X072700
1337836SJohn.Forte@Sun.COM 
1347836SJohn.Forte@Sun.COM struct stmf_lu_provider;
1357836SJohn.Forte@Sun.COM struct stmf_lu;
1367836SJohn.Forte@Sun.COM struct stmf_port_provider;
1377836SJohn.Forte@Sun.COM struct stmf_local_port;
138*12750SNattuvetty.Bhavyan@Sun.COM struct stmf_remote_port;
1397836SJohn.Forte@Sun.COM struct stmf_scsi_session;
1407836SJohn.Forte@Sun.COM struct scsi_task;
1417836SJohn.Forte@Sun.COM struct scsi_devid_desc;
142*12750SNattuvetty.Bhavyan@Sun.COM struct scsi_transport_id;
1437836SJohn.Forte@Sun.COM struct stmf_data_buf;
1447836SJohn.Forte@Sun.COM struct stmf_lun_map;
1457836SJohn.Forte@Sun.COM struct scsi_devid_desc;
1467836SJohn.Forte@Sun.COM 
1477836SJohn.Forte@Sun.COM #ifdef	__cplusplus
1487836SJohn.Forte@Sun.COM }
1497836SJohn.Forte@Sun.COM #endif
1507836SJohn.Forte@Sun.COM 
1517836SJohn.Forte@Sun.COM #endif	/* _STMF_DEFINES_H */
152