xref: /freebsd/sys/net/sff8436.h (revision fe6060f10f634930ff71b7c50291ddc610da2475)
1 /*-
2  * Copyright (c) 2014 Yandex LLC.
3  *
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  * $FreeBSD$
28  */
29 
30 /*
31  * The following set of constants are from Document SFF-8436
32  * "QSFP+ 10 Gbs 4X PLUGGABLE TRANSCEIVER" revision 4.8 dated October 31, 2013
33  *
34  * This SFF standard defines the following QSFP+ memory address module:
35  *
36  * 1) 256-byte addressable block and 128-byte pages
37  * 2) Lower 128-bytes addresses always refer to the same page
38  * 3) Upper address space may refer to different pages depending on
39  *   "page select" byte value.
40  *
41  * Map description:
42  *
43  * Serial address 0xA02:
44  *
45  * Lower bits
46  * 0-127   Monitoring data & page select byte
47  * 128-255:
48  *
49  * Page 00:
50  * 128-191 Base ID Fields
51  * 191-223 Extended ID
52  * 223-255 Vendor Specific ID
53  *
54  * Page 01 (optional):
55  * 128-255 App-specific data
56  *
57  * Page 02 (optional):
58  * 128-255 User EEPROM Data
59  *
60  * Page 03 (optional for Cable Assmeblies)
61  * 128-223 Thresholds
62  * 225-237 Vendor Specific
63  * 238-253 Channel Controls/Monitor
64  * 254-255 Reserverd
65  *
66  * All these values are read across an I2C (i squared C) bus.
67  */
68 
69 #define	SFF_8436_BASE	0xA0	/* Base address for all requests */
70 
71 /* Table 17 - Lower Memory Map */
72 enum {
73 	SFF_8436_MID		= 0,	/* Copy of SFF_8436_ID field */
74 	SFF_8436_STATUS		= 1,	/* 2-bytes status (Table 18) */
75 	SFF_8436_INTR_START	= 3,	/* Interrupt flags (Tables 19-21) */
76 	SFF_8436_INTR_END	= 21,
77 	SFF_8436_MODMON_START	= 22,	/* Module monitors (Table 22 */
78 	SFF_8436_TEMP		= 22,	/* Internally measured module temp */
79 	SFF_8436_VCC		= 26,	/* Internally mesasure module
80 					* supplied voltage */
81 	SFF_8436_MODMON_END	= 33,
82 	SFF_8436_CHMON_START	= 34,	/* Channel monitors (Table 23) */
83 	SFF_8436_RX_CH1_MSB	= 34,	/* Internally measured RX input power */
84 	SFF_8436_RX_CH1_LSB	= 35,	/* for channel 1 */
85 	SFF_8436_RX_CH2_MSB	= 36,	/* Internally measured RX input power */
86 	SFF_8436_RX_CH2_LSB	= 37,	/* for channel 2 */
87 	SFF_8436_RX_CH3_MSB	= 38,	/* Internally measured RX input power */
88 	SFF_8436_RX_CH3_LSB	= 39,	/* for channel 3 */
89 	SFF_8436_RX_CH4_MSB	= 40,	/* Internally measured RX input power */
90 	SFF_8436_RX_CH4_LSB	= 41,	/* for channel 4 */
91 	SFF_8436_TX_CH1_MSB	= 42,	/* Internally measured TX bias */
92 	SFF_8436_TX_CH1_LSB	= 43,	/* for channel 1 */
93 	SFF_8436_TX_CH2_MSB	= 44,	/* Internally measured TX bias */
94 	SFF_8436_TX_CH2_LSB	= 45,	/* for channel 2 */
95 	SFF_8436_TX_CH3_MSB	= 46,	/* Internally measured TX bias */
96 	SFF_8436_TX_CH3_LSB	= 47,	/* for channel 3 */
97 	SFF_8436_TX_CH4_MSB	= 48,	/* Internally measured TX bias */
98 	SFF_8436_TX_CH4_LSB	= 49,	/* for channel 4 */
99 	SFF_8436_CHANMON_END	= 81,
100 	SFF_8436_CONTROL_START	= 86,	/* Control (Table 24) */
101 	SFF_8436_CONTROL_END	= 97,
102 	SFF_8436_MASKS_START	= 100,	/* Module/channel masks (Table 25) */
103 	SFF_8436_MASKS_END	= 106,
104 	SFF_8436_CHPASSWORD	= 119,	/* Password change entry (4 bytes) */
105 	SFF_8436_PASSWORD	= 123,	/* Password entry area (4 bytes) */
106 	SFF_8436_PAGESEL	= 127,	/* Page select byte */
107 };
108 
109 /* Table 18 - Status Indicators bits */
110 /* Byte 1: all bits reserved */
111 
112 /* Byte 2 bits */
113 #define	SFF_8436_STATUS_FLATMEM	(1 << 2)	/* Upper memory flat or paged
114 						* 0 = paging, 1=Page 0 only */
115 #define	SFF_8436_STATUS_INTL	(1 << 1)	/* Digital state of the intL
116 						* Interrupt output pin */
117 #define	SFF_8436_STATUS_NOTREADY 1		/* Module has not yet achieved
118 						* power up and memory data is not
119 						* ready. 0=data is ready */
120 /*
121  * Upper page 0 definitions:
122  * Table 29 - Serial ID: Data fields.
123  *
124  * Note that this table is mostly the same as used in SFF-8472.
125  * The only differenee is address shift: +128 bytes.
126  */
127 enum {
128 	SFF_8436_ID		= 128,  /* Module Type (defined in sff8472.h) */
129 	SFF_8436_EXT_ID		= 129,  /* Extended transceiver type
130 					 * (Table 31) */
131 	SFF_8436_CONNECTOR	= 130,  /* Connector type (Table 32) */
132 	SFF_8436_TRANS_START	= 131,  /* Electric or Optical Compatibility
133 					 * (Table 33) */
134 	SFF_8436_CODE_E1040100G	= 131,	/* 10/40/100G Ethernet Compliance Code */
135 	SFF_8436_CODE_SONET	= 132,	/* SONET Compliance codes */
136 	SFF_8436_CODE_SATA	= 133,	/* SAS/SATA compliance codes */
137 	SFF_8436_CODE_E1G	= 134,	/* Gigabit Ethernet Compliant codes */
138 	SFF_8436_CODE_FC_START	= 135,	/* FC link/media/speed */
139 	SFF_8436_CODE_FC_END	= 138,
140 	SFF_8436_TRANS_END	= 138,
141 	SFF_8436_ENCODING	= 139,	/* Encoding Code for high speed
142 					* serial encoding algorithm (see
143 					* Table 34) */
144 	SFF_8436_BITRATE	= 140,	/* Nominal signaling rate, units
145 					* of 100MBd. */
146 	SFF_8436_RATEID		= 141,	/* Extended RateSelect Compliance
147 					* (see Table 35) */
148 	SFF_8436_LEN_SMF_KM	= 142,	/* Link length supported for single
149 					* mode fiber, units of km */
150 	SFF_8436_LEN_OM3	= 143,	/* Link length supported for 850nm
151 					* 50um multimode fiber, units of 2 m */
152 	SFF_8436_LEN_OM2	= 144, 	/* Link length supported for 50 um
153 					* OM2 fiber, units of 1 m */
154 	SFF_8436_LEN_OM1	= 145,	/* Link length supported for 1310 nm
155 					 * 50um multi-mode fiber, units of 1m*/
156 	SFF_8436_LEN_ASM	= 144, /* Link length of passive cable assembly
157 					* Length is specified as in the INF
158 					* 8074, units of 1m. 0 means this is
159 					* not value assembly. Value of 255
160 					* means thet the Module supports length
161 					* greater than 254 m. */
162 	SFF_8436_DEV_TECH	= 147,	/* Device/transmitter technology,
163 					* see Table 36/37 */
164 	SFF_8436_VENDOR_START	= 148,	/* Vendor name, 16 bytes, padded
165 					* right with 0x20 */
166 	SFF_8436_VENDOR_END	= 163,
167 	SFF_8436_EXTMODCODE	= 164,	/* Extended module code, Table 164 */
168 	SFF_8436_VENDOR_OUI_START	= 165 , /* Vendor OUI SFP vendor IEEE
169 					* company ID */
170 	SFF_8436_VENDOR_OUI_END	= 167,
171 	SFF_8436_PN_START 	= 168,	/* Vendor PN, padded right with 0x20 */
172 	SFF_8436_PN_END 	= 183,
173 	SFF_8436_REV_START 	= 184,	/* Vendor Revision, padded right 0x20 */
174 	SFF_8436_REV_END 	= 185,
175 	SFF_8436_WAVELEN_START	= 186,	/* Wavelength Laser wavelength
176 					* (Passive/Active Cable
177 					* Specification Compliance) */
178 	SFF_8436_WAVELEN_END	= 189,
179 	SFF_8436_MAX_CASE_TEMP	= 190,	/* Allows to specify maximum temp
180 					* above 70C. Maximum case temperature is
181 					* an 8-bit value in Degrees C. A value
182 					*of 0 implies the standard 70C rating.*/
183 	SFF_8436_CC_BASE	= 191,	/* CC_BASE Check code for Base ID
184 					* Fields (first 63 bytes) */
185 	/* Extended ID fields */
186 	SFF_8436_OPTIONS_START	= 192, /* Options Indicates which optional
187 					* transceiver signals are
188 					* implemented (see Table 39) */
189 	SFF_8436_OPTIONS_END	= 195,
190 	SFF_8436_SN_START 	= 196,	/* Vendor SN, riwght padded with 0x20 */
191 	SFF_8436_SN_END 	= 211,
192 	SFF_8436_DATE_START	= 212,	/* Vendor’s manufacturing date code
193 					* (see Table 40) */
194 	SFF_8436_DATE_END	= 219,
195 	SFF_8436_DIAG_TYPE	= 220,	/* Diagnostic Monitoring Type
196 					* Indicates which type of
197 					* diagnostic monitoring is
198 					* implemented (if any) in the
199 					* transceiver (see Table 41) */
200 
201 	SFF_8436_ENHANCED	= 221,	/* Enhanced Options Indicates which
202 					* optional features are implemented
203 					* (if any) in the transceiver
204 					* (see Table 42) */
205 	SFF_8636_BITRATE	= 222,	/* Nominal bit rate per channel, units
206 					* of 250 Mbps */
207 	SFF_8436_CC_EXT		= 223,	/* Check code for the Extended ID
208 					* Fields (bytes 192-222 incl) */
209 	SFF_8436_VENDOR_RSRVD_START	= 224,
210 	SFF_8436_VENDOR_RSRVD_END	= 255,
211 };
212