xref: /illumos-gate/usr/src/uts/common/sys/scsi/generic/smp_frames.h (revision 89b2a9fbeabf42fa54594df0e5927bcc50a07cc9)
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 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_SCSI_GENERIC_SMP_FRAMES_H
28 #define	_SYS_SCSI_GENERIC_SMP_FRAMES_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/sysmacros.h>
35 
36 /*
37  * The definitions of smp frame types and functions conforming to SAS-1.1 and
38  * SAS-2.  Consumers are expected to determine protocol support by examining
39  * the response to the REPORT GENERAL function.
40  */
41 
42 typedef enum smp_frame_type {
43 	SMP_FRAME_TYPE_REQUEST		= 0x40,
44 	SMP_FRAME_TYPE_RESPONSE		= 0x41
45 } smp_frame_type_t;
46 
47 typedef enum smp_function {
48 	SMP_FUNC_REPORT_GENERAL			= 0x00,
49 	SMP_FUNC_REPORT_MANUFACTURER_INFO	= 0x01,
50 	SMP_FUNC_READ_GPIO_REGISTER		= 0x02,
51 	SMP_FUNC_REPORT_SELF_CONFIG_STATUS	= 0x03,
52 	SMP_FUNC_REPORT_ZONE_PERM_TABLE		= 0x04,
53 	SMP_FUNC_REPORT_ZONE_MANAGER_PASSWORD	= 0x05,
54 	SMP_FUNC_REPORT_BROADCAST		= 0x06,
55 	SMP_FUNC_DISCOVER			= 0x10,
56 	SMP_FUNC_REPORT_PHY_ERROR_LOG		= 0x11,
57 	SMP_FUNC_REPORT_PHY_SATA		= 0x12,
58 	SMP_FUNC_REPORT_ROUTE_INFO		= 0x13,
59 	SMP_FUNC_REPORT_PHY_EVENT		= 0x14,
60 	SMP_FUNC_DISCOVER_LIST			= 0x20,
61 	SMP_FUNC_REPORT_PHY_EVENT_LIST		= 0x21,
62 	SMP_FUNC_REPORT_EXP_ROUTE_TABLE_LIST	= 0x22,
63 	SMP_FUNC_CONFIG_GENERAL			= 0x80,
64 	SMP_FUNC_ENABLE_DISABLE_ZONING		= 0x81,
65 	SMP_FUNC_WRITE_GPIO_REGISTER		= 0x82,
66 	SMP_FUNC_ZONED_BROADCAST		= 0x85,
67 	SMP_FUNC_ZONE_LOCK			= 0x86,
68 	SMP_FUNC_ZONE_ACTIVATE			= 0x87,
69 	SMP_FUNC_ZONE_UNLOCK			= 0x88,
70 	SMP_FUNC_CONFIG_ZONE_MANAGER_PASSWORD	= 0x89,
71 	SMP_FUNC_CONFIG_ZONE_PHY_INFO		= 0x8A,
72 	SMP_FUNC_CONFIG_ZONE_PERM_TABLE		= 0x8B,
73 	SMP_FUNC_CONFIG_ROUTE_INFO		= 0x90,
74 	SMP_FUNC_PHY_CONTROL			= 0x91,
75 	SMP_FUNC_PHY_TEST_FUNCTION		= 0x92,
76 	SMP_FUNC_CONFIG_PHY_EVENT		= 0x93
77 } smp_function_t;
78 
79 typedef enum smp_result {
80 	SMP_RES_FUNCTION_ACCEPTED		= 0x00,
81 	SMP_RES_UNKNOWN_FUNCTION		= 0x01,
82 	SMP_RES_FUNCTION_FAILED			= 0x02,
83 	SMP_RES_INVALID_REQUEST_FRAME_LENGTH	= 0x03,
84 	SMP_RES_INVALID_EXPANDER_CHANGE_COUNT	= 0x04,
85 	SMP_RES_BUSY				= 0x05,
86 	SMP_RES_INCOMPLETE_DESCRIPTOR_LIST	= 0x06,
87 	SMP_RES_PHY_DOES_NOT_EXIST		= 0x10,
88 	SMP_RES_INDEX_DOES_NOT_EXIST		= 0x11,
89 	SMP_RES_PHY_DOES_NOT_SUPPORT_SATA	= 0x12,
90 	SMP_RES_UNKNOWN_PHY_OPERATION		= 0x13,
91 	SMP_RES_UNKNOWN_PHY_TEST_FUNCTION	= 0x14,
92 	SMP_RES_PHY_TEST_IN_PROGRESS		= 0x15,
93 	SMP_RES_PHY_VACANT			= 0x16,
94 	SMP_RES_UNKNOWN_PHY_EVENT_SOURCE	= 0x17,
95 	SMP_RES_UNKNOWN_DESCRIPTOR_TYPE		= 0x18,
96 	SMP_RES_UNKNOWN_PHY_FILTER		= 0x19,
97 	SMP_RES_AFFILIATION_VIOLATION		= 0x1A,
98 	SMP_RES_ZONE_VIOLATION			= 0x20,
99 	SMP_RES_NO_MANAGEMENT_ACCESS_RIGHTS	= 0x21,
100 	SMP_RES_UNKNOWN_ENABLE_DISABLE_ZONING	= 0x22,
101 	SMP_RES_ZONE_LOCK_VIOLATION		= 0x23,
102 	SMP_RES_NOT_ACTIVATED			= 0x24,
103 	SMP_RES_ZONE_GROUP_OUT_OF_RANGE		= 0x25,
104 	SMP_RES_NO_PHYSICAL_PRESENCE		= 0x26,
105 	SMP_RES_SAVING_NOT_SUPPORTED		= 0x27,
106 	SMP_RES_SOURCE_ZONE_GROUP_DNE		= 0x28,
107 	SMP_RES_NONE				= -1
108 } smp_result_t;
109 
110 #pragma	pack(1)
111 
112 /*
113  * SAS-2 10.4.3.2 request frame format
114  */
115 typedef struct smp_request_frame {
116 	uint8_t srf_frame_type;
117 	uint8_t srf_function;
118 	uint8_t srf_allocated_response_len;	/* reserved in SAS-1 */
119 	uint8_t srf_request_len;
120 	uint8_t srf_data[1];
121 } smp_request_frame_t;
122 
123 /*
124  * SAS-2 10.4.3.3 response frame format
125  */
126 typedef struct smp_response_frame {
127 	uint8_t srf_frame_type;
128 	uint8_t srf_function;
129 	uint8_t srf_result;
130 	uint8_t srf_response_len;	/* reserved in SAS-1 */
131 	uint8_t srf_data[1];
132 } smp_response_frame_t;
133 
134 typedef uint8_t smp_crc_t[4];
135 
136 #ifdef offsetof
137 #define	SMP_REQ_MINLEN	\
138 	(offsetof(smp_request_frame_t, srf_data[0]) + sizeof (smp_crc_t))
139 #define	SMP_RESP_MINLEN	\
140 	(offsetof(smp_response_frame_t, srf_data[0]) + sizeof (smp_crc_t))
141 #endif	/* offsetof */
142 
143 /*
144  * SAS-2 10.4.3.4 REPORT GENERAL (no additional request bytes)
145  */
146 typedef struct smp_report_general_resp {
147 	uint16_t srgr_exp_change_count;
148 	uint16_t srgr_exp_route_indexes;
149 	DECL_BITFIELD2(
150 	    _reserved1		:7,
151 	    srgr_long_response	:1);
152 	uint8_t srgr_number_of_phys;
153 	DECL_BITFIELD7(
154 	    srgr_externally_configurable_route_table	:1,
155 	    srgr_configuring				:1,
156 	    srgr_configures_others			:1,
157 	    srgr_open_reject_retry_supported		:1,
158 	    srgr_stp_continue_awt			:1,
159 	    _reserved2					:2,
160 	    srgr_table_to_table_supported		:1);
161 	uint8_t _reserved3;
162 	uint64_t srgr_enclosure_logical_identifier;
163 	uint8_t _reserved4[8];
164 	uint8_t _reserved5[2];
165 	uint16_t srgr_stp_bus_inactivity_time_limit;
166 	uint16_t srgr_stp_maximum_connect_time_limit;
167 	uint16_t srgr_stp_smp_nexus_loss_time;
168 	DECL_BITFIELD7(
169 	    srgr_zoning_enabled				:1,
170 	    srgr_zoning_supported			:1,
171 	    srgr_physical_presence_asserted		:1,
172 	    srgr_physical_presence_supported		:1,
173 	    srgr_zone_locked				:1,
174 	    _reserved6					:1,
175 	    srgr_number_of_zone_grps			:2);
176 	DECL_BITFIELD6(
177 	    srgr_saving_zoning_enabled_supported	:1,
178 	    srgr_saving_zone_perm_table_supported	:1,
179 	    srgr_saving_zone_phy_info_supported		:1,
180 	    srgr_saving_zone_mgr_password_supported	:1,
181 	    srgr_saving					:1,
182 	    _reserved7					:4);
183 	uint16_t srgr_max_routed_sas_addrs;
184 	uint64_t srgr_active_zm_sas_addr;
185 	uint16_t srgr_zone_lock_inactivity_limit;
186 	uint8_t _reserved8[2];
187 	uint8_t _reserved9;
188 	uint8_t srgr_first_encl_conn_elem_idx;
189 	uint8_t srgr_number_encl_conn_elem_idxs;
190 	uint8_t _reserved10;
191 	DECL_BITFIELD2(
192 	    _reserved11					:7,
193 	    srgr_reduced_functionality			:1);
194 	uint8_t srgr_time_to_reduced_functionality;
195 	uint8_t srgr_initial_time_to_reduced_functionality;
196 	uint8_t srgr_max_reduced_functionality_time;
197 	uint16_t srgr_last_self_conf_status_descr_idx;
198 	uint16_t srgr_max_stored_self_config_status_descrs;
199 	uint16_t srgr_last_phy_event_list_descr_idx;
200 	uint16_t srgr_max_stored_phy_event_list_descrs;
201 	uint16_t srgr_stp_reject_to_open_limit;
202 	uint8_t _reserved12[2];
203 } smp_report_general_resp_t;
204 
205 typedef enum smp_n_zone_grps {
206 	SMP_ZONE_GROUPS_128	= 0x0,
207 	SMP_ZONE_GROUPS_256	= 0x1
208 } smp_n_zone_grps_t;
209 
210 /*
211  * SAS-2 10.4.3.5 REPORT MANUFACTURER INFORMATION (no additional request bytes)
212  */
213 typedef struct smp_report_manufacturer_info_resp {
214 	uint16_t srmir_exp_change_count;
215 	uint8_t _reserved1[2];
216 	DECL_BITFIELD2(
217 	    srmir_sas_1_1_format	:1,
218 	    _reserved2			:7);
219 	uint8_t _reserved3[3];
220 	char srmir_vendor_identification[8];
221 	char srmir_product_identification[16];
222 	char srmir_product_revision_level[4];
223 	char srmir_component_vendor_identification[8];
224 	uint16_t srmir_component_id;
225 	uint8_t srmir_component_revision_level;
226 	uint8_t _reserved4;
227 	uint8_t srmir_vs_52[8];
228 } smp_report_manufacturer_info_resp_t;
229 
230 /*
231  * SAS-2 10.4.3.6 REPORT SELF_CONFIGURATION STATUS
232  */
233 typedef struct smp_report_self_config_status_req {
234 	uint8_t _reserved1[2];
235 	uint16_t srscsr_starting_self_config_status_descr_idx;
236 } smp_report_self_config_status_req_t;
237 
238 typedef struct smp_report_self_config_status_resp {
239 	uint16_t srscsr_exp_change_count;
240 	uint16_t srscsr_starting_self_config_status_descr_idx;
241 	uint16_t srscsr_number_self_config_status_descrs;
242 	uint16_t srscsr_last_self_config_status_descr_idx;
243 	uint8_t srscsr_self_config_status_descr_len;
244 	uint8_t _reserved1[3];
245 	uint8_t srscsr_descrs[1];
246 } smp_report_self_config_status_resp_t;
247 
248 typedef struct smp_self_config_status_descr {
249 	uint8_t sscsd_status_type;
250 	DECL_BITFIELD2(
251 	    sscsd_final		:1,
252 	    _reserved1		:7);
253 	uint8_t _reserved2;
254 	uint8_t sscsd_phy_identifier;
255 	uint8_t _reserved3[4];
256 	uint64_t sscsd_sas_addr;
257 } smp_self_config_status_descr_t;
258 
259 typedef enum smp_self_config_status_type {
260 	SMP_SCST_NONSPECIFIC_ERROR	= 0x01,
261 	SMP_SCST_CONNECTION		= 0x02,
262 	SMP_SCST_ROUTE_TABLE_FULL	= 0x03,
263 	SMP_SCST_NOMEM			= 0x04,
264 	SMP_SCST_PHY_LAYER_ERROR	= 0x20,
265 	SMP_SCST_LOST_SYNC		= 0x21,
266 	SMP_SCST_LINK_LAYER_ERROR	= 0x40,
267 	SMP_SCST_OPEN_TIMEOUT		= 0x41,
268 	SMP_SCST_ABANDON_OPEN_REJECT	= 0x42,
269 	SMP_SCST_RETRY_OPEN_REJECTS	= 0x43,
270 	SMP_SCST_NEXUS_LOSS		= 0x44,
271 	SMP_SCST_BREAK			= 0x45,
272 	SMP_SCST_CRC_ERROR		= 0x46,
273 	SMP_SCST_PORT_LAYER_ERROR	= 0x60,
274 	SMP_SCST_RESPONSE_TIMEOUT	= 0x61,
275 	SMP_SCST_TRANSPORT_LAYER_ERROR	= 0x80,
276 	SMP_SCST_APP_LAYER_ERROR	= 0xA0,
277 	SMP_SCST_RESPONSE_TOO_SHORT	= 0xA1,
278 	SMP_SCST_UNSUPPORTED_VALUES	= 0xA2,
279 	SMP_SCST_INCONSISTENT		= 0xA3,
280 	SMP_SCST_CONFIGURING		= 0xA4
281 } smp_self_config_status_type_t;
282 
283 /*
284  * SAS-2 10.4.3.7 REPORT ZONE PERMISSION TABLE
285  */
286 typedef struct smp_report_zone_perm_table_req {
287 	DECL_BITFIELD2(
288 	    srzptr_report_type		:2,
289 	    _reserved1			:6);
290 	uint8_t _reserved2;
291 	uint8_t srzptr_starting_src_zone_grp;
292 	uint8_t srzptr_max_zone_perm_descrs;
293 } smp_report_zone_perm_table_req_t;
294 
295 typedef enum smp_zone_perm_table_report_type {
296 	SMP_ZPTRT_CURRENT		= 0x0,
297 	SMP_ZPTRT_SHADOW		= 0x1,
298 	SMP_ZPTRT_SAVED			= 0x2,
299 	SMP_ZPTRT_DEFAULT		= 0x3
300 } smp_zone_perm_table_report_type_t;
301 
302 typedef struct smp_report_zone_perm_table_resp {
303 	uint16_t srzptr_exp_change_count;
304 	DECL_BITFIELD3(
305 	    srzptr_report_type		:2,
306 	    _reserved1			:5,
307 	    srzptr_zone_locked		:1);
308 	DECL_BITFIELD2(
309 	    _reserved2			:6,
310 	    srzptr_number_zone_grps	:2);
311 	uint8_t _reserved3[6];
312 	uint8_t srzptr_starting_src_zone_grp;
313 	uint8_t srzptr_number_zone_perm_descrs;
314 	uint8_t srzptr_descrs[1];
315 } smp_report_zone_perm_table_resp_t;
316 
317 typedef uint8_t smp_zone_perm_descr128_t[16];
318 typedef uint8_t smp_zone_perm_descr256_t[32];
319 
320 #define	SMP_ZONE_PERM_BIT128(__d, __z)	\
321 	((__d)[15 - ((__z) >> 3)] & (1 << ((__z) & 7)))
322 
323 #define	SMP_ZONE_PERM_SET128(__d, __z)	\
324 	((__d)[15 - ((__z) >> 3)] |= (1 << ((__z) & 7)))
325 
326 #define	SMP_ZONE_PERM_CLR128(__d, __z)	\
327 	((__d)[15 - ((__z) >> 3)] &= ~(1 << ((__z) & 7)))
328 
329 #define	SMP_ZONE_PERM_BIT256(__d, __z)	\
330 	((__d)[31 - ((__z) >> 3)] & (1 << ((__z) & 7)))
331 
332 #define	SMP_ZONE_PERM_SET256(__d, __z)	\
333 	((__d)[31 - ((__z) >> 3)] |= (1 << ((__z) & 7)))
334 
335 #define	SMP_ZONE_PERM_CLR256(__d, __z)	\
336 	((__d)[31 - ((__z) >> 3)] &= ~(1 << ((__z) & 7)))
337 
338 /*
339  * SAS-2 10.4.3.8 REPORT ZONE MANAGER PASSWORD (no additional request bytes)
340  */
341 typedef struct smp_report_zone_mgr_password_resp {
342 	uint16_t srzmpr_exp_change_count;
343 	uint8_t _reserved1[2];
344 	uint8_t srzmpr_zone_mgr_password[32];
345 } smp_report_zone_mgr_password_resp_t;
346 
347 /*
348  * SAS-2 10.4.3.9 REPORT BROADCAST
349  */
350 typedef struct smp_report_broadcast_req {
351 	DECL_BITFIELD2(
352 	    srbr_broadcast_type		:4,
353 	    _reserved1			:4);
354 	uint8_t _reserved2[3];
355 } smp_report_broadcast_req_t;
356 
357 typedef enum smp_broadcast_type {
358 	SMP_BROADCAST_CHANGE		= 0x0,
359 	SMP_BROADCAST_RESERVED_CHANGE_0	= 0x1,
360 	SMP_BROADCAST_RESERVED_CHANGE_1	= 0x2,
361 	SMP_BROADCAST_SES		= 0x3,
362 	SMP_BROADCAST_EXPANDER		= 0x4,
363 	SMP_BROADCAST_ASYNC_EVENT	= 0x5,
364 	SMP_BROADCAST_RESERVED_3	= 0x6,
365 	SMP_BROADCAST_RESERVED_4	= 0x7,
366 	SMP_BROADCAST_ZONE_ACTIVATE	= 0x8
367 } smp_broadcast_type_t;
368 
369 typedef struct smp_broadcast_descr {
370 	DECL_BITFIELD2(
371 	    sbd_broadcast_type		:4,
372 	    _reserved1			:4);
373 	uint8_t sbd_phy_identifier;
374 	DECL_BITFIELD2(
375 	    sbd_broadcast_reason	:4,
376 	    _reserved2			:4);
377 	uint16_t sbd_broadcast_count;
378 	uint8_t _reserved3[10];
379 } smp_broadcast_descr_t;
380 
381 typedef struct smp_report_broadcast_resp {
382 	uint16_t srbr_exp_change_count;
383 	DECL_BITFIELD2(
384 	    srbr_broadcast_type		:4,
385 	    _reserved1			:4);
386 	uint8_t srbr_number_broadcast_descrs;
387 	smp_broadcast_descr_t srbr_descrs[1];
388 } smp_report_broadcast_resp_t;
389 
390 /*
391  * SAS-2 10.4.3.10 DISCOVER
392  */
393 typedef struct smp_discover_req {
394 	uint8_t _reserved1[4];
395 	DECL_BITFIELD2(
396 	    sdr_ignore_zone_grp		:1,
397 	    _reserved2			:7);
398 	uint8_t sdr_phy_identifier;
399 	uint8_t _reserved3[2];
400 } smp_discover_req_t;
401 
402 typedef struct smp_snw3_phy_cap {
403 	DECL_BITFIELD4(
404 	    sspc_requested_logical_link_rate	:4,	/* smp_link_rate_t */
405 	    _reserved1				:2,
406 	    sspc_tx_ssc_type			:1,
407 	    sspc_start				:1);
408 	DECL_BITFIELD7(
409 	    _reserved2				:2,
410 	    sspc_g3_ssc				:1,
411 	    sspc_g3_no_ssc			:1,
412 	    sspc_g2_ssc				:1,
413 	    sspc_g2_no_ssc			:1,
414 	    sspc_g1_ssc				:1,
415 	    sspc_g1_no_ssc			:1);
416 	uint8_t _reserved3;
417 	DECL_BITFIELD2(
418 	    sspc_parity		:1,
419 	    _reserved4		:7);
420 } smp_snw3_phy_cap_t;
421 
422 typedef struct smp_discover_resp {
423 	uint16_t sdr_exp_change_count;
424 	uint8_t _reserved1[3];
425 	uint8_t sdr_phy_identifier;
426 	uint8_t _reserved2[2];
427 	DECL_BITFIELD3(
428 	    sdr_attached_reason		:4,
429 	    sdr_attached_device_type	:3,
430 	    _reserved3			:1);
431 	DECL_BITFIELD2(
432 	    sdr_negotiated_logical_link_rate	:4,	/* smp_link_rate_t */
433 	    _reserved4				:4);
434 	DECL_BITFIELD5(
435 	    sdr_attached_sata_host	:1,
436 	    sdr_attached_smp_initiator	:1,
437 	    sdr_attached_stp_initiator	:1,
438 	    sdr_attached_ssp_initiator	:1,
439 	    _reserved5			:4);
440 	DECL_BITFIELD6(
441 	    sdr_attached_sata_device		:1,
442 	    sdr_attached_smp_target		:1,
443 	    sdr_attached_stp_target		:1,
444 	    sdr_attached_ssp_target		:1,
445 	    _reserved6				:3,
446 	    sdr_attached_sata_port_selector	:1);
447 	uint64_t sdr_sas_addr;
448 	uint64_t sdr_attached_sas_addr;
449 	uint8_t sdr_attached_phy_identifier;
450 	DECL_BITFIELD4(
451 	    sdr_attached_break_reply_capable		:1,
452 	    sdr_attached_requested_inside_zpsds		:1,
453 	    sdr_attached_inside_zpsds_persistent	:1,
454 	    _reserved7					:5);
455 	uint8_t _reserved8[6];
456 	DECL_BITFIELD2(
457 	    sdr_hw_min_phys_link_rate	:4,	/* smp_link_rate_t */
458 	    sdr_prog_min_phys_link_rate	:4);	/* smp_link_rate_t */
459 	DECL_BITFIELD2(
460 	    sdr_hw_max_phys_link_rate	:4,	/* smp_link_rate_t */
461 	    sdr_prog_max_phys_link_rate	:4);	/* smp_link_rate_t */
462 	uint8_t sdr_phy_change_count;
463 	DECL_BITFIELD3(
464 	    sdr_partial_pwy_timeout	:4,
465 	    _reserved9			:3,
466 	    sdr_virtual_phy		:1);
467 	DECL_BITFIELD2(
468 	    sdr_routing_attr		:4,	/* smp_routing_attr_t */
469 	    _reserved10			:4);
470 	DECL_BITFIELD2(
471 	    sdr_connector_type		:7,
472 	    _reserved11			:1);
473 	uint8_t sdr_connector_element_index;
474 	uint8_t sdr_connector_physical_link;
475 	uint8_t _reserved12[2];
476 	uint8_t sdr_vendor[2];
477 	uint64_t sdr_attached_device_name;
478 	DECL_BITFIELD8(
479 	    sdr_zoning_enabled				:1,
480 	    sdr_inside_zpsds				:1,
481 	    sdr_zone_group_persistent			:1,
482 	    _reserved13					:1,
483 	    sdr_requested_inside_zpsds			:1,
484 	    sdr_inside_zpsds_persistent			:1,
485 	    sdr_requested_inside_zpsds_changed_by_exp	:1,
486 	    _reserved14					:1);
487 	uint8_t _reserved15[2];
488 	uint8_t sdr_zone_group;
489 	uint8_t sdr_self_config_status;
490 	uint8_t sdr_self_config_levels_completed;
491 	uint8_t _reserved16[2];
492 	uint64_t sdr_self_config_sas_addr;
493 	smp_snw3_phy_cap_t sdr_prog_phy_cap;
494 	smp_snw3_phy_cap_t sdr_current_phy_cap;
495 	smp_snw3_phy_cap_t sdr_attached_phy_cap;
496 	uint8_t _reserved17[6];
497 	DECL_BITFIELD2(
498 	    sdr_negotiated_phys_link_rate	:4,	/* smp_link_rate_t */
499 	    sdr_reason				:4);
500 	DECL_BITFIELD3(
501 	    sdr_hw_muxing_supported	:1,
502 	    sdr_negotiated_ssc		:1,
503 	    _reserved18			:6);
504 	DECL_BITFIELD7(
505 	    sdr_default_zoning_enabled		:1,
506 	    _reserved19				:1,
507 	    sdr_default_zone_group_persistent	:1,
508 	    _reserved20				:1,
509 	    sdr_default_requested_inside_zpsds	:1,
510 	    sdr_default_inside_zpsds_persistent	:1,
511 	    _reserved21				:2);
512 	uint8_t _reserved22[2];
513 	uint8_t sdr_default_zone_group;
514 	DECL_BITFIELD7(
515 	    sdr_saved_zoning_enabled		:1,
516 	    _reserved23				:1,
517 	    sdr_saved_zone_group_persistent	:1,
518 	    _reserved24				:1,
519 	    sdr_saved_requested_inside_zpsds	:1,
520 	    sdr_saved_inside_zpsds_persistent	:1,
521 	    _reserved25				:2);
522 	uint8_t _reserved26[2];
523 	uint8_t saved_zone_group;
524 	DECL_BITFIELD6(
525 	    _reserved27				:2,
526 	    sdr_shadow_zone_group_persistent	:1,
527 	    _reserved28				:1,
528 	    sdr_shadow_requested_inside_zpsds	:1,
529 	    sdr_shadow_inside_zpsds_persistent	:1,
530 	    _reserved29				:2);
531 	uint8_t _reserved30[2];
532 	uint8_t sdr_shadow_zone_group;
533 } smp_discover_resp_t;
534 
535 typedef enum smp_link_rate {
536 	SMP_LINK_RATE_NO_CHANGE = 0x0,
537 	SMP_LINK_RATE_DISABLED = 0x1,
538 	SMP_LINK_RATE_RESET_PROBLEM = 0x2,
539 	SMP_LINK_RATE_SPINUP_HOLD = 0x3,
540 	SMP_LINK_RATE_PORT_SELECTOR = 0x4,
541 	SMP_LINK_RATE_RESET = 0x5,
542 	SMP_LINK_RATE_UNSUPPORTED = 0x6,
543 	SMP_LINK_RATE_1_5 = 0x8,
544 	SMP_LINK_RATE_3 = 0x9,
545 	SMP_LINK_RATE_6 = 0xA
546 } smp_link_rate_t;
547 
548 typedef enum smp_device_type {
549 	SMP_DEV_NONE = 0x0,
550 	SMP_DEV_SAS_SATA = 0x1,
551 	SMP_DEV_EXPANDER = 0x2,
552 	SMP_DEV_EXPANDER_OLD = 0x3
553 } smp_device_type_t;
554 
555 typedef enum smp_routing_attr {
556 	SMP_ROUTING_DIRECT = 0x0,
557 	SMP_ROUTING_SUBTRACTIVE = 0x1,
558 	SMP_ROUTING_TABLE = 0x2
559 } smp_routing_attr_t;
560 
561 /*
562  * SAS-2 10.4.3.11 REPORT PHY ERROR LOG
563  */
564 typedef struct smp_report_phy_error_log_req {
565 	uint8_t _reserved1[5];
566 	uint8_t srpelr_phy_identifier;
567 	uint8_t _reserved2[2];
568 } smp_report_phy_error_log_req_t;
569 
570 typedef struct smp_report_phy_error_log_resp {
571 	uint16_t srpelr_exp_change_count;
572 	uint8_t _reserved1[3];
573 	uint8_t srpelr_phy_identifier;
574 	uint8_t _reserved2[2];
575 	uint32_t srpelr_invalid_dword_count;
576 	uint32_t srpelr_running_disparity_error_count;
577 	uint32_t srpelr_loss_dword_sync_count;
578 	uint32_t srpelr_phy_reset_problem_count;
579 } smp_report_phy_error_log_resp_t;
580 
581 /*
582  * SAS-2 10.4.3.12 REPORT PHY SATA
583  */
584 typedef struct smp_report_phy_sata_req {
585 	uint8_t _reserved1[5];
586 	uint8_t srpsr_phy_identifier;
587 	uint8_t srpsr_affiliation_context;
588 	uint8_t _reserved2;
589 } smp_report_phy_sata_req_t;
590 
591 typedef struct smp_report_phy_sata_resp {
592 	uint16_t srpsr_exp_change_count;
593 	uint8_t _reserved1[3];
594 	uint8_t srpsr_phy_identifier;
595 	uint8_t _reserved2;
596 	DECL_BITFIELD4(
597 	    srpsr_affiliation_valid		:1,
598 	    srpsr_affiliations_supported	:1,
599 	    srpsr_stp_nexus_loss		:1,
600 	    _reserved3				:5);
601 	uint8_t _reserved4[4];
602 	uint64_t srpsr_stp_sas_addr;
603 	uint8_t srpsr_register_device_host_fis[20];
604 	uint8_t _reserved5[4];
605 	uint64_t srpsr_affiliated_stp_init_sas_addr;
606 	uint64_t srpsr_stp_nexus_loss_sas_addr;
607 	uint8_t _reserved6;
608 	uint8_t srpsr_affiliation_context;
609 	uint8_t srpsr_current_affiliation_contexts;
610 	uint8_t srpsr_max_affiliation_contexts;
611 } smp_report_phy_sata_resp_t;
612 
613 /*
614  * SAS-2 10.4.3.13 REPORT ROUTE INFORMATION
615  */
616 typedef struct smp_report_route_info_req {
617 	uint8_t _reserved1[2];
618 	uint16_t srrir_exp_route_index;
619 	uint8_t _reserved2;
620 	uint8_t srrir_phy_identifier;
621 	uint8_t _reserved3[2];
622 } smp_report_route_info_req_t;
623 
624 typedef struct smp_report_route_info_resp {
625 	uint16_t srrir_exp_change_count;
626 	uint16_t srrir_exp_route_index;
627 	uint8_t _reserved1;
628 	uint8_t srrir_phy_identifier;
629 	uint8_t _reserved2[2];
630 	DECL_BITFIELD2(
631 	    _reserved3				:7,
632 	    srrir_exp_route_entry_disabled	:1);
633 	uint8_t _reserved4[3];
634 	uint64_t srrir_routed_sas_addr;
635 	uint8_t _reserved5[16];
636 } smp_report_route_info_resp_t;
637 
638 /*
639  * SAS-2 10.4.3.14 SAS-2 REPORT PHY EVENT
640  */
641 typedef struct smp_report_phy_event_req {
642 	uint8_t _reserved1;
643 	uint8_t _reserved2[4];
644 	uint8_t srper_phy_identifier;
645 	uint8_t _reserved3[2];
646 } smp_report_phy_event_req_t;
647 
648 typedef struct smp_phy_event_report_descr {
649 	uint8_t _reserved1[3];
650 	uint8_t sped_phy_event_source;
651 	uint32_t sped_phy_event;
652 	uint32_t sped_peak_detector_threshold;
653 } smp_phy_event_report_descr_t;
654 
655 typedef struct smp_report_phy_event_resp {
656 	uint16_t srper_exp_change_count;
657 	uint8_t _reserved1[3];
658 	uint8_t srper_phy_identifier;
659 	uint8_t _reserved2[5];
660 	uint8_t srper_n_phy_event_descrs;
661 	smp_phy_event_report_descr_t srper_phy_event_descrs[1];
662 } smp_report_phy_event_resp_t;
663 
664 /*
665  * SAS-2 10.4.3.15 SAS-2 DISCOVER LIST
666  */
667 typedef struct smp_discover_list_req {
668 	uint8_t _reserved1[4];
669 	uint8_t sdlr_starting_phy_identifier;
670 	uint8_t sdlr_max_descrs;
671 	DECL_BITFIELD3(
672 	    sdlr_phy_filter		:4,
673 	    _reserved2			:3,
674 	    sdlr_ignore_zone_group	:1);
675 	DECL_BITFIELD2(
676 	    sdlr_descr_type		:4,
677 	    _reserved3			:4);
678 	uint8_t _reserved4[4];
679 	uint8_t sdlr_vendor[12];
680 } smp_discover_list_req_t;
681 
682 typedef struct smp_discover_short_descr {
683 	uint8_t sdsd_phy_identifier;
684 	uint8_t sdsd_function_result;
685 	DECL_BITFIELD3(
686 	    sdsd_attached_reason	:4,
687 	    sdsd_attached_device_type	:3,
688 	    _restricted1		:1);
689 	DECL_BITFIELD2(
690 	    sdsd_negotiated_logical_link_rate	:4,	/* smp_link_rate_t */
691 	    _restricted2			:4);
692 	DECL_BITFIELD5(
693 	    sdsd_attached_sata_host	:1,
694 	    sdsd_attached_smp_initiator	:1,
695 	    sdsd_attached_stp_initiator	:1,
696 	    sdsd_attached_ssp_initiator	:1,
697 	    _restricted3		:4);
698 	DECL_BITFIELD6(
699 	    sdsd_attached_sata_device		:1,
700 	    sdsd_attached_smp_target		:1,
701 	    sdsd_attached_stp_target		:1,
702 	    sdsd_attached_ssp_target		:1,
703 	    _restricted4			:3,
704 	    sdsd_attached_sata_port_selector	:1);
705 	DECL_BITFIELD3(
706 	    sdsd_routing_attribute	:4,		/* smp_routing_attr_t */
707 	    _reserved1			:3,
708 	    sdsd_virtual_phy		:1);
709 	DECL_BITFIELD2(
710 	    _reserved2			:4,
711 	    sdsd_reason			:4);
712 	uint8_t sdsd_zone_group;
713 	DECL_BITFIELD7(
714 	    _reserved3				:1,
715 	    sdsd_inside_zpsds			:1,
716 	    sdsd_zone_group_persistent		:1,
717 	    _reserved4				:1,
718 	    sdsd_requested_insize_zpsds		:1,
719 	    sdsd_inside_zpsds_persistent	:1,
720 	    _restricted5			:2);
721 	uint8_t sdsd_attached_phy_identifier;
722 	uint8_t sdsd_phy_change_count;
723 	uint64_t sdsd_attached_sas_addr;
724 	uint8_t _reserved5[4];
725 } smp_discover_short_descr_t;
726 
727 typedef struct smp_discover_long_descr {
728 	uint8_t _reserved1[2];
729 	uint8_t sdld_function_result;
730 	uint8_t _reserved2[1];
731 	smp_discover_resp_t sdld_response;
732 } smp_discover_long_descr_t;
733 
734 #define	SMP_DISCOVER_RESP(_ld)	\
735 	(((smp_discover_long_descr_t *)(_ld))->sdld_function_result ==	\
736 	SMP_FUNCTION_ACCEPTED ?	\
737 	&((smp_discover_long_descr_t *)(_ld))->sdld_response :	\
738 	NULL)
739 
740 typedef struct smp_discover_list_resp {
741 	uint16_t sdlr_exp_change_count;
742 	uint8_t _reserved1[2];
743 	uint8_t sdlr_starting_phy_identifier;
744 	uint8_t sdlr_n_descrs;
745 	DECL_BITFIELD2(
746 	    sdlr_phy_filter		:4,
747 	    _reserved2			:4);
748 	DECL_BITFIELD2(
749 	    sdlr_descr_type		:4,
750 	    _reserved3			:4);
751 	uint8_t sdlr_descr_length;
752 	uint8_t _reserved4[3];
753 	DECL_BITFIELD5(
754 	    sdlr_externally_configurable_route_table	:1,
755 	    sdlr_configuring				:1,
756 	    _reserved5					:4,
757 	    sdlr_zoning_enabled				:1,
758 	    sdlr_zoning_supported			:1);
759 	uint8_t _reserved6;
760 	uint16_t sdlr_last_sc_status_descr_index;
761 	uint16_t sdlr_last_phy_event_list_descr_index;
762 	uint8_t _reserved7[10];
763 	uint8_t sdlr_vendor[16];
764 	uint8_t sdlr_descrs[1];	/* short or long format */
765 } smp_discover_list_resp_t;
766 
767 /*
768  * SAS-2 10.4.3.16 REPORT PHY EVENT LIST
769  */
770 typedef struct smp_report_phy_event_list_req {
771 	uint8_t _reserved1[2];
772 	uint16_t srpelr_starting_descr_index;
773 } smp_report_phy_event_list_req_t;
774 
775 typedef struct smp_phy_event_list_descr {
776 	uint8_t _reserved1[2];
777 	uint8_t speld_phy_identifier;
778 	uint8_t speld_phy_event_source;
779 	uint32_t speld_phy_event;
780 	uint32_t speld_peak_detector_threshold;
781 } smp_phy_event_list_descr_t;
782 
783 typedef struct smp_report_phy_event_list_resp {
784 	uint16_t srpelr_exp_change_count;
785 	uint16_t srpelr_starting_descr_index;
786 	uint16_t srpelr_last_descr_index;
787 	uint8_t srpelr_phy_event_list_descr_length;
788 	uint8_t _reserved1[3];
789 	uint8_t srpelr_n_descrs;
790 	smp_phy_event_list_descr_t srpelr_descrs[1];
791 } smp_report_phy_event_list_resp_t;
792 
793 /*
794  * SAS-2 10.4.3.17 REPORT EXPANDER ROUTE TABLE LIST
795  */
796 typedef struct smp_report_exp_route_table_list_req {
797 	uint8_t _reserved1[4];
798 	uint16_t srertlr_max_descrs;
799 	uint16_t srertlr_starting_routed_sas_addr_index;
800 	uint8_t _reserved2[7];
801 	uint8_t srertlr_starting_phy_identifier;
802 	uint8_t _reserved3[8];
803 } smp_report_exp_route_table_list_req_t;
804 
805 typedef struct smp_route_table_descr {
806 	uint64_t srtd_routed_sas_addr;
807 	uint8_t srtd_phy_bitmap[6];
808 	DECL_BITFIELD2(
809 	    _reserved1			:7,
810 	    srtd_zone_group_valid	:1);
811 	uint8_t srtd_zone_group;
812 } smp_route_table_descr_t;
813 
814 #define	SMP_ROUTE_PHY(_d, _s, _i)	\
815 	((_d)->srtd_phy_bitmap[(48 - (_i) + (_s)) >> 3] & \
816 	(1 << ((48 - (_i) + (_s)) & 7)))
817 
818 typedef struct smp_report_exp_route_table_list_resp {
819 	uint16_t srertlr_exp_change_count;
820 	uint16_t srertlr_route_table_change_count;
821 	DECL_BITFIELD3(
822 	    _reserved1		:1,
823 	    srertlr_configuring	:1,
824 	    _reserved2		:6);
825 	uint8_t _reserved3;
826 	uint16_t srertlr_n_descrs;
827 	uint16_t srertlr_first_routed_sas_addr_index;
828 	uint16_t srertlr_last_routed_sas_addr_index;
829 	uint8_t _reserved4[3];
830 	uint8_t srertlr_starting_phy_identifier;
831 	uint8_t _reserved5[12];
832 	smp_route_table_descr_t srertlr_descrs[1];
833 } smp_report_exp_route_table_list_resp_t;
834 
835 /*
836  * SAS-2 10.4.3.18 CONFIGURE GENERAL (no additional response)
837  */
838 typedef struct smp_config_general_req {
839 	uint16_t scgr_expected_exp_change_count;
840 	uint8_t _reserved1[2];
841 	DECL_BITFIELD6(
842 	    scgr_update_stp_bus_inactivity			:1,
843 	    scgr_update_stp_max_conn				:1,
844 	    scgr_update_stp_smp_nexus_loss			:1,
845 	    scgr_update_initial_time_to_reduced_functionality	:1,
846 	    scgr_update_stp_reject_to_open			:1,
847 	    _reserved2						:3);
848 	uint8_t _reserved3;
849 	uint16_t scgr_stp_bus_inactivity;
850 	uint16_t scgr_stp_max_conn;
851 	uint16_t scgr_stp_smp_nexus_loss;
852 	uint8_t scgr_initial_time_to_reduced_functionality;
853 	uint8_t _reserved4;
854 	uint16_t scgr_stp_reject_to_open;
855 } smp_config_general_req_t;
856 
857 /*
858  * SAS-2 10.4.3.19 ENABLE DISABLE ZONING (no additional response)
859  */
860 typedef struct smp_enable_disable_zoning_req {
861 	uint16_t sedzr_expected_exp_change_count;
862 	DECL_BITFIELD2(
863 	    sedzr_save	:2,		/* smp_zoning_save_t */
864 	    _reserved1	:6);
865 	uint8_t _reserved2;
866 	DECL_BITFIELD2(
867 	    sedzr_enable_disable_zoning	:2,
868 	    _reserved3			:6);
869 	uint8_t _reserved4[3];
870 } smp_enable_disable_zoning_req_t;
871 
872 typedef enum smp_zoning_save {
873 	SMP_ZONING_SAVE_CURRENT = 0x0,
874 	SMP_ZONING_SAVE_SAVED = 0x1,
875 	SMP_ZONING_SAVE_BOTH_IF_SUPP = 0x2,
876 	SMP_ZONING_SAVE_BOTH = 0x3
877 } smp_zoning_save_t;
878 
879 typedef enum smp_zoning_enable_op {
880 	SMP_ZONING_ENABLE_OP_NONE = 0x0,
881 	SMP_ZONING_ENABLE_OP_ENABLE = 0x1,
882 	SMP_ZONING_ENABLE_OP_DISABLE = 0x2
883 } smp_zoning_enable_op_t;
884 
885 /*
886  * SAS-2 10.4.3.20 ZONED BROADCAST (no additional response)
887  */
888 typedef struct smp_zoned_broadcast_req {
889 	uint8_t _restricted1[2];
890 	DECL_BITFIELD2(
891 	    szbr_broadcast_type	:4,
892 	    _reserved		:4);
893 	uint8_t szbr_n_broadcast_source_zone_groups;
894 	uint8_t szbr_broadcast_source_zone_groups[1];
895 } smp_zoned_broadcast_req_t;
896 
897 /*
898  * SAS-2 10.4.3.21 ZONE LOCK
899  */
900 typedef struct smp_zone_lock_req {
901 	uint16_t szlr_expected_exp_change_count;
902 	uint16_t szlr_zone_lock_inactivity_timeout;
903 	uint8_t szlr_zone_manager_password[32];
904 } smp_zone_lock_req_t;
905 
906 typedef struct smp_zone_lock_resp {
907 	uint8_t _reserved1[4];
908 	uint64_t szlr_active_zone_manager_sas_addr;
909 } smp_zone_lock_resp_t;
910 
911 /*
912  * SAS-2 10.4.3.22 ZONE ACTIVATE (no additional response)
913  */
914 typedef struct smp_zone_activate_req {
915 	uint16_t szar_expected_exp_change_count;
916 	uint8_t _reserved1[2];
917 } smp_zone_activate_req_t;
918 
919 /*
920  * SAS-2 10.4.3.23 ZONE UNLOCK (no additional response)
921  */
922 typedef struct smp_zone_unlock_req {
923 	uint8_t _restricted1[2];
924 	DECL_BITFIELD2(
925 	    szur_activate_required	:1,
926 	    _reserved1			:7);
927 	uint8_t _reserved2;
928 } smp_zone_unlock_req_t;
929 
930 /*
931  * SAS-2 10.4.3.24 CONFIGURE ZONE MANAGER PASSWORD (no additional response)
932  */
933 typedef struct smp_config_zone_manager_password_req {
934 	uint16_t sczmpr_expected_exp_change_count;
935 	DECL_BITFIELD2(
936 	    sczmpr_save		:2,		/* smp_zoning_save_t */
937 	    _reserved1		:6);
938 	uint8_t _reserved2;
939 	uint8_t sczmpr_zone_manager_password[32];
940 	uint8_t sczmpr_new_zone_manager_password[32];
941 } smp_config_zone_manager_password_req_t;
942 
943 /*
944  * SAS-2 10.4.3.25 CONFIGURE ZONE PHY INFORMATION (no additional response)
945  */
946 typedef struct smp_zone_phy_config_descr {
947 	uint8_t szpcd_phy_identifier;
948 	DECL_BITFIELD6(
949 	    _reserved1				:2,
950 	    szpcd_zone_group_persistent		:1,
951 	    _reserved2				:1,
952 	    szpcd_requested_inside_zpsds	:1,
953 	    szpcd_inside_zpsds_persistent	:1,
954 	    _reserved3				:2);
955 	uint8_t _reserved4;
956 	uint8_t szpcd_zone_group;
957 } smp_zone_phy_config_descr_t;
958 
959 typedef struct smp_config_zone_phy_info_req {
960 	uint16_t sczpir_expected_exp_change_count;
961 	DECL_BITFIELD2(
962 	    sczpir_save		:2,		/* smp_zoning_save_t */
963 	    _reserved1		:6);
964 	uint8_t sczpir_n_descrs;
965 	smp_zone_phy_config_descr_t sczpir_descrs[1];
966 } smp_config_zone_phy_info_req_t;
967 
968 /*
969  * SAS-2 10.4.3.26 CONFIGURE ZONE PERMISSION TABLE (no additional response)
970  */
971 typedef struct smp_config_zone_perm_table_req {
972 	uint16_t sczptr_expected_exp_change_count;
973 	uint8_t sczptr_starting_source_zone_group;
974 	uint8_t sczptr_n_descrs;
975 	DECL_BITFIELD3(
976 	    sczptr_save			:2,	/* smp_zoning_save_t */
977 	    _reserved1			:4,
978 	    sczptr_n_zone_groups	:2);	/* smp_n_zone_grps_t */
979 	uint8_t _reserved2[7];
980 	uint8_t sczptr_descrs[1];	/* smp_zone_perm_descrXXX_t */
981 } smp_config_zone_perm_table_req_t;
982 
983 /*
984  * SAS-2 10.4.3.27 CONFIGURE ROUTE INFORMATION (no additional response)
985  */
986 typedef struct smp_config_route_info_req {
987 	uint16_t scrir_expected_exp_change_count;
988 	uint16_t scrir_exp_route_index;
989 	uint8_t _reserved1;
990 	uint8_t scrir_phy_identifier;
991 	uint8_t _reserved2[2];
992 	DECL_BITFIELD2(
993 	    _reserved3				:7,
994 	    scrir_disable_exp_route_entry	:1);
995 	uint8_t _reserved4[3];
996 	uint64_t scrir_routed_sas_addr;
997 	uint8_t _reserved5[16];
998 } smp_config_route_info_req_t;
999 
1000 /*
1001  * SAS-2 10.4.3.28 PHY CONTROL (no additional response)
1002  */
1003 typedef struct smp_phy_control_req {
1004 	uint16_t spcr_expected_exp_change_count;
1005 	uint8_t _reserved1[3];
1006 	uint8_t spcr_phy_identifier;
1007 	uint8_t spcr_phy_operation;
1008 	DECL_BITFIELD2(
1009 	    spcr_update_partial_pwy_timeout	:1,
1010 	    _reserved2				:7);
1011 	uint8_t _reserved3[12];
1012 	uint64_t spcr_attached_device_name;
1013 	DECL_BITFIELD2(
1014 	    _reserved4				:4,
1015 	    spcr_prog_min_phys_link_rate	:4);	/* smp_link_rate_t */
1016 	DECL_BITFIELD2(
1017 	    _reserved5				:4,
1018 	    spcr_prog_max_phys_link_rate	:4);	/* smp_link_rate_t */
1019 	uint8_t _reserved6[2];
1020 	DECL_BITFIELD2(
1021 	    spcr_partial_pwy_timeout	:4,
1022 	    _reserved7			:4);
1023 	uint8_t _reserved8[3];
1024 } smp_phy_control_req_t;
1025 
1026 typedef enum smp_phy_op {
1027 	SMP_PHY_OP_NOP = 0x00,
1028 	SMP_PHY_OP_LINK_RESET = 0x01,
1029 	SMP_PHY_OP_HARD_RESET = 0x02,
1030 	SMP_PHY_OP_DISABLE = 0x03,
1031 	SMP_PHY_OP_CLEAR_ERROR_LOG = 0x05,
1032 	SMP_PHY_OP_CLEAR_AFFILIATION = 0x06,
1033 	SMP_PHY_OP_TRANSMIT_SATA_PORT_SELECTION_SIGNAL = 0x07,
1034 	SMP_PHY_OP_CLEAR_STP_NEXUS_LOSS = 0x08,
1035 	SMP_PHY_OP_SET_ATTACHED_DEVICE_NAME = 0x09
1036 } smp_phy_op_t;
1037 
1038 /*
1039  * SAS-2 10.4.3.29 PHY TEST FUNCTION (no additional response)
1040  */
1041 typedef struct smp_phy_test_function_req {
1042 	uint16_t sptfr_expected_exp_change_count;
1043 	uint8_t _reserved1[3];
1044 	uint8_t sptfr_phy_identifier;
1045 	uint8_t sptfr_phy_test_function;
1046 	uint8_t sptfr_phy_test_pattern;		/* smp_phy_test_function_t */
1047 	uint8_t _reserved2[3];
1048 	DECL_BITFIELD4(
1049 	    sptfr_test_pattern_phys_link_rate	:4,	/* smp_link_rate_t */
1050 	    sptfr_test_pattern_ssc		:2,
1051 	    sptfr_test_pattern_sata		:1,
1052 	    _reserved3				:1);
1053 	uint8_t _reserved4[3];
1054 	uint8_t sptfr_phy_test_pattern_dwords_ctl;
1055 	uint8_t sptfr_phy_test_pattern_dwords[8];
1056 	uint8_t _reserved5[12];
1057 } smp_phy_test_function_req_t;
1058 
1059 typedef enum smp_phy_test_function {
1060 	SMP_PHY_TEST_FN_STOP = 0x00,
1061 	SMP_PHY_TEST_FN_TRANSMIT_PATTERN = 0x01
1062 } smp_phy_test_function_t;
1063 
1064 /*
1065  * SAS-2 10.4.3.30 CONFIGURE PHY EVENT (no additional response)
1066  */
1067 typedef struct smp_phy_event_config_descr {
1068 	uint8_t _reserved1[3];
1069 	uint8_t specd_phy_event_source;
1070 	uint32_t specd_peak_value_detector_threshold;
1071 } smp_phy_event_config_descr_t;
1072 
1073 typedef struct smp_config_phy_event_req {
1074 	uint16_t scper_expected_exp_change_count;
1075 	DECL_BITFIELD2(
1076 	    scper_clear_peaks	:1,
1077 	    _reserved1		:7);
1078 	uint8_t _reserved2[2];
1079 	uint8_t scper_phy_identifier;
1080 	uint8_t _reserved3;
1081 	uint8_t scper_n_descrs;
1082 	smp_phy_event_config_descr_t scper_descrs[1];
1083 } smp_config_phy_event_req_t;
1084 
1085 #pragma	pack()
1086 
1087 #ifdef	__cplusplus
1088 }
1089 #endif
1090 
1091 #endif	/* _SYS_SCSI_GENERIC_SMP_FRAMES_H */
1092