1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_SCSI_IMPL_SMP_FRAME_H
28 #define	_SYS_SCSI_IMPL_SMP_FRAME_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/sysmacros.h>
37 
38 /*
39  * The definitions of smp frame types and functions conforming to SAS v1.1.
40  * The SAS v2.0 will be supported in the future when it is publicly released.
41  */
42 
43 typedef enum  {
44 	SMP_FRAME_TYPE_REQUEST		= 0x40,
45 	SMP_FRAME_TYPE_RESPONSE		= 0x41
46 } smp_frame_types;
47 
48 typedef enum {
49 	SMP_REPORT_GENERAL			= 0x00,
50 	SMP_REPORT_MANUFACTURER_INFO	= 0x01,
51 	SMP_DISCOVER				= 0x10,
52 	SMP_REPORT_PHY_ERROR_LOG		= 0x11,
53 	SMP_PHY_SATA				= 0x12,
54 	SMP_REPORT_ROUTE_INFORMATION	= 0x13,
55 	SMP_CONFIG_ROUTE_INFORMATION	= 0x90,
56 	SMP_PHY_CONTROL			= 0x91,
57 	SMP_PHY_TEST_FUNCTION		= 0x92
58 } smp_func_types;
59 
60 /*
61  * The reqsize and rspsize in usmp_req and usmp_rsp are reserved in
62  * SAS v1.1, and the fields should be zero if target device is SAS v1.1
63  * compliant.
64  */
65 
66 #pragma	pack(1)
67 typedef struct usmp_req {
68 	uint8_t		smpo_frametype;
69 	uint8_t		smpo_function;
70 	uint8_t		smpo_reserved;
71 	uint8_t		smpo_reqsize;
72 	uint8_t		smpo_msgframe[1];
73 } usmp_req_t;
74 
75 typedef struct usmp_rsp {
76 	uint8_t		smpi_frametype;
77 	uint8_t		smpi_function;
78 	uint8_t		smpi_result;
79 	uint8_t		smpi_rspsize;
80 	uint8_t		smpi_msgframe[1];
81 } usmp_rsp_t;
82 
83 struct smp_crc {
84 	uint8_t code[4];
85 };
86 
87 struct smp_report_general_req {
88 	uint8_t		frametype;
89 	uint8_t		function;
90 	uint8_t 	reserved_byte2;
91 	uint8_t 	reqsize;
92 	struct smp_crc	crc;
93 };
94 
95 struct smp_report_general_rsp {
96 	uint8_t		frametype;
97 	uint8_t		function;
98 	uint8_t 	result;
99 	uint8_t 	rspsize;
100 	uint8_t 	expand_change_count1;
101 	uint8_t 	expand_change_count0;
102 	uint8_t 	expand_route_index1;
103 	uint8_t 	expand_route_index0;
104 	uint8_t 	reserved_byte8;
105 	uint8_t		num_of_phy;
106 	DECL_BITFIELD3(
107 	    crt			:1,
108 	    configuring		:1,
109 	    reserved_byte10	:6);
110 	uint8_t		reserved_byte11;
111 	uint64_t	identifier;
112 	uint8_t		reserved_byte20[8];
113 	struct smp_crc	crc;
114 };
115 #pragma	pack()
116 
117 #ifdef	__cplusplus
118 }
119 #endif
120 
121 #endif	/* _SYS_SCSI_IMPL_SMP_FRAME_H */
122