xref: /titanic_50/usr/src/lib/libsff/common/libsff.h (revision 53548f91e84cd97a638c23b5b295cc69089a5030)
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 _LIBSFF_H
17 #define	_LIBSFF_H
18 
19 /*
20  * Parse SFF structures and values and return an nvlist_t of keys. This library
21  * is private and subject to change and break compat at any time.
22  */
23 
24 #include <libnvpair.h>
25 #include <stdint.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 extern int libsff_parse(const uint8_t *, size_t, uint_t, nvlist_t **);
32 
33 /*
34  * Supported Keys in the resulting nvlist. Not every key will be present in
35  * every SFF compatible device.
36  */
37 #define	LIBSFF_KEY_IDENTIFIER	"Identifier"		/* String */
38 #define	LIBSFF_KEY_CONNECTOR	"Connector"		/* String */
39 #define	LIBSFF_KEY_ENCODING	"Encoding"		/* String */
40 #define	LIBSFF_KEY_VENDOR	"Vendor"		/* String */
41 #define	LIBSFF_KEY_OUI		"OUI"			/* Byte Array [3] */
42 #define	LIBSFF_KEY_PART		"Part Number"		/* String */
43 #define	LIBSFF_KEY_REVISION	"Revision"		/* String */
44 #define	LIBSFF_KEY_SERIAL	"Serial Number"		/* String */
45 #define	LIBSFF_KEY_DATECODE	"Date Code"		/* String */
46 #define	LIBSFF_KEY_BR_NOMINAL	"BR, nominal"		/* String */
47 #define	LIBSFF_KEY_BR_MAX	"BR, maximum"		/* String */
48 #define	LIBSFF_KEY_BR_MIN	"BR, minimum"		/* String */
49 #define	LIBSFF_KEY_LENGTH_SMF_KM "Length SMF (km)"	/* String */
50 #define	LIBSFF_KEY_LENGTH_SMF	"Length SMF (m)"	/* String */
51 #define	LIBSFF_KEY_LENGTH_OM2	"Length 50um OM2"	/* String */
52 #define	LIBSFF_KEY_LENGTH_OM1	"Length 62.5um OM1"	/* String */
53 #define	LIBSFF_KEY_LENGTH_COPPER "Length Copper"	/* String */
54 #define	LIBSFF_KEY_LENGTH_OM3	"Length OM3"		/* String */
55 #define	LIBSFF_KEY_WAVELENGTH	"Laser Wavelength"	/* String */
56 #define	LIBSFF_KEY_WAVE_TOLERANCE "Wavelength Tolerance" /* String */
57 #define	LIBSFF_KEY_OPTIONS	"Options"		/* String Array */
58 #define	LIBSFF_KEY_COMPLIANCE_8472 "8472 Compliance"	/* String */
59 #define	LIBSFF_KEY_EXTENDED_OPTIONS "Extended Options"	/* String Array */
60 #define	LIBSFF_KEY_ENHANCED_OPTIONS "Enhanced Options"	/* String Array */
61 #define	LIBSFF_KEY_EXT_MOD_CODES "Extended Module Codes" /* String Array */
62 #define	LIBSFF_KEY_DIAG_MONITOR	"Diagnostic Monitoring"	/* String */
63 #define	LIBSFF_KEY_EXT_SPEC	"Extended Specification" /* String */
64 #define	LIBSFF_KEY_MAX_CASE_TEMP "Maximum Case Temperature" /* String */
65 #define	LIBSFF_KEY_ATTENUATE_2G	"Cable Attenuation at 2.5 GHz"	/* String */
66 #define	LIBSFF_KEY_ATTENUATE_5G	"Cable Attenuation at 5.0 GHz"	/* String */
67 #define	LIBSFF_KEY_ATTENUATE_7G	"Cable Attenuation at 7.0 GHz"	/* String */
68 #define	LIBSFF_KEY_ATTENUATE_12G "Cable Attenuation at 12.9 GHz" /* String */
69 #define	LIBSFF_KEY_TRAN_TECH	"Transmitter Technology"	/* String */
70 
71 /*
72  * Note, different revisions of the SFF standard have different compliance
73  * values available. We try to use a common set of compliance keys when
74  * possible, even if the values will be different. All entries here are String
75  * Arrays.
76  */
77 #define	LIBSFF_KEY_COMPLIANCE_10GBE	"10G+ Ethernet Compliance Codes"
78 #define	LIBSFF_KEY_COMPLIANCE_IB	"Infiniband Compliance Codes"
79 #define	LIBSFF_KEY_COMPLIANCE_ESCON	"ESCON Compliance Codes"
80 #define	LIBSFF_KEY_COMPLIANCE_SONET	"SONET Compliance Codes"
81 #define	LIBSFF_KEY_COMPLIANCE_GBE	"Ethernet Compliance Codes"
82 #define	LIBSFF_KEY_COMPLIANCE_FC_LEN	"Fibre Channel Link Lengths"
83 #define	LIBSFF_KEY_COMPLIANCE_FC_TECH	"Fibre Channel Technology"
84 #define	LIBSFF_KEY_COMPLIANCE_SFP	"SFP+ Cable Technology"
85 #define	LIBSFF_KEY_COMPLIANCE_FC_MEDIA	"Fibre Channel Transmission Media"
86 #define	LIBSFF_KEY_COMPLIANCE_FC_SPEED	"Fibre Channel Speed"
87 #define	LIBSFF_KEY_COMPLIANCE_SAS	"SAS Compliance Codes"
88 #define	LIBSFF_KEY_COMPLIANCE_ACTIVE	"Active Cable Specification Compliance"
89 #define	LIBSFF_KEY_COMPLIANCE_PASSIVE	"Passive Cable Specification Compliance"
90 
91 
92 /*
93  * The following keys have meaning that varies based on the standard.
94  */
95 #define	LIBSFF_KEY_8472_EXT_IDENTIFIER	"Extended Identifier"	/* uint8_t */
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif /* _LIBSFF_H */
102