From d9bcba3051777c64bc03dbaa7253edaccf467758 Mon Sep 17 00:00:00 2001 From: "han_tien@edge-core.com" Date: Fri, 19 Aug 2022 15:57:16 +0800 Subject: [PATCH] [xcvr_api_factory]Enhance the code in new sfp refinement to distinguish sff8436 and sff8636 Check page 0 offset 1 'revision compliance' according to table 6-3 in SFF8636 Revision2.10a Signed-off-by: han_tien@edge-core.com --- .../sonic_xcvr/xcvr_api_factory.py | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py b/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py index f206f3493..b6e2f5d3d 100644 --- a/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py +++ b/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py @@ -36,6 +36,12 @@ def _get_id(self): return None return id_byte_raw[0] + def _get_id1(self): + id_byte1_raw = self.reader(1,1) + if id_byte1_raw is None: + return None + return id_byte1_raw[0] + def create_xcvr_api(self): # TODO: load correct classes from id_mapping file id = self._get_id() @@ -58,10 +64,21 @@ def create_xcvr_api(self): api = Sff8636Api(xcvr_eeprom) # QSFP+ elif id == 0x0D: - codes = Sff8436Codes - mem_map = Sff8436MemMap(codes) - xcvr_eeprom = XcvrEeprom(self.reader, self.writer, mem_map) - api = Sff8436Api(xcvr_eeprom) + # Check page 0 offset 1 'revision compliance' according to table 6-3 in + # SFF-8636 Revision2.10a + id1 = self._get_id1() + if id1 >= 0 or id1 <= 0x02: + codes = Sff8436Codes + mem_map = Sff8436MemMap(codes) + xcvr_eeprom = XcvrEeprom(self.reader, self.writer, mem_map) + api = Sff8436Api(xcvr_eeprom) + elif id1 >= 0x03 and id1 <= 0x08: + codes = Sff8636Codes + mem_map = Sff8636MemMap(codes) + xcvr_eeprom = XcvrEeprom(self.reader, self.writer, mem_map) + api = Sff8636Api(xcvr_eeprom) + else: + api = None elif id == 0x03: codes = Sff8472Codes mem_map = Sff8472MemMap(codes)