1270287Smelifaro/*-
2270287Smelifaro * Copyright (c) 2014 Yandex LLC.
3270287Smelifaro *
4270287Smelifaro * All rights reserved.
5270287Smelifaro *
6270287Smelifaro * Redistribution and use in source and binary forms, with or without
7270287Smelifaro * modification, are permitted provided that the following conditions
8270287Smelifaro * are met:
9270287Smelifaro * 1. Redistributions of source code must retain the above copyright
10270287Smelifaro *    notice, this list of conditions and the following disclaimer.
11270287Smelifaro * 2. Redistributions in binary form must reproduce the above copyright
12270287Smelifaro *    notice, this list of conditions and the following disclaimer in the
13270287Smelifaro *    documentation and/or other materials provided with the distribution.
14270287Smelifaro *
15270287Smelifaro * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16270287Smelifaro * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17270287Smelifaro * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18270287Smelifaro * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19270287Smelifaro * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20270287Smelifaro * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21270287Smelifaro * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22270287Smelifaro * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23270287Smelifaro * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24270287Smelifaro * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25270287Smelifaro * SUCH DAMAGE.
26270287Smelifaro *
27270287Smelifaro * $FreeBSD$
28270287Smelifaro */
29270287Smelifaro
30270287Smelifaro/*
31270287Smelifaro * The following set of constants are from Document SFF-8436
32270287Smelifaro * "QSFP+ 10 Gbs 4X PLUGGABLE TRANSCEIVER" revision 4.8 dated October 31, 2013
33270287Smelifaro *
34270287Smelifaro * This SFF standard defines the following QSFP+ memory address module:
35270287Smelifaro *
36270287Smelifaro * 1) 256-byte addressable block and 128-byte pages
37270287Smelifaro * 2) Lower 128-bytes addresses always refer to the same page
38270287Smelifaro * 3) Upper address space may refer to different pages depending on
39270287Smelifaro *   "page select" byte value.
40270287Smelifaro *
41270287Smelifaro * Map description:
42270287Smelifaro *
43270287Smelifaro * Serial address 0xA02:
44270287Smelifaro *
45270287Smelifaro * Lower bits
46270287Smelifaro * 0-127   Monitoring data & page select byte
47270287Smelifaro * 128-255:
48270287Smelifaro *
49270287Smelifaro * Page 00:
50270287Smelifaro * 128-191 Base ID Fields
51270287Smelifaro * 191-223 Extended ID
52270287Smelifaro * 223-255 Vendor Specific ID
53270287Smelifaro *
54270287Smelifaro * Page 01 (optional):
55270287Smelifaro * 128-255 App-specific data
56270287Smelifaro *
57270287Smelifaro * Page 02 (optional):
58270287Smelifaro * 128-255 User EEPROM Data
59270287Smelifaro *
60270287Smelifaro * Page 03 (optional for Cable Assmeblies)
61270287Smelifaro * 128-223 Thresholds
62270287Smelifaro * 225-237 Vendor Specific
63270287Smelifaro * 238-253 Channel Controls/Monitor
64270287Smelifaro * 254-255 Reserverd
65270287Smelifaro *
66270287Smelifaro * All these values are read across an I2C (i squared C) bus.
67270287Smelifaro */
68270287Smelifaro
69270287Smelifaro#define	SFF_8436_BASE	0xA0	/* Base address for all requests */
70270287Smelifaro
71270287Smelifaro/* Table 17 - Lower Memory Map */
72270287Smelifaroenum {
73270287Smelifaro	SFF_8436_MID		= 0,	/* Copy of SFF_8436_ID field */
74270287Smelifaro	SFF_8436_STATUS		= 1,	/* 2-bytes status (Table 18) */
75270287Smelifaro	SFF_8436_INTR_START	= 3,	/* Interrupt flags (Tables 19-21) */
76270287Smelifaro	SFF_8436_INTR_END	= 21,
77270287Smelifaro	SFF_8436_MODMON_START	= 22,	/* Module monitors (Table 22 */
78270287Smelifaro	SFF_8436_TEMP		= 22,	/* Internally measured module temp */
79270287Smelifaro	SFF_8436_VCC		= 26,	/* Internally mesasure module
80270287Smelifaro					* supplied voltage */
81270287Smelifaro	SFF_8436_MODMON_END	= 33,
82270287Smelifaro	SFF_8436_CHMON_START	= 34,	/* Channel monitors (Table 23) */
83270287Smelifaro	SFF_8436_RX_CH1_MSB	= 34,	/* Internally measured RX input power */
84270287Smelifaro	SFF_8436_RX_CH1_LSB	= 35,	/* for channel 1 */
85270287Smelifaro	SFF_8436_RX_CH2_MSB	= 36,	/* Internally measured RX input power */
86270287Smelifaro	SFF_8436_RX_CH2_LSB	= 37,	/* for channel 2 */
87270287Smelifaro	SFF_8436_RX_CH3_MSB	= 38,	/* Internally measured RX input power */
88270287Smelifaro	SFF_8436_RX_CH3_LSB	= 39,	/* for channel 3 */
89270287Smelifaro	SFF_8436_RX_CH4_MSB	= 40,	/* Internally measured RX input power */
90270287Smelifaro	SFF_8436_RX_CH4_LSB	= 41,	/* for channel 4 */
91270287Smelifaro	SFF_8436_TX_CH1_MSB	= 42,	/* Internally measured TX bias */
92270287Smelifaro	SFF_8436_TX_CH1_LSB	= 43,	/* for channel 1 */
93270287Smelifaro	SFF_8436_TX_CH2_MSB	= 44,	/* Internally measured TX bias */
94270287Smelifaro	SFF_8436_TX_CH2_LSB	= 45,	/* for channel 2 */
95270287Smelifaro	SFF_8436_TX_CH3_MSB	= 46,	/* Internally measured TX bias */
96270287Smelifaro	SFF_8436_TX_CH3_LSB	= 47,	/* for channel 3 */
97270287Smelifaro	SFF_8436_TX_CH4_MSB	= 48,	/* Internally measured TX bias */
98270287Smelifaro	SFF_8436_TX_CH4_LSB	= 49,	/* for channel 4 */
99270287Smelifaro	SFF_8436_CHANMON_END	= 81,
100270287Smelifaro	SFF_8436_CONTROL_START	= 86,	/* Control (Table 24) */
101270287Smelifaro	SFF_8436_CONTROL_END	= 97,
102270287Smelifaro	SFF_8436_MASKS_START	= 100,	/* Module/channel masks (Table 25) */
103270287Smelifaro	SFF_8436_MASKS_END	= 106,
104270287Smelifaro	SFF_8436_CHPASSWORD	= 119,	/* Password change entry (4 bytes) */
105270287Smelifaro	SFF_8436_PASSWORD	= 123,	/* Password entry area (4 bytes) */
106270287Smelifaro	SFF_8436_PAGESEL	= 127,	/* Page select byte */
107270287Smelifaro};
108270287Smelifaro
109270287Smelifaro/* Table 18 - Status Indicators bits */
110270287Smelifaro/* Byte 1: all bits reserved */
111270287Smelifaro
112270287Smelifaro/* Byte 2 bits */
113270287Smelifaro#define	SFF_8436_STATUS_FLATMEM	(1 << 2)	/* Upper memory flat or paged
114270287Smelifaro						* 0 = paging, 1=Page 0 only */
115270287Smelifaro#define	SFF_8436_STATUS_INTL	(1 << 1)	/* Digital state of the intL
116270287Smelifaro						* Interrupt output pin */
117270287Smelifaro#define	SFF_8436_STATUS_NOTREADY 1		/* Module has not yet achieved
118270287Smelifaro						* power up and memory data is not
119270287Smelifaro						* ready. 0=data is ready */
120270287Smelifaro/*
121270287Smelifaro * Upper page 0 definitions:
122270287Smelifaro * Table 29 - Serial ID: Data fields.
123270287Smelifaro *
124270287Smelifaro * Note that this table is mostly the same as used in SFF-8472.
125270287Smelifaro * The only differenee is address shift: +128 bytes.
126270287Smelifaro */
127270287Smelifaroenum {
128270287Smelifaro	SFF_8436_ID		= 128,  /* Module Type (defined in sff8472.h) */
129270287Smelifaro	SFF_8436_EXT_ID		= 129,  /* Extended transceiver type
130270287Smelifaro					 * (Table 31) */
131270287Smelifaro	SFF_8436_CONNECTOR	= 130,  /* Connector type (Table 32) */
132270287Smelifaro	SFF_8436_TRANS_START	= 131,  /* Electric or Optical Compatibility
133270287Smelifaro					 * (Table 33) */
134294202Smelifaro	SFF_8436_CODE_E1040100G	= 131,	/* 10/40/100G Ethernet Compliance Code */
135270287Smelifaro	SFF_8436_CODE_SONET	= 132,	/* SONET Compliance codes */
136270287Smelifaro	SFF_8436_CODE_SATA	= 133,	/* SAS/SATA compliance codes */
137270287Smelifaro	SFF_8436_CODE_E1G	= 134,	/* Gigabit Ethernet Compliant codes */
138270287Smelifaro	SFF_8436_CODE_FC_START	= 135,	/* FC link/media/speed */
139270287Smelifaro	SFF_8436_CODE_FC_END	= 138,
140270287Smelifaro	SFF_8436_TRANS_END	= 138,
141270287Smelifaro	SFF_8436_ENCODING	= 139,	/* Encoding Code for high speed
142270287Smelifaro					* serial encoding algorithm (see
143270287Smelifaro					* Table 34) */
144270287Smelifaro	SFF_8436_BITRATE	= 140,	/* Nominal signaling rate, units
145270287Smelifaro					* of 100MBd. */
146270287Smelifaro	SFF_8436_RATEID		= 141,	/* Extended RateSelect Compliance
147270287Smelifaro					* (see Table 35) */
148270287Smelifaro	SFF_8436_LEN_SMF_KM	= 142,	/* Link length supported for single
149270287Smelifaro					* mode fiber, units of km */
150270287Smelifaro	SFF_8436_LEN_OM3	= 143,	/* Link length supported for 850nm
151270287Smelifaro					* 50um multimode fiber, units of 2 m */
152270287Smelifaro	SFF_8436_LEN_OM2	= 144, 	/* Link length supported for 50 um
153270287Smelifaro					* OM2 fiber, units of 1 m */
154270287Smelifaro	SFF_8436_LEN_OM1	= 145,	/* Link length supported for 1310 nm
155270287Smelifaro					 * 50um multi-mode fiber, units of 1m*/
156270287Smelifaro	SFF_8436_LEN_ASM	= 144, /* Link length of passive cable assembly
157270287Smelifaro					* Length is specified as in the INF
158270287Smelifaro					* 8074, units of 1m. 0 means this is
159270287Smelifaro					* not value assembly. Value of 255
160270287Smelifaro					* means thet the Module supports length
161270287Smelifaro					* greater than 254 m. */
162270287Smelifaro	SFF_8436_DEV_TECH	= 147,	/* Device/transmitter technology,
163270287Smelifaro					* see Table 36/37 */
164270287Smelifaro	SFF_8436_VENDOR_START	= 148,	/* Vendor name, 16 bytes, padded
165270287Smelifaro					* right with 0x20 */
166270287Smelifaro	SFF_8436_VENDOR_END	= 163,
167270287Smelifaro	SFF_8436_EXTMODCODE	= 164,	/* Extended module code, Table 164 */
168270287Smelifaro	SFF_8436_VENDOR_OUI_START	= 165 , /* Vendor OUI SFP vendor IEEE
169270287Smelifaro					* company ID */
170270287Smelifaro	SFF_8436_VENDOR_OUI_END	= 167,
171270287Smelifaro	SFF_8436_PN_START 	= 168,	/* Vendor PN, padded right with 0x20 */
172270287Smelifaro	SFF_8436_PN_END 	= 183,
173270287Smelifaro	SFF_8436_REV_START 	= 184,	/* Vendor Revision, padded right 0x20 */
174270287Smelifaro	SFF_8436_REV_END 	= 185,
175270287Smelifaro	SFF_8436_WAVELEN_START	= 186,	/* Wavelength Laser wavelength
176270287Smelifaro					* (Passive/Active Cable
177270287Smelifaro					* Specification Compliance) */
178270287Smelifaro	SFF_8436_WAVELEN_END	= 189,
179270287Smelifaro	SFF_8436_MAX_CASE_TEMP	= 190,	/* Allows to specify maximum temp
180270287Smelifaro					* above 70C. Maximum case temperature is
181270287Smelifaro					* an 8-bit value in Degrees C. A value
182270287Smelifaro					*of 0 implies the standard 70C rating.*/
183270287Smelifaro	SFF_8436_CC_BASE	= 191,	/* CC_BASE Check code for Base ID
184270287Smelifaro					* Fields (first 63 bytes) */
185270287Smelifaro	/* Extended ID fields */
186270287Smelifaro	SFF_8436_OPTIONS_START	= 192, /* Options Indicates which optional
187270287Smelifaro					* transceiver signals are
188270287Smelifaro					* implemented (see Table 39) */
189270287Smelifaro	SFF_8436_OPTIONS_END	= 195,
190270287Smelifaro	SFF_8436_SN_START 	= 196,	/* Vendor SN, riwght padded with 0x20 */
191270287Smelifaro	SFF_8436_SN_END 	= 211,
192270287Smelifaro	SFF_8436_DATE_START	= 212,	/* Vendor���s manufacturing date code
193270287Smelifaro					* (see Table 40) */
194270287Smelifaro	SFF_8436_DATE_END	= 219,
195270287Smelifaro	SFF_8436_DIAG_TYPE	= 220,	/* Diagnostic Monitoring Type
196270287Smelifaro					* Indicates which type of
197270287Smelifaro					* diagnostic monitoring is
198270287Smelifaro					* implemented (if any) in the
199270287Smelifaro					* transceiver (see Table 41) */
200270287Smelifaro
201270287Smelifaro	SFF_8436_ENHANCED	= 221,	/* Enhanced Options Indicates which
202270287Smelifaro					* optional features are implemented
203270287Smelifaro					* (if any) in the transceiver
204270287Smelifaro					* (see Table 42) */
205286810Smelifaro	SFF_8636_BITRATE	= 222,	/* Nominal bit rate per channel, units
206286810Smelifaro					* of 250 Mbps */
207286810Smelifaro	SFF_8436_CC_EXT		= 223,	/* Check code for the Extended ID
208270287Smelifaro					* Fields (bytes 192-222 incl) */
209270287Smelifaro	SFF_8436_VENDOR_RSRVD_START	= 224,
210270287Smelifaro	SFF_8436_VENDOR_RSRVD_END	= 255,
211270287Smelifaro};
212270287Smelifaro
213270287Smelifaro
214