xref: /illumos-gate/usr/src/lib/scsi/plugins/ses/SUN/common/sun_impl.h (revision ac88567a7a5bb7f01cf22cf366bc9d6203e24d7a)
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 (c) 2010, Oracle and/or its affiliates. All rights reserved.
24  */
25 
26 #ifndef	_PLUGIN_SUN_IMPL_H
27 #define	_PLUGIN_SUN_IMPL_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #include <sys/types.h>
34 #include <sys/sysmacros.h>
35 #include <sys/scsi/impl/uscsi.h>
36 #include <sys/scsi/generic/commands.h>
37 #include <sys/scsi/impl/spc3_types.h>
38 #include <sys/ccompile.h>
39 #include <stdarg.h>
40 #include <libnvpair.h>
41 
42 #include <scsi/libscsi.h>
43 #include <scsi/libses_plugin.h>
44 
45 #pragma	pack(1)
46 
47 /*
48  * SPMS-1 r111, section 4.2.4 - Configuration
49  * SPMS-1 r111, section 4.1.3.1, Table 8 - Sun Feature Definition
50  */
51 typedef struct sun_feature_block_impl {
52 	uint8_t		sfbi_spms_header[4];
53 	uint8_t		sfbi_spms_major_ver;
54 	uint8_t		_reserved1;
55 	uint16_t	sfbi_spms_revision;
56 	uint8_t		sfbi_chassis_id_off;
57 	uint8_t		sfbi_chassis_id_len;
58 	DECL_BITFIELD2(
59 	    sfbi_fw_upload_max_chunk_sz	:7,
60 	    sfbi_int			:1);
61 	uint8_t		sfbi_subchassis_index;
62 	uint8_t		_reserved2[48];
63 	uint8_t		sfbi_ps[1];	/* Flexible platform specific content */
64 } sun_feature_block_impl_t;
65 
66 /*
67  * SPMS-1 SUNW,FRUID FRU descriptor (Table 23, 4.2.18)
68  */
69 typedef struct sun_fru_descr_impl {
70 	DECL_BITFIELD2(
71 	    sfdi_fru	:1,
72 	    _reserved1	:7);
73 	uint8_t sfdi_parent_element_index;
74 	uint16_t sfdi_fru_data_length;
75 	uint8_t sfdi_fru_data[1];	/* FRUPROM contents */
76 } sun_fru_descr_impl_t;
77 
78 /*
79  * SPMS-1 SUNW,FRUID diagnostic page (Table 22, 4.2.18)
80  */
81 typedef struct sun_fruid_page_impl {
82 	uint8_t sfpi_page_code;
83 	uint8_t _reserved1;
84 	uint16_t sfpi_page_length;
85 	uint32_t sfpi_generation_code;
86 	uint16_t sfpi_descr_addrs[1];
87 } sun_fruid_page_impl_t;
88 
89 #pragma pack()
90 
91 extern ses_pagedesc_t sun_pages[];
92 
93 extern int sun_fill_element_node(ses_plugin_t *, ses_node_t *);
94 extern int sun_fill_enclosure_node(ses_plugin_t *, ses_node_t *);
95 extern int sun_fruid_parse_common(sun_fru_descr_impl_t *, nvlist_t *);
96 
97 #ifdef	__cplusplus
98 }
99 #endif
100 
101 #endif	/* _PLUGIN_SUN_IMPL_H */
102