xref: /titanic_50/usr/src/lib/libsff/common/sff.h (revision 59596c01ca1b980a016d25670874f53e64c27ec0)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright (c) 2017, Joyent, Inc.
14  */
15 
16 #ifndef _SFF_H
17 #define	_SFF_H
18 
19 /*
20  * Definitions internal to libsfp for various SFF versions. This generally
21  * contains offsets for each byte and its purpose. The meaning of the values are
22  * not generally found in this header.
23  */
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 /*
30  * This table is derived from SFF 8024 Section 4.1, Table 4-1.
31  */
32 typedef enum sff_8024_id {
33 	SFF_8024_ID_UNKNOWN	= 0x00,
34 	SFF_8024_ID_GBIC	= 0x01,
35 	SFF_8024_ID_SOLDERED	= 0x02,
36 	SFF_8024_ID_SFP		= 0x03, /* SFP, SFP+, SFP28 */
37 	SFF_8024_ID_XBI		= 0x04,
38 	SFF_8024_ID_XENPAK	= 0x05,
39 	SFF_8024_ID_XFP		= 0x06,
40 	SFF_8024_ID_XFF		= 0x07,
41 	SFF_8024_ID_XFP_E	= 0x08,
42 	SFF_8024_ID_XPAK	= 0x09,
43 	SFF_8024_ID_X2		= 0x0A,
44 	SFF_8024_ID_DWDM_SFP	= 0x0B,
45 	SFF_8024_ID_QSFP	= 0x0C,
46 	SFF_8024_ID_QSFP_PLUS	= 0x0D,
47 	SFF_8024_ID_CXP		= 0x0E,
48 	SFF_8024_ID_SMMHD4X	= 0x0F,
49 	SFF_8024_ID_SMMHD8X	= 0x10,
50 	SFF_8024_ID_QSFP28	= 0x11,
51 	SFF_8024_ID_CXP2	= 0x12,
52 	SFF_8024_ID_CDFP	= 0x13,
53 	SFF_8024_ID_SMMHD4XF	= 0x14,
54 	SFF_8024_ID_SMMHD8XF	= 0x15,
55 	SFF_8024_ID_CDFP3	= 0x16,
56 	SFF_8024_ID_MICROQSFP	= 0x17,
57 	SFF_8024_NIDS		= 0x18,
58 	SFF_8024_VENDOR		= 0x80
59 } sff_8024_id_t;
60 
61 
62 /*
63  * Byte offsets for SFF-8472. Note that most of this applies to INF-8074.
64  * Generally speaking, SFF-8472 is a backwards compatible evolution of INF-8074.
65  */
66 #define	SFF_8472_IDENTIFIER			0
67 #define	SFF_8472_EXT_IDENTIFER			1
68 #define	SFF_8472_CONNECTOR			2
69 
70 /*
71  * Note that several constants overlap here as the offset is used for multiple
72  * purposes.
73  */
74 #define	SFF_8472_COMPLIANCE_10GE		3
75 #define	SFF_8472_COMPLIANCE_IB			3
76 #define	SFF_8472_COMPLIANCE_ESCON		4
77 #define	SFF_8472_COMPLIANCE_SONET_LOW		4
78 #define	SFF_8472_COMPLIANCE_SONET_HIGH		5
79 #define	SFF_8472_COMPLIANCE_ETHERNET		6
80 #define	SFF_8472_COMPLIANCE_FCLEN		7
81 #define	SFF_8472_COMPLIANCE_FC_LOW		7
82 #define	SFF_8472_COMPLIANCE_FC_HIGH		8
83 #define	SFF_8472_COMPLIANCE_SFP			8
84 #define	SFF_8472_COMPLIANCE_FC_MEDIA		9
85 #define	SFF_8472_COMPLIANCE_FC_SPEED		10
86 
87 #define	SFF_8472_ENCODING			11
88 #define	SFF_8472_BR_NOMINAL			12
89 #define	SFF_8472_RATE_IDENTIFIER		13
90 #define	SFF_8472_LENGTH_SMF_KM			14
91 #define	SFF_8472_LENGTH_SMF			15
92 #define	SFF_8472_LENGTH_50UM			16
93 #define	SFF_8472_LENGTH_62UM			17
94 #define	SFF_8472_LENGTH_COPPER			18
95 #define	SFF_8472_LENGTH_OM3			19
96 
97 #define	SFF_8472_VENDOR				20
98 #define	SFF_8472_VENDOR_LEN			16
99 #define	SFF_8472_TRANSCEIVER			36
100 #define	SFF_8472_OUI				37
101 #define	SFF_8472_OUI_LEN			3
102 #define	SFF_8472_VENDOR_PN			40
103 #define	SFF_8472_VENDOR_PN_LEN			16
104 #define	SFF_8472_VENDOR_REV			56
105 #define	SFF_8472_VENDOR_REV_LEN			4
106 
107 #define	SFF_8472_PASSIVE_SPEC			60
108 #define	SFF_8472_ACTIVE_SPEC			60
109 #define	SFF_8472_WAVELENGTH_HI			60
110 #define	SFF_8472_WAVELENGTH_LOW			61
111 
112 #define	SFF_8472_CC_BASE			63
113 
114 #define	SFF_8472_OPTIONS_HI			64
115 #define	SFF_8472_OPTIONS_LOW			65
116 #define	SFF_8472_BR_MAX				66
117 #define	SFF_8472_BR_MIN				67
118 #define	SFF_8472_VENDOR_SN			68
119 #define	SFF_8472_VENDOR_SN_LEN			16
120 #define	SFF_8472_DATE_CODE			84
121 #define	SFF_8472_DATE_CODE_LEN			8
122 #define	SFF_8472_DIAG_MONITORING		92
123 #define	SFF_8472_ENHANCED_OPTIONS		93
124 #define	SFF_8472_SFF_8472_COMPLIANCE		94
125 
126 #define	SFF_8472_CC_EXT				95
127 #define	SFF_8472_VENDOR_SPECIFIC		96
128 #define	SFF_8472_RESERVED			128
129 
130 /*
131  * These values are factors by which we should multiple or divide various units.
132  */
133 #define	SFF_8472_BR_NOMINAL_FACTOR		100
134 #define	SFF_8472_BR_MAX_FACTOR			250
135 #define	SFF_8472_BR_MIN_FACTOR			250
136 #define	SFF_8472_LENGTH_SMF_KM_FACTOR		1
137 #define	SFF_8472_LENGTH_SMF_FACTOR		100
138 #define	SFF_8472_LENGTH_50UM_FACTOR		10
139 #define	SFF_8472_LENGTH_62UM_FACTOR		10
140 #define	SFF_8472_LENGTH_COPPER_FACTOR		1
141 #define	SFF_8472_LENGTH_OM3_FACTOR		10
142 #define	SFF_8472_WAVELENGTH_FACTOR		1
143 
144 
145 /*
146  * SFF 8636 related constants
147  */
148 #define	SFF_8636_IDENTIFIER			0
149 #define	SFF_8636_EXT_IDENTIFIER			129
150 #define	SFF_8636_CONNECTOR			130
151 
152 #define	SFF_8636_COMPLIANCE_10GBEP		131
153 #define	SFF_8636_COMPLIANCE_SONET		132
154 #define	SFF_8636_COMPLIANCE_SAS			133
155 #define	SFF_8636_COMPLIANCE_ETHERNET		134
156 #define	SFF_8636_COMPLIANCE_FCLEN		135
157 #define	SFF_8636_COMPLIANCE_FC_LOW		135
158 #define	SFF_8636_COMPLIANCE_FC_HIGH		136
159 #define	SFF_8636_COMPLIANCE_FC_MEDIA		137
160 #define	SFF_8636_COMPLIANCE_FC_SPEED		138
161 
162 #define	SFF_8636_ENCODING			139
163 #define	SFF_8636_BR_NOMINAL			140
164 #define	SFF_8636_BR_EXT_RATE_SELECT		141
165 #define	SFF_8636_LENGTH_SMF			142
166 #define	SFF_8636_LENGTH_OM3			143
167 #define	SFF_8636_LENGTH_OM2			144
168 #define	SFF_8636_LENGTH_OM1			145
169 #define	SFF_8636_LENGTH_COPPER			146
170 #define	SFF_8636_DEVICE_TECH			147
171 #define	SFF_8636_VENDOR				148
172 #define	SFF_8636_VENDOR_LEN			16
173 #define	SFF_8636_EXTENDED_MODULE		164
174 #define	SFF_8636_OUI				165
175 #define	SFF_8636_OUI_LEN			3
176 #define	SFF_8636_VENDOR_PN			168
177 #define	SFF_8636_VENDOR_PN_LEN			16
178 #define	SFF_8636_VENDOR_REV			184
179 #define	SFF_8636_VENDOR_REV_LEN			2
180 
181 #define	SFF_8636_ATTENUATE_2G			186
182 #define	SFF_8636_ATTENUATE_5G			187
183 #define	SFF_8636_ATTENUATE_7G			188
184 #define	SFF_8636_ATTENUATE_12G			189
185 #define	SFF_8636_WAVELENGTH_NOMINAL_HI		186
186 #define	SFF_8636_WAVELENGTH_NOMINAL_LOW		187
187 #define	SFF_8636_WAVELENGTH_TOLERANCE_HI	188
188 #define	SFF_8636_WAVELENGTH_TOLERANCE_LOW	189
189 #define	SFF_8636_MAX_CASE_TEMP			190
190 #define	SFF_8636_CC_BASE			191
191 
192 #define	SFF_8636_LINK_CODES			192
193 #define	SFF_8636_OPTIONS_HI			193
194 #define	SFF_8636_OPTIONS_MID			194
195 #define	SFF_8636_OPTIONS_LOW			195
196 #define	SFF_8636_VENDOR_SN			196
197 #define	SFF_8636_VENDOR_SN_LEN			16
198 #define	SFF_8636_DATE_CODE			212
199 #define	SFF_8636_DATE_CODE_LEN			8
200 #define	SFF_8636_DIAG_MONITORING		220
201 #define	SFF_8636_ENHANCED_OPTIONS		221
202 #define	SFF_8636_BR_NOMINAL_EXT			222
203 #define	SFF_8636_CC_EXT				223
204 #define	SFF_866_VENDOR_SPECIFIC			224
205 
206 /*
207  * SFF 8636 multiplication factors
208  */
209 #define	SFF_8636_BR_NOMINAL_FACTOR		100
210 #define	SFF_8636_BR_NOMINAL_EXT_FACTOR		250
211 #define	SFF_8636_LENGTH_SMF_FACTOR		1
212 #define	SFF_8636_LENGTH_OM3_FACTOR		2
213 #define	SFF_8636_LENGTH_OM2_FACTOR		1
214 #define	SFF_8636_LENGTH_OM1_FACTOR		1
215 #define	SFF_8636_LENGTH_COPPER_FACTOR		1
216 
217 #ifdef __cplusplus
218 }
219 #endif
220 
221 #endif /* _SFF_H */
222