diff --git a/device/quanta/x86_64-quanta_ix7_bwde-r0/media_settings.json b/device/quanta/x86_64-quanta_ix7_bwde-r0/media_settings.json new file mode 100644 index 0000000000..0ea47167be --- /dev/null +++ b/device/quanta/x86_64-quanta_ix7_bwde-r0/media_settings.json @@ -0,0 +1,254 @@ +{ + "GLOBAL_MEDIA_SETTINGS": { + "1-1": { + "Default": { + "preemphasis": { + "lane0": "0x114D06", + "lane1": "0x0F4F06", + "lane2": "0x0F4F06", + "lane3": "0x104E06" + } + } + }, + "2,4": { + "Default": { + "preemphasis": { + "lane0": "0x104E06", + "lane1": "0x104E06", + "lane2": "0x114D06", + "lane3": "0x104E06" + } + } + }, + "3-3": { + "Default": { + "preemphasis": { + "lane0": "0x104E06", + "lane1": "0x104E06", + "lane2": "0x104E06", + "lane3": "0x104E06" + } + } + }, + "5-5": { + "Default": { + "preemphasis": { + "lane0": "0x104E06", + "lane1": "0x114D06", + "lane2": "0x0F4F06", + "lane3": "0x114D06" + } + } + }, + "6-6": { + "Default": { + "preemphasis": { + "lane0": "0x0F4F06", + "lane1": "0x0F4F06", + "lane2": "0x104E06", + "lane3": "0x114D06" + } + } + }, + "7-7": { + "Default": { + "preemphasis": { + "lane0": "0x0F4F06", + "lane1": "0x0F4F06", + "lane2": "0x0D5106", + "lane3": "0x0F4F06" + } + } + }, + "8-8": { + "Default": { + "preemphasis": { + "lane0": "0x0D5106", + "lane1": "0x0D5106", + "lane2": "0x0D5106", + "lane3": "0x0E5006" + } + } + }, + "9,23": { + "Default": { + "preemphasis": { + "lane0": "0x0C5206", + "lane1": "0x0C5206", + "lane2": "0x0C5206", + "lane3": "0x0C5206" + } + } + }, + "10-10": { + "Default": { + "preemphasis": { + "lane0": "0x0A5406", + "lane1": "0x0C5206", + "lane2": "0x0A5406", + "lane3": "0x0C5206" + } + } + }, + "11,13": { + "Default": { + "preemphasis": { + "lane0": "0x0A5406", + "lane1": "0x0B5306", + "lane2": "0x0A5406", + "lane3": "0x0B5306" + } + } + }, + "12,14": { + "Default": { + "preemphasis": { + "lane0": "0x0A5406", + "lane1": "0x0B5306", + "lane2": "0x0A5406", + "lane3": "0x0A5406" + } + } + }, + "15,17": { + "Default": { + "preemphasis": { + "lane0": "0x095506", + "lane1": "0x095506", + "lane2": "0x095506", + "lane3": "0x095506" + } + } + }, + "16-16": { + "Default": { + "preemphasis": { + "lane0": "0x0A5406", + "lane1": "0x0A5406", + "lane2": "0x0A5406", + "lane3": "0x095506" + } + } + }, + "18,19": { + "Default": { + "preemphasis": { + "lane0": "0x0A5406", + "lane1": "0x0A5406", + "lane2": "0x0A5406", + "lane3": "0x0A5406" + } + } + }, + "20-20": { + "Default": { + "preemphasis": { + "lane0": "0x0B5306", + "lane1": "0x0C5206", + "lane2": "0x0A5406", + "lane3": "0x0C5206" + } + } + }, + "21-21": { + "Default": { + "preemphasis": { + "lane0": "0x0B5306", + "lane1": "0x0B5306", + "lane2": "0x0B5306", + "lane3": "0x0B5306" + } + } + }, + "22-22": { + "Default": { + "preemphasis": { + "lane0": "0x0B5306", + "lane1": "0x0C5206", + "lane2": "0x0A5406", + "lane3": "0x0A5406" + } + } + }, + "24-24": { + "Default": { + "preemphasis": { + "lane0": "0x0C5206", + "lane1": "0x0C5206", + "lane2": "0x0B5306", + "lane3": "0x0C5206" + } + } + }, + "25-25": { + "Default": { + "preemphasis": { + "lane0": "0x0E5006", + "lane1": "0x0D5106", + "lane2": "0x0D5106", + "lane3": "0x0D5106" + } + } + }, + "26-26": { + "Default": { + "preemphasis": { + "lane0": "0x0E5006", + "lane1": "0x0E5006", + "lane2": "0x0D5106", + "lane3": "0x0E5006" + } + } + }, + "27-27": { + "Default": { + "preemphasis": { + "lane0": "0x0F4F06", + "lane1": "0x114D06", + "lane2": "0x104E06", + "lane3": "0x114D06" + } + } + }, + "28,31": { + "Default": { + "preemphasis": { + "lane0": "0x104E06", + "lane1": "0x114D06", + "lane2": "0x104E06", + "lane3": "0x114D06" + } + } + }, + "29-29": { + "Default": { + "preemphasis": { + "lane0": "0x0F4F06", + "lane1": "0x104E06", + "lane2": "0x104E06", + "lane3": "0x104E06" + } + } + }, + "30-30": { + "Default": { + "preemphasis": { + "lane0": "0x114D06", + "lane1": "0x114D06", + "lane2": "0x114D06", + "lane3": "0x114D06" + } + } + }, + "32-32": { + "Default": { + "preemphasis": { + "lane0": "0x104E06", + "lane1": "0x104E06", + "lane2": "0x114D06", + "lane3": "0x114D06" + } + } + } + } +} diff --git a/device/quanta/x86_64-quanta_ix7_bwde-r0/preemphasis-32x100G.soc b/device/quanta/x86_64-quanta_ix7_bwde-r0/preemphasis-32x100G.soc index 986bb271ca..f092f6c29a 100644 --- a/device/quanta/x86_64-quanta_ix7_bwde-r0/preemphasis-32x100G.soc +++ b/device/quanta/x86_64-quanta_ix7_bwde-r0/preemphasis-32x100G.soc @@ -1,546 +1,545 @@ # Pre-emphasis phy raw c45 0xa5 0x1 0xffde 0 -phy raw c45 0xa5 0x1 0xd130 0x4d -phy raw c45 0xa5 0x1 0xd131 0x0611 +phy raw c45 0xa5 0x1 0xd130 0x4D +phy raw c45 0xa5 0x1 0xd131 0x611 phy raw c45 0xa5 0x1 0xd134 1 phy raw c45 0xa5 0x1 0xffde 1 -phy raw c45 0xa5 0x1 0xd130 0x4d -phy raw c45 0xa5 0x1 0xd131 0x0611 +phy raw c45 0xa5 0x1 0xd130 0x4F +phy raw c45 0xa5 0x1 0xd131 0x60F phy raw c45 0xa5 0x1 0xd134 1 phy raw c45 0xa5 0x1 0xffde 2 -phy raw c45 0xa5 0x1 0xd130 0x4e -phy raw c45 0xa5 0x1 0xd131 0x0610 +phy raw c45 0xa5 0x1 0xd130 0x4F +phy raw c45 0xa5 0x1 0xd131 0x60F phy raw c45 0xa5 0x1 0xd134 1 phy raw c45 0xa5 0x1 0xffde 3 -phy raw c45 0xa5 0x1 0xd130 0x4e -phy raw c45 0xa5 0x1 0xd131 0x0610 +phy raw c45 0xa5 0x1 0xd130 0x4E +phy raw c45 0xa5 0x1 0xd131 0x610 phy raw c45 0xa5 0x1 0xd134 1 phy raw c45 0xa9 0x1 0xffde 0 -phy raw c45 0xa9 0x1 0xd130 0x4e -phy raw c45 0xa9 0x1 0xd131 0x0610 +phy raw c45 0xa9 0x1 0xd130 0x4E +phy raw c45 0xa9 0x1 0xd131 0x610 phy raw c45 0xa9 0x1 0xd134 1 phy raw c45 0xa9 0x1 0xffde 1 -phy raw c45 0xa9 0x1 0xd130 0x4e -phy raw c45 0xa9 0x1 0xd131 0x0610 +phy raw c45 0xa9 0x1 0xd130 0x4E +phy raw c45 0xa9 0x1 0xd131 0x610 phy raw c45 0xa9 0x1 0xd134 1 phy raw c45 0xa9 0x1 0xffde 2 -phy raw c45 0xa9 0x1 0xd130 0x4e -phy raw c45 0xa9 0x1 0xd131 0x0610 +phy raw c45 0xa9 0x1 0xd130 0x4D +phy raw c45 0xa9 0x1 0xd131 0x611 phy raw c45 0xa9 0x1 0xd134 1 phy raw c45 0xa9 0x1 0xffde 3 -phy raw c45 0xa9 0x1 0xd130 0x4e -phy raw c45 0xa9 0x1 0xd131 0x0610 +phy raw c45 0xa9 0x1 0xd130 0x4E +phy raw c45 0xa9 0x1 0xd131 0x610 phy raw c45 0xa9 0x1 0xd134 1 phy raw c45 0xc1 0x1 0xffde 0 -phy raw c45 0xc1 0x1 0xd130 0x4e -phy raw c45 0xc1 0x1 0xd131 0x0610 +phy raw c45 0xc1 0x1 0xd130 0x4E +phy raw c45 0xc1 0x1 0xd131 0x610 phy raw c45 0xc1 0x1 0xd134 1 phy raw c45 0xc1 0x1 0xffde 1 -phy raw c45 0xc1 0x1 0xd130 0x4d -phy raw c45 0xc1 0x1 0xd131 0x0611 +phy raw c45 0xc1 0x1 0xd130 0x4E +phy raw c45 0xc1 0x1 0xd131 0x610 phy raw c45 0xc1 0x1 0xd134 1 phy raw c45 0xc1 0x1 0xffde 2 -phy raw c45 0xc1 0x1 0xd130 0x4e -phy raw c45 0xc1 0x1 0xd131 0x0610 +phy raw c45 0xc1 0x1 0xd130 0x4E +phy raw c45 0xc1 0x1 0xd131 0x610 phy raw c45 0xc1 0x1 0xd134 1 phy raw c45 0xc1 0x1 0xffde 3 -phy raw c45 0xc1 0x1 0xd130 0x4e -phy raw c45 0xc1 0x1 0xd131 0x0610 +phy raw c45 0xc1 0x1 0xd130 0x4E +phy raw c45 0xc1 0x1 0xd131 0x610 phy raw c45 0xc1 0x1 0xd134 1 phy raw c45 0xc5 0x1 0xffde 0 -phy raw c45 0xc5 0x1 0xd130 0x4e -phy raw c45 0xc5 0x1 0xd131 0x0610 +phy raw c45 0xc5 0x1 0xd130 0x4E +phy raw c45 0xc5 0x1 0xd131 0x610 phy raw c45 0xc5 0x1 0xd134 1 phy raw c45 0xc5 0x1 0xffde 1 -phy raw c45 0xc5 0x1 0xd130 0x4e -phy raw c45 0xc5 0x1 0xd131 0x0610 +phy raw c45 0xc5 0x1 0xd130 0x4E +phy raw c45 0xc5 0x1 0xd131 0x610 phy raw c45 0xc5 0x1 0xd134 1 phy raw c45 0xc5 0x1 0xffde 2 -phy raw c45 0xc5 0x1 0xd130 0x4d -phy raw c45 0xc5 0x1 0xd131 0x0611 +phy raw c45 0xc5 0x1 0xd130 0x4D +phy raw c45 0xc5 0x1 0xd131 0x611 phy raw c45 0xc5 0x1 0xd134 1 phy raw c45 0xc5 0x1 0xffde 3 -phy raw c45 0xc5 0x1 0xd130 0x4e -phy raw c45 0xc5 0x1 0xd131 0x0610 +phy raw c45 0xc5 0x1 0xd130 0x4E +phy raw c45 0xc5 0x1 0xd131 0x610 phy raw c45 0xc5 0x1 0xd134 1 phy raw c45 0x81 0x1 0xffde 0 -phy raw c45 0x81 0x1 0xd130 0x4e -phy raw c45 0x81 0x1 0xd131 0x0610 +phy raw c45 0x81 0x1 0xd130 0x4E +phy raw c45 0x81 0x1 0xd131 0x610 phy raw c45 0x81 0x1 0xd134 1 phy raw c45 0x81 0x1 0xffde 1 -phy raw c45 0x81 0x1 0xd130 0x4d -phy raw c45 0x81 0x1 0xd131 0x0611 +phy raw c45 0x81 0x1 0xd130 0x4D +phy raw c45 0x81 0x1 0xd131 0x611 phy raw c45 0x81 0x1 0xd134 1 phy raw c45 0x81 0x1 0xffde 2 -phy raw c45 0x81 0x1 0xd130 0x4e -phy raw c45 0x81 0x1 0xd131 0x0610 +phy raw c45 0x81 0x1 0xd130 0x4F +phy raw c45 0x81 0x1 0xd131 0x60F phy raw c45 0x81 0x1 0xd134 1 phy raw c45 0x81 0x1 0xffde 3 -phy raw c45 0x81 0x1 0xd130 0x4e -phy raw c45 0x81 0x1 0xd131 0x0610 +phy raw c45 0x81 0x1 0xd130 0x4D +phy raw c45 0x81 0x1 0xd131 0x611 phy raw c45 0x81 0x1 0xd134 1 phy raw c45 0x85 0x1 0xffde 0 -phy raw c45 0x85 0x1 0xd130 0x4e -phy raw c45 0x85 0x1 0xd131 0x0610 +phy raw c45 0x85 0x1 0xd130 0x4F +phy raw c45 0x85 0x1 0xd131 0x60F phy raw c45 0x85 0x1 0xd134 1 phy raw c45 0x85 0x1 0xffde 1 -phy raw c45 0x85 0x1 0xd130 0x4e -phy raw c45 0x85 0x1 0xd131 0x0610 +phy raw c45 0x85 0x1 0xd130 0x4F +phy raw c45 0x85 0x1 0xd131 0x60F phy raw c45 0x85 0x1 0xd134 1 phy raw c45 0x85 0x1 0xffde 2 -phy raw c45 0x85 0x1 0xd130 0x4e -phy raw c45 0x85 0x1 0xd131 0x0610 +phy raw c45 0x85 0x1 0xd130 0x4E +phy raw c45 0x85 0x1 0xd131 0x610 phy raw c45 0x85 0x1 0xd134 1 phy raw c45 0x85 0x1 0xffde 3 -phy raw c45 0x85 0x1 0xd130 0x4d -phy raw c45 0x85 0x1 0xd131 0x0611 +phy raw c45 0x85 0x1 0xd130 0x4D +phy raw c45 0x85 0x1 0xd131 0x611 phy raw c45 0x85 0x1 0xd134 1 phy raw c45 0x89 0x1 0xffde 0 -phy raw c45 0x89 0x1 0xd130 0x50 -phy raw c45 0x89 0x1 0xd131 0x060e +phy raw c45 0x89 0x1 0xd130 0x4F +phy raw c45 0x89 0x1 0xd131 0x60F phy raw c45 0x89 0x1 0xd134 1 phy raw c45 0x89 0x1 0xffde 1 -phy raw c45 0x89 0x1 0xd130 0x50 -phy raw c45 0x89 0x1 0xd131 0x060e +phy raw c45 0x89 0x1 0xd130 0x4F +phy raw c45 0x89 0x1 0xd131 0x60F phy raw c45 0x89 0x1 0xd134 1 phy raw c45 0x89 0x1 0xffde 2 -phy raw c45 0x89 0x1 0xd130 0x50 -phy raw c45 0x89 0x1 0xd131 0x060e +phy raw c45 0x89 0x1 0xd130 0x51 +phy raw c45 0x89 0x1 0xd131 0x60D phy raw c45 0x89 0x1 0xd134 1 phy raw c45 0x89 0x1 0xffde 3 -phy raw c45 0x89 0x1 0xd130 0x50 -phy raw c45 0x89 0x1 0xd131 0x060e +phy raw c45 0x89 0x1 0xd130 0x4F +phy raw c45 0x89 0x1 0xd131 0x60F phy raw c45 0x89 0x1 0xd134 1 phy raw c45 0x8d 0x1 0xffde 0 -phy raw c45 0x8d 0x1 0xd130 0x4f -phy raw c45 0x8d 0x1 0xd131 0x060f +phy raw c45 0x8d 0x1 0xd130 0x51 +phy raw c45 0x8d 0x1 0xd131 0x60D phy raw c45 0x8d 0x1 0xd134 1 phy raw c45 0x8d 0x1 0xffde 1 -phy raw c45 0x8d 0x1 0xd130 0x4f -phy raw c45 0x8d 0x1 0xd131 0x060f +phy raw c45 0x8d 0x1 0xd130 0x51 +phy raw c45 0x8d 0x1 0xd131 0x60D phy raw c45 0x8d 0x1 0xd134 1 phy raw c45 0x8d 0x1 0xffde 2 -phy raw c45 0x8d 0x1 0xd130 0x4f -phy raw c45 0x8d 0x1 0xd131 0x060f +phy raw c45 0x8d 0x1 0xd130 0x51 +phy raw c45 0x8d 0x1 0xd131 0x60D phy raw c45 0x8d 0x1 0xd134 1 phy raw c45 0x8d 0x1 0xffde 3 -phy raw c45 0x8d 0x1 0xd130 0x4f -phy raw c45 0x8d 0x1 0xd131 0x060f +phy raw c45 0x8d 0x1 0xd130 0x50 +phy raw c45 0x8d 0x1 0xd131 0x60E phy raw c45 0x8d 0x1 0xd134 1 phy raw c45 0x91 0x1 0xffde 0 -phy raw c45 0x91 0x1 0xd130 0x50 -phy raw c45 0x91 0x1 0xd131 0x060e +phy raw c45 0x91 0x1 0xd130 0x52 +phy raw c45 0x91 0x1 0xd131 0x60C phy raw c45 0x91 0x1 0xd134 1 phy raw c45 0x91 0x1 0xffde 1 -phy raw c45 0x91 0x1 0xd130 0x50 -phy raw c45 0x91 0x1 0xd131 0x060e +phy raw c45 0x91 0x1 0xd130 0x52 +phy raw c45 0x91 0x1 0xd131 0x60C phy raw c45 0x91 0x1 0xd134 1 phy raw c45 0x91 0x1 0xffde 2 -phy raw c45 0x91 0x1 0xd130 0x50 -phy raw c45 0x91 0x1 0xd131 0x060e +phy raw c45 0x91 0x1 0xd130 0x52 +phy raw c45 0x91 0x1 0xd131 0x60C phy raw c45 0x91 0x1 0xd134 1 phy raw c45 0x91 0x1 0xffde 3 -phy raw c45 0x91 0x1 0xd130 0x50 -phy raw c45 0x91 0x1 0xd131 0x060e +phy raw c45 0x91 0x1 0xd130 0x52 +phy raw c45 0x91 0x1 0xd131 0x60C phy raw c45 0x91 0x1 0xd134 1 phy raw c45 0x95 0x1 0xffde 0 -phy raw c45 0x95 0x1 0xd130 0x52 -phy raw c45 0x95 0x1 0xd131 0x060c +phy raw c45 0x95 0x1 0xd130 0x54 +phy raw c45 0x95 0x1 0xd131 0x60A phy raw c45 0x95 0x1 0xd134 1 phy raw c45 0x95 0x1 0xffde 1 phy raw c45 0x95 0x1 0xd130 0x52 -phy raw c45 0x95 0x1 0xd131 0x060c +phy raw c45 0x95 0x1 0xd131 0x60C phy raw c45 0x95 0x1 0xd134 1 phy raw c45 0x95 0x1 0xffde 2 -phy raw c45 0x95 0x1 0xd130 0x52 -phy raw c45 0x95 0x1 0xd131 0x060c +phy raw c45 0x95 0x1 0xd130 0x54 +phy raw c45 0x95 0x1 0xd131 0x60A phy raw c45 0x95 0x1 0xd134 1 phy raw c45 0x95 0x1 0xffde 3 phy raw c45 0x95 0x1 0xd130 0x52 -phy raw c45 0x95 0x1 0xd131 0x060c +phy raw c45 0x95 0x1 0xd131 0x60C phy raw c45 0x95 0x1 0xd134 1 phy raw c45 0xa1 0x1 0xffde 0 -phy raw c45 0xa1 0x1 0xd130 0x52 -phy raw c45 0xa1 0x1 0xd131 0x060c +phy raw c45 0xa1 0x1 0xd130 0x54 +phy raw c45 0xa1 0x1 0xd131 0x60A phy raw c45 0xa1 0x1 0xd134 1 phy raw c45 0xa1 0x1 0xffde 1 -phy raw c45 0xa1 0x1 0xd130 0x52 -phy raw c45 0xa1 0x1 0xd131 0x060c +phy raw c45 0xa1 0x1 0xd130 0x53 +phy raw c45 0xa1 0x1 0xd131 0x60B phy raw c45 0xa1 0x1 0xd134 1 phy raw c45 0xa1 0x1 0xffde 2 -phy raw c45 0xa1 0x1 0xd130 0x52 -phy raw c45 0xa1 0x1 0xd131 0x060c +phy raw c45 0xa1 0x1 0xd130 0x54 +phy raw c45 0xa1 0x1 0xd131 0x60A phy raw c45 0xa1 0x1 0xd134 1 phy raw c45 0xa1 0x1 0xffde 3 -phy raw c45 0xa1 0x1 0xd130 0x52 -phy raw c45 0xa1 0x1 0xd131 0x060c +phy raw c45 0xa1 0x1 0xd130 0x53 +phy raw c45 0xa1 0x1 0xd131 0x60B phy raw c45 0xa1 0x1 0xd134 1 phy raw c45 0xad 0x1 0xffde 0 -phy raw c45 0xad 0x1 0xd130 0x53 -phy raw c45 0xad 0x1 0xd131 0x060b +phy raw c45 0xad 0x1 0xd130 0x54 +phy raw c45 0xad 0x1 0xd131 0x60A phy raw c45 0xad 0x1 0xd134 1 phy raw c45 0xad 0x1 0xffde 1 phy raw c45 0xad 0x1 0xd130 0x53 -phy raw c45 0xad 0x1 0xd131 0x060b +phy raw c45 0xad 0x1 0xd131 0x60B phy raw c45 0xad 0x1 0xd134 1 phy raw c45 0xad 0x1 0xffde 2 -phy raw c45 0xad 0x1 0xd130 0x53 -phy raw c45 0xad 0x1 0xd131 0x060b +phy raw c45 0xad 0x1 0xd130 0x54 +phy raw c45 0xad 0x1 0xd131 0x60A phy raw c45 0xad 0x1 0xd134 1 phy raw c45 0xad 0x1 0xffde 3 -phy raw c45 0xad 0x1 0xd130 0x53 -phy raw c45 0xad 0x1 0xd131 0x060b +phy raw c45 0xad 0x1 0xd130 0x54 +phy raw c45 0xad 0x1 0xd131 0x60A phy raw c45 0xad 0x1 0xd134 1 phy raw c45 0xc9 0x1 0xffde 0 -phy raw c45 0xc9 0x1 0xd130 0x53 -phy raw c45 0xc9 0x1 0xd131 0x060b +phy raw c45 0xc9 0x1 0xd130 0x54 +phy raw c45 0xc9 0x1 0xd131 0x60A phy raw c45 0xc9 0x1 0xd134 1 phy raw c45 0xc9 0x1 0xffde 1 phy raw c45 0xc9 0x1 0xd130 0x53 -phy raw c45 0xc9 0x1 0xd131 0x060b +phy raw c45 0xc9 0x1 0xd131 0x60B phy raw c45 0xc9 0x1 0xd134 1 phy raw c45 0xc9 0x1 0xffde 2 -phy raw c45 0xc9 0x1 0xd130 0x53 -phy raw c45 0xc9 0x1 0xd131 0x060b +phy raw c45 0xc9 0x1 0xd130 0x54 +phy raw c45 0xc9 0x1 0xd131 0x60A phy raw c45 0xc9 0x1 0xd134 1 phy raw c45 0xc9 0x1 0xffde 3 phy raw c45 0xc9 0x1 0xd130 0x53 -phy raw c45 0xc9 0x1 0xd131 0x060b +phy raw c45 0xc9 0x1 0xd131 0x60B phy raw c45 0xc9 0x1 0xd134 1 phy raw c45 0xcd 0x1 0xffde 0 phy raw c45 0xcd 0x1 0xd130 0x54 -phy raw c45 0xcd 0x1 0xd131 0x060a +phy raw c45 0xcd 0x1 0xd131 0x60A phy raw c45 0xcd 0x1 0xd134 1 phy raw c45 0xcd 0x1 0xffde 1 -phy raw c45 0xcd 0x1 0xd130 0x54 -phy raw c45 0xcd 0x1 0xd131 0x060a +phy raw c45 0xcd 0x1 0xd130 0x53 +phy raw c45 0xcd 0x1 0xd131 0x60B phy raw c45 0xcd 0x1 0xd134 1 phy raw c45 0xcd 0x1 0xffde 2 phy raw c45 0xcd 0x1 0xd130 0x54 -phy raw c45 0xcd 0x1 0xd131 0x060a +phy raw c45 0xcd 0x1 0xd131 0x60A phy raw c45 0xcd 0x1 0xd134 1 phy raw c45 0xcd 0x1 0xffde 3 phy raw c45 0xcd 0x1 0xd130 0x54 -phy raw c45 0xcd 0x1 0xd131 0x060a +phy raw c45 0xcd 0x1 0xd131 0x60A phy raw c45 0xcd 0x1 0xd134 1 phy raw c45 0xd1 0x1 0xffde 0 -phy raw c45 0xd1 0x1 0xd130 0x56 -phy raw c45 0xd1 0x1 0xd131 0x0608 +phy raw c45 0xd1 0x1 0xd130 0x55 +phy raw c45 0xd1 0x1 0xd131 0x609 phy raw c45 0xd1 0x1 0xd134 1 phy raw c45 0xd1 0x1 0xffde 1 -phy raw c45 0xd1 0x1 0xd130 0x56 -phy raw c45 0xd1 0x1 0xd131 0x0608 +phy raw c45 0xd1 0x1 0xd130 0x55 +phy raw c45 0xd1 0x1 0xd131 0x609 phy raw c45 0xd1 0x1 0xd134 1 phy raw c45 0xd1 0x1 0xffde 2 -phy raw c45 0xd1 0x1 0xd130 0x56 -phy raw c45 0xd1 0x1 0xd131 0x0608 +phy raw c45 0xd1 0x1 0xd130 0x55 +phy raw c45 0xd1 0x1 0xd131 0x609 phy raw c45 0xd1 0x1 0xd134 1 phy raw c45 0xd1 0x1 0xffde 3 -phy raw c45 0xd1 0x1 0xd130 0x56 -phy raw c45 0xd1 0x1 0xd131 0x0608 +phy raw c45 0xd1 0x1 0xd130 0x55 +phy raw c45 0xd1 0x1 0xd131 0x609 phy raw c45 0xd1 0x1 0xd134 1 phy raw c45 0xd5 0x1 0xffde 0 -phy raw c45 0xd5 0x1 0xd130 0x55 -phy raw c45 0xd5 0x1 0xd131 0x0609 +phy raw c45 0xd5 0x1 0xd130 0x54 +phy raw c45 0xd5 0x1 0xd131 0x60A phy raw c45 0xd5 0x1 0xd134 1 phy raw c45 0xd5 0x1 0xffde 1 -phy raw c45 0xd5 0x1 0xd130 0x55 -phy raw c45 0xd5 0x1 0xd131 0x0609 +phy raw c45 0xd5 0x1 0xd130 0x54 +phy raw c45 0xd5 0x1 0xd131 0x60A phy raw c45 0xd5 0x1 0xd134 1 phy raw c45 0xd5 0x1 0xffde 2 -phy raw c45 0xd5 0x1 0xd130 0x55 -phy raw c45 0xd5 0x1 0xd131 0x0609 +phy raw c45 0xd5 0x1 0xd130 0x54 +phy raw c45 0xd5 0x1 0xd131 0x60A phy raw c45 0xd5 0x1 0xd134 1 phy raw c45 0xd5 0x1 0xffde 3 phy raw c45 0xd5 0x1 0xd130 0x55 -phy raw c45 0xd5 0x1 0xd131 0x0609 +phy raw c45 0xd5 0x1 0xd131 0x609 phy raw c45 0xd5 0x1 0xd134 1 phy raw c45 0xe1 0x1 0xffde 0 -phy raw c45 0xe1 0x1 0xd130 0x56 -phy raw c45 0xe1 0x1 0xd131 0x0608 +phy raw c45 0xe1 0x1 0xd130 0x55 +phy raw c45 0xe1 0x1 0xd131 0x609 phy raw c45 0xe1 0x1 0xd134 1 phy raw c45 0xe1 0x1 0xffde 1 -phy raw c45 0xe1 0x1 0xd130 0x56 -phy raw c45 0xe1 0x1 0xd131 0x0608 +phy raw c45 0xe1 0x1 0xd130 0x55 +phy raw c45 0xe1 0x1 0xd131 0x609 phy raw c45 0xe1 0x1 0xd134 1 phy raw c45 0xe1 0x1 0xffde 2 -phy raw c45 0xe1 0x1 0xd130 0x56 -phy raw c45 0xe1 0x1 0xd131 0x0608 +phy raw c45 0xe1 0x1 0xd130 0x55 +phy raw c45 0xe1 0x1 0xd131 0x609 phy raw c45 0xe1 0x1 0xd134 1 phy raw c45 0xe1 0x1 0xffde 3 -phy raw c45 0xe1 0x1 0xd130 0x56 -phy raw c45 0xe1 0x1 0xd131 0x0608 +phy raw c45 0xe1 0x1 0xd130 0x55 +phy raw c45 0xe1 0x1 0xd131 0x609 phy raw c45 0xe1 0x1 0xd134 1 phy raw c45 0xe5 0x1 0xffde 0 -phy raw c45 0xe5 0x1 0xd130 0x55 -phy raw c45 0xe5 0x1 0xd131 0x0609 +phy raw c45 0xe5 0x1 0xd130 0x54 +phy raw c45 0xe5 0x1 0xd131 0x60A phy raw c45 0xe5 0x1 0xd134 1 phy raw c45 0xe5 0x1 0xffde 1 -phy raw c45 0xe5 0x1 0xd130 0x55 -phy raw c45 0xe5 0x1 0xd131 0x0609 +phy raw c45 0xe5 0x1 0xd130 0x54 +phy raw c45 0xe5 0x1 0xd131 0x60A phy raw c45 0xe5 0x1 0xd134 1 phy raw c45 0xe5 0x1 0xffde 2 -phy raw c45 0xe5 0x1 0xd130 0x55 -phy raw c45 0xe5 0x1 0xd131 0x0609 +phy raw c45 0xe5 0x1 0xd130 0x54 +phy raw c45 0xe5 0x1 0xd131 0x60A phy raw c45 0xe5 0x1 0xd134 1 phy raw c45 0xe5 0x1 0xffde 3 -phy raw c45 0xe5 0x1 0xd130 0x55 -phy raw c45 0xe5 0x1 0xd131 0x0609 +phy raw c45 0xe5 0x1 0xd130 0x54 +phy raw c45 0xe5 0x1 0xd131 0x60A phy raw c45 0xe5 0x1 0xd134 1 phy raw c45 0xe9 0x1 0xffde 0 -phy raw c45 0xe9 0x1 0xd130 0x56 -phy raw c45 0xe9 0x1 0xd131 0x0608 +phy raw c45 0xe9 0x1 0xd130 0x54 +phy raw c45 0xe9 0x1 0xd131 0x60A phy raw c45 0xe9 0x1 0xd134 1 phy raw c45 0xe9 0x1 0xffde 1 -phy raw c45 0xe9 0x1 0xd130 0x56 -phy raw c45 0xe9 0x1 0xd131 0x0608 +phy raw c45 0xe9 0x1 0xd130 0x54 +phy raw c45 0xe9 0x1 0xd131 0x60A phy raw c45 0xe9 0x1 0xd134 1 phy raw c45 0xe9 0x1 0xffde 2 -phy raw c45 0xe9 0x1 0xd130 0x56 -phy raw c45 0xe9 0x1 0xd131 0x0608 +phy raw c45 0xe9 0x1 0xd130 0x54 +phy raw c45 0xe9 0x1 0xd131 0x60A phy raw c45 0xe9 0x1 0xd134 1 phy raw c45 0xe9 0x1 0xffde 3 -phy raw c45 0xe9 0x1 0xd130 0x56 -phy raw c45 0xe9 0x1 0xd131 0x0608 +phy raw c45 0xe9 0x1 0xd130 0x54 +phy raw c45 0xe9 0x1 0xd131 0x60A phy raw c45 0xe9 0x1 0xd134 1 phy raw c45 0xed 0x1 0xffde 0 -phy raw c45 0xed 0x1 0xd130 0x55 -phy raw c45 0xed 0x1 0xd131 0x0609 +phy raw c45 0xed 0x1 0xd130 0x53 +phy raw c45 0xed 0x1 0xd131 0x60B phy raw c45 0xed 0x1 0xd134 1 phy raw c45 0xed 0x1 0xffde 1 -phy raw c45 0xed 0x1 0xd130 0x53 -phy raw c45 0xed 0x1 0xd131 0x060b +phy raw c45 0xed 0x1 0xd130 0x52 +phy raw c45 0xed 0x1 0xd131 0x60C phy raw c45 0xed 0x1 0xd134 1 phy raw c45 0xed 0x1 0xffde 2 phy raw c45 0xed 0x1 0xd130 0x54 -phy raw c45 0xed 0x1 0xd131 0x060a +phy raw c45 0xed 0x1 0xd131 0x60A phy raw c45 0xed 0x1 0xd134 1 phy raw c45 0xed 0x1 0xffde 3 -phy raw c45 0xed 0x1 0xd130 0x54 -phy raw c45 0xed 0x1 0xd131 0x060a +phy raw c45 0xed 0x1 0xd130 0x52 +phy raw c45 0xed 0x1 0xd131 0x60C phy raw c45 0xed 0x1 0xd134 1 phy raw c45 0x185 0x1 0xffde 0 -phy raw c45 0x185 0x1 0xd130 0x55 -phy raw c45 0x185 0x1 0xd131 0x0609 +phy raw c45 0x185 0x1 0xd130 0x53 +phy raw c45 0x185 0x1 0xd131 0x60B phy raw c45 0x185 0x1 0xd134 1 phy raw c45 0x185 0x1 0xffde 1 -phy raw c45 0x185 0x1 0xd130 0x55 -phy raw c45 0x185 0x1 0xd131 0x0609 +phy raw c45 0x185 0x1 0xd130 0x53 +phy raw c45 0x185 0x1 0xd131 0x60B phy raw c45 0x185 0x1 0xd134 1 phy raw c45 0x185 0x1 0xffde 2 -phy raw c45 0x185 0x1 0xd130 0x55 -phy raw c45 0x185 0x1 0xd131 0x0609 +phy raw c45 0x185 0x1 0xd130 0x53 +phy raw c45 0x185 0x1 0xd131 0x60B phy raw c45 0x185 0x1 0xd134 1 phy raw c45 0x185 0x1 0xffde 3 -phy raw c45 0x185 0x1 0xd130 0x55 -phy raw c45 0x185 0x1 0xd131 0x0609 +phy raw c45 0x185 0x1 0xd130 0x53 +phy raw c45 0x185 0x1 0xd131 0x60B phy raw c45 0x185 0x1 0xd134 1 phy raw c45 0x18d 0x1 0xffde 0 -phy raw c45 0x18d 0x1 0xd130 0x54 -phy raw c45 0x18d 0x1 0xd131 0x060a +phy raw c45 0x18d 0x1 0xd130 0x53 +phy raw c45 0x18d 0x1 0xd131 0x60B phy raw c45 0x18d 0x1 0xd134 1 phy raw c45 0x18d 0x1 0xffde 1 -phy raw c45 0x18d 0x1 0xd130 0x53 -phy raw c45 0x18d 0x1 0xd131 0x060b +phy raw c45 0x18d 0x1 0xd130 0x52 +phy raw c45 0x18d 0x1 0xd131 0x60C phy raw c45 0x18d 0x1 0xd134 1 phy raw c45 0x18d 0x1 0xffde 2 -phy raw c45 0x18d 0x1 0xd130 0x53 -phy raw c45 0x18d 0x1 0xd131 0x060b +phy raw c45 0x18d 0x1 0xd130 0x54 +phy raw c45 0x18d 0x1 0xd131 0x60A phy raw c45 0x18d 0x1 0xd134 1 phy raw c45 0x18d 0x1 0xffde 3 -phy raw c45 0x18d 0x1 0xd130 0x53 -phy raw c45 0x18d 0x1 0xd131 0x060b +phy raw c45 0x18d 0x1 0xd130 0x54 +phy raw c45 0x18d 0x1 0xd131 0x60A phy raw c45 0x18d 0x1 0xd134 1 phy raw c45 0x1a1 0x1 0xffde 0 -phy raw c45 0x1a1 0x1 0xd130 0x55 -phy raw c45 0x1a1 0x1 0xd131 0x0609 +phy raw c45 0x1a1 0x1 0xd130 0x52 +phy raw c45 0x1a1 0x1 0xd131 0x60C phy raw c45 0x1a1 0x1 0xd134 1 phy raw c45 0x1a1 0x1 0xffde 1 -phy raw c45 0x1a1 0x1 0xd130 0x54 -phy raw c45 0x1a1 0x1 0xd131 0x060a +phy raw c45 0x1a1 0x1 0xd130 0x52 +phy raw c45 0x1a1 0x1 0xd131 0x60C phy raw c45 0x1a1 0x1 0xd134 1 phy raw c45 0x1a1 0x1 0xffde 2 -phy raw c45 0x1a1 0x1 0xd130 0x55 -phy raw c45 0x1a1 0x1 0xd131 0x0609 +phy raw c45 0x1a1 0x1 0xd130 0x52 +phy raw c45 0x1a1 0x1 0xd131 0x60C phy raw c45 0x1a1 0x1 0xd134 1 phy raw c45 0x1a1 0x1 0xffde 3 -phy raw c45 0x1a1 0x1 0xd130 0x53 -phy raw c45 0x1a1 0x1 0xd131 0x060b +phy raw c45 0x1a1 0x1 0xd130 0x52 +phy raw c45 0x1a1 0x1 0xd131 0x60C phy raw c45 0x1a1 0x1 0xd134 1 phy raw c45 0x1a5 0x1 0xffde 0 -phy raw c45 0x1a5 0x1 0xd130 0x54 -phy raw c45 0x1a5 0x1 0xd131 0x060a +phy raw c45 0x1a5 0x1 0xd130 0x52 +phy raw c45 0x1a5 0x1 0xd131 0x60C phy raw c45 0x1a5 0x1 0xd134 1 phy raw c45 0x1a5 0x1 0xffde 1 -phy raw c45 0x1a5 0x1 0xd130 0x53 -phy raw c45 0x1a5 0x1 0xd131 0x060b +phy raw c45 0x1a5 0x1 0xd130 0x52 +phy raw c45 0x1a5 0x1 0xd131 0x60C phy raw c45 0x1a5 0x1 0xd134 1 phy raw c45 0x1a5 0x1 0xffde 2 phy raw c45 0x1a5 0x1 0xd130 0x53 -phy raw c45 0x1a5 0x1 0xd131 0x060b +phy raw c45 0x1a5 0x1 0xd131 0x60B phy raw c45 0x1a5 0x1 0xd134 1 phy raw c45 0x1a5 0x1 0xffde 3 -phy raw c45 0x1a5 0x1 0xd130 0x53 -phy raw c45 0x1a5 0x1 0xd131 0x060b +phy raw c45 0x1a5 0x1 0xd130 0x52 +phy raw c45 0x1a5 0x1 0xd131 0x60C phy raw c45 0x1a5 0x1 0xd134 1 phy raw c45 0x1a9 0x1 0xffde 0 -phy raw c45 0x1a9 0x1 0xd130 0x54 -phy raw c45 0x1a9 0x1 0xd131 0x060a +phy raw c45 0x1a9 0x1 0xd130 0x50 +phy raw c45 0x1a9 0x1 0xd131 0x60E phy raw c45 0x1a9 0x1 0xd134 1 phy raw c45 0x1a9 0x1 0xffde 1 phy raw c45 0x1a9 0x1 0xd130 0x51 -phy raw c45 0x1a9 0x1 0xd131 0x060d +phy raw c45 0x1a9 0x1 0xd131 0x60D phy raw c45 0x1a9 0x1 0xd134 1 phy raw c45 0x1a9 0x1 0xffde 2 -phy raw c45 0x1a9 0x1 0xd130 0x52 -phy raw c45 0x1a9 0x1 0xd131 0x060c +phy raw c45 0x1a9 0x1 0xd130 0x51 +phy raw c45 0x1a9 0x1 0xd131 0x60D phy raw c45 0x1a9 0x1 0xd134 1 phy raw c45 0x1a9 0x1 0xffde 3 -phy raw c45 0x1a9 0x1 0xd130 0x52 -phy raw c45 0x1a9 0x1 0xd131 0x060c +phy raw c45 0x1a9 0x1 0xd130 0x51 +phy raw c45 0x1a9 0x1 0xd131 0x60D phy raw c45 0x1a9 0x1 0xd134 1 phy raw c45 0x1ad 0x1 0xffde 0 -phy raw c45 0x1ad 0x1 0xd130 0x51 -phy raw c45 0x1ad 0x1 0xd131 0x060d +phy raw c45 0x1ad 0x1 0xd130 0x50 +phy raw c45 0x1ad 0x1 0xd131 0x60E phy raw c45 0x1ad 0x1 0xd134 1 phy raw c45 0x1ad 0x1 0xffde 1 -phy raw c45 0x1ad 0x1 0xd130 0x4f -phy raw c45 0x1ad 0x1 0xd131 0x060f +phy raw c45 0x1ad 0x1 0xd130 0x50 +phy raw c45 0x1ad 0x1 0xd131 0x60E phy raw c45 0x1ad 0x1 0xd134 1 phy raw c45 0x1ad 0x1 0xffde 2 -phy raw c45 0x1ad 0x1 0xd130 0x4f -phy raw c45 0x1ad 0x1 0xd131 0x060f +phy raw c45 0x1ad 0x1 0xd130 0x51 +phy raw c45 0x1ad 0x1 0xd131 0x60D phy raw c45 0x1ad 0x1 0xd134 1 phy raw c45 0x1ad 0x1 0xffde 3 -phy raw c45 0x1ad 0x1 0xd130 0x4f -phy raw c45 0x1ad 0x1 0xd131 0x060f +phy raw c45 0x1ad 0x1 0xd130 0x50 +phy raw c45 0x1ad 0x1 0xd131 0x60E phy raw c45 0x1ad 0x1 0xd134 1 phy raw c45 0x1b1 0x1 0xffde 0 -phy raw c45 0x1b1 0x1 0xd130 0x4f -phy raw c45 0x1b1 0x1 0xd131 0x060f +phy raw c45 0x1b1 0x1 0xd130 0x4F +phy raw c45 0x1b1 0x1 0xd131 0x60F phy raw c45 0x1b1 0x1 0xd134 1 phy raw c45 0x1b1 0x1 0xffde 1 -phy raw c45 0x1b1 0x1 0xd130 0x4f -phy raw c45 0x1b1 0x1 0xd131 0x060f +phy raw c45 0x1b1 0x1 0xd130 0x4D +phy raw c45 0x1b1 0x1 0xd131 0x611 phy raw c45 0x1b1 0x1 0xd134 1 phy raw c45 0x1b1 0x1 0xffde 2 -phy raw c45 0x1b1 0x1 0xd130 0x4f -phy raw c45 0x1b1 0x1 0xd131 0x060f +phy raw c45 0x1b1 0x1 0xd130 0x4E +phy raw c45 0x1b1 0x1 0xd131 0x610 phy raw c45 0x1b1 0x1 0xd134 1 phy raw c45 0x1b1 0x1 0xffde 3 -phy raw c45 0x1b1 0x1 0xd130 0x4f -phy raw c45 0x1b1 0x1 0xd131 0x060f +phy raw c45 0x1b1 0x1 0xd130 0x4D +phy raw c45 0x1b1 0x1 0xd131 0x611 phy raw c45 0x1b1 0x1 0xd134 1 phy raw c45 0x1b5 0x1 0xffde 0 -phy raw c45 0x1b5 0x1 0xd130 0x4e -phy raw c45 0x1b5 0x1 0xd131 0x0610 +phy raw c45 0x1b5 0x1 0xd130 0x4E +phy raw c45 0x1b5 0x1 0xd131 0x610 phy raw c45 0x1b5 0x1 0xd134 1 phy raw c45 0x1b5 0x1 0xffde 1 -phy raw c45 0x1b5 0x1 0xd130 0x4d -phy raw c45 0x1b5 0x1 0xd131 0x0611 +phy raw c45 0x1b5 0x1 0xd130 0x4D +phy raw c45 0x1b5 0x1 0xd131 0x611 phy raw c45 0x1b5 0x1 0xd134 1 phy raw c45 0x1b5 0x1 0xffde 2 -phy raw c45 0x1b5 0x1 0xd130 0x4d -phy raw c45 0x1b5 0x1 0xd131 0x0611 +phy raw c45 0x1b5 0x1 0xd130 0x4E +phy raw c45 0x1b5 0x1 0xd131 0x610 phy raw c45 0x1b5 0x1 0xd134 1 phy raw c45 0x1b5 0x1 0xffde 3 -phy raw c45 0x1b5 0x1 0xd130 0x4d -phy raw c45 0x1b5 0x1 0xd131 0x0611 +phy raw c45 0x1b5 0x1 0xd130 0x4D +phy raw c45 0x1b5 0x1 0xd131 0x611 phy raw c45 0x1b5 0x1 0xd134 1 phy raw c45 0xf1 0x1 0xffde 0 -phy raw c45 0xf1 0x1 0xd130 0x4f -phy raw c45 0xf1 0x1 0xd131 0x060f +phy raw c45 0xf1 0x1 0xd130 0x4F +phy raw c45 0xf1 0x1 0xd131 0x60F phy raw c45 0xf1 0x1 0xd134 1 phy raw c45 0xf1 0x1 0xffde 1 -phy raw c45 0xf1 0x1 0xd130 0x4f -phy raw c45 0xf1 0x1 0xd131 0x060f +phy raw c45 0xf1 0x1 0xd130 0x4E +phy raw c45 0xf1 0x1 0xd131 0x610 phy raw c45 0xf1 0x1 0xd134 1 phy raw c45 0xf1 0x1 0xffde 2 -phy raw c45 0xf1 0x1 0xd130 0x4f -phy raw c45 0xf1 0x1 0xd131 0x060f +phy raw c45 0xf1 0x1 0xd130 0x4E +phy raw c45 0xf1 0x1 0xd131 0x610 phy raw c45 0xf1 0x1 0xd134 1 phy raw c45 0xf1 0x1 0xffde 3 -phy raw c45 0xf1 0x1 0xd130 0x4f -phy raw c45 0xf1 0x1 0xd131 0x060f +phy raw c45 0xf1 0x1 0xd130 0x4E +phy raw c45 0xf1 0x1 0xd131 0x610 phy raw c45 0xf1 0x1 0xd134 1 phy raw c45 0xf5 0x1 0xffde 0 -phy raw c45 0xf5 0x1 0xd130 0x4d -phy raw c45 0xf5 0x1 0xd131 0x0611 +phy raw c45 0xf5 0x1 0xd130 0x4D +phy raw c45 0xf5 0x1 0xd131 0x611 phy raw c45 0xf5 0x1 0xd134 1 phy raw c45 0xf5 0x1 0xffde 1 -phy raw c45 0xf5 0x1 0xd130 0x4d -phy raw c45 0xf5 0x1 0xd131 0x0611 +phy raw c45 0xf5 0x1 0xd130 0x4D +phy raw c45 0xf5 0x1 0xd131 0x611 phy raw c45 0xf5 0x1 0xd134 1 phy raw c45 0xf5 0x1 0xffde 2 -phy raw c45 0xf5 0x1 0xd130 0x4d -phy raw c45 0xf5 0x1 0xd131 0x0611 +phy raw c45 0xf5 0x1 0xd130 0x4D +phy raw c45 0xf5 0x1 0xd131 0x611 phy raw c45 0xf5 0x1 0xd134 1 phy raw c45 0xf5 0x1 0xffde 3 -phy raw c45 0xf5 0x1 0xd130 0x4d -phy raw c45 0xf5 0x1 0xd131 0x0611 +phy raw c45 0xf5 0x1 0xd130 0x4D +phy raw c45 0xf5 0x1 0xd131 0x611 phy raw c45 0xf5 0x1 0xd134 1 phy raw c45 0x181 0x1 0xffde 0 -phy raw c45 0x181 0x1 0xd130 0x4e -phy raw c45 0x181 0x1 0xd131 0x0610 +phy raw c45 0x181 0x1 0xd130 0x4E +phy raw c45 0x181 0x1 0xd131 0x610 phy raw c45 0x181 0x1 0xd134 1 phy raw c45 0x181 0x1 0xffde 1 -phy raw c45 0x181 0x1 0xd130 0x4e -phy raw c45 0x181 0x1 0xd131 0x0610 +phy raw c45 0x181 0x1 0xd130 0x4D +phy raw c45 0x181 0x1 0xd131 0x611 phy raw c45 0x181 0x1 0xd134 1 phy raw c45 0x181 0x1 0xffde 2 -phy raw c45 0x181 0x1 0xd130 0x4e -phy raw c45 0x181 0x1 0xd131 0x0610 +phy raw c45 0x181 0x1 0xd130 0x4E +phy raw c45 0x181 0x1 0xd131 0x610 phy raw c45 0x181 0x1 0xd134 1 phy raw c45 0x181 0x1 0xffde 3 -phy raw c45 0x181 0x1 0xd130 0x4e -phy raw c45 0x181 0x1 0xd131 0x0610 +phy raw c45 0x181 0x1 0xd130 0x4D +phy raw c45 0x181 0x1 0xd131 0x611 phy raw c45 0x181 0x1 0xd134 1 phy raw c45 0x189 0x1 0xffde 0 -phy raw c45 0x189 0x1 0xd130 0x4d -phy raw c45 0x189 0x1 0xd131 0x0611 +phy raw c45 0x189 0x1 0xd130 0x4E +phy raw c45 0x189 0x1 0xd131 0x610 phy raw c45 0x189 0x1 0xd134 1 phy raw c45 0x189 0x1 0xffde 1 -phy raw c45 0x189 0x1 0xd130 0x4d -phy raw c45 0x189 0x1 0xd131 0x0611 +phy raw c45 0x189 0x1 0xd130 0x4E +phy raw c45 0x189 0x1 0xd131 0x610 phy raw c45 0x189 0x1 0xd134 1 phy raw c45 0x189 0x1 0xffde 2 -phy raw c45 0x189 0x1 0xd130 0x4d -phy raw c45 0x189 0x1 0xd131 0x0611 +phy raw c45 0x189 0x1 0xd130 0x4D +phy raw c45 0x189 0x1 0xd131 0x611 phy raw c45 0x189 0x1 0xd134 1 phy raw c45 0x189 0x1 0xffde 3 -phy raw c45 0x189 0x1 0xd130 0x4d -phy raw c45 0x189 0x1 0xd131 0x0611 -phy raw c45 0x189 0x1 0xd134 1 - +phy raw c45 0x189 0x1 0xd130 0x4D +phy raw c45 0x189 0x1 0xd131 0x611 +phy raw c45 0x189 0x1 0xd134 1 \ No newline at end of file diff --git a/device/quanta/x86_64-quanta_ix7_rglbmc-r0/media_settings.json b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/media_settings.json new file mode 100644 index 0000000000..0ea47167be --- /dev/null +++ b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/media_settings.json @@ -0,0 +1,254 @@ +{ + "GLOBAL_MEDIA_SETTINGS": { + "1-1": { + "Default": { + "preemphasis": { + "lane0": "0x114D06", + "lane1": "0x0F4F06", + "lane2": "0x0F4F06", + "lane3": "0x104E06" + } + } + }, + "2,4": { + "Default": { + "preemphasis": { + "lane0": "0x104E06", + "lane1": "0x104E06", + "lane2": "0x114D06", + "lane3": "0x104E06" + } + } + }, + "3-3": { + "Default": { + "preemphasis": { + "lane0": "0x104E06", + "lane1": "0x104E06", + "lane2": "0x104E06", + "lane3": "0x104E06" + } + } + }, + "5-5": { + "Default": { + "preemphasis": { + "lane0": "0x104E06", + "lane1": "0x114D06", + "lane2": "0x0F4F06", + "lane3": "0x114D06" + } + } + }, + "6-6": { + "Default": { + "preemphasis": { + "lane0": "0x0F4F06", + "lane1": "0x0F4F06", + "lane2": "0x104E06", + "lane3": "0x114D06" + } + } + }, + "7-7": { + "Default": { + "preemphasis": { + "lane0": "0x0F4F06", + "lane1": "0x0F4F06", + "lane2": "0x0D5106", + "lane3": "0x0F4F06" + } + } + }, + "8-8": { + "Default": { + "preemphasis": { + "lane0": "0x0D5106", + "lane1": "0x0D5106", + "lane2": "0x0D5106", + "lane3": "0x0E5006" + } + } + }, + "9,23": { + "Default": { + "preemphasis": { + "lane0": "0x0C5206", + "lane1": "0x0C5206", + "lane2": "0x0C5206", + "lane3": "0x0C5206" + } + } + }, + "10-10": { + "Default": { + "preemphasis": { + "lane0": "0x0A5406", + "lane1": "0x0C5206", + "lane2": "0x0A5406", + "lane3": "0x0C5206" + } + } + }, + "11,13": { + "Default": { + "preemphasis": { + "lane0": "0x0A5406", + "lane1": "0x0B5306", + "lane2": "0x0A5406", + "lane3": "0x0B5306" + } + } + }, + "12,14": { + "Default": { + "preemphasis": { + "lane0": "0x0A5406", + "lane1": "0x0B5306", + "lane2": "0x0A5406", + "lane3": "0x0A5406" + } + } + }, + "15,17": { + "Default": { + "preemphasis": { + "lane0": "0x095506", + "lane1": "0x095506", + "lane2": "0x095506", + "lane3": "0x095506" + } + } + }, + "16-16": { + "Default": { + "preemphasis": { + "lane0": "0x0A5406", + "lane1": "0x0A5406", + "lane2": "0x0A5406", + "lane3": "0x095506" + } + } + }, + "18,19": { + "Default": { + "preemphasis": { + "lane0": "0x0A5406", + "lane1": "0x0A5406", + "lane2": "0x0A5406", + "lane3": "0x0A5406" + } + } + }, + "20-20": { + "Default": { + "preemphasis": { + "lane0": "0x0B5306", + "lane1": "0x0C5206", + "lane2": "0x0A5406", + "lane3": "0x0C5206" + } + } + }, + "21-21": { + "Default": { + "preemphasis": { + "lane0": "0x0B5306", + "lane1": "0x0B5306", + "lane2": "0x0B5306", + "lane3": "0x0B5306" + } + } + }, + "22-22": { + "Default": { + "preemphasis": { + "lane0": "0x0B5306", + "lane1": "0x0C5206", + "lane2": "0x0A5406", + "lane3": "0x0A5406" + } + } + }, + "24-24": { + "Default": { + "preemphasis": { + "lane0": "0x0C5206", + "lane1": "0x0C5206", + "lane2": "0x0B5306", + "lane3": "0x0C5206" + } + } + }, + "25-25": { + "Default": { + "preemphasis": { + "lane0": "0x0E5006", + "lane1": "0x0D5106", + "lane2": "0x0D5106", + "lane3": "0x0D5106" + } + } + }, + "26-26": { + "Default": { + "preemphasis": { + "lane0": "0x0E5006", + "lane1": "0x0E5006", + "lane2": "0x0D5106", + "lane3": "0x0E5006" + } + } + }, + "27-27": { + "Default": { + "preemphasis": { + "lane0": "0x0F4F06", + "lane1": "0x114D06", + "lane2": "0x104E06", + "lane3": "0x114D06" + } + } + }, + "28,31": { + "Default": { + "preemphasis": { + "lane0": "0x104E06", + "lane1": "0x114D06", + "lane2": "0x104E06", + "lane3": "0x114D06" + } + } + }, + "29-29": { + "Default": { + "preemphasis": { + "lane0": "0x0F4F06", + "lane1": "0x104E06", + "lane2": "0x104E06", + "lane3": "0x104E06" + } + } + }, + "30-30": { + "Default": { + "preemphasis": { + "lane0": "0x114D06", + "lane1": "0x114D06", + "lane2": "0x114D06", + "lane3": "0x114D06" + } + } + }, + "32-32": { + "Default": { + "preemphasis": { + "lane0": "0x104E06", + "lane1": "0x104E06", + "lane2": "0x114D06", + "lane3": "0x114D06" + } + } + } + } +} diff --git a/device/quanta/x86_64-quanta_ix7_rglbmc-r0/preemphasis-32x100G.soc b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/preemphasis-32x100G.soc index 5837a6fdce..f092f6c29a 100644 --- a/device/quanta/x86_64-quanta_ix7_rglbmc-r0/preemphasis-32x100G.soc +++ b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/preemphasis-32x100G.soc @@ -1,546 +1,545 @@ # Pre-emphasis phy raw c45 0xa5 0x1 0xffde 0 -phy raw c45 0xa5 0x1 0xd130 0x41 -phy raw c45 0xa5 0x1 0xd131 0xd +phy raw c45 0xa5 0x1 0xd130 0x4D +phy raw c45 0xa5 0x1 0xd131 0x611 phy raw c45 0xa5 0x1 0xd134 1 phy raw c45 0xa5 0x1 0xffde 1 -phy raw c45 0xa5 0x1 0xd130 0x41 -phy raw c45 0xa5 0x1 0xd131 0xd +phy raw c45 0xa5 0x1 0xd130 0x4F +phy raw c45 0xa5 0x1 0xd131 0x60F phy raw c45 0xa5 0x1 0xd134 1 phy raw c45 0xa5 0x1 0xffde 2 -phy raw c45 0xa5 0x1 0xd130 0x41 -phy raw c45 0xa5 0x1 0xd131 0xd +phy raw c45 0xa5 0x1 0xd130 0x4F +phy raw c45 0xa5 0x1 0xd131 0x60F phy raw c45 0xa5 0x1 0xd134 1 phy raw c45 0xa5 0x1 0xffde 3 -phy raw c45 0xa5 0x1 0xd130 0x41 -phy raw c45 0xa5 0x1 0xd131 0xd +phy raw c45 0xa5 0x1 0xd130 0x4E +phy raw c45 0xa5 0x1 0xd131 0x610 phy raw c45 0xa5 0x1 0xd134 1 phy raw c45 0xa9 0x1 0xffde 0 -phy raw c45 0xa9 0x1 0xd130 0x41 -phy raw c45 0xa9 0x1 0xd131 0xd +phy raw c45 0xa9 0x1 0xd130 0x4E +phy raw c45 0xa9 0x1 0xd131 0x610 phy raw c45 0xa9 0x1 0xd134 1 phy raw c45 0xa9 0x1 0xffde 1 -phy raw c45 0xa9 0x1 0xd130 0x41 -phy raw c45 0xa9 0x1 0xd131 0xd +phy raw c45 0xa9 0x1 0xd130 0x4E +phy raw c45 0xa9 0x1 0xd131 0x610 phy raw c45 0xa9 0x1 0xd134 1 phy raw c45 0xa9 0x1 0xffde 2 -phy raw c45 0xa9 0x1 0xd130 0x41 -phy raw c45 0xa9 0x1 0xd131 0xd +phy raw c45 0xa9 0x1 0xd130 0x4D +phy raw c45 0xa9 0x1 0xd131 0x611 phy raw c45 0xa9 0x1 0xd134 1 phy raw c45 0xa9 0x1 0xffde 3 -phy raw c45 0xa9 0x1 0xd130 0x41 -phy raw c45 0xa9 0x1 0xd131 0xd +phy raw c45 0xa9 0x1 0xd130 0x4E +phy raw c45 0xa9 0x1 0xd131 0x610 phy raw c45 0xa9 0x1 0xd134 1 phy raw c45 0xc1 0x1 0xffde 0 -phy raw c45 0xc1 0x1 0xd130 0x41 -phy raw c45 0xc1 0x1 0xd131 0xd +phy raw c45 0xc1 0x1 0xd130 0x4E +phy raw c45 0xc1 0x1 0xd131 0x610 phy raw c45 0xc1 0x1 0xd134 1 phy raw c45 0xc1 0x1 0xffde 1 -phy raw c45 0xc1 0x1 0xd130 0x41 -phy raw c45 0xc1 0x1 0xd131 0xd +phy raw c45 0xc1 0x1 0xd130 0x4E +phy raw c45 0xc1 0x1 0xd131 0x610 phy raw c45 0xc1 0x1 0xd134 1 phy raw c45 0xc1 0x1 0xffde 2 -phy raw c45 0xc1 0x1 0xd130 0x41 -phy raw c45 0xc1 0x1 0xd131 0xd +phy raw c45 0xc1 0x1 0xd130 0x4E +phy raw c45 0xc1 0x1 0xd131 0x610 phy raw c45 0xc1 0x1 0xd134 1 phy raw c45 0xc1 0x1 0xffde 3 -phy raw c45 0xc1 0x1 0xd130 0x41 -phy raw c45 0xc1 0x1 0xd131 0xd +phy raw c45 0xc1 0x1 0xd130 0x4E +phy raw c45 0xc1 0x1 0xd131 0x610 phy raw c45 0xc1 0x1 0xd134 1 phy raw c45 0xc5 0x1 0xffde 0 -phy raw c45 0xc5 0x1 0xd130 0x41 -phy raw c45 0xc5 0x1 0xd131 0xd +phy raw c45 0xc5 0x1 0xd130 0x4E +phy raw c45 0xc5 0x1 0xd131 0x610 phy raw c45 0xc5 0x1 0xd134 1 phy raw c45 0xc5 0x1 0xffde 1 -phy raw c45 0xc5 0x1 0xd130 0x41 -phy raw c45 0xc5 0x1 0xd131 0xd +phy raw c45 0xc5 0x1 0xd130 0x4E +phy raw c45 0xc5 0x1 0xd131 0x610 phy raw c45 0xc5 0x1 0xd134 1 phy raw c45 0xc5 0x1 0xffde 2 -phy raw c45 0xc5 0x1 0xd130 0x41 -phy raw c45 0xc5 0x1 0xd131 0xd +phy raw c45 0xc5 0x1 0xd130 0x4D +phy raw c45 0xc5 0x1 0xd131 0x611 phy raw c45 0xc5 0x1 0xd134 1 phy raw c45 0xc5 0x1 0xffde 3 -phy raw c45 0xc5 0x1 0xd130 0x41 -phy raw c45 0xc5 0x1 0xd131 0xd +phy raw c45 0xc5 0x1 0xd130 0x4E +phy raw c45 0xc5 0x1 0xd131 0x610 phy raw c45 0xc5 0x1 0xd134 1 phy raw c45 0x81 0x1 0xffde 0 -phy raw c45 0x81 0x1 0xd130 0x41 -phy raw c45 0x81 0x1 0xd131 0xd +phy raw c45 0x81 0x1 0xd130 0x4E +phy raw c45 0x81 0x1 0xd131 0x610 phy raw c45 0x81 0x1 0xd134 1 phy raw c45 0x81 0x1 0xffde 1 -phy raw c45 0x81 0x1 0xd130 0x41 -phy raw c45 0x81 0x1 0xd131 0xd +phy raw c45 0x81 0x1 0xd130 0x4D +phy raw c45 0x81 0x1 0xd131 0x611 phy raw c45 0x81 0x1 0xd134 1 phy raw c45 0x81 0x1 0xffde 2 -phy raw c45 0x81 0x1 0xd130 0x41 -phy raw c45 0x81 0x1 0xd131 0xd +phy raw c45 0x81 0x1 0xd130 0x4F +phy raw c45 0x81 0x1 0xd131 0x60F phy raw c45 0x81 0x1 0xd134 1 phy raw c45 0x81 0x1 0xffde 3 -phy raw c45 0x81 0x1 0xd130 0x41 -phy raw c45 0x81 0x1 0xd131 0xd +phy raw c45 0x81 0x1 0xd130 0x4D +phy raw c45 0x81 0x1 0xd131 0x611 phy raw c45 0x81 0x1 0xd134 1 phy raw c45 0x85 0x1 0xffde 0 -phy raw c45 0x85 0x1 0xd130 0x41 -phy raw c45 0x85 0x1 0xd131 0xd +phy raw c45 0x85 0x1 0xd130 0x4F +phy raw c45 0x85 0x1 0xd131 0x60F phy raw c45 0x85 0x1 0xd134 1 phy raw c45 0x85 0x1 0xffde 1 -phy raw c45 0x85 0x1 0xd130 0x41 -phy raw c45 0x85 0x1 0xd131 0xd +phy raw c45 0x85 0x1 0xd130 0x4F +phy raw c45 0x85 0x1 0xd131 0x60F phy raw c45 0x85 0x1 0xd134 1 phy raw c45 0x85 0x1 0xffde 2 -phy raw c45 0x85 0x1 0xd130 0x41 -phy raw c45 0x85 0x1 0xd131 0xd +phy raw c45 0x85 0x1 0xd130 0x4E +phy raw c45 0x85 0x1 0xd131 0x610 phy raw c45 0x85 0x1 0xd134 1 phy raw c45 0x85 0x1 0xffde 3 -phy raw c45 0x85 0x1 0xd130 0x41 -phy raw c45 0x85 0x1 0xd131 0xd +phy raw c45 0x85 0x1 0xd130 0x4D +phy raw c45 0x85 0x1 0xd131 0x611 phy raw c45 0x85 0x1 0xd134 1 phy raw c45 0x89 0x1 0xffde 0 -phy raw c45 0x89 0x1 0xd130 0x41 -phy raw c45 0x89 0x1 0xd131 0xd +phy raw c45 0x89 0x1 0xd130 0x4F +phy raw c45 0x89 0x1 0xd131 0x60F phy raw c45 0x89 0x1 0xd134 1 phy raw c45 0x89 0x1 0xffde 1 -phy raw c45 0x89 0x1 0xd130 0x41 -phy raw c45 0x89 0x1 0xd131 0xd +phy raw c45 0x89 0x1 0xd130 0x4F +phy raw c45 0x89 0x1 0xd131 0x60F phy raw c45 0x89 0x1 0xd134 1 phy raw c45 0x89 0x1 0xffde 2 -phy raw c45 0x89 0x1 0xd130 0x41 -phy raw c45 0x89 0x1 0xd131 0xd +phy raw c45 0x89 0x1 0xd130 0x51 +phy raw c45 0x89 0x1 0xd131 0x60D phy raw c45 0x89 0x1 0xd134 1 phy raw c45 0x89 0x1 0xffde 3 -phy raw c45 0x89 0x1 0xd130 0x41 -phy raw c45 0x89 0x1 0xd131 0xd +phy raw c45 0x89 0x1 0xd130 0x4F +phy raw c45 0x89 0x1 0xd131 0x60F phy raw c45 0x89 0x1 0xd134 1 phy raw c45 0x8d 0x1 0xffde 0 -phy raw c45 0x8d 0x1 0xd130 0x41 -phy raw c45 0x8d 0x1 0xd131 0xd +phy raw c45 0x8d 0x1 0xd130 0x51 +phy raw c45 0x8d 0x1 0xd131 0x60D phy raw c45 0x8d 0x1 0xd134 1 phy raw c45 0x8d 0x1 0xffde 1 -phy raw c45 0x8d 0x1 0xd130 0x41 -phy raw c45 0x8d 0x1 0xd131 0xd +phy raw c45 0x8d 0x1 0xd130 0x51 +phy raw c45 0x8d 0x1 0xd131 0x60D phy raw c45 0x8d 0x1 0xd134 1 phy raw c45 0x8d 0x1 0xffde 2 -phy raw c45 0x8d 0x1 0xd130 0x41 -phy raw c45 0x8d 0x1 0xd131 0xd +phy raw c45 0x8d 0x1 0xd130 0x51 +phy raw c45 0x8d 0x1 0xd131 0x60D phy raw c45 0x8d 0x1 0xd134 1 phy raw c45 0x8d 0x1 0xffde 3 -phy raw c45 0x8d 0x1 0xd130 0x41 -phy raw c45 0x8d 0x1 0xd131 0xd +phy raw c45 0x8d 0x1 0xd130 0x50 +phy raw c45 0x8d 0x1 0xd131 0x60E phy raw c45 0x8d 0x1 0xd134 1 phy raw c45 0x91 0x1 0xffde 0 -phy raw c45 0x91 0x1 0xd130 0x41 -phy raw c45 0x91 0x1 0xd131 0x0408 +phy raw c45 0x91 0x1 0xd130 0x52 +phy raw c45 0x91 0x1 0xd131 0x60C phy raw c45 0x91 0x1 0xd134 1 phy raw c45 0x91 0x1 0xffde 1 -phy raw c45 0x91 0x1 0xd130 0x41 -phy raw c45 0x91 0x1 0xd131 0x0408 +phy raw c45 0x91 0x1 0xd130 0x52 +phy raw c45 0x91 0x1 0xd131 0x60C phy raw c45 0x91 0x1 0xd134 1 phy raw c45 0x91 0x1 0xffde 2 -phy raw c45 0x91 0x1 0xd130 0x41 -phy raw c45 0x91 0x1 0xd131 0x0408 +phy raw c45 0x91 0x1 0xd130 0x52 +phy raw c45 0x91 0x1 0xd131 0x60C phy raw c45 0x91 0x1 0xd134 1 phy raw c45 0x91 0x1 0xffde 3 -phy raw c45 0x91 0x1 0xd130 0x41 -phy raw c45 0x91 0x1 0xd131 0x0408 +phy raw c45 0x91 0x1 0xd130 0x52 +phy raw c45 0x91 0x1 0xd131 0x60C phy raw c45 0x91 0x1 0xd134 1 phy raw c45 0x95 0x1 0xffde 0 -phy raw c45 0x95 0x1 0xd130 0x41 -phy raw c45 0x95 0x1 0xd131 0x0307 +phy raw c45 0x95 0x1 0xd130 0x54 +phy raw c45 0x95 0x1 0xd131 0x60A phy raw c45 0x95 0x1 0xd134 1 phy raw c45 0x95 0x1 0xffde 1 -phy raw c45 0x95 0x1 0xd130 0x41 -phy raw c45 0x95 0x1 0xd131 0x0307 +phy raw c45 0x95 0x1 0xd130 0x52 +phy raw c45 0x95 0x1 0xd131 0x60C phy raw c45 0x95 0x1 0xd134 1 phy raw c45 0x95 0x1 0xffde 2 -phy raw c45 0x95 0x1 0xd130 0x41 -phy raw c45 0x95 0x1 0xd131 0x0307 +phy raw c45 0x95 0x1 0xd130 0x54 +phy raw c45 0x95 0x1 0xd131 0x60A phy raw c45 0x95 0x1 0xd134 1 phy raw c45 0x95 0x1 0xffde 3 -phy raw c45 0x95 0x1 0xd130 0x41 -phy raw c45 0x95 0x1 0xd131 0x0307 +phy raw c45 0x95 0x1 0xd130 0x52 +phy raw c45 0x95 0x1 0xd131 0x60C phy raw c45 0x95 0x1 0xd134 1 phy raw c45 0xa1 0x1 0xffde 0 -phy raw c45 0xa1 0x1 0xd130 0x41 -phy raw c45 0xa1 0x1 0xd131 0x0307 +phy raw c45 0xa1 0x1 0xd130 0x54 +phy raw c45 0xa1 0x1 0xd131 0x60A phy raw c45 0xa1 0x1 0xd134 1 phy raw c45 0xa1 0x1 0xffde 1 -phy raw c45 0xa1 0x1 0xd130 0x41 -phy raw c45 0xa1 0x1 0xd131 0x0307 +phy raw c45 0xa1 0x1 0xd130 0x53 +phy raw c45 0xa1 0x1 0xd131 0x60B phy raw c45 0xa1 0x1 0xd134 1 phy raw c45 0xa1 0x1 0xffde 2 -phy raw c45 0xa1 0x1 0xd130 0x41 -phy raw c45 0xa1 0x1 0xd131 0x0307 +phy raw c45 0xa1 0x1 0xd130 0x54 +phy raw c45 0xa1 0x1 0xd131 0x60A phy raw c45 0xa1 0x1 0xd134 1 phy raw c45 0xa1 0x1 0xffde 3 -phy raw c45 0xa1 0x1 0xd130 0x41 -phy raw c45 0xa1 0x1 0xd131 0x0307 +phy raw c45 0xa1 0x1 0xd130 0x53 +phy raw c45 0xa1 0x1 0xd131 0x60B phy raw c45 0xa1 0x1 0xd134 1 phy raw c45 0xad 0x1 0xffde 0 -phy raw c45 0xad 0x1 0xd130 0x41 -phy raw c45 0xad 0x1 0xd131 0x0307 +phy raw c45 0xad 0x1 0xd130 0x54 +phy raw c45 0xad 0x1 0xd131 0x60A phy raw c45 0xad 0x1 0xd134 1 phy raw c45 0xad 0x1 0xffde 1 -phy raw c45 0xad 0x1 0xd130 0x41 -phy raw c45 0xad 0x1 0xd131 0x0307 +phy raw c45 0xad 0x1 0xd130 0x53 +phy raw c45 0xad 0x1 0xd131 0x60B phy raw c45 0xad 0x1 0xd134 1 phy raw c45 0xad 0x1 0xffde 2 -phy raw c45 0xad 0x1 0xd130 0x41 -phy raw c45 0xad 0x1 0xd131 0x0307 +phy raw c45 0xad 0x1 0xd130 0x54 +phy raw c45 0xad 0x1 0xd131 0x60A phy raw c45 0xad 0x1 0xd134 1 phy raw c45 0xad 0x1 0xffde 3 -phy raw c45 0xad 0x1 0xd130 0x41 -phy raw c45 0xad 0x1 0xd131 0x0307 +phy raw c45 0xad 0x1 0xd130 0x54 +phy raw c45 0xad 0x1 0xd131 0x60A phy raw c45 0xad 0x1 0xd134 1 phy raw c45 0xc9 0x1 0xffde 0 -phy raw c45 0xc9 0x1 0xd130 0x41 -phy raw c45 0xc9 0x1 0xd131 0x0307 +phy raw c45 0xc9 0x1 0xd130 0x54 +phy raw c45 0xc9 0x1 0xd131 0x60A phy raw c45 0xc9 0x1 0xd134 1 phy raw c45 0xc9 0x1 0xffde 1 -phy raw c45 0xc9 0x1 0xd130 0x41 -phy raw c45 0xc9 0x1 0xd131 0x0307 +phy raw c45 0xc9 0x1 0xd130 0x53 +phy raw c45 0xc9 0x1 0xd131 0x60B phy raw c45 0xc9 0x1 0xd134 1 phy raw c45 0xc9 0x1 0xffde 2 -phy raw c45 0xc9 0x1 0xd130 0x41 -phy raw c45 0xc9 0x1 0xd131 0x0307 +phy raw c45 0xc9 0x1 0xd130 0x54 +phy raw c45 0xc9 0x1 0xd131 0x60A phy raw c45 0xc9 0x1 0xd134 1 phy raw c45 0xc9 0x1 0xffde 3 -phy raw c45 0xc9 0x1 0xd130 0x41 -phy raw c45 0xc9 0x1 0xd131 0x0307 +phy raw c45 0xc9 0x1 0xd130 0x53 +phy raw c45 0xc9 0x1 0xd131 0x60B phy raw c45 0xc9 0x1 0xd134 1 phy raw c45 0xcd 0x1 0xffde 0 -phy raw c45 0xcd 0x1 0xd130 0x41 -phy raw c45 0xcd 0x1 0xd131 0x0307 +phy raw c45 0xcd 0x1 0xd130 0x54 +phy raw c45 0xcd 0x1 0xd131 0x60A phy raw c45 0xcd 0x1 0xd134 1 phy raw c45 0xcd 0x1 0xffde 1 -phy raw c45 0xcd 0x1 0xd130 0x41 -phy raw c45 0xcd 0x1 0xd131 0x0307 +phy raw c45 0xcd 0x1 0xd130 0x53 +phy raw c45 0xcd 0x1 0xd131 0x60B phy raw c45 0xcd 0x1 0xd134 1 phy raw c45 0xcd 0x1 0xffde 2 -phy raw c45 0xcd 0x1 0xd130 0x41 -phy raw c45 0xcd 0x1 0xd131 0x0307 +phy raw c45 0xcd 0x1 0xd130 0x54 +phy raw c45 0xcd 0x1 0xd131 0x60A phy raw c45 0xcd 0x1 0xd134 1 phy raw c45 0xcd 0x1 0xffde 3 -phy raw c45 0xcd 0x1 0xd130 0x41 -phy raw c45 0xcd 0x1 0xd131 0x0307 +phy raw c45 0xcd 0x1 0xd130 0x54 +phy raw c45 0xcd 0x1 0xd131 0x60A phy raw c45 0xcd 0x1 0xd134 1 phy raw c45 0xd1 0x1 0xffde 0 -phy raw c45 0xd1 0x1 0xd130 0x41 -phy raw c45 0xd1 0x1 0xd131 0x0307 +phy raw c45 0xd1 0x1 0xd130 0x55 +phy raw c45 0xd1 0x1 0xd131 0x609 phy raw c45 0xd1 0x1 0xd134 1 phy raw c45 0xd1 0x1 0xffde 1 -phy raw c45 0xd1 0x1 0xd130 0x41 -phy raw c45 0xd1 0x1 0xd131 0x0307 +phy raw c45 0xd1 0x1 0xd130 0x55 +phy raw c45 0xd1 0x1 0xd131 0x609 phy raw c45 0xd1 0x1 0xd134 1 phy raw c45 0xd1 0x1 0xffde 2 -phy raw c45 0xd1 0x1 0xd130 0x41 -phy raw c45 0xd1 0x1 0xd131 0x0307 +phy raw c45 0xd1 0x1 0xd130 0x55 +phy raw c45 0xd1 0x1 0xd131 0x609 phy raw c45 0xd1 0x1 0xd134 1 phy raw c45 0xd1 0x1 0xffde 3 -phy raw c45 0xd1 0x1 0xd130 0x41 -phy raw c45 0xd1 0x1 0xd131 0x0307 +phy raw c45 0xd1 0x1 0xd130 0x55 +phy raw c45 0xd1 0x1 0xd131 0x609 phy raw c45 0xd1 0x1 0xd134 1 phy raw c45 0xd5 0x1 0xffde 0 -phy raw c45 0xd5 0x1 0xd130 0x41 -phy raw c45 0xd5 0x1 0xd131 0x0307 +phy raw c45 0xd5 0x1 0xd130 0x54 +phy raw c45 0xd5 0x1 0xd131 0x60A phy raw c45 0xd5 0x1 0xd134 1 phy raw c45 0xd5 0x1 0xffde 1 -phy raw c45 0xd5 0x1 0xd130 0x41 -phy raw c45 0xd5 0x1 0xd131 0x0307 +phy raw c45 0xd5 0x1 0xd130 0x54 +phy raw c45 0xd5 0x1 0xd131 0x60A phy raw c45 0xd5 0x1 0xd134 1 phy raw c45 0xd5 0x1 0xffde 2 -phy raw c45 0xd5 0x1 0xd130 0x41 -phy raw c45 0xd5 0x1 0xd131 0x0307 +phy raw c45 0xd5 0x1 0xd130 0x54 +phy raw c45 0xd5 0x1 0xd131 0x60A phy raw c45 0xd5 0x1 0xd134 1 phy raw c45 0xd5 0x1 0xffde 3 -phy raw c45 0xd5 0x1 0xd130 0x41 -phy raw c45 0xd5 0x1 0xd131 0x0307 +phy raw c45 0xd5 0x1 0xd130 0x55 +phy raw c45 0xd5 0x1 0xd131 0x609 phy raw c45 0xd5 0x1 0xd134 1 phy raw c45 0xe1 0x1 0xffde 0 -phy raw c45 0xe1 0x1 0xd130 0x41 -phy raw c45 0xe1 0x1 0xd131 0x0307 +phy raw c45 0xe1 0x1 0xd130 0x55 +phy raw c45 0xe1 0x1 0xd131 0x609 phy raw c45 0xe1 0x1 0xd134 1 phy raw c45 0xe1 0x1 0xffde 1 -phy raw c45 0xe1 0x1 0xd130 0x41 -phy raw c45 0xe1 0x1 0xd131 0x0307 +phy raw c45 0xe1 0x1 0xd130 0x55 +phy raw c45 0xe1 0x1 0xd131 0x609 phy raw c45 0xe1 0x1 0xd134 1 phy raw c45 0xe1 0x1 0xffde 2 -phy raw c45 0xe1 0x1 0xd130 0x41 -phy raw c45 0xe1 0x1 0xd131 0x0307 +phy raw c45 0xe1 0x1 0xd130 0x55 +phy raw c45 0xe1 0x1 0xd131 0x609 phy raw c45 0xe1 0x1 0xd134 1 phy raw c45 0xe1 0x1 0xffde 3 -phy raw c45 0xe1 0x1 0xd130 0x41 -phy raw c45 0xe1 0x1 0xd131 0x0307 +phy raw c45 0xe1 0x1 0xd130 0x55 +phy raw c45 0xe1 0x1 0xd131 0x609 phy raw c45 0xe1 0x1 0xd134 1 phy raw c45 0xe5 0x1 0xffde 0 -phy raw c45 0xe5 0x1 0xd130 0x41 -phy raw c45 0xe5 0x1 0xd131 0x0307 +phy raw c45 0xe5 0x1 0xd130 0x54 +phy raw c45 0xe5 0x1 0xd131 0x60A phy raw c45 0xe5 0x1 0xd134 1 phy raw c45 0xe5 0x1 0xffde 1 -phy raw c45 0xe5 0x1 0xd130 0x41 -phy raw c45 0xe5 0x1 0xd131 0x0307 +phy raw c45 0xe5 0x1 0xd130 0x54 +phy raw c45 0xe5 0x1 0xd131 0x60A phy raw c45 0xe5 0x1 0xd134 1 phy raw c45 0xe5 0x1 0xffde 2 -phy raw c45 0xe5 0x1 0xd130 0x41 -phy raw c45 0xe5 0x1 0xd131 0x0307 +phy raw c45 0xe5 0x1 0xd130 0x54 +phy raw c45 0xe5 0x1 0xd131 0x60A phy raw c45 0xe5 0x1 0xd134 1 phy raw c45 0xe5 0x1 0xffde 3 -phy raw c45 0xe5 0x1 0xd130 0x41 -phy raw c45 0xe5 0x1 0xd131 0x0307 +phy raw c45 0xe5 0x1 0xd130 0x54 +phy raw c45 0xe5 0x1 0xd131 0x60A phy raw c45 0xe5 0x1 0xd134 1 phy raw c45 0xe9 0x1 0xffde 0 -phy raw c45 0xe9 0x1 0xd130 0x41 -phy raw c45 0xe9 0x1 0xd131 0x0307 +phy raw c45 0xe9 0x1 0xd130 0x54 +phy raw c45 0xe9 0x1 0xd131 0x60A phy raw c45 0xe9 0x1 0xd134 1 phy raw c45 0xe9 0x1 0xffde 1 -phy raw c45 0xe9 0x1 0xd130 0x41 -phy raw c45 0xe9 0x1 0xd131 0x0307 +phy raw c45 0xe9 0x1 0xd130 0x54 +phy raw c45 0xe9 0x1 0xd131 0x60A phy raw c45 0xe9 0x1 0xd134 1 phy raw c45 0xe9 0x1 0xffde 2 -phy raw c45 0xe9 0x1 0xd130 0x41 -phy raw c45 0xe9 0x1 0xd131 0x0307 +phy raw c45 0xe9 0x1 0xd130 0x54 +phy raw c45 0xe9 0x1 0xd131 0x60A phy raw c45 0xe9 0x1 0xd134 1 phy raw c45 0xe9 0x1 0xffde 3 -phy raw c45 0xe9 0x1 0xd130 0x41 -phy raw c45 0xe9 0x1 0xd131 0x0307 +phy raw c45 0xe9 0x1 0xd130 0x54 +phy raw c45 0xe9 0x1 0xd131 0x60A phy raw c45 0xe9 0x1 0xd134 1 phy raw c45 0xed 0x1 0xffde 0 -phy raw c45 0xed 0x1 0xd130 0x41 -phy raw c45 0xed 0x1 0xd131 0xb +phy raw c45 0xed 0x1 0xd130 0x53 +phy raw c45 0xed 0x1 0xd131 0x60B phy raw c45 0xed 0x1 0xd134 1 phy raw c45 0xed 0x1 0xffde 1 -phy raw c45 0xed 0x1 0xd130 0x41 -phy raw c45 0xed 0x1 0xd131 0xb +phy raw c45 0xed 0x1 0xd130 0x52 +phy raw c45 0xed 0x1 0xd131 0x60C phy raw c45 0xed 0x1 0xd134 1 phy raw c45 0xed 0x1 0xffde 2 -phy raw c45 0xed 0x1 0xd130 0x41 -phy raw c45 0xed 0x1 0xd131 0xb +phy raw c45 0xed 0x1 0xd130 0x54 +phy raw c45 0xed 0x1 0xd131 0x60A phy raw c45 0xed 0x1 0xd134 1 phy raw c45 0xed 0x1 0xffde 3 -phy raw c45 0xed 0x1 0xd130 0x41 -phy raw c45 0xed 0x1 0xd131 0xb +phy raw c45 0xed 0x1 0xd130 0x52 +phy raw c45 0xed 0x1 0xd131 0x60C phy raw c45 0xed 0x1 0xd134 1 phy raw c45 0x185 0x1 0xffde 0 -phy raw c45 0x185 0x1 0xd130 0x41 -phy raw c45 0x185 0x1 0xd131 0x0307 +phy raw c45 0x185 0x1 0xd130 0x53 +phy raw c45 0x185 0x1 0xd131 0x60B phy raw c45 0x185 0x1 0xd134 1 phy raw c45 0x185 0x1 0xffde 1 -phy raw c45 0x185 0x1 0xd130 0x41 -phy raw c45 0x185 0x1 0xd131 0x0307 +phy raw c45 0x185 0x1 0xd130 0x53 +phy raw c45 0x185 0x1 0xd131 0x60B phy raw c45 0x185 0x1 0xd134 1 phy raw c45 0x185 0x1 0xffde 2 -phy raw c45 0x185 0x1 0xd130 0x41 -phy raw c45 0x185 0x1 0xd131 0x0307 +phy raw c45 0x185 0x1 0xd130 0x53 +phy raw c45 0x185 0x1 0xd131 0x60B phy raw c45 0x185 0x1 0xd134 1 phy raw c45 0x185 0x1 0xffde 3 -phy raw c45 0x185 0x1 0xd130 0x41 -phy raw c45 0x185 0x1 0xd131 0x0307 +phy raw c45 0x185 0x1 0xd130 0x53 +phy raw c45 0x185 0x1 0xd131 0x60B phy raw c45 0x185 0x1 0xd134 1 phy raw c45 0x18d 0x1 0xffde 0 -phy raw c45 0x18d 0x1 0xd130 0x41 -phy raw c45 0x18d 0x1 0xd131 0x0307 +phy raw c45 0x18d 0x1 0xd130 0x53 +phy raw c45 0x18d 0x1 0xd131 0x60B phy raw c45 0x18d 0x1 0xd134 1 phy raw c45 0x18d 0x1 0xffde 1 -phy raw c45 0x18d 0x1 0xd130 0x41 -phy raw c45 0x18d 0x1 0xd131 0x0307 +phy raw c45 0x18d 0x1 0xd130 0x52 +phy raw c45 0x18d 0x1 0xd131 0x60C phy raw c45 0x18d 0x1 0xd134 1 phy raw c45 0x18d 0x1 0xffde 2 -phy raw c45 0x18d 0x1 0xd130 0x41 -phy raw c45 0x18d 0x1 0xd131 0x0307 +phy raw c45 0x18d 0x1 0xd130 0x54 +phy raw c45 0x18d 0x1 0xd131 0x60A phy raw c45 0x18d 0x1 0xd134 1 phy raw c45 0x18d 0x1 0xffde 3 -phy raw c45 0x18d 0x1 0xd130 0x41 -phy raw c45 0x18d 0x1 0xd131 0x0307 +phy raw c45 0x18d 0x1 0xd130 0x54 +phy raw c45 0x18d 0x1 0xd131 0x60A phy raw c45 0x18d 0x1 0xd134 1 phy raw c45 0x1a1 0x1 0xffde 0 -phy raw c45 0x1a1 0x1 0xd130 0x41 -phy raw c45 0x1a1 0x1 0xd131 0x0408 +phy raw c45 0x1a1 0x1 0xd130 0x52 +phy raw c45 0x1a1 0x1 0xd131 0x60C phy raw c45 0x1a1 0x1 0xd134 1 phy raw c45 0x1a1 0x1 0xffde 1 -phy raw c45 0x1a1 0x1 0xd130 0x41 -phy raw c45 0x1a1 0x1 0xd131 0x0408 +phy raw c45 0x1a1 0x1 0xd130 0x52 +phy raw c45 0x1a1 0x1 0xd131 0x60C phy raw c45 0x1a1 0x1 0xd134 1 phy raw c45 0x1a1 0x1 0xffde 2 -phy raw c45 0x1a1 0x1 0xd130 0x41 -phy raw c45 0x1a1 0x1 0xd131 0x0408 +phy raw c45 0x1a1 0x1 0xd130 0x52 +phy raw c45 0x1a1 0x1 0xd131 0x60C phy raw c45 0x1a1 0x1 0xd134 1 phy raw c45 0x1a1 0x1 0xffde 3 -phy raw c45 0x1a1 0x1 0xd130 0x41 -phy raw c45 0x1a1 0x1 0xd131 0x0408 +phy raw c45 0x1a1 0x1 0xd130 0x52 +phy raw c45 0x1a1 0x1 0xd131 0x60C phy raw c45 0x1a1 0x1 0xd134 1 phy raw c45 0x1a5 0x1 0xffde 0 -phy raw c45 0x1a5 0x1 0xd130 0x41 -phy raw c45 0x1a5 0x1 0xd131 0x0408 +phy raw c45 0x1a5 0x1 0xd130 0x52 +phy raw c45 0x1a5 0x1 0xd131 0x60C phy raw c45 0x1a5 0x1 0xd134 1 phy raw c45 0x1a5 0x1 0xffde 1 -phy raw c45 0x1a5 0x1 0xd130 0x41 -phy raw c45 0x1a5 0x1 0xd131 0x0408 +phy raw c45 0x1a5 0x1 0xd130 0x52 +phy raw c45 0x1a5 0x1 0xd131 0x60C phy raw c45 0x1a5 0x1 0xd134 1 phy raw c45 0x1a5 0x1 0xffde 2 -phy raw c45 0x1a5 0x1 0xd130 0x41 -phy raw c45 0x1a5 0x1 0xd131 0x0408 +phy raw c45 0x1a5 0x1 0xd130 0x53 +phy raw c45 0x1a5 0x1 0xd131 0x60B phy raw c45 0x1a5 0x1 0xd134 1 phy raw c45 0x1a5 0x1 0xffde 3 -phy raw c45 0x1a5 0x1 0xd130 0x41 -phy raw c45 0x1a5 0x1 0xd131 0x0408 +phy raw c45 0x1a5 0x1 0xd130 0x52 +phy raw c45 0x1a5 0x1 0xd131 0x60C phy raw c45 0x1a5 0x1 0xd134 1 phy raw c45 0x1a9 0x1 0xffde 0 -phy raw c45 0x1a9 0x1 0xd130 0x41 -phy raw c45 0x1a9 0x1 0xd131 0xb +phy raw c45 0x1a9 0x1 0xd130 0x50 +phy raw c45 0x1a9 0x1 0xd131 0x60E phy raw c45 0x1a9 0x1 0xd134 1 phy raw c45 0x1a9 0x1 0xffde 1 -phy raw c45 0x1a9 0x1 0xd130 0x41 -phy raw c45 0x1a9 0x1 0xd131 0xb +phy raw c45 0x1a9 0x1 0xd130 0x51 +phy raw c45 0x1a9 0x1 0xd131 0x60D phy raw c45 0x1a9 0x1 0xd134 1 phy raw c45 0x1a9 0x1 0xffde 2 -phy raw c45 0x1a9 0x1 0xd130 0x41 -phy raw c45 0x1a9 0x1 0xd131 0xb +phy raw c45 0x1a9 0x1 0xd130 0x51 +phy raw c45 0x1a9 0x1 0xd131 0x60D phy raw c45 0x1a9 0x1 0xd134 1 phy raw c45 0x1a9 0x1 0xffde 3 -phy raw c45 0x1a9 0x1 0xd130 0x41 -phy raw c45 0x1a9 0x1 0xd131 0xb +phy raw c45 0x1a9 0x1 0xd130 0x51 +phy raw c45 0x1a9 0x1 0xd131 0x60D phy raw c45 0x1a9 0x1 0xd134 1 phy raw c45 0x1ad 0x1 0xffde 0 -phy raw c45 0x1ad 0x1 0xd130 0x41 -phy raw c45 0x1ad 0x1 0xd131 0xc +phy raw c45 0x1ad 0x1 0xd130 0x50 +phy raw c45 0x1ad 0x1 0xd131 0x60E phy raw c45 0x1ad 0x1 0xd134 1 phy raw c45 0x1ad 0x1 0xffde 1 -phy raw c45 0x1ad 0x1 0xd130 0x41 -phy raw c45 0x1ad 0x1 0xd131 0xc +phy raw c45 0x1ad 0x1 0xd130 0x50 +phy raw c45 0x1ad 0x1 0xd131 0x60E phy raw c45 0x1ad 0x1 0xd134 1 phy raw c45 0x1ad 0x1 0xffde 2 -phy raw c45 0x1ad 0x1 0xd130 0x41 -phy raw c45 0x1ad 0x1 0xd131 0xc +phy raw c45 0x1ad 0x1 0xd130 0x51 +phy raw c45 0x1ad 0x1 0xd131 0x60D phy raw c45 0x1ad 0x1 0xd134 1 phy raw c45 0x1ad 0x1 0xffde 3 -phy raw c45 0x1ad 0x1 0xd130 0x41 -phy raw c45 0x1ad 0x1 0xd131 0xc +phy raw c45 0x1ad 0x1 0xd130 0x50 +phy raw c45 0x1ad 0x1 0xd131 0x60E phy raw c45 0x1ad 0x1 0xd134 1 phy raw c45 0x1b1 0x1 0xffde 0 -phy raw c45 0x1b1 0x1 0xd130 0x41 -phy raw c45 0x1b1 0x1 0xd131 0xd +phy raw c45 0x1b1 0x1 0xd130 0x4F +phy raw c45 0x1b1 0x1 0xd131 0x60F phy raw c45 0x1b1 0x1 0xd134 1 phy raw c45 0x1b1 0x1 0xffde 1 -phy raw c45 0x1b1 0x1 0xd130 0x41 -phy raw c45 0x1b1 0x1 0xd131 0xd +phy raw c45 0x1b1 0x1 0xd130 0x4D +phy raw c45 0x1b1 0x1 0xd131 0x611 phy raw c45 0x1b1 0x1 0xd134 1 phy raw c45 0x1b1 0x1 0xffde 2 -phy raw c45 0x1b1 0x1 0xd130 0x41 -phy raw c45 0x1b1 0x1 0xd131 0xd +phy raw c45 0x1b1 0x1 0xd130 0x4E +phy raw c45 0x1b1 0x1 0xd131 0x610 phy raw c45 0x1b1 0x1 0xd134 1 phy raw c45 0x1b1 0x1 0xffde 3 -phy raw c45 0x1b1 0x1 0xd130 0x41 -phy raw c45 0x1b1 0x1 0xd131 0xd +phy raw c45 0x1b1 0x1 0xd130 0x4D +phy raw c45 0x1b1 0x1 0xd131 0x611 phy raw c45 0x1b1 0x1 0xd134 1 phy raw c45 0x1b5 0x1 0xffde 0 -phy raw c45 0x1b5 0x1 0xd130 0x41 -phy raw c45 0x1b5 0x1 0xd131 0xf +phy raw c45 0x1b5 0x1 0xd130 0x4E +phy raw c45 0x1b5 0x1 0xd131 0x610 phy raw c45 0x1b5 0x1 0xd134 1 phy raw c45 0x1b5 0x1 0xffde 1 -phy raw c45 0x1b5 0x1 0xd130 0x41 -phy raw c45 0x1b5 0x1 0xd131 0xf +phy raw c45 0x1b5 0x1 0xd130 0x4D +phy raw c45 0x1b5 0x1 0xd131 0x611 phy raw c45 0x1b5 0x1 0xd134 1 phy raw c45 0x1b5 0x1 0xffde 2 -phy raw c45 0x1b5 0x1 0xd130 0x41 -phy raw c45 0x1b5 0x1 0xd131 0xf +phy raw c45 0x1b5 0x1 0xd130 0x4E +phy raw c45 0x1b5 0x1 0xd131 0x610 phy raw c45 0x1b5 0x1 0xd134 1 phy raw c45 0x1b5 0x1 0xffde 3 -phy raw c45 0x1b5 0x1 0xd130 0x41 -phy raw c45 0x1b5 0x1 0xd131 0xf +phy raw c45 0x1b5 0x1 0xd130 0x4D +phy raw c45 0x1b5 0x1 0xd131 0x611 phy raw c45 0x1b5 0x1 0xd134 1 phy raw c45 0xf1 0x1 0xffde 0 -phy raw c45 0xf1 0x1 0xd130 0x41 -phy raw c45 0xf1 0x1 0xd131 0xd +phy raw c45 0xf1 0x1 0xd130 0x4F +phy raw c45 0xf1 0x1 0xd131 0x60F phy raw c45 0xf1 0x1 0xd134 1 phy raw c45 0xf1 0x1 0xffde 1 -phy raw c45 0xf1 0x1 0xd130 0x41 -phy raw c45 0xf1 0x1 0xd131 0xd +phy raw c45 0xf1 0x1 0xd130 0x4E +phy raw c45 0xf1 0x1 0xd131 0x610 phy raw c45 0xf1 0x1 0xd134 1 phy raw c45 0xf1 0x1 0xffde 2 -phy raw c45 0xf1 0x1 0xd130 0x41 -phy raw c45 0xf1 0x1 0xd131 0xd +phy raw c45 0xf1 0x1 0xd130 0x4E +phy raw c45 0xf1 0x1 0xd131 0x610 phy raw c45 0xf1 0x1 0xd134 1 phy raw c45 0xf1 0x1 0xffde 3 -phy raw c45 0xf1 0x1 0xd130 0x41 -phy raw c45 0xf1 0x1 0xd131 0xd +phy raw c45 0xf1 0x1 0xd130 0x4E +phy raw c45 0xf1 0x1 0xd131 0x610 phy raw c45 0xf1 0x1 0xd134 1 phy raw c45 0xf5 0x1 0xffde 0 -phy raw c45 0xf5 0x1 0xd130 0x41 -phy raw c45 0xf5 0x1 0xd131 0xf +phy raw c45 0xf5 0x1 0xd130 0x4D +phy raw c45 0xf5 0x1 0xd131 0x611 phy raw c45 0xf5 0x1 0xd134 1 phy raw c45 0xf5 0x1 0xffde 1 -phy raw c45 0xf5 0x1 0xd130 0x41 -phy raw c45 0xf5 0x1 0xd131 0xf +phy raw c45 0xf5 0x1 0xd130 0x4D +phy raw c45 0xf5 0x1 0xd131 0x611 phy raw c45 0xf5 0x1 0xd134 1 phy raw c45 0xf5 0x1 0xffde 2 -phy raw c45 0xf5 0x1 0xd130 0x41 -phy raw c45 0xf5 0x1 0xd131 0xf +phy raw c45 0xf5 0x1 0xd130 0x4D +phy raw c45 0xf5 0x1 0xd131 0x611 phy raw c45 0xf5 0x1 0xd134 1 phy raw c45 0xf5 0x1 0xffde 3 -phy raw c45 0xf5 0x1 0xd130 0x41 -phy raw c45 0xf5 0x1 0xd131 0xf +phy raw c45 0xf5 0x1 0xd130 0x4D +phy raw c45 0xf5 0x1 0xd131 0x611 phy raw c45 0xf5 0x1 0xd134 1 phy raw c45 0x181 0x1 0xffde 0 -phy raw c45 0x181 0x1 0xd130 0x41 -phy raw c45 0x181 0x1 0xd131 0xd +phy raw c45 0x181 0x1 0xd130 0x4E +phy raw c45 0x181 0x1 0xd131 0x610 phy raw c45 0x181 0x1 0xd134 1 phy raw c45 0x181 0x1 0xffde 1 -phy raw c45 0x181 0x1 0xd130 0x41 -phy raw c45 0x181 0x1 0xd131 0xd +phy raw c45 0x181 0x1 0xd130 0x4D +phy raw c45 0x181 0x1 0xd131 0x611 phy raw c45 0x181 0x1 0xd134 1 phy raw c45 0x181 0x1 0xffde 2 -phy raw c45 0x181 0x1 0xd130 0x41 -phy raw c45 0x181 0x1 0xd131 0xd +phy raw c45 0x181 0x1 0xd130 0x4E +phy raw c45 0x181 0x1 0xd131 0x610 phy raw c45 0x181 0x1 0xd134 1 phy raw c45 0x181 0x1 0xffde 3 -phy raw c45 0x181 0x1 0xd130 0x41 -phy raw c45 0x181 0x1 0xd131 0xd +phy raw c45 0x181 0x1 0xd130 0x4D +phy raw c45 0x181 0x1 0xd131 0x611 phy raw c45 0x181 0x1 0xd134 1 phy raw c45 0x189 0x1 0xffde 0 -phy raw c45 0x189 0x1 0xd130 0x41 -phy raw c45 0x189 0x1 0xd131 0xe +phy raw c45 0x189 0x1 0xd130 0x4E +phy raw c45 0x189 0x1 0xd131 0x610 phy raw c45 0x189 0x1 0xd134 1 phy raw c45 0x189 0x1 0xffde 1 -phy raw c45 0x189 0x1 0xd130 0x41 -phy raw c45 0x189 0x1 0xd131 0xe +phy raw c45 0x189 0x1 0xd130 0x4E +phy raw c45 0x189 0x1 0xd131 0x610 phy raw c45 0x189 0x1 0xd134 1 phy raw c45 0x189 0x1 0xffde 2 -phy raw c45 0x189 0x1 0xd130 0x41 -phy raw c45 0x189 0x1 0xd131 0xe +phy raw c45 0x189 0x1 0xd130 0x4D +phy raw c45 0x189 0x1 0xd131 0x611 phy raw c45 0x189 0x1 0xd134 1 phy raw c45 0x189 0x1 0xffde 3 -phy raw c45 0x189 0x1 0xd130 0x41 -phy raw c45 0x189 0x1 0xd131 0xe -phy raw c45 0x189 0x1 0xd134 1 - +phy raw c45 0x189 0x1 0xd130 0x4D +phy raw c45 0x189 0x1 0xd131 0x611 +phy raw c45 0x189 0x1 0xd134 1 \ No newline at end of file diff --git a/device/quanta/x86_64-quanta_ix8_rglbmc-r0/media_settings.json b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/media_settings.json new file mode 100644 index 0000000000..9b69cade28 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/media_settings.json @@ -0,0 +1,31 @@ +{ + "GLOBAL_MEDIA_SETTINGS": { + "1-48": { + "Default": { + "preemphasis": { + "lane0": "0x0a5503" + } + } + }, + "49,51-56": { + "Default": { + "preemphasis": { + "lane0": "0x0a5703", + "lane1": "0x0a5703", + "lane2": "0x0a5703", + "lane3": "0x0a5703" + } + } + }, + "50-50": { + "Default": { + "preemphasis": { + "lane0": "0x0a5003", + "lane1": "0x0a5003", + "lane2": "0x0a5003", + "lane3": "0x0a5003" + } + } + } + } +} diff --git a/device/quanta/x86_64-quanta_ix8_rglbmc-r0/preemphasis-48x25_8x100.soc b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/preemphasis-48x25_8x100.soc index 3a0193b73d..fe049e4c13 100644 --- a/device/quanta/x86_64-quanta_ix8_rglbmc-r0/preemphasis-48x25_8x100.soc +++ b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/preemphasis-48x25_8x100.soc @@ -6,320 +6,320 @@ linkscan off phy raw c45 0xd1 0x1 0xffde 0 phy raw c45 0xd1 0x1 0xd130 0x55 -phy raw c45 0xd1 0x1 0xd131 0x303 +phy raw c45 0xd1 0x1 0xd131 0x30a phy raw c45 0xd1 0x1 0xd134 0x1 phy raw c45 0xd1 0x1 0xffde 1 phy raw c45 0xd1 0x1 0xd130 0x55 -phy raw c45 0xd1 0x1 0xd131 0x303 +phy raw c45 0xd1 0x1 0xd131 0x30a phy raw c45 0xd1 0x1 0xd134 0x1 phy raw c45 0xd1 0x1 0xffde 2 phy raw c45 0xd1 0x1 0xd130 0x55 -phy raw c45 0xd1 0x1 0xd131 0x303 +phy raw c45 0xd1 0x1 0xd131 0x30a phy raw c45 0xd1 0x1 0xd134 0x1 phy raw c45 0xd1 0x1 0xffde 3 phy raw c45 0xd1 0x1 0xd130 0x55 -phy raw c45 0xd1 0x1 0xd131 0x303 +phy raw c45 0xd1 0x1 0xd131 0x30a phy raw c45 0xd1 0x1 0xd134 0x1 phy raw c45 0xd5 0x1 0xffde 0 phy raw c45 0xd5 0x1 0xd130 0x55 -phy raw c45 0xd5 0x1 0xd131 0x303 +phy raw c45 0xd5 0x1 0xd131 0x30a phy raw c45 0xd5 0x1 0xd134 0x1 phy raw c45 0xd5 0x1 0xffde 1 phy raw c45 0xd5 0x1 0xd130 0x55 -phy raw c45 0xd5 0x1 0xd131 0x303 +phy raw c45 0xd5 0x1 0xd131 0x30a phy raw c45 0xd5 0x1 0xd134 0x1 phy raw c45 0xd5 0x1 0xffde 2 phy raw c45 0xd5 0x1 0xd130 0x55 -phy raw c45 0xd5 0x1 0xd131 0x303 +phy raw c45 0xd5 0x1 0xd131 0x30a phy raw c45 0xd5 0x1 0xd134 0x1 phy raw c45 0xd5 0x1 0xffde 3 phy raw c45 0xd5 0x1 0xd130 0x55 -phy raw c45 0xd5 0x1 0xd131 0x303 +phy raw c45 0xd5 0x1 0xd131 0x30a phy raw c45 0xd5 0x1 0xd134 0x1 phy raw c45 0xc9 0x1 0xffde 0 phy raw c45 0xc9 0x1 0xd130 0x55 -phy raw c45 0xc9 0x1 0xd131 0x303 +phy raw c45 0xc9 0x1 0xd131 0x30a phy raw c45 0xc9 0x1 0xd134 0x1 phy raw c45 0xc9 0x1 0xffde 1 phy raw c45 0xc9 0x1 0xd130 0x55 -phy raw c45 0xc9 0x1 0xd131 0x303 +phy raw c45 0xc9 0x1 0xd131 0x30a phy raw c45 0xc9 0x1 0xd134 0x1 phy raw c45 0xc9 0x1 0xffde 2 phy raw c45 0xc9 0x1 0xd130 0x55 -phy raw c45 0xc9 0x1 0xd131 0x303 +phy raw c45 0xc9 0x1 0xd131 0x30a phy raw c45 0xc9 0x1 0xd134 0x1 phy raw c45 0xc9 0x1 0xffde 3 phy raw c45 0xc9 0x1 0xd130 0x55 -phy raw c45 0xc9 0x1 0xd131 0x303 +phy raw c45 0xc9 0x1 0xd131 0x30a phy raw c45 0xc9 0x1 0xd134 0x1 phy raw c45 0x81 0x1 0xffde 0 phy raw c45 0x81 0x1 0xd130 0x55 -phy raw c45 0x81 0x1 0xd131 0x303 +phy raw c45 0x81 0x1 0xd131 0x30a phy raw c45 0x81 0x1 0xd134 0x1 phy raw c45 0x81 0x1 0xffde 1 phy raw c45 0x81 0x1 0xd130 0x55 -phy raw c45 0x81 0x1 0xd131 0x303 +phy raw c45 0x81 0x1 0xd131 0x30a phy raw c45 0x81 0x1 0xd134 0x1 phy raw c45 0x81 0x1 0xffde 2 phy raw c45 0x81 0x1 0xd130 0x55 -phy raw c45 0x81 0x1 0xd131 0x303 +phy raw c45 0x81 0x1 0xd131 0x30a phy raw c45 0x81 0x1 0xd134 0x1 phy raw c45 0x81 0x1 0xffde 3 phy raw c45 0x81 0x1 0xd130 0x55 -phy raw c45 0x81 0x1 0xd131 0x303 +phy raw c45 0x81 0x1 0xd131 0x30a phy raw c45 0x81 0x1 0xd134 0x1 phy raw c45 0x85 0x1 0xffde 0 phy raw c45 0x85 0x1 0xd130 0x55 -phy raw c45 0x85 0x1 0xd131 0x303 +phy raw c45 0x85 0x1 0xd131 0x30a phy raw c45 0x85 0x1 0xd134 0x1 phy raw c45 0x85 0x1 0xffde 1 phy raw c45 0x85 0x1 0xd130 0x55 -phy raw c45 0x85 0x1 0xd131 0x303 +phy raw c45 0x85 0x1 0xd131 0x30a phy raw c45 0x85 0x1 0xd134 0x1 phy raw c45 0x85 0x1 0xffde 2 phy raw c45 0x85 0x1 0xd130 0x55 -phy raw c45 0x85 0x1 0xd131 0x303 +phy raw c45 0x85 0x1 0xd131 0x30a phy raw c45 0x85 0x1 0xd134 0x1 phy raw c45 0x85 0x1 0xffde 3 phy raw c45 0x85 0x1 0xd130 0x55 -phy raw c45 0x85 0x1 0xd131 0x303 +phy raw c45 0x85 0x1 0xd131 0x30a phy raw c45 0x85 0x1 0xd134 0x1 phy raw c45 0x8d 0x1 0xffde 0 phy raw c45 0x8d 0x1 0xd130 0x55 -phy raw c45 0x8d 0x1 0xd131 0x303 +phy raw c45 0x8d 0x1 0xd131 0x30a phy raw c45 0x8d 0x1 0xd134 0x1 phy raw c45 0x8d 0x1 0xffde 1 phy raw c45 0x8d 0x1 0xd130 0x55 -phy raw c45 0x8d 0x1 0xd131 0x303 +phy raw c45 0x8d 0x1 0xd131 0x30a phy raw c45 0x8d 0x1 0xd134 0x1 phy raw c45 0x8d 0x1 0xffde 2 phy raw c45 0x8d 0x1 0xd130 0x55 -phy raw c45 0x8d 0x1 0xd131 0x303 +phy raw c45 0x8d 0x1 0xd131 0x30a phy raw c45 0x8d 0x1 0xd134 0x1 phy raw c45 0x8d 0x1 0xffde 3 phy raw c45 0x8d 0x1 0xd130 0x55 -phy raw c45 0x8d 0x1 0xd131 0x303 +phy raw c45 0x8d 0x1 0xd131 0x30a phy raw c45 0x8d 0x1 0xd134 0x1 phy raw c45 0x95 0x1 0xffde 0 phy raw c45 0x95 0x1 0xd130 0x55 -phy raw c45 0x95 0x1 0xd131 0x303 +phy raw c45 0x95 0x1 0xd131 0x30a phy raw c45 0x95 0x1 0xd134 0x1 phy raw c45 0x95 0x1 0xffde 1 phy raw c45 0x95 0x1 0xd130 0x55 -phy raw c45 0x95 0x1 0xd131 0x303 +phy raw c45 0x95 0x1 0xd131 0x30a phy raw c45 0x95 0x1 0xd134 0x1 phy raw c45 0x95 0x1 0xffde 2 phy raw c45 0x95 0x1 0xd130 0x55 -phy raw c45 0x95 0x1 0xd131 0x303 +phy raw c45 0x95 0x1 0xd131 0x30a phy raw c45 0x95 0x1 0xd134 0x1 phy raw c45 0x95 0x1 0xffde 3 phy raw c45 0x95 0x1 0xd130 0x55 -phy raw c45 0x95 0x1 0xd131 0x303 +phy raw c45 0x95 0x1 0xd131 0x30a phy raw c45 0x95 0x1 0xd134 0x1 phy raw c45 0xa5 0x1 0xffde 0 phy raw c45 0xa5 0x1 0xd130 0x55 -phy raw c45 0xa5 0x1 0xd131 0x303 +phy raw c45 0xa5 0x1 0xd131 0x30a phy raw c45 0xa5 0x1 0xd134 0x1 phy raw c45 0xa5 0x1 0xffde 1 phy raw c45 0xa5 0x1 0xd130 0x55 -phy raw c45 0xa5 0x1 0xd131 0x303 +phy raw c45 0xa5 0x1 0xd131 0x30a phy raw c45 0xa5 0x1 0xd134 0x1 phy raw c45 0xa5 0x1 0xffde 2 phy raw c45 0xa5 0x1 0xd130 0x55 -phy raw c45 0xa5 0x1 0xd131 0x303 +phy raw c45 0xa5 0x1 0xd131 0x30a phy raw c45 0xa5 0x1 0xd134 0x1 phy raw c45 0xa5 0x1 0xffde 3 phy raw c45 0xa5 0x1 0xd130 0x55 -phy raw c45 0xa5 0x1 0xd131 0x303 +phy raw c45 0xa5 0x1 0xd131 0x30a phy raw c45 0xa5 0x1 0xd134 0x1 phy raw c45 0xa9 0x1 0xffde 0 phy raw c45 0xa9 0x1 0xd130 0x55 -phy raw c45 0xa9 0x1 0xd131 0x303 +phy raw c45 0xa9 0x1 0xd131 0x30a phy raw c45 0xa9 0x1 0xd134 0x1 phy raw c45 0xa9 0x1 0xffde 1 phy raw c45 0xa9 0x1 0xd130 0x55 -phy raw c45 0xa9 0x1 0xd131 0x303 +phy raw c45 0xa9 0x1 0xd131 0x30a phy raw c45 0xa9 0x1 0xd134 0x1 phy raw c45 0xa9 0x1 0xffde 2 phy raw c45 0xa9 0x1 0xd130 0x55 -phy raw c45 0xa9 0x1 0xd131 0x303 +phy raw c45 0xa9 0x1 0xd131 0x30a phy raw c45 0xa9 0x1 0xd134 0x1 phy raw c45 0xa9 0x1 0xffde 3 phy raw c45 0xa9 0x1 0xd130 0x55 -phy raw c45 0xa9 0x1 0xd131 0x303 +phy raw c45 0xa9 0x1 0xd131 0x30a phy raw c45 0xa9 0x1 0xd134 0x1 phy raw c45 0xc1 0x1 0xffde 0 phy raw c45 0xc1 0x1 0xd130 0x55 -phy raw c45 0xc1 0x1 0xd131 0x303 +phy raw c45 0xc1 0x1 0xd131 0x30a phy raw c45 0xc1 0x1 0xd134 0x1 phy raw c45 0xc1 0x1 0xffde 1 phy raw c45 0xc1 0x1 0xd130 0x55 -phy raw c45 0xc1 0x1 0xd131 0x303 +phy raw c45 0xc1 0x1 0xd131 0x30a phy raw c45 0xc1 0x1 0xd134 0x1 phy raw c45 0xc1 0x1 0xffde 2 phy raw c45 0xc1 0x1 0xd130 0x55 -phy raw c45 0xc1 0x1 0xd131 0x303 +phy raw c45 0xc1 0x1 0xd131 0x30a phy raw c45 0xc1 0x1 0xd134 0x1 phy raw c45 0xc1 0x1 0xffde 3 phy raw c45 0xc1 0x1 0xd130 0x55 -phy raw c45 0xc1 0x1 0xd131 0x303 +phy raw c45 0xc1 0x1 0xd131 0x30a phy raw c45 0xc1 0x1 0xd134 0x1 phy raw c45 0xf5 0x1 0xffde 0 phy raw c45 0xf5 0x1 0xd130 0x55 -phy raw c45 0xf5 0x1 0xd131 0x303 +phy raw c45 0xf5 0x1 0xd131 0x30a phy raw c45 0xf5 0x1 0xd134 0x1 phy raw c45 0xf5 0x1 0xffde 1 phy raw c45 0xf5 0x1 0xd130 0x55 -phy raw c45 0xf5 0x1 0xd131 0x303 +phy raw c45 0xf5 0x1 0xd131 0x30a phy raw c45 0xf5 0x1 0xd134 0x1 phy raw c45 0xf5 0x1 0xffde 2 phy raw c45 0xf5 0x1 0xd130 0x55 -phy raw c45 0xf5 0x1 0xd131 0x303 +phy raw c45 0xf5 0x1 0xd131 0x30a phy raw c45 0xf5 0x1 0xd134 0x1 phy raw c45 0xf5 0x1 0xffde 3 phy raw c45 0xf5 0x1 0xd130 0x55 -phy raw c45 0xf5 0x1 0xd131 0x303 +phy raw c45 0xf5 0x1 0xd131 0x30a phy raw c45 0xf5 0x1 0xd134 0x1 phy raw c45 0x185 0x1 0xffde 0 phy raw c45 0x185 0x1 0xd130 0x55 -phy raw c45 0x185 0x1 0xd131 0x303 +phy raw c45 0x185 0x1 0xd131 0x30a phy raw c45 0x185 0x1 0xd134 0x1 phy raw c45 0x185 0x1 0xffde 1 phy raw c45 0x185 0x1 0xd130 0x55 -phy raw c45 0x185 0x1 0xd131 0x303 +phy raw c45 0x185 0x1 0xd131 0x30a phy raw c45 0x185 0x1 0xd134 0x1 phy raw c45 0x185 0x1 0xffde 2 phy raw c45 0x185 0x1 0xd130 0x55 -phy raw c45 0x185 0x1 0xd131 0x303 +phy raw c45 0x185 0x1 0xd131 0x30a phy raw c45 0x185 0x1 0xd134 0x1 phy raw c45 0x185 0x1 0xffde 3 phy raw c45 0x185 0x1 0xd130 0x55 -phy raw c45 0x185 0x1 0xd131 0x303 +phy raw c45 0x185 0x1 0xd131 0x30a phy raw c45 0x185 0x1 0xd134 0x1 # Start of 8x100G phy raw c45 0xe1 0x1 0xffde 0 -phy raw c45 0xe1 0x1 0xd130 0x55 -phy raw c45 0xe1 0x1 0xd131 0x303 +phy raw c45 0xe1 0x1 0xd130 0x57 +phy raw c45 0xe1 0x1 0xd131 0x30a phy raw c45 0xe1 0x1 0xffde 1 -phy raw c45 0xe1 0x1 0xd130 0x55 -phy raw c45 0xe1 0x1 0xd131 0x303 +phy raw c45 0xe1 0x1 0xd130 0x57 +phy raw c45 0xe1 0x1 0xd131 0x30a phy raw c45 0xe1 0x1 0xffde 2 -phy raw c45 0xe1 0x1 0xd130 0x55 -phy raw c45 0xe1 0x1 0xd131 0x303 +phy raw c45 0xe1 0x1 0xd130 0x57 +phy raw c45 0xe1 0x1 0xd131 0x30a phy raw c45 0xe1 0x1 0xffde 3 -phy raw c45 0xe1 0x1 0xd130 0x59 -phy raw c45 0xe1 0x1 0xd131 0x505 +phy raw c45 0xe1 0x1 0xd130 0x57 +phy raw c45 0xe1 0x1 0xd131 0x30a phy raw c45 0xe1 0x1 0xd134 0x1 phy raw c45 0xe5 0x1 0xffde 0 -phy raw c45 0xe5 0x1 0xd130 0x59 -phy raw c45 0xe5 0x1 0xd131 0x502 +phy raw c45 0xe5 0x1 0xd130 0x50 +phy raw c45 0xe5 0x1 0xd131 0x30a phy raw c45 0xe5 0x1 0xffde 1 -phy raw c45 0xe5 0x1 0xd130 0x59 -phy raw c45 0xe5 0x1 0xd131 0x502 +phy raw c45 0xe5 0x1 0xd130 0x50 +phy raw c45 0xe5 0x1 0xd131 0x30a phy raw c45 0xe5 0x1 0xffde 2 -phy raw c45 0xe5 0x1 0xd130 0x59 -phy raw c45 0xe5 0x1 0xd131 0x502 +phy raw c45 0xe5 0x1 0xd130 0x50 +phy raw c45 0xe5 0x1 0xd131 0x30a phy raw c45 0xe5 0x1 0xffde 3 -phy raw c45 0xe5 0x1 0xd130 0x59 -phy raw c45 0xe5 0x1 0xd131 0x502 +phy raw c45 0xe5 0x1 0xd130 0x50 +phy raw c45 0xe5 0x1 0xd131 0x30a phy raw c45 0xe5 0x1 0xd134 0x1 phy raw c45 0xed 0x1 0xffde 0 -phy raw c45 0xed 0x1 0xd130 0x59 -phy raw c45 0xed 0x1 0xd131 0x502 +phy raw c45 0xed 0x1 0xd130 0x57 +phy raw c45 0xed 0x1 0xd131 0x30a phy raw c45 0xed 0x1 0xffde 1 -phy raw c45 0xed 0x1 0xd130 0x59 -phy raw c45 0xed 0x1 0xd131 0x502 +phy raw c45 0xed 0x1 0xd130 0x57 +phy raw c45 0xed 0x1 0xd131 0x30a phy raw c45 0xed 0x1 0xffde 2 -phy raw c45 0xed 0x1 0xd130 0x59 -phy raw c45 0xed 0x1 0xd131 0x502 +phy raw c45 0xed 0x1 0xd130 0x57 +phy raw c45 0xed 0x1 0xd131 0x30a phy raw c45 0xed 0x1 0xffde 3 -phy raw c45 0xed 0x1 0xd130 0x59 -phy raw c45 0xed 0x1 0xd131 0x502 +phy raw c45 0xed 0x1 0xd130 0x57 +phy raw c45 0xed 0x1 0xd131 0x30a phy raw c45 0xed 0x1 0xd134 0x1 phy raw c45 0x189 0x1 0xffde 0 -phy raw c45 0x189 0x1 0xd130 0x59 -phy raw c45 0x189 0x1 0xd131 0x502 +phy raw c45 0x189 0x1 0xd130 0x57 +phy raw c45 0x189 0x1 0xd131 0x30a phy raw c45 0x189 0x1 0xffde 1 -phy raw c45 0x189 0x1 0xd130 0x59 -phy raw c45 0x189 0x1 0xd131 0x502 +phy raw c45 0x189 0x1 0xd130 0x57 +phy raw c45 0x189 0x1 0xd131 0x30a phy raw c45 0x189 0x1 0xffde 2 -phy raw c45 0x189 0x1 0xd130 0x59 -phy raw c45 0x189 0x1 0xd131 0x502 +phy raw c45 0x189 0x1 0xd130 0x57 +phy raw c45 0x189 0x1 0xd131 0x30a phy raw c45 0x189 0x1 0xffde 3 -phy raw c45 0x189 0x1 0xd130 0x59 -phy raw c45 0x189 0x1 0xd131 0x502 +phy raw c45 0x189 0x1 0xd130 0x57 +phy raw c45 0x189 0x1 0xd131 0x30a phy raw c45 0x189 0x1 0xd134 0x1 phy raw c45 0x1a1 0x1 0xffde 0 -phy raw c45 0x1a1 0x1 0xd130 0x59 -phy raw c45 0x1a1 0x1 0xd131 0x502 +phy raw c45 0x1a1 0x1 0xd130 0x57 +phy raw c45 0x1a1 0x1 0xd131 0x30a phy raw c45 0x1a1 0x1 0xffde 1 -phy raw c45 0x1a1 0x1 0xd130 0x59 -phy raw c45 0x1a1 0x1 0xd131 0x502 +phy raw c45 0x1a1 0x1 0xd130 0x57 +phy raw c45 0x1a1 0x1 0xd131 0x30a phy raw c45 0x1a1 0x1 0xffde 2 -phy raw c45 0x1a1 0x1 0xd130 0x59 -phy raw c45 0x1a1 0x1 0xd131 0x502 +phy raw c45 0x1a1 0x1 0xd130 0x57 +phy raw c45 0x1a1 0x1 0xd131 0x30a phy raw c45 0x1a1 0x1 0xffde 3 -phy raw c45 0x1a1 0x1 0xd130 0x59 -phy raw c45 0x1a1 0x1 0xd131 0x502 +phy raw c45 0x1a1 0x1 0xd130 0x57 +phy raw c45 0x1a1 0x1 0xd131 0x30a phy raw c45 0x1a1 0x1 0xd134 0x1 phy raw c45 0x1a9 0x1 0xffde 0 -phy raw c45 0x1a9 0x1 0xd130 0x59 -phy raw c45 0x1a9 0x1 0xd131 0x502 +phy raw c45 0x1a9 0x1 0xd130 0x57 +phy raw c45 0x1a9 0x1 0xd131 0x30a phy raw c45 0x1a9 0x1 0xffde 1 -phy raw c45 0x1a9 0x1 0xd130 0x59 -phy raw c45 0x1a9 0x1 0xd131 0x502 +phy raw c45 0x1a9 0x1 0xd130 0x57 +phy raw c45 0x1a9 0x1 0xd131 0x30a phy raw c45 0x1a9 0x1 0xffde 2 -phy raw c45 0x1a9 0x1 0xd130 0x59 -phy raw c45 0x1a9 0x1 0xd131 0x502 +phy raw c45 0x1a9 0x1 0xd130 0x57 +phy raw c45 0x1a9 0x1 0xd131 0x30a phy raw c45 0x1a9 0x1 0xffde 3 -phy raw c45 0x1a9 0x1 0xd130 0x59 -phy raw c45 0x1a9 0x1 0xd131 0x502 +phy raw c45 0x1a9 0x1 0xd130 0x57 +phy raw c45 0x1a9 0x1 0xd131 0x30a phy raw c45 0x1a9 0x1 0xd134 0x1 phy raw c45 0x1b1 0x1 0xffde 0 -phy raw c45 0x1b1 0x1 0xd130 0x59 -phy raw c45 0x1b1 0x1 0xd131 0x502 +phy raw c45 0x1b1 0x1 0xd130 0x57 +phy raw c45 0x1b1 0x1 0xd131 0x30a phy raw c45 0x1b1 0x1 0xffde 1 -phy raw c45 0x1b1 0x1 0xd130 0x59 -phy raw c45 0x1b1 0x1 0xd131 0x502 +phy raw c45 0x1b1 0x1 0xd130 0x57 +phy raw c45 0x1b1 0x1 0xd131 0x30a phy raw c45 0x1b1 0x1 0xffde 2 -phy raw c45 0x1b1 0x1 0xd130 0x59 -phy raw c45 0x1b1 0x1 0xd131 0x502 +phy raw c45 0x1b1 0x1 0xd130 0x57 +phy raw c45 0x1b1 0x1 0xd131 0x30a phy raw c45 0x1b1 0x1 0xffde 3 -phy raw c45 0x1b1 0x1 0xd130 0x59 -phy raw c45 0x1b1 0x1 0xd131 0x502 +phy raw c45 0x1b1 0x1 0xd130 0x57 +phy raw c45 0x1b1 0x1 0xd131 0x30a phy raw c45 0x1b1 0x1 0xd134 0x1 phy raw c45 0x1b5 0x1 0xffde 0 -phy raw c45 0x1b5 0x1 0xd130 0x59 -phy raw c45 0x1b5 0x1 0xd131 0x502 +phy raw c45 0x1b5 0x1 0xd130 0x57 +phy raw c45 0x1b5 0x1 0xd131 0x30a phy raw c45 0x1b5 0x1 0xffde 1 -phy raw c45 0x1b5 0x1 0xd130 0x59 -phy raw c45 0x1b5 0x1 0xd131 0x502 +phy raw c45 0x1b5 0x1 0xd130 0x57 +phy raw c45 0x1b5 0x1 0xd131 0x30a phy raw c45 0x1b5 0x1 0xffde 2 -phy raw c45 0x1b5 0x1 0xd130 0x59 -phy raw c45 0x1b5 0x1 0xd131 0x502 +phy raw c45 0x1b5 0x1 0xd130 0x57 +phy raw c45 0x1b5 0x1 0xd131 0x30a phy raw c45 0x1b5 0x1 0xffde 3 -phy raw c45 0x1b5 0x1 0xd130 0x59 -phy raw c45 0x1b5 0x1 0xd131 0x502 +phy raw c45 0x1b5 0x1 0xd130 0x57 +phy raw c45 0x1b5 0x1 0xd131 0x30a phy raw c45 0x1b5 0x1 0xd134 0x1 linkscan on \ No newline at end of file diff --git a/device/quanta/x86_64-quanta_ix8a_bwde-r0/media_settings.json b/device/quanta/x86_64-quanta_ix8a_bwde-r0/media_settings.json new file mode 100644 index 0000000000..2f6b52abea --- /dev/null +++ b/device/quanta/x86_64-quanta_ix8a_bwde-r0/media_settings.json @@ -0,0 +1,21 @@ +{ + "GLOBAL_MEDIA_SETTINGS": { + "1-48": { + "Default": { + "preemphasis": { + "lane0": "0x063203" + } + } + }, + "49-56": { + "Default": { + "preemphasis": { + "lane0": "0x0a500a", + "lane1": "0x0a500a", + "lane2": "0x0a500a", + "lane3": "0x0a500a" + } + } + } + } +} \ No newline at end of file diff --git a/device/quanta/x86_64-quanta_ix8c_bwde-r0/Quanta-IX8C-56X/td3-ix8c-48x25G+8x100G.config.bcm b/device/quanta/x86_64-quanta_ix8c_bwde-r0/Quanta-IX8C-56X/td3-ix8c-48x25G+8x100G.config.bcm index aa8c6d02c5..a5dc7f6f43 100644 --- a/device/quanta/x86_64-quanta_ix8c_bwde-r0/Quanta-IX8C-56X/td3-ix8c-48x25G+8x100G.config.bcm +++ b/device/quanta/x86_64-quanta_ix8c_bwde-r0/Quanta-IX8C-56X/td3-ix8c-48x25G+8x100G.config.bcm @@ -479,84 +479,83 @@ phy_chain_rx_polarity_flip_physical{131.0}=0x0 phy_chain_rx_polarity_flip_physical{132.0}=0x0 -serdes_preemphasis_1=0x35503 -serdes_preemphasis_2=0x35503 -serdes_preemphasis_3=0x35503 -serdes_preemphasis_4=0x35503 -serdes_preemphasis_5=0x35503 -serdes_preemphasis_6=0x35503 -serdes_preemphasis_7=0x35503 -serdes_preemphasis_8=0x35503 -serdes_preemphasis_13=0x35503 -serdes_preemphasis_14=0x35503 -serdes_preemphasis_15=0x35503 -serdes_preemphasis_16=0x35503 -serdes_preemphasis_21=0x35503 -serdes_preemphasis_22=0x35503 -serdes_preemphasis_23=0x35503 -serdes_preemphasis_24=0x35503 -serdes_preemphasis_29=0x35503 -serdes_preemphasis_30=0x35503 -serdes_preemphasis_31=0x35503 -serdes_preemphasis_32=0x35503 -serdes_preemphasis_33=0x35503 -serdes_preemphasis_34=0x35503 -serdes_preemphasis_35=0x35503 -serdes_preemphasis_36=0x35503 -serdes_preemphasis_41=0x35503 -serdes_preemphasis_42=0x35503 -serdes_preemphasis_43=0x35503 -serdes_preemphasis_44=0x35503 -serdes_preemphasis_49=0x35503 -serdes_preemphasis_50=0x35503 -serdes_preemphasis_51=0x35503 -serdes_preemphasis_52=0x35503 -serdes_preemphasis_57=0x35503 -serdes_preemphasis_58=0x35503 -serdes_preemphasis_59=0x35503 -serdes_preemphasis_60=0x35503 -serdes_preemphasis_61=0x35503 -serdes_preemphasis_62=0x35503 -serdes_preemphasis_63=0x35503 -serdes_preemphasis_64=0x35503 -serdes_preemphasis_lane0_67=0x25905 -serdes_preemphasis_lane1_67=0x25905 -serdes_preemphasis_lane2_67=0x25905 -serdes_preemphasis_lane3_67=0x25905 -serdes_preemphasis_lane0_71=0x25905 -serdes_preemphasis_lane1_71=0x25905 -serdes_preemphasis_lane2_71=0x25905 -serdes_preemphasis_lane3_71=0x25905 -serdes_preemphasis_lane0_79=0x25905 -serdes_preemphasis_lane1_79=0x25905 -serdes_preemphasis_lane2_79=0x25905 -serdes_preemphasis_lane3_79=0x25905 -serdes_preemphasis_87=0x35503 -serdes_preemphasis_88=0x35503 -serdes_preemphasis_89=0x35503 -serdes_preemphasis_90=0x35503 -serdes_preemphasis_95=0x35503 -serdes_preemphasis_96=0x35503 -serdes_preemphasis_97=0x35503 -serdes_preemphasis_98=0x35503 -serdes_preemphasis_lane0_99=0x35503 -serdes_preemphasis_lane1_99=0x35503 -serdes_preemphasis_lane2_99=0x35503 -serdes_preemphasis_lane3_99=0x55905 -serdes_preemphasis_lane0_107=0x25905 -serdes_preemphasis_lane1_107=0x25905 -serdes_preemphasis_lane2_107=0x25905 -serdes_preemphasis_lane3_107=0x25905 -serdes_preemphasis_lane0_115=0x25905 -serdes_preemphasis_lane1_115=0x25905 -serdes_preemphasis_lane2_115=0x25905 -serdes_preemphasis_lane3_115=0x25905 -serdes_preemphasis_lane0_123=0x25905 -serdes_preemphasis_lane1_123=0x25905 -serdes_preemphasis_lane2_123=0x25905 -serdes_preemphasis_lane3_123=0x25905 -serdes_preemphasis_lane0_127=0x25905 -serdes_preemphasis_lane1_127=0x25905 -serdes_preemphasis_lane2_127=0x25905 -serdes_preemphasis_lane3_127=0x25905 - +serdes_preemphasis_60=0x0c5602 +serdes_preemphasis_59=0x0c5602 +serdes_preemphasis_58=0x0c5602 +serdes_preemphasis_57=0x0c5602 +serdes_preemphasis_64=0x0c5602 +serdes_preemphasis_63=0x0c5602 +serdes_preemphasis_62=0x0c5602 +serdes_preemphasis_61=0x0c5602 +serdes_preemphasis_49=0x0c5602 +serdes_preemphasis_50=0x0c5602 +serdes_preemphasis_51=0x0c5602 +serdes_preemphasis_52=0x0c5602 +serdes_preemphasis_4=0x0c5602 +serdes_preemphasis_3=0x0c5602 +serdes_preemphasis_2=0x085804 +serdes_preemphasis_1=0x0c5602 +serdes_preemphasis_8=0x085804 +serdes_preemphasis_7=0x085804 +serdes_preemphasis_6=0x085804 +serdes_preemphasis_5=0x085804 +serdes_preemphasis_16=0x065806 +serdes_preemphasis_15=0x085804 +serdes_preemphasis_14=0x085804 +serdes_preemphasis_13=0x085804 +serdes_preemphasis_24=0x065806 +serdes_preemphasis_23=0x065806 +serdes_preemphasis_22=0x065806 +serdes_preemphasis_21=0x065806 +serdes_preemphasis_32=0x065806 +serdes_preemphasis_31=0x065806 +serdes_preemphasis_30=0x065806 +serdes_preemphasis_29=0x075805 +serdes_preemphasis_36=0x075805 +serdes_preemphasis_35=0x075805 +serdes_preemphasis_34=0x065806 +serdes_preemphasis_33=0x085804 +serdes_preemphasis_44=0x085804 +serdes_preemphasis_43=0x085804 +serdes_preemphasis_42=0x085804 +serdes_preemphasis_41=0x085804 +serdes_preemphasis_88=0x085804 +serdes_preemphasis_87=0x085804 +serdes_preemphasis_90=0x085804 +serdes_preemphasis_89=0x085804 +serdes_preemphasis_96=0x085804 +serdes_preemphasis_95=0x085804 +serdes_preemphasis_98=0x085804 +serdes_preemphasis_97=0x085804 +serdes_preemphasis_lane0_99=0x0c5404 +serdes_preemphasis_lane1_99=0x0c5404 +serdes_preemphasis_lane2_99=0x0c5404 +serdes_preemphasis_lane3_99=0x0c5404 +serdes_preemphasis_lane0_107=0x0c5404 +serdes_preemphasis_lane1_107=0x0c5404 +serdes_preemphasis_lane2_107=0x0c5404 +serdes_preemphasis_lane3_107=0x0c5404 +serdes_preemphasis_lane0_115=0x105202 +serdes_preemphasis_lane1_115=0x105202 +serdes_preemphasis_lane2_115=0x105202 +serdes_preemphasis_lane3_115=0x105202 +serdes_preemphasis_lane0_123=0x0c5404 +serdes_preemphasis_lane1_123=0x0c5404 +serdes_preemphasis_lane2_123=0x0c5404 +serdes_preemphasis_lane3_123=0x0c5404 +serdes_preemphasis_lane0_79=0x0d5205 +serdes_preemphasis_lane1_79=0x0d5205 +serdes_preemphasis_lane2_79=0x0d5205 +serdes_preemphasis_lane3_79=0x0d5205 +serdes_preemphasis_lane0_67=0x105202 +serdes_preemphasis_lane1_67=0x105202 +serdes_preemphasis_lane2_67=0x105202 +serdes_preemphasis_lane3_67=0x105202 +serdes_preemphasis_lane0_71=0x115201 +serdes_preemphasis_lane1_71=0x115201 +serdes_preemphasis_lane2_71=0x115201 +serdes_preemphasis_lane3_71=0x115201 +serdes_preemphasis_lane0_127=0x105202 +serdes_preemphasis_lane1_127=0x105202 +serdes_preemphasis_lane2_127=0x105202 +serdes_preemphasis_lane3_127=0x105202 diff --git a/device/quanta/x86_64-quanta_ix8c_bwde-r0/led_proc_init.soc b/device/quanta/x86_64-quanta_ix8c_bwde-r0/led_proc_init.soc index 49f097daca..8470ab26ef 100644 --- a/device/quanta/x86_64-quanta_ix8c_bwde-r0/led_proc_init.soc +++ b/device/quanta/x86_64-quanta_ix8c_bwde-r0/led_proc_init.soc @@ -1,4 +1,2 @@ -sleep 10 -m0 Load 0 0x3800 /usr/share/sonic/platform/custom_led.bin -led auto on +m0 load 0 0x3800 /usr/share/sonic/platform/custom_led.bin led start diff --git a/device/quanta/x86_64-quanta_ix8c_bwde-r0/media_settings.json b/device/quanta/x86_64-quanta_ix8c_bwde-r0/media_settings.json new file mode 100644 index 0000000000..31a774aee2 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix8c_bwde-r0/media_settings.json @@ -0,0 +1,72 @@ +{ + "GLOBAL_MEDIA_SETTINGS": { + "1-14,16": { + "Default": { + "preemphasis": { + "lane0": "0x0c5602" + } + } + }, + "15,17-20,22-24,36-48": { + "Default": { + "preemphasis": { + "lane0": "0x085804" + } + } + }, + "21,25-31,35": { + "Default": { + "preemphasis": { + "lane0": "0x065806" + } + } + }, + "32-34": { + "Default": { + "preemphasis": { + "lane0": "0x075805" + } + } + }, + "49,50,52": { + "Default": { + "preemphasis": { + "lane0": "0x0c5404", + "lane1": "0x0c5404", + "lane2": "0x0c5404", + "lane3": "0x0c5404" + } + } + }, + "51,54,56": { + "Default": { + "preemphasis": { + "lane0": "0x105202", + "lane1": "0x105202", + "lane2": "0x105202", + "lane3": "0x105202" + } + } + }, + "53-53": { + "Default": { + "preemphasis": { + "lane0": "0x0d5205", + "lane1": "0x0d5205", + "lane2": "0x0d5205", + "lane3": "0x0d5205" + } + } + }, + "55-55": { + "Default": { + "preemphasis": { + "lane0": "0x115201", + "lane1": "0x115201", + "lane2": "0x115201", + "lane3": "0x115201" + } + } + } + } +} \ No newline at end of file diff --git a/device/quanta/x86_64-quanta_ix9_bwde-r0/Quanta-IX9-32X/hwsku.json b/device/quanta/x86_64-quanta_ix9_bwde-r0/Quanta-IX9-32X/hwsku.json new file mode 100755 index 0000000000..f2d75a388a --- /dev/null +++ b/device/quanta/x86_64-quanta_ix9_bwde-r0/Quanta-IX9-32X/hwsku.json @@ -0,0 +1,132 @@ +{ + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet8": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet16": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet24": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet32": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet40": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet48": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet56": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet64": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet72": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet80": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet88": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet96": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet104": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet112": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet120": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet128": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet136": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet144": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet152": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet160": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet168": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet176": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet184": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet192": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet200": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet208": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet216": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet224": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet232": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet240": { + "default_brkout_mode": "1x400G", + "fec":"rs" + }, + "Ethernet248": { + "default_brkout_mode": "1x400G", + "fec":"rs" + } + } +} diff --git a/device/quanta/x86_64-quanta_ix9_bwde-r0/Quanta-IX9-32X/th3-ix9-32x400G.config.bcm b/device/quanta/x86_64-quanta_ix9_bwde-r0/Quanta-IX9-32X/th3-ix9-32x400G.config.bcm index 93937398e8..c45c402b72 100644 --- a/device/quanta/x86_64-quanta_ix9_bwde-r0/Quanta-IX9-32X/th3-ix9-32x400G.config.bcm +++ b/device/quanta/x86_64-quanta_ix9_bwde-r0/Quanta-IX9-32X/th3-ix9-32x400G.config.bcm @@ -1,6 +1,7 @@ phy_null=1 pll_bypass=1 +sai_tunnel_global_sip_mask_enable=1 core_clock_frequency=1325 dpr_clock_frequency=1000 device_clock_frequency=1325 @@ -235,6 +236,8 @@ dport_map_port_132=125 dport_map_port_133=126 dport_map_port_134=127 dport_map_port_135=128 +dport_map_port_136=129 +dport_map_port_137=130 ### lane swap and polarity follow front port order ### phy_chain_tx_lane_map_physical{33.0}=0x75206431 diff --git a/device/quanta/x86_64-quanta_ix9_bwde-r0/custom_led.bin b/device/quanta/x86_64-quanta_ix9_bwde-r0/custom_led.bin index 1f12caa4fa..2f86cb209d 100644 Binary files a/device/quanta/x86_64-quanta_ix9_bwde-r0/custom_led.bin and b/device/quanta/x86_64-quanta_ix9_bwde-r0/custom_led.bin differ diff --git a/device/quanta/x86_64-quanta_ix9_bwde-r0/led_proc_init.soc b/device/quanta/x86_64-quanta_ix9_bwde-r0/led_proc_init.soc index b6c5d50739..05022542de 100644 --- a/device/quanta/x86_64-quanta_ix9_bwde-r0/led_proc_init.soc +++ b/device/quanta/x86_64-quanta_ix9_bwde-r0/led_proc_init.soc @@ -1,6 +1,4 @@ -sleep 10 m0 Load 0 0x3800 /usr/share/sonic/platform/custom_led.bin -led auto on led start rcload /usr/share/sonic/platform/preemphasis-32x400G.soc diff --git a/device/quanta/x86_64-quanta_ix9_bwde-r0/media_settings.json b/device/quanta/x86_64-quanta_ix9_bwde-r0/media_settings.json new file mode 100644 index 0000000000..989ccb7560 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix9_bwde-r0/media_settings.json @@ -0,0 +1,132 @@ +{ + "GLOBAL_MEDIA_SETTINGS": { + "1,3-32": { + "Default": { + "main":{ + "lane0": "0x00000098", + "lane1": "0x00000098", + "lane2": "0x00000098", + "lane3": "0x00000098", + "lane4": "0x00000098", + "lane5": "0x00000098", + "lane6": "0x00000098", + "lane7": "0x00000098" + }, + "post1":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0x00000000" + }, + "post2":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0x00000000" + }, + "post3":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0x00000000" + }, + "pre1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff0", + "lane2": "0xfffffff0", + "lane3": "0xfffffff0", + "lane4": "0xfffffff0", + "lane5": "0xfffffff0", + "lane6": "0xfffffff0", + "lane7": "0xfffffff0" + }, + "pre2":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0x00000000" + } + } + }, + "2-2": { + "Default": { + "main":{ + "lane0": "0x00000098", + "lane1": "0x00000098", + "lane2": "0x00000098", + "lane3": "0x00000098", + "lane4": "0x00000098", + "lane5": "0x00000098", + "lane6": "0x00000098", + "lane7": "0x00000090" + }, + "post1":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0xfffffffc" + }, + "post2":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0x00000000" + }, + "post3":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0x00000000" + }, + "pre1":{ + "lane0": "0xfffffff0", + "lane1": "0xfffffff0", + "lane2": "0xfffffff0", + "lane3": "0xfffffff0", + "lane4": "0xfffffff0", + "lane5": "0xfffffff0", + "lane6": "0xfffffff0", + "lane7": "0xffffffee" + }, + "pre2":{ + "lane0": "0x00000000", + "lane1": "0x00000000", + "lane2": "0x00000000", + "lane3": "0x00000000", + "lane4": "0x00000000", + "lane5": "0x00000000", + "lane6": "0x00000000", + "lane7": "0x00000000" + } + } + } + } +} \ No newline at end of file diff --git a/device/quanta/x86_64-quanta_ix9_bwde-r0/platform.json b/device/quanta/x86_64-quanta_ix9_bwde-r0/platform.json new file mode 100644 index 0000000000..306a8ddaab --- /dev/null +++ b/device/quanta/x86_64-quanta_ix9_bwde-r0/platform.json @@ -0,0 +1,600 @@ +{ + "chassis": { + "name": "T9032-IX9", + "components": [ + { + "name": "BIOS" + }, + { + "name": "BMC" + }, + { + "name": "BOOT_CPLD" + }, + { + "name": "FAN_CPLD" + }, + { + "name": "MB_CPLD_IO_1" + }, + { + "name": "MB_CPLD_IO_2" + }, + { + "name": "MB_CPLD_LED_1" + }, + { + "name": "MB_CPLD_LED_2" + }, + { + "name": "PCIe" + } + ], + "fans": [ + { + "name": "Fantray1_1" + }, + { + "name": "Fantray1_2" + }, + { + "name": "Fantray2_1" + }, + { + "name": "Fantray2_2" + }, + { + "name": "Fantray3_1" + }, + { + "name": "Fantray3_2" + }, + { + "name": "Fantray4_1" + }, + { + "name": "Fantray4_2" + }, + { + "name": "Fantray5_1" + }, + { + "name": "Fantray5_2" + }, + { + "name": "Fantray6_1" + }, + { + "name": "Fantray6_2" + } + ], + "fan_drawers": [ + { + "name": "Fantray1", + "fans": [ + { + "name": "Fantray1_1" + }, + { + "name": "Fantray1_2" + } + ] + }, + { + "name": "Fantray2", + "fans": [ + { + "name": "Fantray2_1" + }, + { + "name": "Fantray2_2" + } + ] + }, + { + "name": "Fantray3", + "fans": [ + { + "name": "Fantray3_1" + }, + { + "name": "Fantray3_2" + } + ] + }, + { + "name": "Fantray4", + "fans": [ + { + "name": "Fantray4_1" + }, + { + "name": "Fantray4_2" + } + ] + }, + { + "name": "Fantray5", + "fans": [ + { + "name": "Fantray5_1" + }, + { + "name": "Fantray5_2" + } + ] + }, + { + "name": "Fantray6", + "fans": [ + { + "name": "Fantray6_1" + }, + { + "name": "Fantray6_2" + } + ] + } + ], + "psus": [ + { + "name": "PSU 1", + "fans": [ + { + "name": "PSU-1_FAN" + } + ] + }, + { + "name": "PSU 2", + "fans": [ + { + "name": "PSU-2_FAN" + } + ] + } + ], + "thermals": [ + { + "name": "PSU1_TEMP1" + }, + { + "name": "PSU1_TEMP2" + }, + { + "name": "PSU1_TEMP3" + }, + { + "name": "PSU2_TEMP1" + }, + { + "name": "PSU2_TEMP2" + }, + { + "name": "PSU2_TEMP3" + }, + { + "name": "Temp_1V05_PCH_VR" + }, + { + "name": "Temp_Ambient_0" + }, + { + "name": "Temp_Ambient_1" + }, + { + "name": "Temp_Ambient_2" + }, + { + "name": "Temp_Ambient_3" + }, + { + "name": "Temp_Ambient_4" + }, + { + "name": "Temp_Ambient_5" + }, + { + "name": "Temp_CPU" + }, + { + "name": "Temp_DDRAB_VR" + }, + { + "name": "Temp_SOC_DIMMA0" + }, + { + "name": "Temp_VCCGBE_VR" + }, + { + "name": "Temp_VCCIN_VR" + } + ], + "sfps": [ + { + "name": "Ethernet0" + }, + { + "name": "Ethernet8" + }, + { + "name": "Ethernet16" + }, + { + "name": "Ethernet24" + }, + { + "name": "Ethernet32" + }, + { + "name": "Ethernet40" + }, + { + "name": "Ethernet48" + }, + { + "name": "Ethernet56" + }, + { + "name": "Ethernet64" + }, + { + "name": "Ethernet72" + }, + { + "name": "Ethernet80" + }, + { + "name": "Ethernet88" + }, + { + "name": "Ethernet96" + }, + { + "name": "Ethernet104" + }, + { + "name": "Ethernet112" + }, + { + "name": "Ethernet120" + }, + { + "name": "Ethernet128" + }, + { + "name": "Ethernet136" + }, + { + "name": "Ethernet144" + }, + { + "name": "Ethernet152" + }, + { + "name": "Ethernet160" + }, + { + "name": "Ethernet168" + }, + { + "name": "Ethernet176" + }, + { + "name": "Ethernet184" + }, + { + "name": "Ethernet192" + }, + { + "name": "Ethernet200" + }, + { + "name": "Ethernet208" + }, + { + "name": "Ethernet216" + }, + { + "name": "Ethernet224" + }, + { + "name": "Ethernet232" + }, + { + "name": "Ethernet240" + }, + { + "name": "Ethernet248" + } + ] + }, + "interfaces": { + "Ethernet0": { + "breakout_modes": { + "1x400G": ["Eth1/1"], + "2x200G[100G]": ["Eth1/1/1", "Eth1/1/2"], + "4x100G[50G]": ["Eth1/1/1", "Eth1/1/2", "Eth1/1/3", "Eth1/1/4"] + }, + "index": "1,1,1,1,1,1,1,1", + "lanes": "33,34,35,36,37,38,39,40" + }, + "Ethernet8": { + "breakout_modes": { + "1x400G": ["Eth1/2"], + "2x200G[100G]": ["Eth1/2/1", "Eth1/2/2"], + "4x100G[50G]": ["Eth1/2/1", "Eth1/2/2", "Eth1/2/3", "Eth1/2/4"] + }, + "index": "2,2,2,2,2,2,2,2", + "lanes": "25,26,27,28,29,30,31,32" + }, + "Ethernet16": { + "breakout_modes": { + "1x400G": ["Eth1/3"], + "2x200G[100G]": ["Eth1/3/1", "Eth1/3/2"], + "4x100G[50G]": ["Eth1/3/1", "Eth1/3/2", "Eth1/3/3", "Eth1/3/4"] + }, + "index": "3,3,3,3,3,3,3,3", + "lanes": "49,50,51,52,53,54,55,56" + }, + "Ethernet24": { + "breakout_modes": { + "1x400G": ["Eth1/4"], + "2x200G[100G]": ["Eth1/4/1", "Eth1/4/2"], + "4x100G[50G]": ["Eth1/4/1", "Eth1/4/2", "Eth1/4/3", "Eth1/4/4"] + }, + "index": "4,4,4,4,4,4,4,4", + "lanes": "57,58,59,60,61,62,63,64" + }, + "Ethernet32": { + "breakout_modes": { + "1x400G": ["Eth1/5"], + "2x200G[100G]": ["Eth1/5/1", "Eth1/5/2"], + "4x100G[50G]": ["Eth1/5/1", "Eth1/5/2", "Eth1/5/3", "Eth1/5/4"] + }, + "index": "5,5,5,5,5,5,5,5", + "lanes": "65,66,67,68,69,70,71,72" + }, + "Ethernet40": { + "breakout_modes": { + "1x400G": ["Eth1/6"], + "2x200G[100G]": ["Eth1/6/1", "Eth1/6/2"], + "4x100G[50G]": ["Eth1/6/1", "Eth1/6/2", "Eth1/6/3", "Eth1/6/4"] + }, + "index": "6,6,6,6,6,6,6,6", + "lanes": "73,74,75,76,77,78,79,80" + }, + "Ethernet48": { + "breakout_modes": { + "1x400G": ["Eth1/7"], + "2x200G[100G]": ["Eth1/7/1", "Eth1/7/2"], + "4x100G[50G]": ["Eth1/7/1", "Eth1/7/2", "Eth1/7/3", "Eth1/7/4"] + }, + "index": "7,7,7,7,7,7,7,7", + "lanes": "81,82,83,84,85,86,87,88" + }, + "Ethernet56": { + "breakout_modes": { + "1x400G": ["Eth1/8"], + "2x200G[100G]": ["Eth1/8/1", "Eth1/8/2"], + "4x100G[50G]": ["Eth1/8/1", "Eth1/8/2", "Eth1/8/3", "Eth1/8/4"] + }, + "index": "8,8,8,8,8,8,8,8", + "lanes": "89,90,91,92,93,94,95,96" + }, + "Ethernet64": { + "breakout_modes": { + "1x400G": ["Eth1/9"], + "2x200G[100G]": ["Eth1/9/1", "Eth1/9/2"], + "4x100G[50G]": ["Eth1/9/1", "Eth1/9/2", "Eth1/9/3", "Eth1/9/4"] + }, + "index": "9,9,9,9,9,9,9,9", + "lanes": "17,18,19,20,21,22,23,24" + }, + "Ethernet72": { + "breakout_modes": { + "1x400G": ["Eth1/10"], + "2x200G[100G]": ["Eth1/10/1", "Eth1/10/2"], + "4x100G[50G]": ["Eth1/10/1", "Eth1/10/2", "Eth1/10/3", "Eth1/10/4"] + }, + "index": "10,10,10,10,10,10,10,10", + "lanes": "97,98,99,100,101,102,103,104" + }, + "Ethernet80": { + "breakout_modes": { + "1x400G": ["Eth1/11"], + "2x200G[100G]": ["Eth1/11/1", "Eth1/11/2"], + "4x100G[50G]": ["Eth1/11/1", "Eth1/11/2", "Eth1/11/3", "Eth1/11/4"] + }, + "index": "11,11,11,11,11,11,11,11", + "lanes": "9,10,11,12,13,14,15,16" + }, + "Ethernet88": { + "breakout_modes": { + "1x400G": ["Eth1/12"], + "2x200G[100G]": ["Eth1/12/1", "Eth1/12/2"], + "4x100G[50G]": ["Eth1/12/1", "Eth1/12/2", "Eth1/12/3", "Eth1/12/4"] + }, + "index": "12,12,12,12,12,12,12,12", + "lanes": "41,42,43,44,45,46,47,48" + }, + "Ethernet96": { + "breakout_modes": { + "1x400G": ["Eth1/13"], + "2x200G[100G]": ["Eth1/13/1", "Eth1/13/2"], + "4x100G[50G]": ["Eth1/13/1", "Eth1/13/2", "Eth1/13/3", "Eth1/13/4"] + }, + "index": "13,13,13,13,13,13,13,13", + "lanes": "113,114,115,116,117,118,119,120" + }, + "Ethernet104": { + "breakout_modes": { + "1x400G": ["Eth1/14"], + "2x200G[100G]": ["Eth1/14/1", "Eth1/14/2"], + "4x100G[50G]": ["Eth1/14/1", "Eth1/14/2", "Eth1/14/3", "Eth1/14/4"] + }, + "index": "14,14,14,14,14,14,14,14", + "lanes": "105,106,107,108,109,110,111,112" + }, + "Ethernet112": { + "breakout_modes": { + "1x400G": ["Eth1/15"], + "2x200G[100G]": ["Eth1/15/1", "Eth1/15/2"], + "4x100G[50G]": ["Eth1/15/1", "Eth1/15/2", "Eth1/15/3", "Eth1/15/4"] + }, + "index": "15,15,15,15,15,15,15,15", + "lanes": "121,122,123,124,125,126,127,128" + }, + "Ethernet120": { + "breakout_modes": { + "1x400G": ["Eth1/16"], + "2x200G[100G]": ["Eth1/16/1", "Eth1/16/2"], + "4x100G[50G]": ["Eth1/16/1", "Eth1/16/2", "Eth1/16/3", "Eth1/16/4"] + }, + "index": "16,16,16,16,16,16,16,16", + "lanes": "1,2,3,4,5,6,7,8" + }, + "Ethernet128": { + "breakout_modes": { + "1x400G": ["Eth1/17"], + "2x200G[100G]": ["Eth1/17/1", "Eth1/17/2"], + "4x100G[50G]": ["Eth1/17/1", "Eth1/17/2", "Eth1/17/3", "Eth1/17/4"] + }, + "index": "17,17,17,17,17,17,17,17", + "lanes": "137,138,139,140,141,142,143,144" + }, + "Ethernet136": { + "breakout_modes": { + "1x400G": ["Eth1/18"], + "2x200G[100G]": ["Eth1/18/1", "Eth1/18/2"], + "4x100G[50G]": ["Eth1/18/1", "Eth1/18/2", "Eth1/18/3", "Eth1/18/4"] + }, + "index": "18,18,18,18,18,18,18,18", + "lanes": "129,130,131,132,133,134,135,136" + }, + "Ethernet144": { + "breakout_modes": { + "1x400G": ["Eth1/19"], + "2x200G[100G]": ["Eth1/19/1", "Eth1/19/2"], + "4x100G[50G]": ["Eth1/19/1", "Eth1/19/2", "Eth1/19/3", "Eth1/19/4"] + }, + "index": "19,19,19,19,19,19,19,19", + "lanes": "241,242,243,244,245,246,247,248" + }, + "Ethernet152": { + "breakout_modes": { + "1x400G": ["Eth1/20"], + "2x200G[100G]": ["Eth1/20/1", "Eth1/20/2"], + "4x100G[50G]": ["Eth1/20/1", "Eth1/20/2", "Eth1/20/3", "Eth1/20/4"] + }, + "index": "20,20,20,20,20,20,20,20", + "lanes": "249,250,251,252,253,254,255,256" + }, + "Ethernet160": { + "breakout_modes": { + "1x400G": ["Eth1/21"], + "2x200G[100G]": ["Eth1/21/1", "Eth1/21/2"], + "4x100G[50G]": ["Eth1/21/1", "Eth1/21/2", "Eth1/21/3", "Eth1/21/4"] + }, + "index": "21,21,21,21,21,21,21,21", + "lanes": "225,226,227,228,229,230,231,232" + }, + "Ethernet168": { + "breakout_modes": { + "1x400G": ["Eth1/22"], + "2x200G[100G]": ["Eth1/22/1", "Eth1/22/2"], + "4x100G[50G]": ["Eth1/22/1", "Eth1/22/2", "Eth1/22/3", "Eth1/22/4"] + }, + "index": "22,22,22,22,22,22,22,22", + "lanes": "145,146,147,148,149,150,151,152" + }, + "Ethernet176": { + "breakout_modes": { + "1x400G": ["Eth1/23"], + "2x200G[100G]": ["Eth1/23/1", "Eth1/23/2"], + "4x100G[50G]": ["Eth1/23/1", "Eth1/23/2", "Eth1/23/3", "Eth1/23/4"] + }, + "index": "23,23,23,23,23,23,23,23", + "lanes": "153,154,155,156,157,158,159,160" + }, + "Ethernet184": { + "breakout_modes": { + "1x400G": ["Eth1/24"], + "2x200G[100G]": ["Eth1/24/1", "Eth1/24/2"], + "4x100G[50G]": ["Eth1/24/1", "Eth1/24/2", "Eth1/24/3", "Eth1/24/4"] + }, + "index": "24,24,24,24,24,24,24,24", + "lanes": "233,234,235,236,237,238,239,240" + }, + "Ethernet192": { + "breakout_modes": { + "1x400G": ["Eth1/25"], + "2x200G[100G]": ["Eth1/25/1", "Eth1/25/2"], + "4x100G[50G]": ["Eth1/25/1", "Eth1/25/2", "Eth1/25/3", "Eth1/25/4"] + }, + "index": "25,25,25,25,25,25,25,25", + "lanes": "161,162,163,164,165,166,167,168" + }, + "Ethernet200": { + "breakout_modes": { + "1x400G": ["Eth1/26"], + "2x200G[100G]": ["Eth1/26/1", "Eth1/26/2"], + "4x100G[50G]": ["Eth1/26/1", "Eth1/26/2", "Eth1/26/3", "Eth1/26/4"] + }, + "index": "26,26,26,26,26,26,26,26", + "lanes": "169,170,171,172,173,174,175,176" + }, + "Ethernet208": { + "breakout_modes": { + "1x400G": ["Eth1/27"], + "2x200G[100G]": ["Eth1/27/1", "Eth1/27/2"], + "4x100G[50G]": ["Eth1/27/1", "Eth1/27/2", "Eth1/27/3", "Eth1/27/4"] + }, + "index": "27,27,27,27,27,27,27,27", + "lanes": "177,178,179,180,181,182,183,184" + }, + "Ethernet216": { + "breakout_modes": { + "1x400G": ["Eth1/28"], + "2x200G[100G]": ["Eth1/28/1", "Eth1/28/2"], + "4x100G[50G]": ["Eth1/28/1", "Eth1/28/2", "Eth1/28/3", "Eth1/28/4"] + }, + "index": "28,28,28,28,28,28,28,28", + "lanes": "185,186,187,188,189,190,191,192" + }, + "Ethernet224": { + "breakout_modes": { + "1x400G": ["Eth1/29"] + }, + "index": "29,29,29,29,29,29,29,29", + "lanes": "193,194,195,196,197,198,199,200" + }, + "Ethernet232": { + "breakout_modes": { + "1x400G": ["Eth1/30"] + }, + "index": "30,30,30,30,30,30,30,30", + "lanes": "201,202,203,204,205,206,207,208" + }, + "Ethernet240": { + "breakout_modes": { + "1x400G": ["Eth1/31"], + "2x200G[100G]": ["Eth1/31/1", "Eth1/31/2"], + "4x100G[50G]": ["Eth1/31/1", "Eth1/31/2", "Eth1/31/3", "Eth1/31/4"], + "8x50G[25G][10G]": ["Eth1/31/1", "Eth1/31/2", "Eth1/31/3", "Eth1/31/4", "Eth1/31/5", "Eth1/31/6", "Eth1/31/7", "Eth1/31/8"] + }, + "index": "31,31,31,31,31,31,31,31", + "lanes": "209,210,211,212,213,214,215,216" + }, + "Ethernet248": { + "breakout_modes": { + "1x400G": ["Eth1/32"], + "2x200G[100G]": ["Eth1/32/1", "Eth1/32/2"], + "4x100G[50G]": ["Eth1/32/1", "Eth1/32/2", "Eth1/32/3", "Eth1/32/4"], + "8x50G[25G][10G]": ["Eth1/31/1", "Eth1/31/2", "Eth1/31/3", "Eth1/31/4", "Eth1/31/5", "Eth1/31/6", "Eth1/31/7", "Eth1/31/8"] + }, + "index": "32,32,32,32,32,32,32,32", + "lanes": "217,218,219,220,221,222,223,224" + } + } +} diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index c43a66ee43..c7c7381b97 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -9,7 +9,7 @@ include $(PLATFORM_PATH)/platform-modules-accton.mk #include $(PLATFORM_PATH)/platform-modules-inventec.mk include $(PLATFORM_PATH)/platform-modules-cel.mk #include $(PLATFORM_PATH)/platform-modules-delta.mk -#include $(PLATFORM_PATH)/platform-modules-quanta.mk +include $(PLATFORM_PATH)/platform-modules-quanta.mk ##include $(PLATFORM_PATH)/platform-modules-mitac.mk include $(PLATFORM_PATH)/platform-modules-juniper.mk #include $(PLATFORM_PATH)/platform-modules-brcm-xlr-gts.mk diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/qci_cpld_led.c b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/qci_cpld_led.c index 64841e8538..147a2a7f86 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/qci_cpld_led.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/qci_cpld_led.c @@ -49,7 +49,7 @@ static struct class *cpld_class = NULL; struct cpld_data { struct i2c_client *cpld_client; - char name[8]; + char name[16]; u8 cpld_id; }; diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/quanta_hwmon_ipmi.c b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/quanta_hwmon_ipmi.c index 08d6a97d9a..29b439f290 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/quanta_hwmon_ipmi.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/quanta_hwmon_ipmi.c @@ -86,6 +86,8 @@ #define IPMI_TIMEOUT (4 * HZ) #define IPMI_MAX_WAIT_QUEUE 1 +typedef struct ipmi_user *ipmi_user_t; + struct quanta_hwmon_ipmi_data { struct platform_device *ipmi_platform_dev; @@ -1829,7 +1831,7 @@ static int32_t __init quanta_hwmon_ipmi_init(void) goto device_reg_err; } - data->ipmi_hwmon_dev = hwmon_device_register_with_groups(NULL, DRVNAME, NULL, + data->ipmi_hwmon_dev = hwmon_device_register_with_groups(&data->ipmi_platform_dev->dev, DRVNAME, NULL, NULL); err = IS_ERR(data->ipmi_hwmon_dev); if (err) @@ -1856,21 +1858,15 @@ static int32_t __init quanta_hwmon_ipmi_init(void) return 0; init_sensor_err: - if (g_sensor_data) - { - kfree(g_sensor_data); - g_sensor_data = NULL; - } + kfree(g_sensor_data); + g_sensor_data = NULL; ipmi_create_err: hwmon_device_unregister(data->ipmi_hwmon_dev); hwmon_register_err: platform_device_unregister(data->ipmi_platform_dev); device_reg_err: - if (data) - { - kfree(data); - data = NULL; - } + kfree(data); + data = NULL; alloc_err: return err; } @@ -1886,17 +1882,10 @@ static void __exit quanta_hwmon_ipmi_exit(void) platform_device_unregister(data->ipmi_platform_dev); - if (g_sensor_data) - { - kfree(g_sensor_data); - g_sensor_data = NULL; - } - - if (data) - { - kfree(data); - data = NULL; - } + kfree(g_sensor_data); + g_sensor_data = NULL; + kfree(data); + data = NULL; } module_init(quanta_hwmon_ipmi_init); diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/quanta_platform_ix7.c b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/quanta_platform_ix7.c index 02705e37d8..742b6b6e7d 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/quanta_platform_ix7.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/quanta_platform_ix7.c @@ -151,9 +151,9 @@ static int __init ix7_platform_init(void) } else { - g_client[0] = i2c_new_device(adapter, &ix7_i2c_devices[0]); // pca9546 - g_client[1] = i2c_new_device(adapter, &ix7_i2c_devices[1]); // pca9548 - g_client[2] = i2c_new_device(adapter, &ix7_i2c_devices[10]); // pca9546 in CPU board + g_client[0] = i2c_new_client_device(adapter, &ix7_i2c_devices[0]); // pca9546 + g_client[1] = i2c_new_client_device(adapter, &ix7_i2c_devices[1]); // pca9548 + g_client[2] = i2c_new_client_device(adapter, &ix7_i2c_devices[10]); // pca9546 in CPU board i2c_put_adapter(adapter); } @@ -164,7 +164,7 @@ static int __init ix7_platform_init(void) } else { - g_client[3] = i2c_new_device(adapter, &ix7_i2c_devices[11]); // CPU Board Data + g_client[3] = i2c_new_client_device(adapter, &ix7_i2c_devices[11]); // CPU Board Data i2c_put_adapter(adapter); } @@ -175,8 +175,8 @@ static int __init ix7_platform_init(void) } else { - g_client[4] = i2c_new_device(adapter, &ix7_i2c_devices[8]); // CPLD2 - g_client[5] = i2c_new_device(adapter, &ix7_i2c_devices[13]); // CPLD_led_1 + g_client[4] = i2c_new_client_device(adapter, &ix7_i2c_devices[8]); // CPLD2 + g_client[5] = i2c_new_client_device(adapter, &ix7_i2c_devices[13]); // CPLD_led_1 i2c_put_adapter(adapter); } @@ -187,8 +187,8 @@ static int __init ix7_platform_init(void) } else { - g_client[6] = i2c_new_device(adapter, &ix7_i2c_devices[9]); // CPLD3 - g_client[7] = i2c_new_device(adapter, &ix7_i2c_devices[14]); // CPLD_led_2 + g_client[6] = i2c_new_client_device(adapter, &ix7_i2c_devices[9]); // CPLD3 + g_client[7] = i2c_new_client_device(adapter, &ix7_i2c_devices[14]); // CPLD_led_2 i2c_put_adapter(adapter); } @@ -199,7 +199,7 @@ static int __init ix7_platform_init(void) } else { - g_client[8] = i2c_new_device(adapter, &ix7_i2c_devices[2]); // MB_BOARDINFO_EEPROM + g_client[8] = i2c_new_client_device(adapter, &ix7_i2c_devices[2]); // MB_BOARDINFO_EEPROM i2c_put_adapter(adapter); } @@ -210,7 +210,7 @@ static int __init ix7_platform_init(void) } else { - g_client[9] = i2c_new_device(adapter, &ix7_i2c_devices[7]); // pca9555 MB Board Data + g_client[9] = i2c_new_client_device(adapter, &ix7_i2c_devices[7]); // pca9555 MB Board Data i2c_put_adapter(adapter); } @@ -221,7 +221,7 @@ static int __init ix7_platform_init(void) } else { - g_client[10] = i2c_new_device(adapter, &ix7_i2c_devices[3]); // pca9548_1 SFP + g_client[10] = i2c_new_client_device(adapter, &ix7_i2c_devices[3]); // pca9548_1 SFP i2c_put_adapter(adapter); } @@ -232,7 +232,7 @@ static int __init ix7_platform_init(void) } else { - g_client[11] = i2c_new_device(adapter, &ix7_i2c_devices[4]); // pca9548_2 SFP + g_client[11] = i2c_new_client_device(adapter, &ix7_i2c_devices[4]); // pca9548_2 SFP i2c_put_adapter(adapter); } @@ -243,7 +243,7 @@ static int __init ix7_platform_init(void) } else { - g_client[12] = i2c_new_device(adapter, &ix7_i2c_devices[5]); // pca9548_3 SFP + g_client[12] = i2c_new_client_device(adapter, &ix7_i2c_devices[5]); // pca9548_3 SFP i2c_put_adapter(adapter); } @@ -254,7 +254,7 @@ static int __init ix7_platform_init(void) } else { - g_client[13] = i2c_new_device(adapter, &ix7_i2c_devices[6]); // pca9548_4 SFP + g_client[13] = i2c_new_client_device(adapter, &ix7_i2c_devices[6]); // pca9548_4 SFP i2c_put_adapter(adapter); } @@ -266,7 +266,7 @@ static int __init ix7_platform_init(void) } else { - g_client_port[i - 17] = i2c_new_device(adapter, &ix7_i2c_devices[12]); + g_client_port[i - 17] = i2c_new_client_device(adapter, &ix7_i2c_devices[12]); i2c_put_adapter(adapter); } } diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/chassis.py index 58d44f4c55..a14eb81b7d 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/chassis.py @@ -72,6 +72,13 @@ class Chassis(ChassisBase): for index in range(1, self.__num_of_ports + 1): self.__xcvr_presence[index] = self._sfp_list[index-1].get_presence() + # Initialize components + from sonic_platform.component import ComponentBIOS, ComponentBMC, ComponentCPLD, ComponentPCIE + self._component_list.append(ComponentBIOS()) + self._component_list.append(ComponentBMC()) + self._component_list.extend(ComponentCPLD.get_component_list()) + self._component_list.append(ComponentPCIE()) + ############################################## # Device methods ############################################## @@ -189,19 +196,7 @@ class Chassis(ChassisBase): is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used to pass a description of the reboot cause. """ - hw_reboot_cause = "" - with open("/sys/class/watchdog/watchdog0/reboot_reason", "r") as f: - hw_reboot_cause = f.read().strip('\n') - - if hw_reboot_cause == "2": - reboot_cause = self.REBOOT_CAUSE_WATCHDOG - description = 'Hardware Watchdog Reset' - else: - reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE - description = 'Unknown reason' - - return (reboot_cause, description) - + return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Invalid Reason") ############################################## # Other methods @@ -239,10 +234,10 @@ class Chassis(ChassisBase): cur_xcvr_presence = self._sfp_list[index-1].get_presence() if cur_xcvr_presence != self.__xcvr_presence[index]: if cur_xcvr_presence is True: - xcvr_change_event_dict[str(index)] = '1' + xcvr_change_event_dict[index] = '1' self.__xcvr_presence[index] = True elif cur_xcvr_presence is False: - xcvr_change_event_dict[str(index)] = '0' + xcvr_change_event_dict[index] = '0' self.__xcvr_presence[index] = False event = True diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/component.py new file mode 100644 index 0000000000..9f5f69f422 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/component.py @@ -0,0 +1,202 @@ +#!/usr/bin/env python + +######################################################################## +# Quanta IX7 +# +# Name: component.py, version: 1.3 +# Module contains an implementation of SONiC Platform Base API and +# provides the Components' (e.g., BIOS, CPLD, FPGA, etc.) available in +# the platform +# +######################################################################## + +try: + import subprocess + from sonic_platform_base.component_base import ComponentBase + from collections import namedtuple +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Component(ComponentBase): + def __init__(self): + ComponentBase.__init__(self) + self.name = None + self.description = None + + def get_name(self): + return self.name + + def get_description(self): + return self.description + + def install_firmware(self, image_path): + """ + Installs firmware to the component + + Args: + image_path: A string, path to firmware image + + Returns: + A boolean, True if install was successful, False if not + """ + return False + + @staticmethod + def _get_command_result(cmdline): + try: + proc = subprocess.Popen(cmdline, + stdout=subprocess.PIPE, + shell=True, stderr=subprocess.STDOUT, + universal_newlines=True) + stdout = proc.communicate()[0] + rc = proc.wait() + result = stdout.rstrip('\n') + if rc != 0: + raise RuntimeError("Failed to execute command {}, return code {}, {}".format(cmdline, rc, stdout)) + + except OSError as e: + raise RuntimeError("Failed to execute command {} due to {}".format(cmdline, repr(e))) + + return result + + +class ComponentBIOS(Component): + COMPONENT_NAME = 'BIOS' + COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' + + BIOS_QUERY_VERSION_COMMAND = "dmidecode -s bios-version" + + def __init__(self): + super(ComponentBIOS, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + bios_ver = self._get_command_result(self.BIOS_QUERY_VERSION_COMMAND) + if not bios_ver: + return 'ERR' + else: + return bios_ver + + +class ComponentBMC(Component): + COMPONENT_NAME = 'BMC' + COMPONENT_DESCRIPTION = 'BMC - Board Management Controller' + BMC_QUERY_VERSION_COMMAND = "ipmitool mc info | grep 'Firmware Revision'" + + def __init__(self): + super(ComponentBMC, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + bmc_ver = self._get_command_result(self.BMC_QUERY_VERSION_COMMAND) + if not bmc_ver: + return 'ERR' + else: + bmc_ver = bmc_ver.split(": ")[1] + return bmc_ver.strip() + + +class ComponentCPLD(Component): + Cpld = namedtuple("Cpld", ['name', 'cmd_index', 'description']) + + cplds = { + 1: Cpld("UART_CPLD", 1, "UART"), + 2: Cpld("BOOT_CPLD", 2, "Power sequence"), + 3: Cpld("FAN_CPLD", 3, "Fan"), + 4: Cpld("MB_CPLD_IO_1", 5, "Port IO-1"), + 5: Cpld("MB_CPLD_IO_2", 6, "Port IO-2"), + 6: Cpld("MB_CPLD_LED_1", 4, "Port LED-1"), + 7: Cpld("MB_CPLD_LED_2", 7, "Port LED-2"), + } + + def __init__(self, component_index): + super(ComponentCPLD, self).__init__() + self.index = component_index + + def get_name(self): + """ + Retrieves the name of the component + + Returns: + A string containing the name of the component + """ + self.name = self.cplds[self.index].name + + return self.name + + def get_description(self): + """ + Retrieves the description of the component + + Returns: + A string containing the description of the component + """ + self.description = self.cplds[self.index].description + + return self.description + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + res = self._get_command_result("ipmitool raw 0x32 0xff 0x02 {}".format(self.cplds[self.index].cmd_index)) + if not res: + return 'ERR' + else: + return res.split()[3].upper() + res.split()[2].upper() + res.split()[1].upper() + res.split()[0].upper() + + @classmethod + def get_component_list(cls): + component_list = [] + cpld_number = len(cls.cplds) + + for cpld_idx in range(1, cpld_number + 1): + component_list.append(cls(cpld_idx)) + + return component_list + + +class ComponentPCIE(Component): + COMPONENT_NAME = 'PCIe' + COMPONENT_DESCRIPTION = 'ASIC PCIe Firmware' + PCIE_QUERY_VERSION_COMMAND = "bcmcmd 'pciephy fw version' | grep 'FW version'" + + def __init__(self): + super(ComponentPCIE, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + version = self._get_command_result(self.PCIE_QUERY_VERSION_COMMAND) + if not version: + return 'ERR' + else: + version = version.split(": ")[1] + return version.strip() diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/fan_drawer.py index 75e954576a..3d5f767477 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/fan_drawer.py @@ -28,7 +28,7 @@ class FanDrawer(FanDrawerBase): Returns: string: The name of the device """ - return 'Fan {}'.format(self._index) + return 'Fantray{}'.format(self._index) def get_presence(self): """ diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/psu.py index 49846fff48..3ef0c6816c 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/psu.py @@ -213,10 +213,10 @@ class Psu(PsuBase): def get_input_voltage(self): """ - Retrieves current PSU voltage output + Retrieves current PSU voltage input Returns: - A float number, the output voltage in volts, + A float number, the input voltage in volts, e.g. 12.1 """ voltage_in = 0.0 diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/sfp.py index a00fc8f297..c833647305 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/sfp.py @@ -10,13 +10,10 @@ import os import time -#import subprocess -#import sonic_device_util from ctypes import create_string_buffer try: from sonic_platform_base.sfp_base import SfpBase -# from sonic_platform_base.sonic_eeprom import eeprom_dts from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId @@ -175,7 +172,6 @@ class Sfp(SfpBase): # Init index self.index = sfp_index self.port_num = self.index - #self.dom_supported = False self.sfp_type = sfp_type self.lpmode_path = "/sys/class/cpld-qsfp28/port-"+str(self.port_num)+"/lpmode" self.reset_path = "/sys/class/cpld-qsfp28/port-"+str(self.port_num)+"/reset" @@ -262,15 +258,6 @@ class Sfp(SfpBase): else: return 'N/A' - def __read_txt_file(self, file_path): - try: - with open(file_path, 'r') as fd: - data = fd.read() - return data.strip() - except IOError: - pass - return "" - def __is_host(self): return os.system(self.HOST_CHK_CMD) == 0 @@ -325,26 +312,6 @@ class Sfp(SfpBase): return eeprom_raw - def __convert_string_to_num(self, value_str): - if "-inf" in value_str: - return 'N/A' - elif "Unknown" in value_str: - return 'N/A' - elif 'dBm' in value_str: - t_str = value_str.rstrip('dBm') - return float(t_str) - elif 'mA' in value_str: - t_str = value_str.rstrip('mA') - return float(t_str) - elif 'C' in value_str: - t_str = value_str.rstrip('C') - return float(t_str) - elif 'Volts' in value_str: - t_str = value_str.rstrip('Volts') - return float(t_str) - else: - return 'N/A' - def _dom_capability_detect(self): if not self.get_presence(): self.dom_supported = False @@ -503,9 +470,7 @@ class Sfp(SfpBase): else: if not self.get_presence(): return transceiver_info_dict - elif i == max_retry-1: - pass - else: + elif i < max_retry-1: time.sleep(0.5) if sfp_interface_bulk_raw is None: @@ -560,7 +525,8 @@ class Sfp(SfpBase): ['data']['Extended Identifier']['value'] transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data \ ['data']['RateIdentifier']['value'] - transceiver_info_dict['type_abbrv_name'] = 'N/A' + transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data \ + ['data']['type_abbrv_name']['value'] if self.sfp_type == QSFP_TYPE: for key in qsfp_cable_length_tup: if key in sfp_interface_bulk_data['data']: @@ -830,7 +796,7 @@ class Sfp(SfpBase): transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['TxBiasLowWarning']['value'] for key in transceiver_dom_threshold_dict: - transceiver_dom_threshold_dict[key] = self.__convert_string_to_num(transceiver_dom_threshold_dict[key]) + transceiver_dom_threshold_dict[key] = self._convert_string_to_num(transceiver_dom_threshold_dict[key]) return transceiver_dom_threshold_dict @@ -878,7 +844,7 @@ class Sfp(SfpBase): transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] for key in transceiver_dom_threshold_info_dict: - transceiver_dom_threshold_info_dict[key] = self.__convert_string_to_num(transceiver_dom_threshold_info_dict[key]) + transceiver_dom_threshold_info_dict[key] = self._convert_string_to_num(transceiver_dom_threshold_info_dict[key]) return transceiver_dom_threshold_info_dict @@ -1425,7 +1391,7 @@ class Sfp(SfpBase): sysfsfile_eeprom = open( sysfs_sfp_i2c_client_eeprom_path, mode="r+b", buffering=0) buffer = create_string_buffer(1) - buffer[0] = chr(tx_disable_ctl) + buffer[0] = tx_disable_ctl # Write to eeprom sysfsfile_eeprom.seek(offset + SFP_STATUS_CONTROL_OFFSET) sysfsfile_eeprom.write(buffer[0]) @@ -1478,7 +1444,7 @@ class Sfp(SfpBase): else: tx_disable_ctl = channel_state & (~channel) buffer = create_string_buffer(1) - buffer[0] = chr(tx_disable_ctl) + buffer[0] = tx_disable_ctl # Write to eeprom sysfsfile_eeprom = open( self.port_to_eeprom_mapping[self.port_num], "r+b") @@ -1565,7 +1531,7 @@ class Sfp(SfpBase): power_set_bit |= 1 << 1 buffer = create_string_buffer(1) - buffer[0] = chr(power_override_bit | power_set_bit) + buffer[0] = power_override_bit | power_set_bit # Write to eeprom sysfsfile_eeprom = open(self.port_to_eeprom_mapping[self.port_num], "r+b") sysfsfile_eeprom.seek(QSFP_POWEROVERRIDE_OFFSET) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/thermal.py index bf5757c9fa..238d15fbea 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/thermal.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# Quanta +# Quanta IX7 # # Module contains an implementation of SONiC Platform Base API and # provides the Thermal information @@ -57,7 +57,7 @@ class Thermal(ThermalBase): with open(attr_path, 'r') as fd: retval = fd.read() except Exception as error: - logging.error("Unable to open ", attr_path, " file !") + logging.error("Unable to open " + attr_path + " file !") retval = retval.rstrip(' \t\n\r') return retval diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/watchdog.py index 282f356f4e..0e63d9368c 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/watchdog.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/watchdog.py @@ -48,12 +48,16 @@ WD_MAIN_IDENTITY = "iTCO_wdt" WDT_SYSFS_PATH = "/sys/class/watchdog/" DEFAULT_TIMEOUT=180 +watchdog=0 class Watchdog(WatchdogBase): def __init__(self): self.watchdog, self.wdt_main_dev_name = self._get_wdt() + if self.wdt_main_dev_name is None: + raise Exception("Watchdog device is not instantiated") + self.status_path = "/sys/class/watchdog/%s/status" % self.wdt_main_dev_name self.state_path = "/sys/class/watchdog/%s/state" % self.wdt_main_dev_name self.timeout_path = "/sys/class/watchdog/%s/timeout" % self.wdt_main_dev_name @@ -74,14 +78,16 @@ class Watchdog(WatchdogBase): """ Retrieves watchdog device """ + global watchdog wdt_main_dev_list = [dev for dev in os.listdir( "/dev/") if dev.startswith("watchdog") and self._is_wd_main(dev)] if not wdt_main_dev_list: - return None + return (None, None) wdt_main_dev_name = wdt_main_dev_list[0] watchdog_device_path = "/dev/{}".format(wdt_main_dev_name) - self.watchdog = os.open(watchdog_device_path, os.O_RDWR) - return self.watchdog, wdt_main_dev_name + if not watchdog: + watchdog = os.open(watchdog_device_path, os.O_RDWR) + return watchdog, wdt_main_dev_name def _read_file(self, file_path): """ @@ -228,7 +234,8 @@ class Watchdog(WatchdogBase): Close watchdog """ - os.close(self.watchdog) + if self.watchdog is not None : + os.close(self.watchdog) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/utils/quanta_ix7_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/utils/quanta_ix7_util.py index 901f7ba1ae..4196e24f46 100755 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/utils/quanta_ix7_util.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/utils/quanta_ix7_util.py @@ -28,7 +28,7 @@ command: """ import os -import commands +import subprocess import sys, getopt import logging import time @@ -38,18 +38,16 @@ args = [] FORCE = 0 i2c_prefix = '/sys/bus/i2c/devices/' - if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] - + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): global DEBUG global args global FORCE - if len(sys.argv)<2: + if len(sys.argv) < 2: show_help() options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', @@ -57,9 +55,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -73,34 +71,43 @@ def main(): logging.info('no option') for arg in args: if arg == 'install': - install() + install() elif arg == 'clean': - uninstall() + uninstall() else: show_help() - return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_log(txt): if DEBUG == True: - print "[IX7-32X]"+txt + print("[IX7-32X]" + txt) return def exec_cmd(cmd, show): - logging.info('Run :'+cmd) - status, output = commands.getstatusoutput(cmd) + logging.info('Run :' + cmd) + status, output = subprocess.getstatusoutput(cmd) show_log (cmd +"with result:" + str(status)) - show_log (" output:"+output) + show_log (" output:" + output) if status: - logging.info('Failed :'+cmd) + logging.info('Failed :' + cmd) if show: - print('Failed :'+cmd) - return status, output + print('Failed :' + cmd) + return status, output + +pca954x_bus_addr =[ +'0-0071', +'0-0072', +'0-0077', +'5-0073', +'6-0073', +'7-0073', +'8-0073' +] instantiate =[ #Enable front-ports LED decoding @@ -119,7 +126,7 @@ drivers =[ 'lpc_ich', 'i2c-i801', 'i2c-dev', -'i2c-mux-pca954x force_deselect_on_exit=1', +'i2c-mux-pca954x', 'gpio-pca953x', 'optoe', 'qci_cpld', @@ -155,11 +162,24 @@ def system_install(): exec_cmd("depmod -a ", 1) #install drivers for i in range(0,len(drivers)): - status, output = exec_cmd("modprobe "+drivers[i], 1) - if status: - print output - if FORCE == 0: - return status + status, output = exec_cmd("modprobe " + drivers[i], 1) + if status: + print(output) + #retry quanta_hwmon_ipmi in case it init failed due to ipmi_msghandler init uncompleted + if drivers[i] == 'quanta_hwmon_ipmi': + for _ in range(0, 3): + time.sleep(3) + ret, out = exec_cmd("modprobe quanta_hwmon_ipmi ", 1) + if ret == 0: + break + if ret and FORCE == 0: + return ret + elif FORCE == 0: + return status + + # set pca954x idle_state as -2: MUX_IDLE_DISCONNECT + for i in range(0,len(pca954x_bus_addr)): + exec_cmd("echo -2 > /sys/bus/i2c/drivers/pca954x/{}/idle_state".format(pca954x_bus_addr[i]), 1) #turn on module power exec_cmd("echo 21 > /sys/class/gpio/export ", 1) @@ -174,15 +194,15 @@ def system_install(): exec_cmd("echo 1 >/sys/class/gpio/gpio33/value", 1) #instantiate devices - for i in range(0,len(instantiate)): + for i in range(0, len(instantiate)): status, output = exec_cmd(instantiate[i], 1) - if status: - print output - if FORCE == 0: - return status + if status: + print(output) + if FORCE == 0: + return status #QSFP for 1~32 port - for port_number in range(1,33): + for port_number in range(1, 33): bus_number = port_number + 16 os.system("echo %d >/sys/bus/i2c/devices/%d-0050/port_name" % (port_number, bus_number)) return @@ -195,36 +215,37 @@ def system_ready(): def install(): if not device_found(): - print "No device, installing...." + print("No device, installing....") status = system_install() if status: if FORCE == 0: - return status + return status status, output = exec_cmd("pip3 install /usr/share/sonic/device/x86_64-quanta_ix7_rglbmc-r0/sonic_platform-1.0-py3-none-any.whl",1) if status: - print output - if FORCE == 0: - return status + print(output) + if FORCE == 0: + return status else: - print " ix7 driver already installed...." + print(" ix7 driver already installed....") return def uninstall(): global FORCE #uninstall drivers - for i in range(len(un_drivers)-1,-1,-1): - status, output = exec_cmd("rmmod "+un_drivers[i], 1) + for i in range(len(un_drivers) - 1, -1, -1): + status, output = exec_cmd("rmmod " + un_drivers[i], 1) if status: - print output + print(output) if FORCE == 0: return status status, output = exec_cmd("pip3 uninstall sonic-platform -y ",1) if status: - print output - if FORCE == 0: - return status + print(output) + if FORCE == 0: + return status + return def device_found(): diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/modules/qci_cpld_led.c b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/modules/qci_cpld_led.c index d924f51ebc..7354e9071c 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/modules/qci_cpld_led.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/modules/qci_cpld_led.c @@ -51,7 +51,7 @@ static struct class *cpld_class = NULL; struct cpld_data { struct i2c_client *cpld_client; - char name[8]; + char name[16]; u8 cpld_id; }; diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/modules/quanta_hwmon_ipmi.c b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/modules/quanta_hwmon_ipmi.c index 08d6a97d9a..29b439f290 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/modules/quanta_hwmon_ipmi.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/modules/quanta_hwmon_ipmi.c @@ -86,6 +86,8 @@ #define IPMI_TIMEOUT (4 * HZ) #define IPMI_MAX_WAIT_QUEUE 1 +typedef struct ipmi_user *ipmi_user_t; + struct quanta_hwmon_ipmi_data { struct platform_device *ipmi_platform_dev; @@ -1829,7 +1831,7 @@ static int32_t __init quanta_hwmon_ipmi_init(void) goto device_reg_err; } - data->ipmi_hwmon_dev = hwmon_device_register_with_groups(NULL, DRVNAME, NULL, + data->ipmi_hwmon_dev = hwmon_device_register_with_groups(&data->ipmi_platform_dev->dev, DRVNAME, NULL, NULL); err = IS_ERR(data->ipmi_hwmon_dev); if (err) @@ -1856,21 +1858,15 @@ static int32_t __init quanta_hwmon_ipmi_init(void) return 0; init_sensor_err: - if (g_sensor_data) - { - kfree(g_sensor_data); - g_sensor_data = NULL; - } + kfree(g_sensor_data); + g_sensor_data = NULL; ipmi_create_err: hwmon_device_unregister(data->ipmi_hwmon_dev); hwmon_register_err: platform_device_unregister(data->ipmi_platform_dev); device_reg_err: - if (data) - { - kfree(data); - data = NULL; - } + kfree(data); + data = NULL; alloc_err: return err; } @@ -1886,17 +1882,10 @@ static void __exit quanta_hwmon_ipmi_exit(void) platform_device_unregister(data->ipmi_platform_dev); - if (g_sensor_data) - { - kfree(g_sensor_data); - g_sensor_data = NULL; - } - - if (data) - { - kfree(data); - data = NULL; - } + kfree(g_sensor_data); + g_sensor_data = NULL; + kfree(data); + data = NULL; } module_init(quanta_hwmon_ipmi_init); diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/modules/quanta_platform_ix7_bwde.c b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/modules/quanta_platform_ix7_bwde.c index 4658cee285..01f1169939 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/modules/quanta_platform_ix7_bwde.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/modules/quanta_platform_ix7_bwde.c @@ -148,9 +148,9 @@ static int __init ix7_bwde_platform_init(void) } else { - g_client[0] = i2c_new_device(adapter, &ix7_bwde_i2c_devices[0]); // pca9546 - g_client[1] = i2c_new_device(adapter, &ix7_bwde_i2c_devices[1]); // pca9548 - g_client[2] = i2c_new_device(adapter, &ix7_bwde_i2c_devices[10]); // CPU Board Data + g_client[0] = i2c_new_client_device(adapter, &ix7_bwde_i2c_devices[0]); // pca9546 + g_client[1] = i2c_new_client_device(adapter, &ix7_bwde_i2c_devices[1]); // pca9548 + g_client[2] = i2c_new_client_device(adapter, &ix7_bwde_i2c_devices[10]); // CPU Board Data i2c_put_adapter(adapter); } @@ -161,8 +161,8 @@ static int __init ix7_bwde_platform_init(void) } else { - g_client[3] = i2c_new_device(adapter, &ix7_bwde_i2c_devices[8]); // CPLD2 - g_client[4] = i2c_new_device(adapter, &ix7_bwde_i2c_devices[12]); // CPLD_led_1 + g_client[3] = i2c_new_client_device(adapter, &ix7_bwde_i2c_devices[8]); // CPLD2 + g_client[4] = i2c_new_client_device(adapter, &ix7_bwde_i2c_devices[12]); // CPLD_led_1 i2c_put_adapter(adapter); } @@ -173,8 +173,8 @@ static int __init ix7_bwde_platform_init(void) } else { - g_client[5] = i2c_new_device(adapter, &ix7_bwde_i2c_devices[9]); // CPLD3 - g_client[6] = i2c_new_device(adapter, &ix7_bwde_i2c_devices[13]); // CPLD_led_2 + g_client[5] = i2c_new_client_device(adapter, &ix7_bwde_i2c_devices[9]); // CPLD3 + g_client[6] = i2c_new_client_device(adapter, &ix7_bwde_i2c_devices[13]); // CPLD_led_2 i2c_put_adapter(adapter); } @@ -185,7 +185,7 @@ static int __init ix7_bwde_platform_init(void) } else { - g_client[7] = i2c_new_device(adapter, &ix7_bwde_i2c_devices[2]); // MB_BOARDINFO_EEPROM + g_client[7] = i2c_new_client_device(adapter, &ix7_bwde_i2c_devices[2]); // MB_BOARDINFO_EEPROM i2c_put_adapter(adapter); } @@ -196,7 +196,7 @@ static int __init ix7_bwde_platform_init(void) } else { - g_client[8] = i2c_new_device(adapter, &ix7_bwde_i2c_devices[7]); // pca9555 MB Board Data + g_client[8] = i2c_new_client_device(adapter, &ix7_bwde_i2c_devices[7]); // pca9555 MB Board Data i2c_put_adapter(adapter); } @@ -207,7 +207,7 @@ static int __init ix7_bwde_platform_init(void) } else { - g_client[9] = i2c_new_device(adapter, &ix7_bwde_i2c_devices[3]); // pca9548_1 SFP + g_client[9] = i2c_new_client_device(adapter, &ix7_bwde_i2c_devices[3]); // pca9548_1 SFP i2c_put_adapter(adapter); } @@ -218,7 +218,7 @@ static int __init ix7_bwde_platform_init(void) } else { - g_client[10] = i2c_new_device(adapter, &ix7_bwde_i2c_devices[4]); // pca9548_2 SFP + g_client[10] = i2c_new_client_device(adapter, &ix7_bwde_i2c_devices[4]); // pca9548_2 SFP i2c_put_adapter(adapter); } @@ -229,7 +229,7 @@ static int __init ix7_bwde_platform_init(void) } else { - g_client[11] = i2c_new_device(adapter, &ix7_bwde_i2c_devices[5]); // pca9548_3 SFP + g_client[11] = i2c_new_client_device(adapter, &ix7_bwde_i2c_devices[5]); // pca9548_3 SFP i2c_put_adapter(adapter); } @@ -240,7 +240,7 @@ static int __init ix7_bwde_platform_init(void) } else { - g_client[12] = i2c_new_device(adapter, &ix7_bwde_i2c_devices[6]); // pca9548_4 SFP + g_client[12] = i2c_new_client_device(adapter, &ix7_bwde_i2c_devices[6]); // pca9548_4 SFP i2c_put_adapter(adapter); } @@ -252,7 +252,7 @@ static int __init ix7_bwde_platform_init(void) } else { - g_client_port[i - 13] = i2c_new_device(adapter, &ix7_bwde_i2c_devices[11]); + g_client_port[i - 13] = i2c_new_client_device(adapter, &ix7_bwde_i2c_devices[11]); i2c_put_adapter(adapter); } } diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/chassis.py index 92a8c433ce..bcd0739e5f 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/chassis.py @@ -8,6 +8,7 @@ try: import sys import time + import syslog from sonic_platform_base.chassis_base import ChassisBase from sonic_platform.eeprom import Eeprom from sonic_platform.psu import Psu @@ -71,6 +72,13 @@ class Chassis(ChassisBase): for index in range(1, self.__num_of_ports + 1): self.__xcvr_presence[index] = self._sfp_list[index-1].get_presence() + # Initialize components + from sonic_platform.component import ComponentBIOS, ComponentBMC, ComponentCPLD, ComponentPCIE + self._component_list.append(ComponentBIOS()) + self._component_list.append(ComponentBMC()) + self._component_list.extend(ComponentCPLD.get_component_list()) + self._component_list.append(ComponentPCIE()) + ############################################## # Device methods ############################################## @@ -178,6 +186,39 @@ class Chassis(ChassisBase): """ return self._eeprom.system_eeprom_info() + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Invalid Reason") + + ############################################## + # Other methods + ############################################## + def get_watchdog(self): + """ + Retreives hardware watchdog device on this chassis + + Returns: + An object derived from WatchdogBase representing the hardware + watchdog device + """ + try: + if self._watchdog is None: + from sonic_platform.watchdog import Watchdog + # Create the watchdog Instance + self._watchdog = Watchdog() + + except Exception as e: + syslog.syslog(syslog.LOG_ERR, "Fail to load watchdog due to {}".format(e)) + return self._watchdog + def get_change_event(self, timeout=0): """ Currently only support transceiver change events @@ -193,10 +234,10 @@ class Chassis(ChassisBase): cur_xcvr_presence = self._sfp_list[index-1].get_presence() if cur_xcvr_presence != self.__xcvr_presence[index]: if cur_xcvr_presence is True: - xcvr_change_event_dict[str(index)] = '1' + xcvr_change_event_dict[index] = '1' self.__xcvr_presence[index] = True elif cur_xcvr_presence is False: - xcvr_change_event_dict[str(index)] = '0' + xcvr_change_event_dict[index] = '0' self.__xcvr_presence[index] = False event = True diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/component.py new file mode 100644 index 0000000000..ae0c252289 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/component.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python + +######################################################################## +# Quanta IX7_BDE +# +# Name: component.py, version: 1.3 +# Module contains an implementation of SONiC Platform Base API and +# provides the Components' (e.g., BIOS, CPLD, FPGA, etc.) available in +# the platform +# +######################################################################## + +try: + import subprocess + from sonic_platform_base.component_base import ComponentBase + from collections import namedtuple +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Component(ComponentBase): + def __init__(self): + ComponentBase.__init__(self) + self.name = None + self.description = None + + def get_name(self): + return self.name + + def get_description(self): + return self.description + + def install_firmware(self, image_path): + """ + Installs firmware to the component + + Args: + image_path: A string, path to firmware image + + Returns: + A boolean, True if install was successful, False if not + """ + return False + + @staticmethod + def _get_command_result(cmdline): + try: + proc = subprocess.Popen(cmdline, + stdout=subprocess.PIPE, + shell=True, stderr=subprocess.STDOUT, + universal_newlines=True) + stdout = proc.communicate()[0] + rc = proc.wait() + result = stdout.rstrip('\n') + if rc != 0: + raise RuntimeError("Failed to execute command {}, return code {}, {}".format(cmdline, rc, stdout)) + + except OSError as e: + raise RuntimeError("Failed to execute command {} due to {}".format(cmdline, repr(e))) + + return result + + +class ComponentBIOS(Component): + COMPONENT_NAME = 'BIOS' + COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' + + BIOS_QUERY_VERSION_COMMAND = "dmidecode -s bios-version" + + def __init__(self): + super(ComponentBIOS, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + bios_ver = self._get_command_result(self.BIOS_QUERY_VERSION_COMMAND) + if not bios_ver: + return 'ERR' + else: + return bios_ver + + +class ComponentBMC(Component): + COMPONENT_NAME = 'BMC' + COMPONENT_DESCRIPTION = 'BMC - Board Management Controller' + BMC_QUERY_VERSION_COMMAND = "ipmitool mc info | grep 'Firmware Revision'" + + def __init__(self): + super(ComponentBMC, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + bmc_ver = self._get_command_result(self.BMC_QUERY_VERSION_COMMAND) + if not bmc_ver: + return 'ERR' + else: + bmc_ver = bmc_ver.split(": ")[1] + return bmc_ver.strip() + + +class ComponentCPLD(Component): + Cpld = namedtuple("Cpld", ['name', 'cmd_index', 'description']) + + cplds = { + 1: Cpld("BOOT_CPLD", 1, "Power sequence"), + 2: Cpld("FAN_CPLD", 2, "Fan"), + 3: Cpld("MB_CPLD_IO_1", 4, "Port IO-1"), + 4: Cpld("MB_CPLD_IO_2", 5, "Port IO-2"), + 5: Cpld("MB_CPLD_LED_1", 3, "Port LED-1"), + 6: Cpld("MB_CPLD_LED_2", 6, "Port LED-2"), + } + + def __init__(self, component_index): + super(ComponentCPLD, self).__init__() + self.index = component_index + + def get_name(self): + """ + Retrieves the name of the component + + Returns: + A string containing the name of the component + """ + self.name = self.cplds[self.index].name + + return self.name + + def get_description(self): + """ + Retrieves the description of the component + + Returns: + A string containing the description of the component + """ + self.description = self.cplds[self.index].description + + return self.description + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x01") + res = self._get_command_result("ipmitool raw 0x32 0xff 0x02 {}".format(self.cplds[self.index].cmd_index)) + self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x00") + if not res: + return 'ERR' + else: + return res.split()[3].upper() + res.split()[2].upper() + res.split()[1].upper() + res.split()[0].upper() + + @classmethod + def get_component_list(cls): + component_list = [] + cpld_number = len(cls.cplds) + + for cpld_idx in range(1, cpld_number + 1): + component_list.append(cls(cpld_idx)) + + return component_list + + +class ComponentPCIE(Component): + COMPONENT_NAME = 'PCIe' + COMPONENT_DESCRIPTION = 'ASIC PCIe Firmware' + PCIE_QUERY_VERSION_COMMAND = "bcmcmd 'pciephy fw version' | grep 'FW version'" + + def __init__(self): + super(ComponentPCIE, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + version = self._get_command_result(self.PCIE_QUERY_VERSION_COMMAND) + if not version: + return 'ERR' + else: + version = version.split(": ")[1] + return version.strip() diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/fan.py index 5567eaff93..fbd8004ce7 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/fan.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# Quanta IX7 +# Quanta IX7_BDE # # Module contains an implementation of SONiC Platform Base API and # provides the FAN information @@ -11,6 +11,7 @@ try: import logging import os + import glob from sonic_platform_base.fan_base import FanBase except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -19,9 +20,7 @@ except ImportError as e: ############### # Global ############### -HWMON_DIR = "/sys/class/hwmon/hwmon2/" -FAN_INDEX_START = 18 -NUM_FANTRAYS = 6 +HWMON_IPMI_DIR = "/sys/devices/platform/quanta_hwmon_ipmi/hwmon/hwmon*/" FANS_PERTRAY = 2 class Fan(FanBase): @@ -30,30 +29,46 @@ class Fan(FanBase): def __init__(self, index, is_psu_fan=False): self.is_psu_fan = is_psu_fan self.fan_index = index - self.psu_fan_index_mapping = { - 1:37, - 2:47, - } - self.psu_index_mapping = { - 1:39, - 2:49, - } + hwmon_dir=glob.glob(HWMON_IPMI_DIR)[0] + if self.is_psu_fan: - self.fan_presence_attr = "power{}_present".format(self.psu_index_mapping[index]) - self.fan_pwm_attr = "fan{}_pwm".format(self.psu_fan_index_mapping[index]) - self.fan_rpm_attr = "fan{}_input".format(self.psu_fan_index_mapping[index]) - self.fan_direction_attr = "fan{}_direction".format(self.psu_fan_index_mapping[index]) + power_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_POWER_OUT".format(self.fan_index), 'power') + fan_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_Fan".format(self.fan_index), 'fan') + self.fan_presence_attr = power_out_prefix + 'present' + self.fan_pwm_attr = fan_prefix + 'pwm' + self.fan_rpm_attr = fan_prefix + 'input' + self.fan_direction_attr = fan_prefix + 'direction' else: - self.fan_presence_attr = "fan{}_present".format(FAN_INDEX_START+(index-1)) - self.fan_pwm_attr = "fan{}_pwm".format(FAN_INDEX_START+(index-1)) - self.fan_rpm_attr = "fan{}_input".format(FAN_INDEX_START+(index-1)) - self.fan_direction_attr = "fan{}_direction".format(FAN_INDEX_START+(index-1)) + fantray_index = (self.fan_index-1)//FANS_PERTRAY+1 + fan_index_intray = self.fan_index - ((fantray_index-1)*FANS_PERTRAY) + fan_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "Fan_SYS_{}_{}".format(fantray_index, fan_index_intray), 'fan') + self.fan_presence_attr = fan_prefix + 'present' + self.fan_pwm_attr = fan_prefix + 'pwm' + self.fan_rpm_attr = fan_prefix + 'input' + self.fan_direction_attr = fan_prefix + 'direction' ####################### # private function ####################### + def __get_hwmon_attr_prefix(self, dir, label, type): + + retval = 'ERR' + if not os.path.isdir(dir): + return retval + + try: + for filename in os.listdir(dir): + if filename[-5:] == 'label' and type in filename: + file_path = os.path.join(dir, filename) + if os.path.isfile(file_path) and label == self.__get_attr_value(file_path): + return file_path[0:-5] + except Exception as error: + logging.error("Error when getting {} label path: {}".format(label, error)) + + return retval + def __get_attr_value(self, attr_path): retval = 'ERR' @@ -64,7 +79,7 @@ class Fan(FanBase): with open(attr_path, 'r') as fd: retval = fd.read() except Exception as error: - logging.error("Unable to open " + attr_path + " file !") + logging.error("Unable to open {} file: {}".format(attr_path, error)) retval = retval.rstrip(' \t\n\r') return retval @@ -95,8 +110,7 @@ class Fan(FanBase): Returns: bool: True if device is present, False if not """ - attr_path = HWMON_DIR + self.fan_presence_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_presence_attr) if (attr_rv != 'ERR'): if (attr_rv == '1'): return True @@ -112,11 +126,13 @@ class Fan(FanBase): Returns: A boolean value, True if device is operating properly, False if not """ - attr_path = HWMON_DIR + self.fan_rpm_attr - attr_rv = self.__get_attr_value(attr_path) + if self.get_presence(): + attr_rv = self.__get_attr_value(self.fan_rpm_attr) - if (attr_rv != 'ERR' and attr_rv != '0.0'): - return True + if (attr_rv != 'ERR' and attr_rv != '0.0'): + return True + else: + return False else: return False @@ -132,8 +148,7 @@ class Fan(FanBase): A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST depending on fan direction """ - attr_path = HWMON_DIR + self.fan_direction_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_direction_attr) if attr_rv == '2': return self.FAN_DIRECTION_INTAKE @@ -148,13 +163,15 @@ class Fan(FanBase): An integer, the percentage of full fan speed, in the range 0 (off) to 100 (full speed) """ - attr_path = HWMON_DIR + self.fan_pwm_attr - attr_rv = self.__get_attr_value(attr_path) + if self.get_presence(): + attr_rv = self.__get_attr_value(self.fan_pwm_attr) - if (attr_rv != 'ERR'): - return int(float(attr_rv)) + if (attr_rv != 'ERR'): + return int(float(attr_rv)) + else: + return False else: - return False + return 0 def get_speed_rpm(self): """ @@ -163,8 +180,7 @@ class Fan(FanBase): Returns: An integer, speed of the fan in RPM """ - attr_path = HWMON_DIR + self.fan_rpm_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_rpm_attr) if (attr_rv != 'ERR'): return int(float(attr_rv)) @@ -179,8 +195,7 @@ class Fan(FanBase): An integer, the percentage of full fan speed, in the range 0 (off) to 100 (full speed) """ - attr_path = HWMON_DIR + self.fan_pwm_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_pwm_attr) if (attr_rv != 'ERR'): return int(float(attr_rv)) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/fan_drawer.py index 75e954576a..3d5f767477 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/fan_drawer.py @@ -28,7 +28,7 @@ class FanDrawer(FanDrawerBase): Returns: string: The name of the device """ - return 'Fan {}'.format(self._index) + return 'Fantray{}'.format(self._index) def get_presence(self): """ diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/psu.py index 3fcb9e979a..6188c95c76 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/psu.py @@ -8,58 +8,61 @@ try: import logging import os + import glob from sonic_platform_base.psu_base import PsuBase from sonic_platform.fan import Fan except ImportError as e: raise ImportError(str(e) + "- required module not found") -HWMON_DIR = "/sys/class/hwmon/hwmon2/" - +HWMON_IPMI_DIR = "/sys/devices/platform/quanta_hwmon_ipmi/hwmon/hwmon*/" class Psu(PsuBase): def __init__(self, index): PsuBase.__init__(self) fan = Fan(index, True) self._fan_list.append(fan) + self.index = index + hwmon_dir=glob.glob(HWMON_IPMI_DIR)[0] - self.psu_index_mapping = { - 1:39, - 2:49, - } - self.psu_powerin_index_mapping = { - 1:38, - 2:48, - } - self.psu_currentout_index_mapping = { - 1:36, - 2:46, - } - self.psu_currentin_index_mapping = { - 1:35, - 2:45, - } - self.psu_voltageout_index_mapping = { - 1:44, - 2:54, - } - self.psu_voltagein_index_mapping = { - 1:43, - 2:53, - } - self.index = index - self.psu_presence_attr = "power{}_present".format(self.psu_index_mapping[self.index]) - self.psu_status_attr = "curr{}_input".format(self.psu_currentout_index_mapping[self.index]) - self.psu_power_in_attr = "power{}_input".format(self.psu_powerin_index_mapping[self.index]) - self.psu_power_out_attr = "power{}_input".format(self.psu_index_mapping[self.index]) - self.psu_voltage_out_attr = "in{}_input".format(self.psu_voltageout_index_mapping[self.index]) - self.psu_current_out_attr = "curr{}_input".format(self.psu_currentout_index_mapping[self.index]) - self.psu_voltage_in_attr = "in{}_input".format(self.psu_voltagein_index_mapping[self.index]) - self.psu_current_in_attr = "curr{}_input".format(self.psu_currentin_index_mapping[self.index]) - self.psu_serial_attr = "power{}_sn".format(self.psu_index_mapping[self.index]) - self.psu_model_attr = "power{}_model".format(self.psu_index_mapping[self.index]) - self.psu_mfr_id_attr = "power{}_mfrid".format(self.psu_index_mapping[self.index]) - self.psu_capacity_attr = "power{}_pout_max".format(self.psu_index_mapping[self.index]) - self.psu_type_attr = "power{}_vin_type".format(self.psu_index_mapping[self.index]) + current_in_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_CURRENT_IN".format(self.index), 'curr') + current_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_CURRENT_OUT".format(self.index), 'curr') + power_in_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_POWER_IN".format(self.index), 'power') + power_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_POWER_OUT".format(self.index), 'power') + voltage_in_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_VOLTAGE_IN".format(self.index), 'in') + voltage_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_VOLTAGE_OUT".format(self.index), 'in') + temp1_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_TEMP1".format(self.index), 'temp') + + self.psu_current_in_attr = current_in_prefix + 'input' + self.psu_current_out_attr = current_out_prefix + 'input' + self.psu_power_in_attr = power_in_prefix + 'input' + self.psu_power_out_attr = power_out_prefix + 'input' + self.psu_voltage_in_attr = voltage_in_prefix + 'input' + self.psu_voltage_out_attr = voltage_out_prefix + 'input' + self.psu_status_attr = current_out_prefix + 'input' + self.psu_presence_attr = power_out_prefix + 'present' + self.psu_serial_attr = power_out_prefix + 'sn' + self.psu_model_attr = power_out_prefix + 'model' + self.psu_mfr_id_attr = power_out_prefix + 'mfrid' + self.psu_capacity_attr = power_out_prefix + 'pout_max' + self.psu_type_attr = power_out_prefix + 'vin_type' + self.psu_temp_attr = temp1_prefix + 'input' + + def __get_hwmon_attr_prefix(self, dir, label, type): + + retval = 'ERR' + if not os.path.isdir(dir): + return retval + + try: + for filename in os.listdir(dir): + if filename[-5:] == 'label' and type in filename: + file_path = os.path.join(dir, filename) + if os.path.isfile(file_path) and label == self.__get_attr_value(file_path): + return file_path[0:-5] + except Exception as error: + logging.error("Error when getting {} label path: {}".format(label, error)) + + return retval def __get_attr_value(self, attr_path): @@ -71,10 +74,9 @@ class Psu(PsuBase): with open(attr_path, 'r') as fd: retval = fd.read() except Exception as error: - logging.error("Unable to open " + attr_path + " file !") + logging.error("Unable to open {} file: {}".format(attr_path, error)) retval = retval.rstrip(' \t\n\r') - fd.close() return retval ############################################## @@ -98,10 +100,9 @@ class Psu(PsuBase): bool: True if device is present, False if not """ presence = False - attr_path = HWMON_DIR+self.psu_presence_attr attr_normal = '1' - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_presence_attr) if (attr_rv != 'ERR'): if (attr_rv == attr_normal): presence = True @@ -116,8 +117,7 @@ class Psu(PsuBase): string: Model/part number of device """ model = "N/A" - attr_path = HWMON_DIR+self.psu_model_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_model_attr) if (attr_rv != 'ERR'): model = attr_rv @@ -131,8 +131,7 @@ class Psu(PsuBase): string: Manufacturer's id of device """ mfr_id = "N/A" - attr_path = HWMON_DIR+self.psu_mfr_id_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_mfr_id_attr) if (attr_rv != 'ERR'): mfr_id = attr_rv @@ -146,9 +145,7 @@ class Psu(PsuBase): string: Serial number of device """ serial = "N/A" - attr_path = HWMON_DIR+self.psu_serial_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_serial_attr) if (attr_rv != 'ERR'): serial = attr_rv @@ -162,9 +159,7 @@ class Psu(PsuBase): A boolean value, True if device is operating properly, False if not """ status = False - attr_path = HWMON_DIR+self.psu_status_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_status_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) if (int(attr_rv) != 0): @@ -185,9 +180,7 @@ class Psu(PsuBase): e.g. 12.1 """ voltage_out = 0.0 - attr_path = HWMON_DIR+self.psu_voltage_out_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_voltage_out_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) voltage_out = float(attr_rv) / 1000 @@ -202,9 +195,7 @@ class Psu(PsuBase): A float number, the electric current in amperes, e.g 15.4 """ current_out = 0.0 - attr_path = HWMON_DIR+self.psu_current_out_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_current_out_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) current_out = float(attr_rv) / 1000 @@ -213,16 +204,14 @@ class Psu(PsuBase): def get_input_voltage(self): """ - Retrieves current PSU voltage output + Retrieves current PSU voltage input Returns: - A float number, the output voltage in volts, + A float number, the input voltage in volts, e.g. 12.1 """ voltage_in = 0.0 - attr_path = HWMON_DIR+self.psu_voltage_in_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_voltage_in_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) voltage_in = float(attr_rv) / 1000 @@ -237,9 +226,7 @@ class Psu(PsuBase): A float number, the electric current in amperes, e.g 15.4 """ current_in = 0.0 - attr_path = HWMON_DIR+self.psu_current_in_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_current_in_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) current_in = float(attr_rv) / 1000 @@ -254,9 +241,7 @@ class Psu(PsuBase): A float number, the power in watts, e.g. 302.6 """ power_out = 0.0 - attr_path = HWMON_DIR+self.psu_power_out_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_power_out_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) power_out = float(attr_rv) / 1000 @@ -293,8 +278,7 @@ class Psu(PsuBase): A string, the type of PSU (AC/DC) """ type = "AC" - attr_path = HWMON_DIR+self.psu_type_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_type_attr) if (attr_rv != 'ERR'): type = attr_rv @@ -308,8 +292,7 @@ class Psu(PsuBase): An integer, the capacity of PSU """ capacity = 0 - attr_path = HWMON_DIR+self.psu_capacity_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_capacity_attr) if (attr_rv != 'ERR'): try: capacity = int(attr_rv) @@ -318,3 +301,19 @@ class Psu(PsuBase): return capacity + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + + tout = 0.0 + attr_rv = self.__get_attr_value(self.psu_temp_attr) + if (attr_rv != 'ERR'): + tout = float(attr_rv) + + # tout is in milli degree celcius + return float(tout/1000.0) + diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/sfp.py index 759fa99a4b..1faf552c7b 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/sfp.py @@ -10,13 +10,10 @@ import os import time -#import subprocess -#import sonic_device_util from ctypes import create_string_buffer try: from sonic_platform_base.sfp_base import SfpBase -# from sonic_platform_base.sonic_eeprom import eeprom_dts from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId @@ -175,7 +172,6 @@ class Sfp(SfpBase): # Init index self.index = sfp_index self.port_num = self.index - #self.dom_supported = False self.sfp_type = sfp_type self.lpmode_path = "/sys/class/cpld-qsfp28/port-"+str(self.port_num)+"/lpmode" self.reset_path = "/sys/class/cpld-qsfp28/port-"+str(self.port_num)+"/reset" @@ -262,15 +258,6 @@ class Sfp(SfpBase): else: return 'N/A' - def __read_txt_file(self, file_path): - try: - with open(file_path, 'r') as fd: - data = fd.read() - return data.strip() - except IOError: - pass - return "" - def __is_host(self): return os.system(self.HOST_CHK_CMD) == 0 @@ -325,26 +312,6 @@ class Sfp(SfpBase): return eeprom_raw - def __convert_string_to_num(self, value_str): - if "-inf" in value_str: - return 'N/A' - elif "Unknown" in value_str: - return 'N/A' - elif 'dBm' in value_str: - t_str = value_str.rstrip('dBm') - return float(t_str) - elif 'mA' in value_str: - t_str = value_str.rstrip('mA') - return float(t_str) - elif 'C' in value_str: - t_str = value_str.rstrip('C') - return float(t_str) - elif 'Volts' in value_str: - t_str = value_str.rstrip('Volts') - return float(t_str) - else: - return 'N/A' - def _dom_capability_detect(self): if not self.get_presence(): self.dom_supported = False @@ -503,9 +470,7 @@ class Sfp(SfpBase): else: if not self.get_presence(): return transceiver_info_dict - elif i == max_retry-1: - pass - else: + elif i < max_retry-1: time.sleep(0.5) if sfp_interface_bulk_raw is None: @@ -560,7 +525,8 @@ class Sfp(SfpBase): ['data']['Extended Identifier']['value'] transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data \ ['data']['RateIdentifier']['value'] - transceiver_info_dict['type_abbrv_name'] = 'N/A' + transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data \ + ['data']['type_abbrv_name']['value'] if self.sfp_type == QSFP_TYPE: for key in qsfp_cable_length_tup: if key in sfp_interface_bulk_data['data']: @@ -830,7 +796,7 @@ class Sfp(SfpBase): transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['TxBiasLowWarning']['value'] for key in transceiver_dom_threshold_dict: - transceiver_dom_threshold_dict[key] = self.__convert_string_to_num(transceiver_dom_threshold_dict[key]) + transceiver_dom_threshold_dict[key] = self._convert_string_to_num(transceiver_dom_threshold_dict[key]) return transceiver_dom_threshold_dict @@ -878,7 +844,7 @@ class Sfp(SfpBase): transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] for key in transceiver_dom_threshold_info_dict: - transceiver_dom_threshold_info_dict[key] = self.__convert_string_to_num(transceiver_dom_threshold_info_dict[key]) + transceiver_dom_threshold_info_dict[key] = self._convert_string_to_num(transceiver_dom_threshold_info_dict[key]) return transceiver_dom_threshold_info_dict @@ -1425,7 +1391,7 @@ class Sfp(SfpBase): sysfsfile_eeprom = open( sysfs_sfp_i2c_client_eeprom_path, mode="r+b", buffering=0) buffer = create_string_buffer(1) - buffer[0] = chr(tx_disable_ctl) + buffer[0] = tx_disable_ctl # Write to eeprom sysfsfile_eeprom.seek(offset + SFP_STATUS_CONTROL_OFFSET) sysfsfile_eeprom.write(buffer[0]) @@ -1478,7 +1444,7 @@ class Sfp(SfpBase): else: tx_disable_ctl = channel_state & (~channel) buffer = create_string_buffer(1) - buffer[0] = chr(tx_disable_ctl) + buffer[0] = tx_disable_ctl # Write to eeprom sysfsfile_eeprom = open( self.port_to_eeprom_mapping[self.port_num], "r+b") @@ -1565,7 +1531,7 @@ class Sfp(SfpBase): power_set_bit |= 1 << 1 buffer = create_string_buffer(1) - buffer[0] = chr(power_override_bit | power_set_bit) + buffer[0] = power_override_bit | power_set_bit # Write to eeprom sysfsfile_eeprom = open(self.port_to_eeprom_mapping[self.port_num], "r+b") sysfsfile_eeprom.seek(QSFP_POWEROVERRIDE_OFFSET) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/thermal.py index a80a07a999..cf6073438d 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/thermal.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# Quanta +# Quanta IX7_BDE # # Module contains an implementation of SONiC Platform Base API and # provides the Thermal information @@ -10,45 +10,68 @@ import logging import os +import glob try: from sonic_platform_base.thermal_base import ThermalBase except ImportError as e: raise ImportError(str(e) + "- required module not found") -HWMON_DIR = "/sys/class/hwmon/hwmon2/" +HWMON_IPMI_DIR = "/sys/devices/platform/quanta_hwmon_ipmi/hwmon/hwmon*/" thermal_index_mapping = { - 1:40, - 2:41, - 3:42, - 4:50, - 5:51, - 6:52, - 7:73, - 8:74, - 9:75, - 10:76, - 11:77, - 12:78, - 13:79, - 14:80, - 15:81, - 16:82, - 17:83, - 18:84 + 1:'PSU1_TEMP1', + 2:'PSU1_TEMP2', + 3:'PSU1_TEMP3', + 4:'PSU2_TEMP1', + 5:'PSU2_TEMP2', + 6:'PSU2_TEMP3', + 7:'Temp_1V05_PCH_VR', + 8:'Temp_Ambient_1', + 9:'Temp_Ambient_2', + 10:'Temp_Ambient_3', + 11:'Temp_Ambient_4', + 12:'Temp_Ambient_5', + 13:'Temp_Ambient_6', + 14:'Temp_CPU', + 15:'Temp_DDRAB_VR', + 16:'Temp_SOC_DIMMA0', + 17:'Temp_VCCGBE_VR', + 18:'Temp_VCCIN_VR' } + + class Thermal(ThermalBase): """Platform-specific Thermal class""" def __init__(self, thermal_index): - self.index = thermal_index - self.temp_attr = "temp{}_input".format(thermal_index_mapping[self.index]) - self.high_th_attr = "temp{}_ncrit".format(thermal_index_mapping[self.index]) - self.high_crit_th_attr = "temp{}_crit".format(thermal_index_mapping[self.index]) - self.name_attr = "temp{}_label".format(thermal_index_mapping[self.index]) + self.index = thermal_index + hwmon_dir=glob.glob(HWMON_IPMI_DIR)[0] + thermal_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, thermal_index_mapping[self.index], 'temp') + self.temp_attr = "{}input".format(thermal_prefix) + self.high_th_attr = "{}ncrit".format(thermal_prefix) + self.high_crit_th_attr = "{}crit".format(thermal_prefix) + self.low_th_attr = "{}lncrit".format(thermal_prefix) + self.low_crit_th_attr = "{}lcrit".format(thermal_prefix) + self.name_attr = "{}label".format(thermal_prefix) + def __get_hwmon_attr_prefix(self, dir, label, type): + + retval = 'ERR' + if not os.path.isdir(dir): + return retval + + try: + for filename in os.listdir(dir): + if filename[-5:] == 'label' and type in filename: + file_path = os.path.join(dir, filename) + if os.path.isfile(file_path) and label == self.__get_attr_value(file_path): + return file_path[0:-5] + except Exception as error: + logging.error("Error when getting {} label path: {}".format(label, error)) + + return retval def __get_attr_value(self, attr_path): @@ -60,7 +83,7 @@ class Thermal(ThermalBase): with open(attr_path, 'r') as fd: retval = fd.read() except Exception as error: - logging.error("Unable to open ", attr_path, " file !") + logging.error("Unable to open {} file: {}".format(attr_path, error)) retval = retval.rstrip(' \t\n\r') return retval @@ -72,8 +95,7 @@ class Thermal(ThermalBase): Returns: string: The name of the device """ - attr_path = HWMON_DIR + self.name_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.name_attr) if (attr_rv != 'ERR'): return attr_rv @@ -87,8 +109,7 @@ class Thermal(ThermalBase): Returns: bool: True if device is present, False if not """ - attr_path = HWMON_DIR + self.name_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.name_attr) if (attr_rv != 'ERR'): return True @@ -115,8 +136,37 @@ class Thermal(ThermalBase): A float number of current temperature in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - attr_path = HWMON_DIR + self.temp_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.temp_attr) + + if (attr_rv != 'ERR'): + return float(attr_rv) / 1000 + else: + return None + + def get_low_threshold(self): + """ + Retrieves the low threshold temperature of thermal + + Returns: + A float number, the low threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + attr_rv = self.__get_attr_value(self.low_th_attr) + + if (attr_rv != 'ERR'): + return float(attr_rv) / 1000 + else: + return None + + def get_low_critical_threshold(self): + """ + Retrieves the low critical threshold temperature of thermal + + Returns: + A float number, the low critical threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + attr_rv = self.__get_attr_value(self.low_crit_th_attr) if (attr_rv != 'ERR'): return float(attr_rv) / 1000 @@ -131,8 +181,7 @@ class Thermal(ThermalBase): A float number, the high threshold temperature of thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - attr_path = HWMON_DIR + self.high_th_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.high_th_attr) if (attr_rv != 'ERR'): return float(attr_rv) / 1000 @@ -147,8 +196,7 @@ class Thermal(ThermalBase): A float number, the high threshold temperature of thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - attr_path = HWMON_DIR + self.high_crit_th_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.high_crit_th_attr) if (attr_rv != 'ERR'): return float(attr_rv) / 1000 diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/watchdog.py new file mode 100644 index 0000000000..0e63d9368c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/watchdog.py @@ -0,0 +1,241 @@ +#!/usr/bin/env python + +############################################################################# +# +# Watchdog contains an implementation of SONiC Platform Base Watchdog API +# +############################################################################# +import fcntl +import os +import array + +try: + from sonic_platform_base.watchdog_base import WatchdogBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +""" ioctl constants """ +IO_WRITE = 0x40000000 +IO_READ = 0x80000000 +IO_READ_WRITE = 0xC0000000 +IO_SIZE_INT = 0x00040000 +IO_SIZE_40 = 0x00280000 +IO_TYPE_WATCHDOG = ord('W') << 8 + +WDR_INT = IO_READ | IO_SIZE_INT | IO_TYPE_WATCHDOG +WDR_40 = IO_READ | IO_SIZE_40 | IO_TYPE_WATCHDOG +WDWR_INT = IO_READ_WRITE | IO_SIZE_INT | IO_TYPE_WATCHDOG + +""" Watchdog ioctl commands """ +WDIOC_GETSUPPORT = 0 | WDR_40 +WDIOC_GETSTATUS = 1 | WDR_INT +WDIOC_GETBOOTSTATUS = 2 | WDR_INT +WDIOC_GETTEMP = 3 | WDR_INT +WDIOC_SETOPTIONS = 4 | WDR_INT +WDIOC_KEEPALIVE = 5 | WDR_INT +WDIOC_SETTIMEOUT = 6 | WDWR_INT +WDIOC_GETTIMEOUT = 7 | WDR_INT +WDIOC_SETPRETIMEOUT = 8 | WDWR_INT +WDIOC_GETPRETIMEOUT = 9 | WDR_INT +WDIOC_GETTIMELEFT = 10 | WDR_INT + +""" Watchdog status constants """ +WDIOS_DISABLECARD = 0x0001 +WDIOS_ENABLECARD = 0x0002 + +WDT_COMMON_ERROR = -1 +WD_MAIN_IDENTITY = "iTCO_wdt" +WDT_SYSFS_PATH = "/sys/class/watchdog/" + +DEFAULT_TIMEOUT=180 +watchdog=0 + +class Watchdog(WatchdogBase): + + def __init__(self): + + self.watchdog, self.wdt_main_dev_name = self._get_wdt() + if self.wdt_main_dev_name is None: + raise Exception("Watchdog device is not instantiated") + + self.status_path = "/sys/class/watchdog/%s/status" % self.wdt_main_dev_name + self.state_path = "/sys/class/watchdog/%s/state" % self.wdt_main_dev_name + self.timeout_path = "/sys/class/watchdog/%s/timeout" % self.wdt_main_dev_name + # Set default value + self._disable() + self.armed = False + self.timeout = DEFAULT_TIMEOUT + + def _is_wd_main(self, dev): + """ + Checks watchdog identity + """ + identity = self._read_file( + "{}/{}/identity".format(WDT_SYSFS_PATH, dev)) + return identity == WD_MAIN_IDENTITY + + def _get_wdt(self): + """ + Retrieves watchdog device + """ + global watchdog + wdt_main_dev_list = [dev for dev in os.listdir( + "/dev/") if dev.startswith("watchdog") and self._is_wd_main(dev)] + if not wdt_main_dev_list: + return (None, None) + wdt_main_dev_name = wdt_main_dev_list[0] + watchdog_device_path = "/dev/{}".format(wdt_main_dev_name) + if not watchdog: + watchdog = os.open(watchdog_device_path, os.O_RDWR) + return watchdog, wdt_main_dev_name + + def _read_file(self, file_path): + """ + Read text file + """ + try: + with open(file_path, "r") as fd: + txt = fd.read() + except IOError: + return WDT_COMMON_ERROR + return txt.strip() + + def _enable(self): + """ + Turn on the watchdog timer + """ + req = array.array('h', [WDIOS_ENABLECARD]) + fcntl.ioctl(self.watchdog, WDIOC_SETOPTIONS, req, False) + + def _disable(self): + """ + Turn off the watchdog timer + """ + req = array.array('h', [WDIOS_DISABLECARD]) + fcntl.ioctl(self.watchdog, WDIOC_SETOPTIONS, req, False) + + def _keepalive(self): + """ + Keep alive watchdog timer + """ + fcntl.ioctl(self.watchdog, WDIOC_KEEPALIVE) + + def _settimeout(self, seconds): + """ + Set watchdog timer timeout + @param seconds - timeout in seconds + @return is the actual set timeout + """ + req = array.array('I', [seconds]) + fcntl.ioctl(self.watchdog, WDIOC_SETTIMEOUT, req, True) + return int(req[0]) + + def _gettimeout(self, timeout_path): + """ + Get watchdog timeout + @return watchdog timeout + """ + req = array.array('I', [0]) + fcntl.ioctl(self.watchdog, WDIOC_GETTIMEOUT, req, True) + + return int(req[0]) + + def _gettimeleft(self): + """ + Get time left before watchdog timer expires + @return time left in seconds + """ + req = array.array('I', [0]) + fcntl.ioctl(self.watchdog, WDIOC_GETTIMELEFT, req, True) + + return int(req[0]) + + ################################################################# + + def arm(self, seconds): + """ + Arm the hardware watchdog with a timeout of seconds. + If the watchdog is currently armed, calling this function will + simply reset the timer to the provided value. If the underlying + hardware does not support the value provided in , this + method should arm the watchdog with the *next greater* available + value. + Returns: + An integer specifying the *actual* number of seconds the watchdog + was armed with. On failure returns -1. + """ + + ret = WDT_COMMON_ERROR + if seconds < 0: + return ret + + try: + if self.timeout != seconds: + self.timeout = self._settimeout(seconds) + if self.armed: + self._keepalive() + else: + self._settimeout(seconds) + self._enable() + self.armed = True + ret = self.timeout + except IOError as e: + pass + + return ret + + def disarm(self): + """ + Disarm the hardware watchdog + Returns: + A boolean, True if watchdog is disarmed successfully, False if not + """ + disarmed = False + if self.is_armed(): + try: + self._disable() + self.armed = False + disarmed = True + except IOError: + pass + + return disarmed + + def is_armed(self): + """ + Retrieves the armed state of the hardware watchdog. + Returns: + A boolean, True if watchdog is armed, False if not + """ + + return self.armed + + def get_remaining_time(self): + """ + If the watchdog is armed, retrieve the number of seconds remaining on + the watchdog timer + Returns: + An integer specifying the number of seconds remaining on thei + watchdog timer. If the watchdog is not armed, returns -1. + """ + + timeleft = WDT_COMMON_ERROR + + if self.armed: + try: + timeleft = self._gettimeleft() + except IOError: + pass + + return timeleft + + def __del__(self): + """ + Close watchdog + """ + + if self.watchdog is not None : + os.close(self.watchdog) + + + diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/utils/quanta_ix7_bwde_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/utils/quanta_ix7_bwde_util.py index 952fc11a68..a20aa33828 100755 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/utils/quanta_ix7_bwde_util.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/utils/quanta_ix7_bwde_util.py @@ -28,27 +28,26 @@ command: """ import os -import commands +import subprocess import sys, getopt import logging +import time DEBUG = False args = [] FORCE = 0 i2c_prefix = '/sys/bus/i2c/devices/' - if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] - + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): global DEBUG global args global FORCE - if len(sys.argv)<2: + if len(sys.argv) < 2: show_help() options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', @@ -56,9 +55,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -72,34 +71,42 @@ def main(): logging.info('no option') for arg in args: if arg == 'install': - install() + install() elif arg == 'clean': - uninstall() + uninstall() else: show_help() - return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_log(txt): if DEBUG == True: - print "[IX7-BWDE-32X]"+txt + print("[IX7-BWDE-32X]"+txt) return def exec_cmd(cmd, show): - logging.info('Run :'+cmd) - status, output = commands.getstatusoutput(cmd) + logging.info('Run :' + cmd) + status, output = subprocess.getstatusoutput(cmd) show_log (cmd +"with result:" + str(status)) - show_log (" output:"+output) + show_log (" output:" + output) if status: - logging.info('Failed :'+cmd) + logging.info('Failed :' + cmd) if show: - print('Failed :'+cmd) - return status, output + print('Failed :' + cmd) + return status, output + +pca954x_bus_addr =[ +'0-0072', +'0-0077', +'5-0073', +'6-0073', +'7-0073', +'8-0073' +] instantiate =[ #Enable front-ports LED decoding @@ -118,7 +125,7 @@ drivers =[ 'lpc_ich', 'i2c-i801', 'i2c-dev', -'i2c-mux-pca954x force_deselect_on_exit=1', +'i2c-mux-pca954x', 'gpio-pca953x', 'optoe', 'qci_cpld', @@ -149,18 +156,30 @@ def system_install(): exec_cmd("depmod -a ", 1) #install drivers for i in range(0,len(drivers)): - status, output = exec_cmd("modprobe "+drivers[i], 1) - if status: - print output - if FORCE == 0: - return status - + status, output = exec_cmd("modprobe " + drivers[i], 1) + if status: + print(output) + #retry quanta_hwmon_ipmi in case it init failed due to ipmi_msghandler init uncompleted + if drivers[i] == 'quanta_hwmon_ipmi': + for _ in range(0, 3): + time.sleep(3) + ret, out = exec_cmd("modprobe quanta_hwmon_ipmi ", 1) + if ret == 0: + break + if ret and FORCE == 0: + return ret + elif FORCE == 0: + return status #reload ethernet drivers for correct order exec_cmd("rmmod ixgbe ", 1) exec_cmd("rmmod igb ", 1) exec_cmd("modprobe igb ", 1) exec_cmd("modprobe ixgbe ", 1) + # set pca954x idle_state as -2: MUX_IDLE_DISCONNECT + for i in range(0,len(pca954x_bus_addr)): + exec_cmd("echo -2 > /sys/bus/i2c/drivers/pca954x/{}/idle_state".format(pca954x_bus_addr[i]), 1) + #turn on module power exec_cmd("echo 21 > /sys/class/gpio/export ", 1) exec_cmd("echo high > /sys/class/gpio/gpio21/direction ", 1) @@ -174,23 +193,23 @@ def system_install(): exec_cmd("echo 1 >/sys/class/gpio/gpio33/value", 1) #instantiate devices - for i in range(0,len(instantiate)): + for i in range(0, len(instantiate)): status, output = exec_cmd(instantiate[i], 1) - if status: - print output - if FORCE == 0: - return status + if status: + print(output) + if FORCE == 0: + return status #QSFP for 1~32 port - for port_number in range(1,33): + for port_number in range(1, 33): bus_number = port_number + 12 os.system("echo %d >/sys/bus/i2c/devices/%d-0050/port_name" % (port_number, bus_number)) status, output = exec_cmd("pip3 install /usr/share/sonic/device/x86_64-quanta_ix7_bwde-r0/sonic_platform-1.0-py3-none-any.whl",1) if status: - print output - if FORCE == 0: - return status + print(output) + if FORCE == 0: + return status return @@ -202,29 +221,29 @@ def system_ready(): def install(): if not device_found(): - print "No device, installing...." + print("No device, installing....") status = system_install() if status: if FORCE == 0: - return status + return status else: - print " ix7-bwde driver already installed...." + print(" ix7-bwde driver already installed....") return def uninstall(): global FORCE #uninstall drivers - for i in range(len(un_drivers)-1,-1,-1): - status, output = exec_cmd("rmmod "+un_drivers[i], 1) + for i in range(len(un_drivers) - 1, -1, -1): + status, output = exec_cmd("rmmod " + un_drivers[i], 1) if status: - print output + print(output) if FORCE == 0: return status status, output = exec_cmd("pip3 uninstall sonic-platform -y ",1) if status: - print output - if FORCE == 0: - return status + print(output) + if FORCE == 0: + return status return def device_found(): diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_cpld_led.c b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_cpld_led.c index 64841e8538..147a2a7f86 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_cpld_led.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_cpld_led.c @@ -49,7 +49,7 @@ static struct class *cpld_class = NULL; struct cpld_data { struct i2c_client *cpld_client; - char name[8]; + char name[16]; u8 cpld_id; }; diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_platform_ix8.c b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_platform_ix8.c index 51876246e1..fe295b5dfe 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_platform_ix8.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_platform_ix8.c @@ -192,9 +192,9 @@ static int __init ix8_platform_init(void) } else { - g_client[0] = i2c_new_device(adapter, &ix8_i2c_devices[0]); // pca9546 - g_client[1] = i2c_new_device(adapter, &ix8_i2c_devices[1]); // pca9548 - g_client[2] = i2c_new_device(adapter, &ix8_i2c_devices[16]); // pca9546cpu + g_client[0] = i2c_new_client_device(adapter, &ix8_i2c_devices[0]); // pca9546 + g_client[1] = i2c_new_client_device(adapter, &ix8_i2c_devices[1]); // pca9548 + g_client[2] = i2c_new_client_device(adapter, &ix8_i2c_devices[16]); // pca9546cpu i2c_put_adapter(adapter); } @@ -205,7 +205,7 @@ static int __init ix8_platform_init(void) } else { - g_client[3] = i2c_new_device(adapter, &ix8_i2c_devices[17]); // CPU Board Data + g_client[3] = i2c_new_client_device(adapter, &ix8_i2c_devices[17]); // CPU Board Data i2c_put_adapter(adapter); } @@ -216,9 +216,9 @@ static int __init ix8_platform_init(void) } else { - g_client[4] = i2c_new_device(adapter, &ix8_i2c_devices[10]); // CPLD_1 - g_client[5] = i2c_new_device(adapter, &ix8_i2c_devices[18]); // CPLD_4 - g_client[6] = i2c_new_device(adapter, &ix8_i2c_devices[19]); // CPLD_6 + g_client[4] = i2c_new_client_device(adapter, &ix8_i2c_devices[10]); // CPLD_1 + g_client[5] = i2c_new_client_device(adapter, &ix8_i2c_devices[18]); // CPLD_4 + g_client[6] = i2c_new_client_device(adapter, &ix8_i2c_devices[19]); // CPLD_6 i2c_put_adapter(adapter); } @@ -229,7 +229,7 @@ static int __init ix8_platform_init(void) } else { - g_client[7] = i2c_new_device(adapter, &ix8_i2c_devices[11]); // CPLD_2 + g_client[7] = i2c_new_client_device(adapter, &ix8_i2c_devices[11]); // CPLD_2 i2c_put_adapter(adapter); } @@ -240,8 +240,8 @@ static int __init ix8_platform_init(void) } else { - g_client[8] = i2c_new_device(adapter, &ix8_i2c_devices[12]); // CPLD_3 - g_client[9] = i2c_new_device(adapter, &ix8_i2c_devices[2]); // MB_BOARDINFO_EEPROM + g_client[8] = i2c_new_client_device(adapter, &ix8_i2c_devices[12]); // CPLD_3 + g_client[9] = i2c_new_client_device(adapter, &ix8_i2c_devices[2]); // MB_BOARDINFO_EEPROM i2c_put_adapter(adapter); } @@ -252,8 +252,8 @@ static int __init ix8_platform_init(void) } else { - g_client[10] = i2c_new_device(adapter, &ix8_i2c_devices[13]); // MB Board Data - g_client[11] = i2c_new_device(adapter, &ix8_i2c_devices[14]); // QSFP:49~52 + g_client[10] = i2c_new_client_device(adapter, &ix8_i2c_devices[13]); // MB Board Data + g_client[11] = i2c_new_client_device(adapter, &ix8_i2c_devices[14]); // QSFP:49~52 i2c_put_adapter(adapter); } @@ -264,7 +264,7 @@ static int __init ix8_platform_init(void) } else { - g_client[12] = i2c_new_device(adapter, &ix8_i2c_devices[3]); // pca9548_1 SFP + g_client[12] = i2c_new_client_device(adapter, &ix8_i2c_devices[3]); // pca9548_1 SFP i2c_put_adapter(adapter); } @@ -275,7 +275,7 @@ static int __init ix8_platform_init(void) } else { - g_client[13] = i2c_new_device(adapter, &ix8_i2c_devices[4]); // pca9548_2 SFP + g_client[13] = i2c_new_client_device(adapter, &ix8_i2c_devices[4]); // pca9548_2 SFP i2c_put_adapter(adapter); } @@ -286,7 +286,7 @@ static int __init ix8_platform_init(void) } else { - g_client[14] = i2c_new_device(adapter, &ix8_i2c_devices[5]); // pca9548_3 SFP + g_client[14] = i2c_new_client_device(adapter, &ix8_i2c_devices[5]); // pca9548_3 SFP i2c_put_adapter(adapter); } @@ -297,7 +297,7 @@ static int __init ix8_platform_init(void) } else { - g_client[15] = i2c_new_device(adapter, &ix8_i2c_devices[6]); // pca9548_4 SFP + g_client[15] = i2c_new_client_device(adapter, &ix8_i2c_devices[6]); // pca9548_4 SFP i2c_put_adapter(adapter); } @@ -308,7 +308,7 @@ static int __init ix8_platform_init(void) } else { - g_client[16] = i2c_new_device(adapter, &ix8_i2c_devices[7]); // pca9548_5 SFP + g_client[16] = i2c_new_client_device(adapter, &ix8_i2c_devices[7]); // pca9548_5 SFP i2c_put_adapter(adapter); } @@ -319,7 +319,7 @@ static int __init ix8_platform_init(void) } else { - g_client[17] = i2c_new_device(adapter, &ix8_i2c_devices[8]); // pca9548_6 SFP + g_client[17] = i2c_new_client_device(adapter, &ix8_i2c_devices[8]); // pca9548_6 SFP i2c_put_adapter(adapter); } @@ -330,7 +330,7 @@ static int __init ix8_platform_init(void) } else { - g_client[18] = i2c_new_device(adapter, &ix8_i2c_devices[9]); // pca9548_7 QSFP + g_client[18] = i2c_new_client_device(adapter, &ix8_i2c_devices[9]); // pca9548_7 QSFP i2c_put_adapter(adapter); } @@ -342,7 +342,7 @@ static int __init ix8_platform_init(void) } else { - g_client_port[i - 17] = i2c_new_device(adapter, &ix8_i2c_devices[15]); + g_client_port[i - 17] = i2c_new_client_device(adapter, &ix8_i2c_devices[15]); i2c_put_adapter(adapter); } } @@ -355,7 +355,7 @@ static int __init ix8_platform_init(void) else { adapter = i2c_get_adapter_wait(i); - g_client_port[i - 17] = i2c_new_device(adapter, &ix8_i2c_devices[20]); + g_client_port[i - 17] = i2c_new_client_device(adapter, &ix8_i2c_devices[20]); i2c_put_adapter(adapter); } } diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/quanta_hwmon_ipmi.c b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/quanta_hwmon_ipmi.c index 5c9570c103..ce932d9b6c 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/quanta_hwmon_ipmi.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/quanta_hwmon_ipmi.c @@ -86,6 +86,8 @@ #define IPMI_TIMEOUT (4 * HZ) #define IPMI_MAX_WAIT_QUEUE 1 +typedef struct ipmi_user *ipmi_user_t; + struct quanta_hwmon_ipmi_data { struct platform_device *ipmi_platform_dev; @@ -1090,7 +1092,7 @@ int32_t sdr_convert_sensor_reading(uint8_t idx, uint8_t val, result = (m * (int16_t)val) * decimal_point + b; break; default: - return; + return result; } pow_convert(&result, k2); @@ -1242,7 +1244,7 @@ int32_t ipmi_get_vin_type(uint8_t idx, uint8_t *retbuf) if (rv) { printk("BMC down at (%d)!!\n", __LINE__); } - else { + else { switch (returnData) { case 0x7: //LVDC @@ -1830,7 +1832,7 @@ static int32_t __init quanta_hwmon_ipmi_init(void) goto device_reg_err; } - data->ipmi_hwmon_dev = hwmon_device_register_with_groups(NULL, DRVNAME, NULL, + data->ipmi_hwmon_dev = hwmon_device_register_with_groups(&data->ipmi_platform_dev->dev, DRVNAME, NULL, NULL); err = IS_ERR(data->ipmi_hwmon_dev); if (err) @@ -1857,21 +1859,15 @@ static int32_t __init quanta_hwmon_ipmi_init(void) return 0; init_sensor_err: - if (g_sensor_data) - { - kfree(g_sensor_data); - g_sensor_data = NULL; - } + kfree(g_sensor_data); + g_sensor_data = NULL; ipmi_create_err: hwmon_device_unregister(data->ipmi_hwmon_dev); hwmon_register_err: platform_device_unregister(data->ipmi_platform_dev); device_reg_err: - if (data) - { - kfree(data); - data = NULL; - } + kfree(data); + data = NULL; alloc_err: return err; } @@ -1887,17 +1883,10 @@ static void __exit quanta_hwmon_ipmi_exit(void) platform_device_unregister(data->ipmi_platform_dev); - if (g_sensor_data) - { - kfree(g_sensor_data); - g_sensor_data = NULL; - } - - if (data) - { - kfree(data); - data = NULL; - } + kfree(g_sensor_data); + g_sensor_data = NULL; + kfree(data); + data = NULL; } module_init(quanta_hwmon_ipmi_init); diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/chassis.py index b959d66780..5599f703f4 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/chassis.py @@ -72,6 +72,13 @@ class Chassis(ChassisBase): for index in range(1, self.__num_of_ports + 1): self.__xcvr_presence[index] = self._sfp_list[index-1].get_presence() + # Initialize components + from sonic_platform.component import ComponentBIOS, ComponentBMC, ComponentCPLD, ComponentPCIE + self._component_list.append(ComponentBIOS()) + self._component_list.append(ComponentBMC()) + self._component_list.extend(ComponentCPLD.get_component_list()) + self._component_list.append(ComponentPCIE()) + ############################################## # Device methods ############################################## @@ -79,7 +86,7 @@ class Chassis(ChassisBase): def get_sfp(self, index): """ Retrieves sfp represented by (1-based) index - For Quanta IX8 the index in sfputil.py starts from 1, so override + For Quanta the index in sfputil.py starts from 1, so override Args: index: An integer, the index (1-based) of the sfp to retrieve. @@ -179,6 +186,18 @@ class Chassis(ChassisBase): """ return self._eeprom.system_eeprom_info() + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Invalid Reason") + ############################################## # Other methods ############################################## @@ -215,10 +234,10 @@ class Chassis(ChassisBase): cur_xcvr_presence = self._sfp_list[index-1].get_presence() if cur_xcvr_presence != self.__xcvr_presence[index]: if cur_xcvr_presence is True: - xcvr_change_event_dict[str(index)] = '1' + xcvr_change_event_dict[index] = '1' self.__xcvr_presence[index] = True elif cur_xcvr_presence is False: - xcvr_change_event_dict[str(index)] = '0' + xcvr_change_event_dict[index] = '0' self.__xcvr_presence[index] = False event = True diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/component.py new file mode 100644 index 0000000000..95f275014f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/component.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python + +######################################################################## +# Quanta IX8 +# +# Name: component.py, version: 1.3 +# Module contains an implementation of SONiC Platform Base API and +# provides the Components' (e.g., BIOS, CPLD, FPGA, etc.) available in +# the platform +# +######################################################################## + +try: + import subprocess + from sonic_platform_base.component_base import ComponentBase + from collections import namedtuple +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Component(ComponentBase): + def __init__(self): + ComponentBase.__init__(self) + self.name = None + self.description = None + + def get_name(self): + return self.name + + def get_description(self): + return self.description + + def install_firmware(self, image_path): + """ + Installs firmware to the component + + Args: + image_path: A string, path to firmware image + + Returns: + A boolean, True if install was successful, False if not + """ + return False + + @staticmethod + def _get_command_result(cmdline): + try: + proc = subprocess.Popen(cmdline, + stdout=subprocess.PIPE, + shell=True, stderr=subprocess.STDOUT, + universal_newlines=True) + stdout = proc.communicate()[0] + rc = proc.wait() + result = stdout.rstrip('\n') + if rc != 0: + raise RuntimeError("Failed to execute command {}, return code {}, {}".format(cmdline, rc, stdout)) + + except OSError as e: + raise RuntimeError("Failed to execute command {} due to {}".format(cmdline, repr(e))) + + return result + + +class ComponentBIOS(Component): + COMPONENT_NAME = 'BIOS' + COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' + + BIOS_QUERY_VERSION_COMMAND = "dmidecode -s bios-version" + + def __init__(self): + super(ComponentBIOS, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + bios_ver = self._get_command_result(self.BIOS_QUERY_VERSION_COMMAND) + if not bios_ver: + return 'ERR' + else: + return bios_ver + + +class ComponentBMC(Component): + COMPONENT_NAME = 'BMC' + COMPONENT_DESCRIPTION = 'BMC - Board Management Controller' + BMC_QUERY_VERSION_COMMAND = "ipmitool mc info | grep 'Firmware Revision'" + + def __init__(self): + super(ComponentBMC, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + bmc_ver = self._get_command_result(self.BMC_QUERY_VERSION_COMMAND) + if not bmc_ver: + return 'ERR' + else: + bmc_ver = bmc_ver.split(": ")[1] + return bmc_ver.strip() + + +class ComponentCPLD(Component): + Cpld = namedtuple("Cpld", ['name', 'cmd_index', 'description']) + + cplds = { + 1: Cpld("UART_CPLD", 1, "UART"), + 2: Cpld("BOOT_CPLD", 2, "Power sequence"), + 3: Cpld("FAN_CPLD", 3, "Fan"), + 4: Cpld("MB_CPLD_IO_1", 5, "Port IO-1"), + 5: Cpld("MB_CPLD_IO_2", 6, "Port IO-2"), + 6: Cpld("MB_CPLD_IO_3", 8, "Port IO-3"), + 7: Cpld("MB_CPLD_LED_1", 7, "Port LED-1"), + 8: Cpld("MB_CPLD_LED_2", 4, "Port LED-2"), + } + + def __init__(self, component_index): + super(ComponentCPLD, self).__init__() + self.index = component_index + + def get_name(self): + """ + Retrieves the name of the component + + Returns: + A string containing the name of the component + """ + self.name = self.cplds[self.index].name + + return self.name + + def get_description(self): + """ + Retrieves the description of the component + + Returns: + A string containing the description of the component + """ + self.description = self.cplds[self.index].description + + return self.description + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + res = self._get_command_result("ipmitool raw 0x32 0xff 0x02 {}".format(self.cplds[self.index].cmd_index)) + if not res: + return 'ERR' + else: + return res.split()[3].upper() + res.split()[2].upper() + res.split()[1].upper() + res.split()[0].upper() + + @classmethod + def get_component_list(cls): + component_list = [] + cpld_number = len(cls.cplds) + + for cpld_idx in range(1, cpld_number + 1): + component_list.append(cls(cpld_idx)) + + return component_list + + +class ComponentPCIE(Component): + COMPONENT_NAME = 'PCIe' + COMPONENT_DESCRIPTION = 'ASIC PCIe Firmware' + PCIE_QUERY_VERSION_COMMAND = "bcmcmd 'pciephy fw version' | grep 'FW version'" + + def __init__(self): + super(ComponentPCIE, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + version = self._get_command_result(self.PCIE_QUERY_VERSION_COMMAND) + if not version: + return 'ERR' + else: + version = version.split(": ")[1] + return version.strip() diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/fan_drawer.py index 75e954576a..3d5f767477 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/fan_drawer.py @@ -28,7 +28,7 @@ class FanDrawer(FanDrawerBase): Returns: string: The name of the device """ - return 'Fan {}'.format(self._index) + return 'Fantray{}'.format(self._index) def get_presence(self): """ diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/psu.py index 60e0f29740..e039602510 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/psu.py @@ -212,10 +212,10 @@ class Psu(PsuBase): def get_input_voltage(self): """ - Retrieves current PSU voltage output + Retrieves current PSU voltage input Returns: - A float number, the output voltage in volts, + A float number, the input voltage in volts, e.g. 12.1 """ voltage_in = 0.0 diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/sfp.py index a1a3d92f8c..f7a9a105a5 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/sfp.py @@ -10,13 +10,10 @@ import os import time -#import subprocess -#import sonic_device_util from ctypes import create_string_buffer try: from sonic_platform_base.sfp_base import SfpBase -# from sonic_platform_base.sonic_eeprom import eeprom_dts from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId @@ -175,7 +172,6 @@ class Sfp(SfpBase): # Init index self.index = sfp_index self.port_num = self.index - #self.dom_supported = False self.sfp_type = sfp_type # Init eeprom path eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom' @@ -284,15 +280,6 @@ class Sfp(SfpBase): else: return 'N/A' - def __read_txt_file(self, file_path): - try: - with open(file_path, 'r') as fd: - data = fd.read() - return data.strip() - except IOError: - pass - return "" - def __is_host(self): return os.system(self.HOST_CHK_CMD) == 0 @@ -355,26 +342,6 @@ class Sfp(SfpBase): return eeprom_raw - def __convert_string_to_num(self, value_str): - if "-inf" in value_str: - return 'N/A' - elif "Unknown" in value_str: - return 'N/A' - elif 'dBm' in value_str: - t_str = value_str.rstrip('dBm') - return float(t_str) - elif 'mA' in value_str: - t_str = value_str.rstrip('mA') - return float(t_str) - elif 'C' in value_str: - t_str = value_str.rstrip('C') - return float(t_str) - elif 'Volts' in value_str: - t_str = value_str.rstrip('Volts') - return float(t_str) - else: - return 'N/A' - def _dom_capability_detect(self): if not self.get_presence(): self.dom_supported = False @@ -533,9 +500,7 @@ class Sfp(SfpBase): else: if not self.get_presence(): return transceiver_info_dict - elif i == max_retry-1: - pass - else: + elif i < max_retry-1: time.sleep(0.5) if sfp_interface_bulk_raw is None: @@ -590,7 +555,8 @@ class Sfp(SfpBase): ['data']['Extended Identifier']['value'] transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data \ ['data']['RateIdentifier']['value'] - transceiver_info_dict['type_abbrv_name'] = 'N/A' + transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data \ + ['data']['type_abbrv_name']['value'] if self.sfp_type == QSFP_TYPE: for key in qsfp_cable_length_tup: if key in sfp_interface_bulk_data['data']: @@ -860,7 +826,7 @@ class Sfp(SfpBase): transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['TxBiasLowWarning']['value'] for key in transceiver_dom_threshold_dict: - transceiver_dom_threshold_dict[key] = self.__convert_string_to_num(transceiver_dom_threshold_dict[key]) + transceiver_dom_threshold_dict[key] = self._convert_string_to_num(transceiver_dom_threshold_dict[key]) return transceiver_dom_threshold_dict @@ -908,7 +874,7 @@ class Sfp(SfpBase): transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] for key in transceiver_dom_threshold_info_dict: - transceiver_dom_threshold_info_dict[key] = self.__convert_string_to_num(transceiver_dom_threshold_info_dict[key]) + transceiver_dom_threshold_info_dict[key] = self._convert_string_to_num(transceiver_dom_threshold_info_dict[key]) return transceiver_dom_threshold_info_dict @@ -1453,7 +1419,7 @@ class Sfp(SfpBase): sysfsfile_eeprom = open( sysfs_sfp_i2c_client_eeprom_path, mode="r+b", buffering=0) buffer = create_string_buffer(1) - buffer[0] = chr(tx_disable_ctl) + buffer[0] = tx_disable_ctl # Write to eeprom sysfsfile_eeprom.seek(offset + SFP_STATUS_CONTROL_OFFSET) sysfsfile_eeprom.write(buffer[0]) @@ -1506,7 +1472,7 @@ class Sfp(SfpBase): else: tx_disable_ctl = channel_state & (~channel) buffer = create_string_buffer(1) - buffer[0] = chr(tx_disable_ctl) + buffer[0] = tx_disable_ctl # Write to eeprom sysfsfile_eeprom = open( self.port_to_eeprom_mapping[self.port_num], "r+b") @@ -1594,7 +1560,7 @@ class Sfp(SfpBase): power_set_bit |= 1 << 1 buffer = create_string_buffer(1) - buffer[0] = chr(power_override_bit | power_set_bit) + buffer[0] = power_override_bit | power_set_bit # Write to eeprom sysfsfile_eeprom = open(self.port_to_eeprom_mapping[self.port_num], "r+b") sysfsfile_eeprom.seek(QSFP_POWEROVERRIDE_OFFSET) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/thermal.py index f2ba187547..770a2dfd5b 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/thermal.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# Quanta +# Quanta IX8 # # Module contains an implementation of SONiC Platform Base API and # provides the Thermal information diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/watchdog.py index 282f356f4e..0e63d9368c 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/watchdog.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/watchdog.py @@ -48,12 +48,16 @@ WD_MAIN_IDENTITY = "iTCO_wdt" WDT_SYSFS_PATH = "/sys/class/watchdog/" DEFAULT_TIMEOUT=180 +watchdog=0 class Watchdog(WatchdogBase): def __init__(self): self.watchdog, self.wdt_main_dev_name = self._get_wdt() + if self.wdt_main_dev_name is None: + raise Exception("Watchdog device is not instantiated") + self.status_path = "/sys/class/watchdog/%s/status" % self.wdt_main_dev_name self.state_path = "/sys/class/watchdog/%s/state" % self.wdt_main_dev_name self.timeout_path = "/sys/class/watchdog/%s/timeout" % self.wdt_main_dev_name @@ -74,14 +78,16 @@ class Watchdog(WatchdogBase): """ Retrieves watchdog device """ + global watchdog wdt_main_dev_list = [dev for dev in os.listdir( "/dev/") if dev.startswith("watchdog") and self._is_wd_main(dev)] if not wdt_main_dev_list: - return None + return (None, None) wdt_main_dev_name = wdt_main_dev_list[0] watchdog_device_path = "/dev/{}".format(wdt_main_dev_name) - self.watchdog = os.open(watchdog_device_path, os.O_RDWR) - return self.watchdog, wdt_main_dev_name + if not watchdog: + watchdog = os.open(watchdog_device_path, os.O_RDWR) + return watchdog, wdt_main_dev_name def _read_file(self, file_path): """ @@ -228,7 +234,8 @@ class Watchdog(WatchdogBase): Close watchdog """ - os.close(self.watchdog) + if self.watchdog is not None : + os.close(self.watchdog) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/utils/quanta_ix8_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/utils/quanta_ix8_util.py index 19dc24e370..833bfe27c4 100755 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/utils/quanta_ix8_util.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/utils/quanta_ix8_util.py @@ -28,7 +28,7 @@ command: """ import os -import commands +import subprocess import sys, getopt import logging import time @@ -38,18 +38,16 @@ args = [] FORCE = 0 i2c_prefix = '/sys/bus/i2c/devices/' - if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] - + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): global DEBUG global args global FORCE - if len(sys.argv)<2: + if len(sys.argv) < 2: show_help() options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', @@ -57,9 +55,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -73,34 +71,46 @@ def main(): logging.info('no option') for arg in args: if arg == 'install': - install() + install() elif arg == 'clean': - uninstall() + uninstall() else: show_help() - return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_log(txt): if DEBUG == True: - print "[IX8-56X]"+txt + print("[IX8-56X]" + txt) return def exec_cmd(cmd, show): - logging.info('Run :'+cmd) - status, output = commands.getstatusoutput(cmd) + logging.info('Run :' + cmd) + status, output = subprocess.getstatusoutput(cmd) show_log (cmd +"with result:" + str(status)) - show_log (" output:"+output) + show_log (" output:" + output) if status: - logging.info('Failed :'+cmd) + logging.info('Failed :' + cmd) if show: - print('Failed :'+cmd) - return status, output + print('Failed :' + cmd) + return status, output + +pca954x_bus_addr =[ +'0-0071', +'0-0072', +'0-0077', +'5-0073', +'6-0073', +'7-0073', +'8-0073', +'9-0073', +'10-0073', +'11-0073' +] instantiate =[ #export pca9698 for qsfp present @@ -207,7 +217,7 @@ drivers =[ 'lpc_ich', 'i2c-i801', 'i2c-dev', -'i2c-mux-pca954x force_deselect_on_exit=1', +'i2c-mux-pca954x', 'gpio-pca953x', 'optoe', 'qci_cpld_sfp28', @@ -243,11 +253,24 @@ def system_install(): exec_cmd("depmod -a ", 1) #install drivers for i in range(0,len(drivers)): - status, output = exec_cmd("modprobe "+drivers[i], 1) - if status: - print output - if FORCE == 0: - return status + status, output = exec_cmd("modprobe " + drivers[i], 1) + if status: + print(output) + #retry quanta_hwmon_ipmi in case it init failed due to ipmi_msghandler init uncompleted + if drivers[i] == 'quanta_hwmon_ipmi': + for _ in range(0, 3): + time.sleep(3) + ret, out = exec_cmd("modprobe quanta_hwmon_ipmi ", 1) + if ret == 0: + break + if ret and FORCE == 0: + return ret + elif FORCE == 0: + return status + + # set pca954x idle_state as -2: MUX_IDLE_DISCONNECT + for i in range(0,len(pca954x_bus_addr)): + exec_cmd("echo -2 > /sys/bus/i2c/drivers/pca954x/{}/idle_state".format(pca954x_bus_addr[i]), 1) #turn on module power exec_cmd("echo 21 > /sys/class/gpio/export ", 1) @@ -268,23 +291,23 @@ def system_install(): exec_cmd("echo 1 >/sys/class/gpio/gpio73/value", 1) #instantiate devices - for i in range(0,len(instantiate)): + for i in range(0, len(instantiate)): status, output = exec_cmd(instantiate[i], 1) - if status: - print output - if FORCE == 0: - return status + if status: + print(output) + if FORCE == 0: + return status #QSFP for 1~56 port - for port_number in range(1,57): + for port_number in range(1, 57): bus_number = port_number + 16 os.system("echo %d >/sys/bus/i2c/devices/%d-0050/port_name" % (port_number, bus_number)) status, output = exec_cmd("pip3 install /usr/share/sonic/device/x86_64-quanta_ix8_rglbmc-r0/sonic_platform-1.0-py3-none-any.whl",1) if status: - print output - if FORCE == 0: - return status + print(output) + if FORCE == 0: + return status #Enable front-ports LED decoding exec_cmd('echo 1 > /sys/class/cpld-led/CPLDLED-1/led_decode', 1) @@ -299,29 +322,31 @@ def system_ready(): def install(): if not device_found(): - print "No device, installing...." + print("No device, installing....") status = system_install() if status: if FORCE == 0: - return status + return status else: - print " ix8 driver already installed...." + print(" ix8 driver already installed....") return def uninstall(): global FORCE #uninstall drivers - for i in range(len(un_drivers)-1,-1,-1): - status, output = exec_cmd("rmmod "+un_drivers[i], 1) + for i in range(len(un_drivers) - 1, -1, -1): + status, output = exec_cmd("rmmod " + un_drivers[i], 1) if status: - print output - if FORCE == 0: - return status + print(output) + if FORCE == 0: + return status + status, output = exec_cmd("pip3 uninstall sonic-platform -y ",1) if status: - print output - if FORCE == 0: - return status + print(output) + if FORCE == 0: + return status + return def device_found(): diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/modules/qci_cpld_led.c b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/modules/qci_cpld_led.c index 9be8920f51..1f594e7bec 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/modules/qci_cpld_led.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/modules/qci_cpld_led.c @@ -49,7 +49,7 @@ static struct class *cpld_class = NULL; struct cpld_data { struct i2c_client *cpld_client; - char name[8]; + char name[16]; u8 cpld_id; }; diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/modules/qci_platform_ix8a_bwde.c b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/modules/qci_platform_ix8a_bwde.c index e5f6a6529d..2b82674e74 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/modules/qci_platform_ix8a_bwde.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/modules/qci_platform_ix8a_bwde.c @@ -170,9 +170,9 @@ static int __init ix8a_bwde_platform_init(void) } else { - g_client[0] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[0]); // pca9546_1 - g_client[1] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[1]); // pca9548_1 - g_client[2] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[16]); // CPU Linking Board at CPU's I2C Bus // + g_client[0] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[0]); // pca9546_1 + g_client[1] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[1]); // pca9548_1 + g_client[2] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[16]); // CPU Linking Board at CPU's I2C Bus // i2c_put_adapter(adapter); } @@ -183,9 +183,9 @@ static int __init ix8a_bwde_platform_init(void) } else { - g_client[3] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[11]); // CPLD_1 - g_client[4] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[17]); // CPLD_4 // - g_client[5] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[18]); // CPLD_6 // + g_client[3] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[11]); // CPLD_1 + g_client[4] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[17]); // CPLD_4 // + g_client[5] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[18]); // CPLD_6 // i2c_put_adapter(adapter); } @@ -196,7 +196,7 @@ static int __init ix8a_bwde_platform_init(void) } else { - g_client[6] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[12]); // CPLD_2 + g_client[6] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[12]); // CPLD_2 i2c_put_adapter(adapter); } @@ -207,7 +207,7 @@ static int __init ix8a_bwde_platform_init(void) } else { - g_client[7] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[13]); // CPLD_3 + g_client[7] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[13]); // CPLD_3 i2c_put_adapter(adapter); } @@ -218,8 +218,8 @@ static int __init ix8a_bwde_platform_init(void) } else { - g_client[8] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[2]); // pca9539_1 - g_client[9] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[14]); // pca9698_QSFP + g_client[8] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[2]); // pca9539_1 + g_client[9] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[14]); // pca9698_QSFP i2c_put_adapter(adapter); } @@ -230,7 +230,7 @@ static int __init ix8a_bwde_platform_init(void) } else { - g_client[10] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[4]); // pca9548_1 SFP + g_client[10] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[4]); // pca9548_1 SFP i2c_put_adapter(adapter); } @@ -241,7 +241,7 @@ static int __init ix8a_bwde_platform_init(void) } else { - g_client[11] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[5]); // pca9548_2 SFP + g_client[11] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[5]); // pca9548_2 SFP i2c_put_adapter(adapter); } @@ -252,7 +252,7 @@ static int __init ix8a_bwde_platform_init(void) } else { - g_client[12] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[6]); // pca9548_3 SFP + g_client[12] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[6]); // pca9548_3 SFP i2c_put_adapter(adapter); } @@ -263,7 +263,7 @@ static int __init ix8a_bwde_platform_init(void) } else { - g_client[13] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[7]); // pca9548_4 SFP + g_client[13] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[7]); // pca9548_4 SFP i2c_put_adapter(adapter); } @@ -274,7 +274,7 @@ static int __init ix8a_bwde_platform_init(void) } else { - g_client[14] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[8]); // pca9548_5 SFP + g_client[14] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[8]); // pca9548_5 SFP i2c_put_adapter(adapter); } @@ -285,7 +285,7 @@ static int __init ix8a_bwde_platform_init(void) } else { - g_client[15] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[9]); // pca9548_6 SFP + g_client[15] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[9]); // pca9548_6 SFP i2c_put_adapter(adapter); } @@ -296,7 +296,7 @@ static int __init ix8a_bwde_platform_init(void) } else { - g_client[16] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[10]); // pca9548_7 SFP + g_client[16] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[10]); // pca9548_7 SFP i2c_put_adapter(adapter); } @@ -307,7 +307,7 @@ static int __init ix8a_bwde_platform_init(void) } else { - g_client[17] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[3]); // eeprom + g_client[17] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[3]); // eeprom i2c_put_adapter(adapter); } @@ -320,9 +320,9 @@ static int __init ix8a_bwde_platform_init(void) else { if (i < 61) // SFP28 1~48 EEPROM - g_client_port[i - 13] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[19]); + g_client_port[i - 13] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[19]); else // QSFP 49~56 EEPROM - g_client_port[i - 13] = i2c_new_device(adapter, &ix8a_bwde_i2c_devices[15]); + g_client_port[i - 13] = i2c_new_client_device(adapter, &ix8a_bwde_i2c_devices[15]); i2c_put_adapter(adapter); } } diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/modules/quanta_hwmon_ipmi.c b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/modules/quanta_hwmon_ipmi.c index 65517e5d91..d927647b51 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/modules/quanta_hwmon_ipmi.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/modules/quanta_hwmon_ipmi.c @@ -28,7 +28,7 @@ #define __TO_R_EXP(bacc) (int32_t)(tos32(((BSWAP_32(bacc) & 0xf0) >> 4), 4)) #define __TO_B_EXP(bacc) (int32_t)(tos32((BSWAP_32(bacc) & 0xf), 4)) -#define SENSOR_ATTR_MAX 17 +#define SENSOR_ATTR_MAX 19 #define SENSOR_ATTR_NAME_LENGTH 20 #define SENSOR_GET_CAP_LABEL 0x001 @@ -44,7 +44,7 @@ #define SENSOR_GET_CAP_UNR 0x100 #define SENSOR_GET_CAP_MODEL 0x200 -#define SENSOR_GET_CAP_SN 0x400 +#define SENSOR_GET_CAP_SN 0x400 #define SENSOR_GET_CAP_PWM 0x800 #define SENSOR_GET_CAP_CONMODE 0x1000 @@ -52,7 +52,9 @@ #define SENSOR_GET_CAP_FAN_PRESENT 0x4000 #define SENSOR_GET_CAP_PSU_PRESENT 0x8000 -#define SENSOR_GET_CAP_MFRID 0x10000 +#define SENSOR_GET_CAP_MFRID 0x10000 +#define SENSOR_GET_CAP_VIN_TYPE 0x20000 +#define SENSOR_GET_CAP_POUT_MAX 0x40000 #define SDR_SENSOR_TYPE_TEMP 0x01 #define SDR_SENSOR_TYPE_VOLT 0x02 @@ -84,6 +86,8 @@ #define IPMI_TIMEOUT (4 * HZ) #define IPMI_MAX_WAIT_QUEUE 1 +typedef struct ipmi_user *ipmi_user_t; + struct quanta_hwmon_ipmi_data { struct platform_device *ipmi_platform_dev; @@ -1007,6 +1011,8 @@ void ipmi_sdr_set_sensor_factor(uint8_t idx, g_sensor_data[idx].capability |= SENSOR_GET_CAP_SN; g_sensor_data[idx].capability |= SENSOR_GET_CAP_MFRID; g_sensor_data[idx].capability |= SENSOR_GET_CAP_PSU_PRESENT; + g_sensor_data[idx].capability |= SENSOR_GET_CAP_VIN_TYPE; + g_sensor_data[idx].capability |= SENSOR_GET_CAP_POUT_MAX; } sprintf(g_sensor_data[idx].attrinfo.attr_type_str, "power"); } @@ -1086,7 +1092,7 @@ int32_t sdr_convert_sensor_reading(uint8_t idx, uint8_t val, result = (m * (int16_t)val) * decimal_point + b; break; default: - return; + return result; } pow_convert(&result, k2); @@ -1218,6 +1224,82 @@ int32_t ipmi_get_psu_info(uint8_t idx, uint8_t cmd, uint8_t *retbuf) return sprintf(retbuf, "N/A\n"); } +int32_t ipmi_get_vin_type(uint8_t idx, uint8_t *retbuf) +{ + uint8_t psu_slot = 0; + int32_t rv = 0; + + uint8_t returnData = 0; + uint8_t msg_data[] = { 0x06, 0x52, 0x0f, 0x00, 0x01, 0xd8 }; // read line status + + if (strstr(g_sensor_data[idx].sensor_idstring, "PSU1")) psu_slot = 1; + else psu_slot = 2; + + msg_data[3] = (psu_slot == 1) ? 0xb0 : 0xb2; + if (ipmi_check_psu_present(psu_slot)) { + mutex_lock(&ipmi_lock); + rv = ipmi_send_system_cmd(msg_data, sizeof(msg_data), &returnData, 1); + mutex_unlock(&ipmi_lock); + + if (rv) { + printk("BMC down at (%d)!!\n", __LINE__); + } + else { + switch (returnData) + { + case 0x7: //LVDC + case 0x3: //HVDC + return sprintf(retbuf, "DC\n"); + default: + return sprintf(retbuf, "AC\n"); + } + } + } + else { + //printk("Error ! cannot detect PSU%d\n", psu_slot); + } + + return sprintf(retbuf, "N/A\n"); +} + +int32_t ipmi_get_pout_max(uint8_t idx, uint8_t *retbuf) +{ + uint8_t psu_slot = 0; + int32_t rv = 0, pout_max = 0; + + uint8_t returnData[2] = { 0 }; + uint8_t msg_data[] = { 0x06, 0x52, 0x0f, 0x00, 0x02, 0xa7 }; + + if (strstr(g_sensor_data[idx].sensor_idstring, "PSU1")) psu_slot = 1; + else psu_slot = 2; + + msg_data[3] = (psu_slot == 1) ? 0xb0 : 0xb2; + if (ipmi_check_psu_present(psu_slot)) { + mutex_lock(&ipmi_lock); + rv = ipmi_send_system_cmd(msg_data, sizeof(msg_data), returnData, 1); + mutex_unlock(&ipmi_lock); + + if (rv) { + printk("BMC down at (%d)!!\n", __LINE__); + } + else { + /* MFR_POUT_MAX has 2 data format: Direct and Linear Data (see PMbus spec). + Query command is needed to tell the data format, but since we have not use PSU + whose output power is over 0x07ff (2047), just check the first 5 bits*/ + if ((returnData[1] & 0xf8) == 0) // Direct + pout_max = (returnData[1] << 8) | returnData[0]; + else // Linear Data + pout_max = (((returnData[1] & 0x07) << 8) | returnData[0]) << ((returnData[1] & 0xf8) >> 3); + return sprintf(retbuf, "%d\n", pout_max); + } + } + else { + //printk("Error ! cannot detect PSU%d\n", psu_slot); + } + + return sprintf(retbuf, "N/A\n"); +} + void ipmi_fan_control(uint8_t cmd_data1, uint8_t cmd_data2, uint8_t *retbuf) { int32_t rv = 0; @@ -1356,6 +1438,18 @@ static ssize_t show_mfrid(struct device *dev, struct device_attribute *devattr, return ipmi_get_psu_info(attr->index + DEBUGUSE_SHIFT, 0x99, buf); } +static ssize_t show_vin_type(struct device *dev, struct device_attribute *devattr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + return ipmi_get_vin_type(attr->index + DEBUGUSE_SHIFT, buf); +} + +static ssize_t show_pout_max(struct device *dev, struct device_attribute *devattr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + return ipmi_get_pout_max(attr->index + DEBUGUSE_SHIFT, buf); +} + static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, char *buf) { @@ -1432,7 +1526,6 @@ static ssize_t show_fanpresent(struct device *dev, uint8_t msg_data[] = { 0x36, 0xB9, 0x4C, 0x1C, 0x00, 0x02 }; /*netfn = 0x36; cmd = 0xB9; */ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct kernel_ipmi_msg msg; fan_idx = (g_sensor_data[attr->index].sensor_idstring[8] - '0') - 1; @@ -1465,7 +1558,8 @@ static ssize_t(*const attr_show_func_ptr[SENSOR_ATTR_MAX])(struct device *dev, , show_unc, show_ucr, show_unr , show_model, show_sn, show_pwm , show_controlmode, show_direction, show_fanpresent - , show_psupresent, show_mfrid + , show_psupresent, show_mfrid, show_vin_type + , show_pout_max }; static ssize_t(*const attr_store_func_ptr[SENSOR_ATTR_MAX])(struct device *dev, @@ -1476,7 +1570,8 @@ static ssize_t(*const attr_store_func_ptr[SENSOR_ATTR_MAX])(struct device *dev, , NULL, NULL, NULL , NULL, NULL, store_pwm , store_controlmode, NULL, NULL - , NULL, NULL + , NULL, NULL, NULL + , NULL }; static const char *const sensor_attrnames[SENSOR_ATTR_MAX] = @@ -1486,7 +1581,8 @@ static const char *const sensor_attrnames[SENSOR_ATTR_MAX] = , "%s%d_ncrit", "%s%d_crit", "%s%d_max" , "%s%d_model", "%s%d_sn", "%s%d_pwm" , "%s%d_controlmode", "%s%d_direction", "%s%d_present" - , "%s%d_present", "%s%d_mfrid" + , "%s%d_present", "%s%d_mfrid", "%s%d_vin_type" + , "%s%d_pout_max" }; static int32_t create_sensor_attrs(int32_t attr_no) @@ -1735,7 +1831,7 @@ static int32_t __init quanta_hwmon_ipmi_init(void) goto device_reg_err; } - data->ipmi_hwmon_dev = hwmon_device_register_with_groups(NULL, DRVNAME, NULL, + data->ipmi_hwmon_dev = hwmon_device_register_with_groups(&data->ipmi_platform_dev->dev, DRVNAME, NULL, NULL); err = IS_ERR(data->ipmi_hwmon_dev); if (err) @@ -1762,21 +1858,15 @@ static int32_t __init quanta_hwmon_ipmi_init(void) return 0; init_sensor_err: - if (g_sensor_data) - { - kfree(g_sensor_data); - g_sensor_data = NULL; - } + kfree(g_sensor_data); + g_sensor_data = NULL; ipmi_create_err: hwmon_device_unregister(data->ipmi_hwmon_dev); hwmon_register_err: platform_device_unregister(data->ipmi_platform_dev); device_reg_err: - if (data) - { - kfree(data); - data = NULL; - } + kfree(data); + data = NULL; alloc_err: return err; } @@ -1792,23 +1882,16 @@ static void __exit quanta_hwmon_ipmi_exit(void) platform_device_unregister(data->ipmi_platform_dev); - if (g_sensor_data) - { - kfree(g_sensor_data); - g_sensor_data = NULL; - } - - if (data) - { - kfree(data); - data = NULL; - } + kfree(g_sensor_data); + g_sensor_data = NULL; + kfree(data); + data = NULL; } module_init(quanta_hwmon_ipmi_init); module_exit(quanta_hwmon_ipmi_exit); MODULE_AUTHOR("Charcar~~Charcar~Charlie li li"); -MODULE_VERSION("2.0"); +MODULE_VERSION("2.1"); MODULE_DESCRIPTION("Quanta BMC hardware monitor driver"); MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/chassis.py index c765f37344..44528964c5 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/chassis.py @@ -72,6 +72,13 @@ class Chassis(ChassisBase): for index in range(1, self.__num_of_ports + 1): self.__xcvr_presence[index] = self._sfp_list[index-1].get_presence() + # Initialize components + from sonic_platform.component import ComponentBIOS, ComponentBMC, ComponentCPLD, ComponentPCIE + self._component_list.append(ComponentBIOS()) + self._component_list.append(ComponentBMC()) + self._component_list.extend(ComponentCPLD.get_component_list()) + self._component_list.append(ComponentPCIE()) + ############################################## # Device methods ############################################## @@ -79,7 +86,7 @@ class Chassis(ChassisBase): def get_sfp(self, index): """ Retrieves sfp represented by (1-based) index - For Quanta IX8A the index in sfputil.py starts from 1, so override + For Quanta the index in sfputil.py starts from 1, so override Args: index: An integer, the index (1-based) of the sfp to retrieve. @@ -179,6 +186,18 @@ class Chassis(ChassisBase): """ return self._eeprom.system_eeprom_info() + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Invalid Reason") + ############################################## # Other methods ############################################## @@ -215,10 +234,10 @@ class Chassis(ChassisBase): cur_xcvr_presence = self._sfp_list[index-1].get_presence() if cur_xcvr_presence != self.__xcvr_presence[index]: if cur_xcvr_presence is True: - xcvr_change_event_dict[str(index)] = '1' + xcvr_change_event_dict[index] = '1' self.__xcvr_presence[index] = True elif cur_xcvr_presence is False: - xcvr_change_event_dict[str(index)] = '0' + xcvr_change_event_dict[index] = '0' self.__xcvr_presence[index] = False event = True diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/component.py new file mode 100644 index 0000000000..f697f9bbe5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/component.py @@ -0,0 +1,204 @@ +#!/usr/bin/env python + +######################################################################## +# Quanta IX8A_BDE +# +# Name: component.py, version: 1.3 +# Module contains an implementation of SONiC Platform Base API and +# provides the Components' (e.g., BIOS, CPLD, FPGA, etc.) available in +# the platform +# +######################################################################## + +try: + import subprocess + from sonic_platform_base.component_base import ComponentBase + from collections import namedtuple +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Component(ComponentBase): + def __init__(self): + ComponentBase.__init__(self) + self.name = None + self.description = None + + def get_name(self): + return self.name + + def get_description(self): + return self.description + + def install_firmware(self, image_path): + """ + Installs firmware to the component + + Args: + image_path: A string, path to firmware image + + Returns: + A boolean, True if install was successful, False if not + """ + return False + + @staticmethod + def _get_command_result(cmdline): + try: + proc = subprocess.Popen(cmdline, + stdout=subprocess.PIPE, + shell=True, stderr=subprocess.STDOUT, + universal_newlines=True) + stdout = proc.communicate()[0] + rc = proc.wait() + result = stdout.rstrip('\n') + if rc != 0: + raise RuntimeError("Failed to execute command {}, return code {}, {}".format(cmdline, rc, stdout)) + + except OSError as e: + raise RuntimeError("Failed to execute command {} due to {}".format(cmdline, repr(e))) + + return result + + +class ComponentBIOS(Component): + COMPONENT_NAME = 'BIOS' + COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' + + BIOS_QUERY_VERSION_COMMAND = "dmidecode -s bios-version" + + def __init__(self): + super(ComponentBIOS, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + bios_ver = self._get_command_result(self.BIOS_QUERY_VERSION_COMMAND) + if not bios_ver: + return 'ERR' + else: + return bios_ver + + +class ComponentBMC(Component): + COMPONENT_NAME = 'BMC' + COMPONENT_DESCRIPTION = 'BMC - Board Management Controller' + BMC_QUERY_VERSION_COMMAND = "ipmitool mc info | grep 'Firmware Revision'" + + def __init__(self): + super(ComponentBMC, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + bmc_ver = self._get_command_result(self.BMC_QUERY_VERSION_COMMAND) + if not bmc_ver: + return 'ERR' + else: + bmc_ver = bmc_ver.split(": ")[1] + return bmc_ver.strip() + + +class ComponentCPLD(Component): + Cpld = namedtuple("Cpld", ['name', 'cmd_index', 'description']) + + cplds = { + 1: Cpld("BOOT_CPLD", 1, "Power sequence"), + 2: Cpld("FAN_CPLD", 2, "Fan"), + 3: Cpld("MB_CPLD_IO_1", 7, "Port IO-1"), + 4: Cpld("MB_CPLD_IO_2", 5, "Port IO-2"), + 5: Cpld("MB_CPLD_IO_3", 4, "Port IO-3"), + 6: Cpld("MB_CPLD_LED_1", 6, "Port LED-1"), + 7: Cpld("MB_CPLD_LED_2", 3, "Port LED-2"), + } + + def __init__(self, component_index): + super(ComponentCPLD, self).__init__() + self.index = component_index + + def get_name(self): + """ + Retrieves the name of the component + + Returns: + A string containing the name of the component + """ + self.name = self.cplds[self.index].name + + return self.name + + def get_description(self): + """ + Retrieves the description of the component + + Returns: + A string containing the description of the component + """ + self.description = self.cplds[self.index].description + + return self.description + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x01") + res = self._get_command_result("ipmitool raw 0x32 0xff 0x02 {}".format(self.cplds[self.index].cmd_index)) + self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x00") + if not res: + return 'ERR' + else: + return res.split()[3].upper() + res.split()[2].upper() + res.split()[1].upper() + res.split()[0].upper() + + @classmethod + def get_component_list(cls): + component_list = [] + cpld_number = len(cls.cplds) + + for cpld_idx in range(1, cpld_number + 1): + component_list.append(cls(cpld_idx)) + + return component_list + + +class ComponentPCIE(Component): + COMPONENT_NAME = 'PCIe' + COMPONENT_DESCRIPTION = 'ASIC PCIe Firmware' + PCIE_QUERY_VERSION_COMMAND = "bcmcmd 'pciephy fw version' | grep 'FW version'" + + def __init__(self): + super(ComponentPCIE, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + version = self._get_command_result(self.PCIE_QUERY_VERSION_COMMAND) + if not version: + return 'ERR' + else: + version = version.split(": ")[1] + return version.strip() diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/fan.py index 8aae9147c4..934891f370 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/fan.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# Quanta IX8A-BWDE +# Quanta IX8A_BDE # # Module contains an implementation of SONiC Platform Base API and # provides the FAN information @@ -11,6 +11,7 @@ try: import logging import os + import glob from sonic_platform_base.fan_base import FanBase except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -19,9 +20,7 @@ except ImportError as e: ############### # Global ############### -HWMON_DIR = "/sys/class/hwmon/hwmon2/" -FAN_INDEX_START = 18 -NUM_FANTRAYS = 6 +HWMON_IPMI_DIR = "/sys/devices/platform/quanta_hwmon_ipmi/hwmon/hwmon*/" FANS_PERTRAY = 2 class Fan(FanBase): @@ -30,30 +29,46 @@ class Fan(FanBase): def __init__(self, index, is_psu_fan=False): self.is_psu_fan = is_psu_fan self.fan_index = index - self.psu_fan_index_mapping = { - 1:120, - 2:132, - } - self.psu_index_mapping = { - 1:114, - 2:126, - } + hwmon_dir=glob.glob(HWMON_IPMI_DIR)[0] + if self.is_psu_fan: - self.fan_presence_attr = "power{}_present".format(self.psu_index_mapping[index]) - self.fan_pwm_attr = "fan{}_pwm".format(self.psu_fan_index_mapping[index]) - self.fan_rpm_attr = "fan{}_input".format(self.psu_fan_index_mapping[index]) - self.fan_direction_attr = "fan{}_direction".format(self.psu_fan_index_mapping[index]) + power_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_POWER_OUT".format(self.fan_index), 'power') + fan_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_Fan".format(self.fan_index), 'fan') + self.fan_presence_attr = power_out_prefix + 'present' + self.fan_pwm_attr = fan_prefix + 'pwm' + self.fan_rpm_attr = fan_prefix + 'input' + self.fan_direction_attr = fan_prefix + 'direction' else: - self.fan_presence_attr = "fan{}_present".format(FAN_INDEX_START+(index-1)) - self.fan_pwm_attr = "fan{}_pwm".format(FAN_INDEX_START+(index-1)) - self.fan_rpm_attr = "fan{}_input".format(FAN_INDEX_START+(index-1)) - self.fan_direction_attr = "fan{}_direction".format(FAN_INDEX_START+(index-1)) + fantray_index = (self.fan_index-1)//FANS_PERTRAY+1 + fan_index_intray = self.fan_index - ((fantray_index-1)*FANS_PERTRAY) + fan_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "Fan_SYS_{}_{}".format(fantray_index, fan_index_intray), 'fan') + self.fan_presence_attr = fan_prefix + 'present' + self.fan_pwm_attr = fan_prefix + 'pwm' + self.fan_rpm_attr = fan_prefix + 'input' + self.fan_direction_attr = fan_prefix + 'direction' ####################### # private function ####################### + def __get_hwmon_attr_prefix(self, dir, label, type): + + retval = 'ERR' + if not os.path.isdir(dir): + return retval + + try: + for filename in os.listdir(dir): + if filename[-5:] == 'label' and type in filename: + file_path = os.path.join(dir, filename) + if os.path.isfile(file_path) and label == self.__get_attr_value(file_path): + return file_path[0:-5] + except Exception as error: + logging.error("Error when getting {} label path: {}".format(label, error)) + + return retval + def __get_attr_value(self, attr_path): retval = 'ERR' @@ -64,7 +79,7 @@ class Fan(FanBase): with open(attr_path, 'r') as fd: retval = fd.read() except Exception as error: - logging.error("Unable to open " + attr_path + " file !") + logging.error("Unable to open {} file: {}".format(attr_path, error)) retval = retval.rstrip(' \t\n\r') return retval @@ -95,8 +110,7 @@ class Fan(FanBase): Returns: bool: True if device is present, False if not """ - attr_path = HWMON_DIR + self.fan_presence_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_presence_attr) if (attr_rv != 'ERR'): if (attr_rv == '1'): return True @@ -113,8 +127,7 @@ class Fan(FanBase): A boolean value, True if device is operating properly, False if not """ if self.get_presence(): - attr_path = HWMON_DIR + self.fan_rpm_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_rpm_attr) if (attr_rv != 'ERR' and attr_rv != '0.0'): return True @@ -135,8 +148,7 @@ class Fan(FanBase): A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST depending on fan direction """ - attr_path = HWMON_DIR + self.fan_direction_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_direction_attr) if attr_rv == '2': return self.FAN_DIRECTION_INTAKE @@ -152,8 +164,7 @@ class Fan(FanBase): to 100 (full speed) """ if self.get_presence(): - attr_path = HWMON_DIR + self.fan_pwm_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_pwm_attr) if (attr_rv != 'ERR'): return int(float(attr_rv)) @@ -169,8 +180,7 @@ class Fan(FanBase): Returns: An integer, speed of the fan in RPM """ - attr_path = HWMON_DIR + self.fan_rpm_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_rpm_attr) if (attr_rv != 'ERR'): return int(float(attr_rv)) @@ -185,8 +195,7 @@ class Fan(FanBase): An integer, the percentage of full fan speed, in the range 0 (off) to 100 (full speed) """ - attr_path = HWMON_DIR + self.fan_pwm_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_pwm_attr) if (attr_rv != 'ERR'): return int(float(attr_rv)) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/fan_drawer.py index 75e954576a..3d5f767477 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/fan_drawer.py @@ -28,7 +28,7 @@ class FanDrawer(FanDrawerBase): Returns: string: The name of the device """ - return 'Fan {}'.format(self._index) + return 'Fantray{}'.format(self._index) def get_presence(self): """ diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/psu.py index bd3f4ce808..6188c95c76 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/psu.py @@ -8,57 +8,61 @@ try: import logging import os + import glob from sonic_platform_base.psu_base import PsuBase from sonic_platform.fan import Fan except ImportError as e: raise ImportError(str(e) + "- required module not found") -HWMON_DIR = "/sys/class/hwmon/hwmon2/" +HWMON_IPMI_DIR = "/sys/devices/platform/quanta_hwmon_ipmi/hwmon/hwmon*/" class Psu(PsuBase): def __init__(self, index): PsuBase.__init__(self) fan = Fan(index, True) self._fan_list.append(fan) + self.index = index + hwmon_dir=glob.glob(HWMON_IPMI_DIR)[0] - self.psu_index_mapping = { - 1:114, - 2:126, - } - self.psu_powerin_index_mapping = { - 1:119, - 2:131, - } - self.psu_currentout_index_mapping = { - 1:130, - 2:115, - } - self.psu_currentin_index_mapping = { - 1:130, - 2:115, - } - self.psu_voltageout_index_mapping = { - 1:129, - 2:124, - } - self.psu_voltagein_index_mapping = { - 1:125, - 2:128, - } - self.index = index - self.psu_presence_attr = "power{}_present".format(self.psu_index_mapping[self.index]) - self.psu_status_attr = "curr{}_input".format(self.psu_currentout_index_mapping[self.index]) - self.psu_power_in_attr = "power{}_input".format(self.psu_powerin_index_mapping[self.index]) - self.psu_power_out_attr = "power{}_input".format(self.psu_index_mapping[self.index]) - self.psu_voltage_out_attr = "in{}_input".format(self.psu_voltageout_index_mapping[self.index]) - self.psu_current_out_attr = "curr{}_input".format(self.psu_currentout_index_mapping[self.index]) - self.psu_voltage_in_attr = "in{}_input".format(self.psu_voltagein_index_mapping[self.index]) - self.psu_current_in_attr = "curr{}_input".format(self.psu_currentin_index_mapping[self.index]) - self.psu_serial_attr = "power{}_sn".format(self.psu_index_mapping[self.index]) - self.psu_model_attr = "power{}_model".format(self.psu_index_mapping[self.index]) - self.psu_mfr_id_attr = "power{}_mfrid".format(self.psu_index_mapping[self.index]) - self.psu_capacity_attr = "power{}_pout_max".format(self.psu_index_mapping[self.index]) - self.psu_type_attr = "power{}_vin_type".format(self.psu_index_mapping[self.index]) + current_in_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_CURRENT_IN".format(self.index), 'curr') + current_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_CURRENT_OUT".format(self.index), 'curr') + power_in_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_POWER_IN".format(self.index), 'power') + power_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_POWER_OUT".format(self.index), 'power') + voltage_in_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_VOLTAGE_IN".format(self.index), 'in') + voltage_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_VOLTAGE_OUT".format(self.index), 'in') + temp1_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_TEMP1".format(self.index), 'temp') + + self.psu_current_in_attr = current_in_prefix + 'input' + self.psu_current_out_attr = current_out_prefix + 'input' + self.psu_power_in_attr = power_in_prefix + 'input' + self.psu_power_out_attr = power_out_prefix + 'input' + self.psu_voltage_in_attr = voltage_in_prefix + 'input' + self.psu_voltage_out_attr = voltage_out_prefix + 'input' + self.psu_status_attr = current_out_prefix + 'input' + self.psu_presence_attr = power_out_prefix + 'present' + self.psu_serial_attr = power_out_prefix + 'sn' + self.psu_model_attr = power_out_prefix + 'model' + self.psu_mfr_id_attr = power_out_prefix + 'mfrid' + self.psu_capacity_attr = power_out_prefix + 'pout_max' + self.psu_type_attr = power_out_prefix + 'vin_type' + self.psu_temp_attr = temp1_prefix + 'input' + + def __get_hwmon_attr_prefix(self, dir, label, type): + + retval = 'ERR' + if not os.path.isdir(dir): + return retval + + try: + for filename in os.listdir(dir): + if filename[-5:] == 'label' and type in filename: + file_path = os.path.join(dir, filename) + if os.path.isfile(file_path) and label == self.__get_attr_value(file_path): + return file_path[0:-5] + except Exception as error: + logging.error("Error when getting {} label path: {}".format(label, error)) + + return retval def __get_attr_value(self, attr_path): @@ -70,10 +74,9 @@ class Psu(PsuBase): with open(attr_path, 'r') as fd: retval = fd.read() except Exception as error: - logging.error("Unable to open " + attr_path + " file !") + logging.error("Unable to open {} file: {}".format(attr_path, error)) retval = retval.rstrip(' \t\n\r') - fd.close() return retval ############################################## @@ -97,10 +100,9 @@ class Psu(PsuBase): bool: True if device is present, False if not """ presence = False - attr_path = HWMON_DIR+self.psu_presence_attr attr_normal = '1' - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_presence_attr) if (attr_rv != 'ERR'): if (attr_rv == attr_normal): presence = True @@ -115,8 +117,7 @@ class Psu(PsuBase): string: Model/part number of device """ model = "N/A" - attr_path = HWMON_DIR+self.psu_model_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_model_attr) if (attr_rv != 'ERR'): model = attr_rv @@ -130,8 +131,7 @@ class Psu(PsuBase): string: Manufacturer's id of device """ mfr_id = "N/A" - attr_path = HWMON_DIR+self.psu_mfr_id_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_mfr_id_attr) if (attr_rv != 'ERR'): mfr_id = attr_rv @@ -145,9 +145,7 @@ class Psu(PsuBase): string: Serial number of device """ serial = "N/A" - attr_path = HWMON_DIR+self.psu_serial_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_serial_attr) if (attr_rv != 'ERR'): serial = attr_rv @@ -161,9 +159,7 @@ class Psu(PsuBase): A boolean value, True if device is operating properly, False if not """ status = False - attr_path = HWMON_DIR+self.psu_status_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_status_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) if (int(attr_rv) != 0): @@ -184,9 +180,7 @@ class Psu(PsuBase): e.g. 12.1 """ voltage_out = 0.0 - attr_path = HWMON_DIR+self.psu_voltage_out_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_voltage_out_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) voltage_out = float(attr_rv) / 1000 @@ -201,9 +195,7 @@ class Psu(PsuBase): A float number, the electric current in amperes, e.g 15.4 """ current_out = 0.0 - attr_path = HWMON_DIR+self.psu_current_out_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_current_out_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) current_out = float(attr_rv) / 1000 @@ -212,16 +204,14 @@ class Psu(PsuBase): def get_input_voltage(self): """ - Retrieves current PSU voltage output + Retrieves current PSU voltage input Returns: - A float number, the output voltage in volts, + A float number, the input voltage in volts, e.g. 12.1 """ voltage_in = 0.0 - attr_path = HWMON_DIR+self.psu_voltage_in_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_voltage_in_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) voltage_in = float(attr_rv) / 1000 @@ -236,9 +226,7 @@ class Psu(PsuBase): A float number, the electric current in amperes, e.g 15.4 """ current_in = 0.0 - attr_path = HWMON_DIR+self.psu_current_in_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_current_in_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) current_in = float(attr_rv) / 1000 @@ -253,9 +241,7 @@ class Psu(PsuBase): A float number, the power in watts, e.g. 302.6 """ power_out = 0.0 - attr_path = HWMON_DIR+self.psu_power_out_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_power_out_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) power_out = float(attr_rv) / 1000 @@ -292,8 +278,7 @@ class Psu(PsuBase): A string, the type of PSU (AC/DC) """ type = "AC" - attr_path = HWMON_DIR+self.psu_type_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_type_attr) if (attr_rv != 'ERR'): type = attr_rv @@ -307,8 +292,7 @@ class Psu(PsuBase): An integer, the capacity of PSU """ capacity = 0 - attr_path = HWMON_DIR+self.psu_capacity_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_capacity_attr) if (attr_rv != 'ERR'): try: capacity = int(attr_rv) @@ -317,3 +301,19 @@ class Psu(PsuBase): return capacity + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + + tout = 0.0 + attr_rv = self.__get_attr_value(self.psu_temp_attr) + if (attr_rv != 'ERR'): + tout = float(attr_rv) + + # tout is in milli degree celcius + return float(tout/1000.0) + diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/sfp.py index bd7692be16..abbebb0343 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/sfp.py @@ -10,13 +10,10 @@ import os import time -#import subprocess -#import sonic_device_util from ctypes import create_string_buffer try: from sonic_platform_base.sfp_base import SfpBase -# from sonic_platform_base.sonic_eeprom import eeprom_dts from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId @@ -175,7 +172,6 @@ class Sfp(SfpBase): # Init index self.index = sfp_index self.port_num = self.index - #self.dom_supported = False self.sfp_type = sfp_type # Init eeprom path eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom' @@ -284,15 +280,6 @@ class Sfp(SfpBase): else: return 'N/A' - def __read_txt_file(self, file_path): - try: - with open(file_path, 'r') as fd: - data = fd.read() - return data.strip() - except IOError: - pass - return "" - def __is_host(self): return os.system(self.HOST_CHK_CMD) == 0 @@ -355,26 +342,6 @@ class Sfp(SfpBase): return eeprom_raw - def __convert_string_to_num(self, value_str): - if "-inf" in value_str: - return 'N/A' - elif "Unknown" in value_str: - return 'N/A' - elif 'dBm' in value_str: - t_str = value_str.rstrip('dBm') - return float(t_str) - elif 'mA' in value_str: - t_str = value_str.rstrip('mA') - return float(t_str) - elif 'C' in value_str: - t_str = value_str.rstrip('C') - return float(t_str) - elif 'Volts' in value_str: - t_str = value_str.rstrip('Volts') - return float(t_str) - else: - return 'N/A' - def _dom_capability_detect(self): if not self.get_presence(): self.dom_supported = False @@ -533,9 +500,7 @@ class Sfp(SfpBase): else: if not self.get_presence(): return transceiver_info_dict - elif i == max_retry-1: - pass - else: + elif i < max_retry-1: time.sleep(0.5) if sfp_interface_bulk_raw is None: @@ -590,7 +555,8 @@ class Sfp(SfpBase): ['data']['Extended Identifier']['value'] transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data \ ['data']['RateIdentifier']['value'] - transceiver_info_dict['type_abbrv_name'] = 'N/A' + transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data \ + ['data']['type_abbrv_name']['value'] if self.sfp_type == QSFP_TYPE: for key in qsfp_cable_length_tup: if key in sfp_interface_bulk_data['data']: @@ -860,7 +826,7 @@ class Sfp(SfpBase): transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['TxBiasLowWarning']['value'] for key in transceiver_dom_threshold_dict: - transceiver_dom_threshold_dict[key] = self.__convert_string_to_num(transceiver_dom_threshold_dict[key]) + transceiver_dom_threshold_dict[key] = self._convert_string_to_num(transceiver_dom_threshold_dict[key]) return transceiver_dom_threshold_dict @@ -908,7 +874,7 @@ class Sfp(SfpBase): transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] for key in transceiver_dom_threshold_info_dict: - transceiver_dom_threshold_info_dict[key] = self.__convert_string_to_num(transceiver_dom_threshold_info_dict[key]) + transceiver_dom_threshold_info_dict[key] = self._convert_string_to_num(transceiver_dom_threshold_info_dict[key]) return transceiver_dom_threshold_info_dict @@ -1461,7 +1427,7 @@ class Sfp(SfpBase): sysfsfile_eeprom = open( sysfs_sfp_i2c_client_eeprom_path, mode="r+b", buffering=0) buffer = create_string_buffer(1) - buffer[0] = chr(tx_disable_ctl) + buffer[0] = tx_disable_ctl # Write to eeprom sysfsfile_eeprom.seek(offset + SFP_STATUS_CONTROL_OFFSET) sysfsfile_eeprom.write(buffer[0]) @@ -1514,7 +1480,7 @@ class Sfp(SfpBase): else: tx_disable_ctl = channel_state & (~channel) buffer = create_string_buffer(1) - buffer[0] = chr(tx_disable_ctl) + buffer[0] = tx_disable_ctl # Write to eeprom sysfsfile_eeprom = open( self.port_to_eeprom_mapping[self.port_num], "r+b") @@ -1602,7 +1568,7 @@ class Sfp(SfpBase): power_set_bit |= 1 << 1 buffer = create_string_buffer(1) - buffer[0] = chr(power_override_bit | power_set_bit) + buffer[0] = power_override_bit | power_set_bit # Write to eeprom sysfsfile_eeprom = open(self.port_to_eeprom_mapping[self.port_num], "r+b") sysfsfile_eeprom.seek(QSFP_POWEROVERRIDE_OFFSET) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/thermal.py index 1e07cb0e3e..32da974f89 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/thermal.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# Quanta +# Quanta IX8A_BDE # # Module contains an implementation of SONiC Platform Base API and # provides the Thermal information @@ -10,43 +10,44 @@ import logging import os +import glob try: from sonic_platform_base.thermal_base import ThermalBase except ImportError as e: raise ImportError(str(e) + "- required module not found") -HWMON_DIR = "/sys/class/hwmon/hwmon2/" +HWMON_IPMI_DIR = "/sys/devices/platform/quanta_hwmon_ipmi/hwmon/hwmon*/" thermal_index_mapping = { - 1:53, - 2:54, - 3:55, - 4:56, - 5:57, - 6:58, - 7:59, - 8:60, - 9:61, - 10:62, - 11:63, - 12:64, - 13:86, - 14:87, - 15:88, - 16:89, - 17:90, - 18:91, - 19:92, - 20:93, - 21:94, - 22:109, - 23:116, - 24:117, - 25:121, - 26:122, - 27:123, - 28:127 + 1:'PSU1_TEMP1', + 2:'PSU1_TEMP2', + 3:'PSU1_TEMP3', + 4:'PSU2_TEMP1', + 5:'PSU2_TEMP2', + 6:'PSU2_TEMP3', + 7:'QMACTemp_0', + 8:'QMACTemp_1', + 9:'QMACTemp_2', + 10:'QMACTemp_3', + 11:'QMACTemp_4', + 12:'QMACTemp_5', + 13:'QMACTemp_6', + 14:'QMACTemp_7', + 15:'QMACTemp_8', + 16:'QMACTemp_9', + 17:'Temp_1V05_PCH_VR', + 18:'Temp_Ambient_1', + 19:'Temp_Ambient_2', + 20:'Temp_Ambient_3', + 21:'Temp_Ambient_4', + 22:'Temp_Ambient_5', + 23:'Temp_Ambient_6', + 24:'Temp_CPU', + 25:'Temp_DDRAB_VR', + 26:'Temp_SOC_DIMMA0', + 27:'Temp_VCCGBE_VR', + 28:'Temp_VCCIN_VR' } @@ -55,12 +56,32 @@ class Thermal(ThermalBase): """Platform-specific Thermal class""" def __init__(self, thermal_index): - self.index = thermal_index - self.temp_attr = "temp{}_input".format(thermal_index_mapping[self.index]) - self.high_th_attr = "temp{}_ncrit".format(thermal_index_mapping[self.index]) - self.high_crit_th_attr = "temp{}_crit".format(thermal_index_mapping[self.index]) - self.name_attr = "temp{}_label".format(thermal_index_mapping[self.index]) + self.index = thermal_index + hwmon_dir=glob.glob(HWMON_IPMI_DIR)[0] + thermal_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, thermal_index_mapping[self.index], 'temp') + self.temp_attr = "{}input".format(thermal_prefix) + self.high_th_attr = "{}ncrit".format(thermal_prefix) + self.high_crit_th_attr = "{}crit".format(thermal_prefix) + self.low_th_attr = "{}lncrit".format(thermal_prefix) + self.low_crit_th_attr = "{}lcrit".format(thermal_prefix) + self.name_attr = "{}label".format(thermal_prefix) + def __get_hwmon_attr_prefix(self, dir, label, type): + + retval = 'ERR' + if not os.path.isdir(dir): + return retval + + try: + for filename in os.listdir(dir): + if filename[-5:] == 'label' and type in filename: + file_path = os.path.join(dir, filename) + if os.path.isfile(file_path) and label == self.__get_attr_value(file_path): + return file_path[0:-5] + except Exception as error: + logging.error("Error when getting {} label path: {}".format(label, error)) + + return retval def __get_attr_value(self, attr_path): @@ -72,7 +93,7 @@ class Thermal(ThermalBase): with open(attr_path, 'r') as fd: retval = fd.read() except Exception as error: - logging.error("Unable to open " + attr_path + " file !") + logging.error("Unable to open {} file: {}".format(attr_path, error)) retval = retval.rstrip(' \t\n\r') return retval @@ -84,8 +105,7 @@ class Thermal(ThermalBase): Returns: string: The name of the device """ - attr_path = HWMON_DIR + self.name_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.name_attr) if (attr_rv != 'ERR'): return attr_rv @@ -99,8 +119,7 @@ class Thermal(ThermalBase): Returns: bool: True if device is present, False if not """ - attr_path = HWMON_DIR + self.name_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.name_attr) if (attr_rv != 'ERR'): return True @@ -127,8 +146,37 @@ class Thermal(ThermalBase): A float number of current temperature in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - attr_path = HWMON_DIR + self.temp_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.temp_attr) + + if (attr_rv != 'ERR'): + return float(attr_rv) / 1000 + else: + return None + + def get_low_threshold(self): + """ + Retrieves the low threshold temperature of thermal + + Returns: + A float number, the low threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + attr_rv = self.__get_attr_value(self.low_th_attr) + + if (attr_rv != 'ERR'): + return float(attr_rv) / 1000 + else: + return None + + def get_low_critical_threshold(self): + """ + Retrieves the low critical threshold temperature of thermal + + Returns: + A float number, the low critical threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + attr_rv = self.__get_attr_value(self.low_crit_th_attr) if (attr_rv != 'ERR'): return float(attr_rv) / 1000 @@ -143,8 +191,7 @@ class Thermal(ThermalBase): A float number, the high threshold temperature of thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - attr_path = HWMON_DIR + self.high_th_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.high_th_attr) if (attr_rv != 'ERR'): return float(attr_rv) / 1000 @@ -159,8 +206,7 @@ class Thermal(ThermalBase): A float number, the high threshold temperature of thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - attr_path = HWMON_DIR + self.high_crit_th_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.high_crit_th_attr) if (attr_rv != 'ERR'): return float(attr_rv) / 1000 diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/watchdog.py index 282f356f4e..0e63d9368c 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/watchdog.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/watchdog.py @@ -48,12 +48,16 @@ WD_MAIN_IDENTITY = "iTCO_wdt" WDT_SYSFS_PATH = "/sys/class/watchdog/" DEFAULT_TIMEOUT=180 +watchdog=0 class Watchdog(WatchdogBase): def __init__(self): self.watchdog, self.wdt_main_dev_name = self._get_wdt() + if self.wdt_main_dev_name is None: + raise Exception("Watchdog device is not instantiated") + self.status_path = "/sys/class/watchdog/%s/status" % self.wdt_main_dev_name self.state_path = "/sys/class/watchdog/%s/state" % self.wdt_main_dev_name self.timeout_path = "/sys/class/watchdog/%s/timeout" % self.wdt_main_dev_name @@ -74,14 +78,16 @@ class Watchdog(WatchdogBase): """ Retrieves watchdog device """ + global watchdog wdt_main_dev_list = [dev for dev in os.listdir( "/dev/") if dev.startswith("watchdog") and self._is_wd_main(dev)] if not wdt_main_dev_list: - return None + return (None, None) wdt_main_dev_name = wdt_main_dev_list[0] watchdog_device_path = "/dev/{}".format(wdt_main_dev_name) - self.watchdog = os.open(watchdog_device_path, os.O_RDWR) - return self.watchdog, wdt_main_dev_name + if not watchdog: + watchdog = os.open(watchdog_device_path, os.O_RDWR) + return watchdog, wdt_main_dev_name def _read_file(self, file_path): """ @@ -228,7 +234,8 @@ class Watchdog(WatchdogBase): Close watchdog """ - os.close(self.watchdog) + if self.watchdog is not None : + os.close(self.watchdog) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/utils/quanta_ix8a_bwde_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/utils/quanta_ix8a_bwde_util.py index ed8c5fef6b..c238247793 100755 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/utils/quanta_ix8a_bwde_util.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/utils/quanta_ix8a_bwde_util.py @@ -28,7 +28,7 @@ command: """ import os -import commands +import subprocess import sys, getopt import logging import time @@ -39,8 +39,8 @@ FORCE = 0 i2c_prefix = '/sys/bus/i2c/devices/' if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): global DEBUG @@ -55,9 +55,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -71,26 +71,26 @@ def main(): logging.info('no option') for arg in args: if arg == 'install': - install() + install() elif arg == 'clean': - uninstall() + uninstall() else: show_help() return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_log(txt): if DEBUG == True: - print "[IX8A-BWDE-56X]" + txt + print("[IX8A-BWDE-56X]" + txt) return def exec_cmd(cmd, show): logging.info('Run :' + cmd) - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) show_log (cmd +"with result:" + str(status)) show_log (" output:" + output) if status: @@ -99,6 +99,18 @@ def exec_cmd(cmd, show): print('Failed :' + cmd) return status, output +pca954x_bus_addr =[ +'0-0072', +'0-0077', +'5-0073', +'6-0073', +'7-0073', +'8-0073', +'9-0073', +'10-0073', +'11-0073' +] + instantiate =[ #export pca9698 for qsfp present 'echo 34 > /sys/class/gpio/export', @@ -204,7 +216,7 @@ drivers =[ 'lpc_ich', 'i2c-i801', 'i2c-dev', -'i2c-mux-pca954x force_deselect_on_exit=1', +'i2c-mux-pca954x', 'gpio-pca953x', 'optoe', 'qci_cpld_sfp28', @@ -235,11 +247,20 @@ def system_install(): exec_cmd("depmod -a ", 1) #install drivers for i in range(0,len(drivers)): - status, output = exec_cmd("modprobe " + drivers[i], 1) - if status: - print output - if FORCE == 0: - return status + status, output = exec_cmd("modprobe " + drivers[i], 1) + if status: + print(output) + #retry quanta_hwmon_ipmi in case it init failed due to ipmi_msghandler init uncompleted + if drivers[i] == 'quanta_hwmon_ipmi': + for _ in range(0, 3): + time.sleep(3) + ret, out = exec_cmd("modprobe quanta_hwmon_ipmi ", 1) + if ret == 0: + break + if ret and FORCE == 0: + return ret + elif FORCE == 0: + return status #reload ethernet drivers in correct order exec_cmd("rmmod ixgbe ", 1) @@ -247,6 +268,10 @@ def system_install(): exec_cmd("modprobe igb ", 1) exec_cmd("modprobe ixgbe ", 1) + # set pca954x idle_state as -2: MUX_IDLE_DISCONNECT + for i in range(0,len(pca954x_bus_addr)): + exec_cmd("echo -2 > /sys/bus/i2c/drivers/pca954x/{}/idle_state".format(pca954x_bus_addr[i]), 1) + #turn on module power exec_cmd("echo 21 > /sys/class/gpio/export ", 1) exec_cmd("echo high > /sys/class/gpio/gpio21/direction ", 1) @@ -268,10 +293,10 @@ def system_install(): #instantiate devices for i in range(0, len(instantiate)): status, output = exec_cmd(instantiate[i], 1) - if status: - print output - if FORCE == 0: - return status + if status: + print(output) + if FORCE == 0: + return status #QSFP for 1~56 port for port_number in range(1, 57): @@ -291,35 +316,35 @@ def system_ready(): def install(): if not device_found(): - print "No device, installing...." + print("No device, installing....") status = system_install() if status: if FORCE == 0: return status status, output = exec_cmd("pip3 install /usr/share/sonic/device/x86_64-quanta_ix8a_bwde-r0/sonic_platform-1.0-py3-none-any.whl",1) if status: - print output - if FORCE == 0: - return status + print(output) + if FORCE == 0: + return status else: - print " ix8a-bwde driver already installed...." + print(" ix8a-bwde driver already installed....") return def uninstall(): global FORCE #uninstall drivers for i in range(len(un_drivers) - 1, -1, -1): - status, output = exec_cmd("rmmod " + un_drivers[i], 1) + status, output = exec_cmd("rmmod " + un_drivers[i], 1) if status: - print output + print(output) if FORCE == 0: return status status, output = exec_cmd("pip3 uninstall sonic-platform -y ",1) if status: - print output - if FORCE == 0: - return status + print(output) + if FORCE == 0: + return status return diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/modules/qci_cpld_led.c b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/modules/qci_cpld_led.c index 2b0fe902c4..23f91455f6 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/modules/qci_cpld_led.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/modules/qci_cpld_led.c @@ -49,7 +49,7 @@ static struct class *cpld_class = NULL; struct cpld_data { struct i2c_client *cpld_client; - char name[8]; + char name[16]; u8 cpld_id; }; diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/modules/qci_platform_ix8c.c b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/modules/qci_platform_ix8c.c index d0ae085cd4..0dfd926a47 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/modules/qci_platform_ix8c.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/modules/qci_platform_ix8c.c @@ -171,9 +171,9 @@ static int __init ix8c_platform_init(void) } else { - g_client[0] = i2c_new_device(adapter, &ix8c_i2c_devices[0]); // pca9546 - g_client[1] = i2c_new_device(adapter, &ix8c_i2c_devices[1]); // pca9548 - g_client[2] = i2c_new_device(adapter, &ix8c_i2c_devices[16]); // CPU Linking Board at CPU's I2C Bus + g_client[0] = i2c_new_client_device(adapter, &ix8c_i2c_devices[0]); // pca9546 + g_client[1] = i2c_new_client_device(adapter, &ix8c_i2c_devices[1]); // pca9548 + g_client[2] = i2c_new_client_device(adapter, &ix8c_i2c_devices[16]); // CPU Linking Board at CPU's I2C Bus i2c_put_adapter(adapter); } @@ -184,9 +184,9 @@ static int __init ix8c_platform_init(void) } else { - g_client[3] = i2c_new_device(adapter, &ix8c_i2c_devices[10]); // CPLD_1 - g_client[4] = i2c_new_device(adapter, &ix8c_i2c_devices[17]); // CPLD_4 - g_client[5] = i2c_new_device(adapter, &ix8c_i2c_devices[18]); // CPLD_6 + g_client[3] = i2c_new_client_device(adapter, &ix8c_i2c_devices[10]); // CPLD_1 + g_client[4] = i2c_new_client_device(adapter, &ix8c_i2c_devices[17]); // CPLD_4 + g_client[5] = i2c_new_client_device(adapter, &ix8c_i2c_devices[18]); // CPLD_6 i2c_put_adapter(adapter); } @@ -197,7 +197,7 @@ static int __init ix8c_platform_init(void) } else { - g_client[6] = i2c_new_device(adapter, &ix8c_i2c_devices[11]); // CPLD_2 + g_client[6] = i2c_new_client_device(adapter, &ix8c_i2c_devices[11]); // CPLD_2 i2c_put_adapter(adapter); } @@ -208,8 +208,8 @@ static int __init ix8c_platform_init(void) } else { - g_client[7] = i2c_new_device(adapter, &ix8c_i2c_devices[12]); // CPLD_3 - g_client[8] = i2c_new_device(adapter, &ix8c_i2c_devices[2]); // MB_BOARDINFO_EEPROM + g_client[7] = i2c_new_client_device(adapter, &ix8c_i2c_devices[12]); // CPLD_3 + g_client[8] = i2c_new_client_device(adapter, &ix8c_i2c_devices[2]); // MB_BOARDINFO_EEPROM i2c_put_adapter(adapter); } @@ -220,8 +220,8 @@ static int __init ix8c_platform_init(void) } else { - g_client[9] = i2c_new_device(adapter, &ix8c_i2c_devices[13]); // MB Board Data - g_client[10] = i2c_new_device(adapter, &ix8c_i2c_devices[14]); // QSFP:49~52 + g_client[9] = i2c_new_client_device(adapter, &ix8c_i2c_devices[13]); // MB Board Data + g_client[10] = i2c_new_client_device(adapter, &ix8c_i2c_devices[14]); // QSFP:49~52 i2c_put_adapter(adapter); } @@ -232,7 +232,7 @@ static int __init ix8c_platform_init(void) } else { - g_client[11] = i2c_new_device(adapter, &ix8c_i2c_devices[3]); // pca9548_1 SFP + g_client[11] = i2c_new_client_device(adapter, &ix8c_i2c_devices[3]); // pca9548_1 SFP i2c_put_adapter(adapter); } @@ -243,7 +243,7 @@ static int __init ix8c_platform_init(void) } else { - g_client[12] = i2c_new_device(adapter, &ix8c_i2c_devices[4]); // pca9548_2 SFP + g_client[12] = i2c_new_client_device(adapter, &ix8c_i2c_devices[4]); // pca9548_2 SFP i2c_put_adapter(adapter); } @@ -254,7 +254,7 @@ static int __init ix8c_platform_init(void) } else { - g_client[13] = i2c_new_device(adapter, &ix8c_i2c_devices[5]); // pca9548_3 SFP + g_client[13] = i2c_new_client_device(adapter, &ix8c_i2c_devices[5]); // pca9548_3 SFP i2c_put_adapter(adapter); } @@ -265,7 +265,7 @@ static int __init ix8c_platform_init(void) } else { - g_client[14] = i2c_new_device(adapter, &ix8c_i2c_devices[6]); // pca9548_4 SFP + g_client[14] = i2c_new_client_device(adapter, &ix8c_i2c_devices[6]); // pca9548_4 SFP i2c_put_adapter(adapter); } @@ -276,7 +276,7 @@ static int __init ix8c_platform_init(void) } else { - g_client[15] = i2c_new_device(adapter, &ix8c_i2c_devices[7]); // pca9548_5 SFP + g_client[15] = i2c_new_client_device(adapter, &ix8c_i2c_devices[7]); // pca9548_5 SFP i2c_put_adapter(adapter); } @@ -287,7 +287,7 @@ static int __init ix8c_platform_init(void) } else { - g_client[16] = i2c_new_device(adapter, &ix8c_i2c_devices[8]); // pca9548_6 SFP + g_client[16] = i2c_new_client_device(adapter, &ix8c_i2c_devices[8]); // pca9548_6 SFP i2c_put_adapter(adapter); } @@ -298,7 +298,7 @@ static int __init ix8c_platform_init(void) } else { - g_client[17] = i2c_new_device(adapter, &ix8c_i2c_devices[9]); // pca9548_7 QSFP + g_client[17] = i2c_new_client_device(adapter, &ix8c_i2c_devices[9]); // pca9548_7 QSFP i2c_put_adapter(adapter); } @@ -311,9 +311,9 @@ static int __init ix8c_platform_init(void) else { if (i < 61) // SFP28 1~48 EEPROM - g_client_port[i - 13] = i2c_new_device(adapter, &ix8c_i2c_devices[19]); + g_client_port[i - 13] = i2c_new_client_device(adapter, &ix8c_i2c_devices[19]); else // QSFP 49~56 EEPROM - g_client_port[i - 13] = i2c_new_device(adapter, &ix8c_i2c_devices[15]); + g_client_port[i - 13] = i2c_new_client_device(adapter, &ix8c_i2c_devices[15]); i2c_put_adapter(adapter); } } diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/modules/quanta_hwmon_ipmi.c b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/modules/quanta_hwmon_ipmi.c index 157ae94778..1da44bda02 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/modules/quanta_hwmon_ipmi.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/modules/quanta_hwmon_ipmi.c @@ -28,7 +28,7 @@ #define __TO_R_EXP(bacc) (int32_t)(tos32(((BSWAP_32(bacc) & 0xf0) >> 4), 4)) #define __TO_B_EXP(bacc) (int32_t)(tos32((BSWAP_32(bacc) & 0xf), 4)) -#define SENSOR_ATTR_MAX 17 +#define SENSOR_ATTR_MAX 19 #define SENSOR_ATTR_NAME_LENGTH 20 #define SENSOR_GET_CAP_LABEL 0x001 @@ -53,6 +53,8 @@ #define SENSOR_GET_CAP_PSU_PRESENT 0x8000 #define SENSOR_GET_CAP_MFRID 0x10000 +#define SENSOR_GET_CAP_VIN_TYPE 0x20000 +#define SENSOR_GET_CAP_POUT_MAX 0x40000 #define SDR_SENSOR_TYPE_TEMP 0x01 #define SDR_SENSOR_TYPE_VOLT 0x02 @@ -84,6 +86,8 @@ #define IPMI_TIMEOUT (4 * HZ) #define IPMI_MAX_WAIT_QUEUE 1 +typedef struct ipmi_user *ipmi_user_t; + struct quanta_hwmon_ipmi_data { struct platform_device *ipmi_platform_dev; struct device *ipmi_hwmon_dev; @@ -912,6 +916,8 @@ void ipmi_sdr_set_sensor_factor(uint8_t idx, struct sdr_record_full_sensor *sens g_sensor_data[idx].capability |= SENSOR_GET_CAP_SN; g_sensor_data[idx].capability |= SENSOR_GET_CAP_MFRID; g_sensor_data[idx].capability |= SENSOR_GET_CAP_PSU_PRESENT; + g_sensor_data[idx].capability |= SENSOR_GET_CAP_VIN_TYPE; + g_sensor_data[idx].capability |= SENSOR_GET_CAP_POUT_MAX; } sprintf(g_sensor_data[idx].attrinfo.attr_type_str, "power"); } @@ -976,7 +982,7 @@ int32_t sdr_convert_sensor_reading(uint8_t idx, uint8_t val, int32_t *point_resu result = (m * (int16_t)val) * decimal_point + b; break; default: - return; + return result; } pow_convert(&result, k2); @@ -1074,6 +1080,83 @@ int32_t ipmi_get_psu_info(uint8_t idx, uint8_t cmd, uint8_t *retbuf) return sprintf(retbuf, "N/A\n"); } +int32_t ipmi_get_vin_type(uint8_t idx, uint8_t *retbuf) +{ + uint8_t psu_slot = 0; + int32_t rv = 0; + + uint8_t returnData = 0; + uint8_t msg_data[] = { 0x06, 0x52, 0x0f, 0x00, 0x01, 0xd8 }; // read line status + + if (strstr(g_sensor_data[idx].sensor_idstring, "PSU1")) psu_slot = 1; + else psu_slot = 2; + + msg_data[3] = (psu_slot == 1) ? 0xb0 : 0xb2; + if (ipmi_check_psu_present(psu_slot)) { + mutex_lock(&ipmi_lock); + rv = ipmi_send_system_cmd(msg_data, sizeof(msg_data), &returnData, 1); + mutex_unlock(&ipmi_lock); + + if (rv) { + printk("BMC down at (%d)!!\n", __LINE__); + } + else { + switch (returnData) + { + case 0x7: //LVDC + case 0x3: //HVDC + return sprintf(retbuf, "DC\n"); + default: + return sprintf(retbuf, "AC\n"); + } + } + } + else { + //printk("Error ! cannot detect PSU%d\n", psu_slot); + } + + return sprintf(retbuf, "N/A\n"); +} + +int32_t ipmi_get_pout_max(uint8_t idx, uint8_t *retbuf) +{ + uint8_t psu_slot = 0; + int32_t rv = 0, pout_max = 0; + + uint8_t returnData[2] = { 0 }, tempData[2] = { 0 }; + uint8_t msg_data[] = { 0x06, 0x52, 0x0f, 0x00, 0x02, 0xa7 }; + + if (strstr(g_sensor_data[idx].sensor_idstring, "PSU1")) psu_slot = 1; + else psu_slot = 2; + + msg_data[3] = (psu_slot == 1) ? 0xb0 : 0xb2; + if (ipmi_check_psu_present(psu_slot)) { + mutex_lock(&ipmi_lock); + rv = ipmi_send_system_cmd(msg_data, sizeof(msg_data), returnData, 1); + mutex_unlock(&ipmi_lock); + + if (rv) { + printk("BMC down at (%d)!!\n", __LINE__); + } + else { + /* MFR_POUT_MAX has 2 data format: Direct and Linear Data (see PMbus spec). + Query command is needed to tell the data format, but since we have not use PSU + whose output power is over 0x07ff (2047), just check the first 5 bits*/ + if (returnData[1] & 0xf8 == 0) // Direct + pout_max = (returnData[1] << 8) | returnData[0]; + else // Linear Data + pout_max = (((returnData[1] & 0x07) << 8) | returnData[0]) << ((returnData[1] & 0xf8) >> 3); + return sprintf(retbuf, "%d\n", pout_max); + } + } + else { + //printk("Error ! cannot detect PSU%d\n", psu_slot); + } + + return sprintf(retbuf, "N/A\n"); +} + + void ipmi_fan_control(uint8_t cmd_data1, uint8_t cmd_data2, uint8_t *retbuf) { int32_t rv = 0; @@ -1183,6 +1266,18 @@ static ssize_t show_mfrid(struct device *dev, struct device_attribute *devattr, return ipmi_get_psu_info(attr->index + DEBUGUSE_SHIFT, 0x99, buf); } +static ssize_t show_vin_type(struct device *dev, struct device_attribute *devattr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + return ipmi_get_vin_type(attr->index + DEBUGUSE_SHIFT, buf); +} + +static ssize_t show_pout_max(struct device *dev, struct device_attribute *devattr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + return ipmi_get_pout_max(attr->index + DEBUGUSE_SHIFT, buf); +} + static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, char *buf) { uint8_t returnData[10] = { 0 }; @@ -1277,7 +1372,8 @@ static ssize_t(*const attr_show_func_ptr[SENSOR_ATTR_MAX]) (struct device *dev, , show_unc, show_ucr, show_unr , show_model, show_sn, show_pwm , show_controlmode, show_direction, show_fanpresent - , show_psupresent, show_mfrid + , show_psupresent, show_mfrid, show_vin_type + , show_pout_max }; static ssize_t(*const attr_store_func_ptr[SENSOR_ATTR_MAX]) (struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) = @@ -1287,7 +1383,8 @@ static ssize_t(*const attr_store_func_ptr[SENSOR_ATTR_MAX]) (struct device *dev, , NULL, NULL, NULL , NULL, NULL, store_pwm , store_controlmode, NULL, NULL - , NULL, NULL + , NULL, NULL, NULL + , NULL }; static const char *const sensor_attrnames[SENSOR_ATTR_MAX] = @@ -1297,7 +1394,8 @@ static const char *const sensor_attrnames[SENSOR_ATTR_MAX] = , "%s%d_ncrit", "%s%d_crit", "%s%d_max" , "%s%d_model", "%s%d_sn", "%s%d_pwm" , "%s%d_controlmode", "%s%d_direction", "%s%d_present" - , "%s%d_present", "%s%d_mfrid" + , "%s%d_present", "%s%d_mfrid", "%s%d_vin_type" + , "%s%d_pout_max" }; static int32_t create_sensor_attrs(int32_t attr_no) @@ -1516,7 +1614,7 @@ static int32_t __init quanta_hwmon_ipmi_init(void) goto device_reg_err; } - data->ipmi_hwmon_dev = hwmon_device_register_with_groups(NULL, DRVNAME, NULL, NULL); + data->ipmi_hwmon_dev = hwmon_device_register_with_groups(&data->ipmi_platform_dev->dev, DRVNAME, NULL, NULL); err = IS_ERR(data->ipmi_hwmon_dev); if (err) { printk("hwmon register fail\n"); @@ -1539,19 +1637,15 @@ static int32_t __init quanta_hwmon_ipmi_init(void) return 0; init_sensor_err: - if (g_sensor_data) { - kfree(g_sensor_data); - g_sensor_data = NULL; - } + kfree(g_sensor_data); + g_sensor_data = NULL; ipmi_create_err: hwmon_device_unregister(data->ipmi_hwmon_dev); hwmon_register_err: platform_device_unregister(data->ipmi_platform_dev); device_reg_err: - if (data) { - kfree(data); - data = NULL; - } + kfree(data); + data = NULL; alloc_err: return err; } @@ -1567,15 +1661,10 @@ static void __exit quanta_hwmon_ipmi_exit(void) platform_device_unregister(data->ipmi_platform_dev); - if (g_sensor_data) { - kfree(g_sensor_data); - g_sensor_data = NULL; - } - - if (data) { - kfree(data); - data = NULL; - } + kfree(g_sensor_data); + g_sensor_data = NULL; + kfree(data); + data = NULL; } module_init(quanta_hwmon_ipmi_init); diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/chassis.py index 544a3ee27c..7cb5c4c1e6 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/chassis.py @@ -8,6 +8,7 @@ try: import sys import time + import syslog from sonic_platform_base.chassis_base import ChassisBase from sonic_platform.eeprom import Eeprom from sonic_platform.psu import Psu @@ -71,6 +72,13 @@ class Chassis(ChassisBase): for index in range(1, self.__num_of_ports + 1): self.__xcvr_presence[index] = self._sfp_list[index-1].get_presence() + # Initialize components + from sonic_platform.component import ComponentBIOS, ComponentBMC, ComponentCPLD, ComponentPCIE + self._component_list.append(ComponentBIOS()) + self._component_list.append(ComponentBMC()) + self._component_list.extend(ComponentCPLD.get_component_list()) + self._component_list.append(ComponentPCIE()) + ############################################## # Device methods ############################################## @@ -78,7 +86,7 @@ class Chassis(ChassisBase): def get_sfp(self, index): """ Retrieves sfp represented by (1-based) index - For Quanta IX8C the index in sfputil.py starts from 1, so override + For Quanta the index in sfputil.py starts from 1, so override Args: index: An integer, the index (1-based) of the sfp to retrieve. @@ -188,13 +196,34 @@ class Chassis(ChassisBase): is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used to pass a description of the reboot cause. """ - #raise NotImplementedError return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Invalid Reason") + ############################################## + # Other methods + ############################################## + def get_watchdog(self): + """ + Retreives hardware watchdog device on this chassis + + Returns: + An object derived from WatchdogBase representing the hardware + watchdog device + """ + try: + if self._watchdog is None: + from sonic_platform.watchdog import Watchdog + # Create the watchdog Instance + self._watchdog = Watchdog() + + except Exception as e: + syslog.syslog(syslog.LOG_ERR, "Fail to load watchdog due to {}".format(e)) + return self._watchdog + def get_change_event(self, timeout=0): """ Currently only support transceiver change events """ + start_ms = time.time() * 1000 xcvr_change_event_dict = {} event = False @@ -205,10 +234,10 @@ class Chassis(ChassisBase): cur_xcvr_presence = self._sfp_list[index-1].get_presence() if cur_xcvr_presence != self.__xcvr_presence[index]: if cur_xcvr_presence is True: - xcvr_change_event_dict[str(index)] = '1' + xcvr_change_event_dict[index] = '1' self.__xcvr_presence[index] = True elif cur_xcvr_presence is False: - xcvr_change_event_dict[str(index)] = '0' + xcvr_change_event_dict[index] = '0' self.__xcvr_presence[index] = False event = True diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/component.py new file mode 100644 index 0000000000..75066275d2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/component.py @@ -0,0 +1,204 @@ +#!/usr/bin/env python + +######################################################################## +# Quanta IX8C +# +# Name: component.py, version: 1.3 +# Module contains an implementation of SONiC Platform Base API and +# provides the Components' (e.g., BIOS, CPLD, FPGA, etc.) available in +# the platform +# +######################################################################## + +try: + import subprocess + from sonic_platform_base.component_base import ComponentBase + from collections import namedtuple +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Component(ComponentBase): + def __init__(self): + ComponentBase.__init__(self) + self.name = None + self.description = None + + def get_name(self): + return self.name + + def get_description(self): + return self.description + + def install_firmware(self, image_path): + """ + Installs firmware to the component + + Args: + image_path: A string, path to firmware image + + Returns: + A boolean, True if install was successful, False if not + """ + return False + + @staticmethod + def _get_command_result(cmdline): + try: + proc = subprocess.Popen(cmdline, + stdout=subprocess.PIPE, + shell=True, stderr=subprocess.STDOUT, + universal_newlines=True) + stdout = proc.communicate()[0] + rc = proc.wait() + result = stdout.rstrip('\n') + if rc != 0: + raise RuntimeError("Failed to execute command {}, return code {}, {}".format(cmdline, rc, stdout)) + + except OSError as e: + raise RuntimeError("Failed to execute command {} due to {}".format(cmdline, repr(e))) + + return result + + +class ComponentBIOS(Component): + COMPONENT_NAME = 'BIOS' + COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' + + BIOS_QUERY_VERSION_COMMAND = "dmidecode -s bios-version" + + def __init__(self): + super(ComponentBIOS, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + bios_ver = self._get_command_result(self.BIOS_QUERY_VERSION_COMMAND) + if not bios_ver: + return 'ERR' + else: + return bios_ver + + +class ComponentBMC(Component): + COMPONENT_NAME = 'BMC' + COMPONENT_DESCRIPTION = 'BMC - Board Management Controller' + BMC_QUERY_VERSION_COMMAND = "ipmitool mc info | grep 'Firmware Revision'" + + def __init__(self): + super(ComponentBMC, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + bmc_ver = self._get_command_result(self.BMC_QUERY_VERSION_COMMAND) + if not bmc_ver: + return 'ERR' + else: + bmc_ver = bmc_ver.split(": ")[1] + return bmc_ver.strip() + + +class ComponentCPLD(Component): + Cpld = namedtuple("Cpld", ['name', 'cmd_index', 'description']) + + cplds = { + 1: Cpld("BOOT_CPLD", 1, "Power sequence"), + 2: Cpld("FAN_CPLD", 2, "Fan"), + 3: Cpld("MB_CPLD_IO_1", 7, "Port IO-1"), + 4: Cpld("MB_CPLD_IO_2", 5, "Port IO-2"), + 5: Cpld("MB_CPLD_IO_3", 4, "Port IO-3"), + 6: Cpld("MB_CPLD_LED_1", 6, "Port LED-1"), + 7: Cpld("MB_CPLD_LED_2", 3, "Port LED-2"), + } + + def __init__(self, component_index): + super(ComponentCPLD, self).__init__() + self.index = component_index + + def get_name(self): + """ + Retrieves the name of the component + + Returns: + A string containing the name of the component + """ + self.name = self.cplds[self.index].name + + return self.name + + def get_description(self): + """ + Retrieves the description of the component + + Returns: + A string containing the description of the component + """ + self.description = self.cplds[self.index].description + + return self.description + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x01") + res = self._get_command_result("ipmitool raw 0x32 0xff 0x02 {}".format(self.cplds[self.index].cmd_index)) + self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x00") + if not res: + return 'ERR' + else: + return res.split()[3].upper() + res.split()[2].upper() + res.split()[1].upper() + res.split()[0].upper() + + @classmethod + def get_component_list(cls): + component_list = [] + cpld_number = len(cls.cplds) + + for cpld_idx in range(1, cpld_number + 1): + component_list.append(cls(cpld_idx)) + + return component_list + + +class ComponentPCIE(Component): + COMPONENT_NAME = 'PCIe' + COMPONENT_DESCRIPTION = 'ASIC PCIe Firmware' + PCIE_QUERY_VERSION_COMMAND = "bcmcmd 'pciephy fw version' | grep 'FW version'" + + def __init__(self): + super(ComponentPCIE, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + version = self._get_command_result(self.PCIE_QUERY_VERSION_COMMAND) + if not version: + return 'ERR' + else: + version = version.split(": ")[1] + return version.strip() diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/fan.py index ed3a836ba1..94a9b74df8 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/fan.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# Inventec d7264 +# Quanta IX8C # # Module contains an implementation of SONiC Platform Base API and # provides the FAN information @@ -11,6 +11,7 @@ try: import logging import os + import glob from sonic_platform_base.fan_base import FanBase except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -19,9 +20,7 @@ except ImportError as e: ############### # Global ############### -HWMON_DIR = "/sys/class/hwmon/hwmon2/" -FAN_INDEX_START = 20 -NUM_FANTRAYS = 6 +HWMON_IPMI_DIR = "/sys/devices/platform/quanta_hwmon_ipmi/hwmon/hwmon*/" FANS_PERTRAY = 2 class Fan(FanBase): @@ -30,30 +29,46 @@ class Fan(FanBase): def __init__(self, index, is_psu_fan=False): self.is_psu_fan = is_psu_fan self.fan_index = index - self.psu_fan_index_mapping = { - 1:39, - 2:49, - } - self.psu_index_mapping = { - 1:41, - 2:51, - } + hwmon_dir=glob.glob(HWMON_IPMI_DIR)[0] + if self.is_psu_fan: - self.fan_presence_attr = "power{}_present".format(self.psu_index_mapping[index]) - self.fan_pwm_attr = "fan{}_pwm".format(self.psu_fan_index_mapping[index]) - self.fan_rpm_attr = "fan{}_input".format(self.psu_fan_index_mapping[index]) - self.fan_direction_attr = "fan{}_direction".format(self.psu_fan_index_mapping[index]) + power_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_POWER_OUT".format(self.fan_index), 'power') + fan_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_Fan".format(self.fan_index), 'fan') + self.fan_presence_attr = power_out_prefix + 'present' + self.fan_pwm_attr = fan_prefix + 'pwm' + self.fan_rpm_attr = fan_prefix + 'input' + self.fan_direction_attr = fan_prefix + 'direction' else: - self.fan_presence_attr = "fan{}_present".format(FAN_INDEX_START+(index-1)) - self.fan_pwm_attr = "fan{}_pwm".format(FAN_INDEX_START+(index-1)) - self.fan_rpm_attr = "fan{}_input".format(FAN_INDEX_START+(index-1)) - self.fan_direction_attr = "fan{}_direction".format(FAN_INDEX_START+(index-1)) + fantray_index = (self.fan_index-1)//FANS_PERTRAY+1 + fan_index_intray = self.fan_index - ((fantray_index-1)*FANS_PERTRAY) + fan_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "Fan_SYS_{}_{}".format(fantray_index, fan_index_intray), 'fan') + self.fan_presence_attr = fan_prefix + 'present' + self.fan_pwm_attr = fan_prefix + 'pwm' + self.fan_rpm_attr = fan_prefix + 'input' + self.fan_direction_attr = fan_prefix + 'direction' ####################### # private function ####################### + def __get_hwmon_attr_prefix(self, dir, label, type): + + retval = 'ERR' + if not os.path.isdir(dir): + return retval + + try: + for filename in os.listdir(dir): + if filename[-5:] == 'label' and type in filename: + file_path = os.path.join(dir, filename) + if os.path.isfile(file_path) and label == self.__get_attr_value(file_path): + return file_path[0:-5] + except Exception as error: + logging.error("Error when getting {} label path: {}".format(label, error)) + + return retval + def __get_attr_value(self, attr_path): retval = 'ERR' @@ -64,7 +79,7 @@ class Fan(FanBase): with open(attr_path, 'r') as fd: retval = fd.read() except Exception as error: - logging.error("Unable to open " + attr_path + " file !") + logging.error("Unable to open {} file: {}".format(attr_path, error)) retval = retval.rstrip(' \t\n\r') return retval @@ -84,7 +99,7 @@ class Fan(FanBase): if self.is_psu_fan: return "PSU-{}_FAN".format(self.fan_index) else: - fantray_index = (self.fan_index-1)/FANS_PERTRAY+1 + fantray_index = (self.fan_index-1)//FANS_PERTRAY+1 fan_index_intray = self.fan_index - ((fantray_index-1)*FANS_PERTRAY) return "Fantray{}_{}".format(fantray_index, fan_index_intray) @@ -95,8 +110,7 @@ class Fan(FanBase): Returns: bool: True if device is present, False if not """ - attr_path = HWMON_DIR + self.fan_presence_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_presence_attr) if (attr_rv != 'ERR'): if (attr_rv == '1'): return True @@ -113,8 +127,7 @@ class Fan(FanBase): A boolean value, True if device is operating properly, False if not """ if self.get_presence(): - attr_path = HWMON_DIR + self.fan_rpm_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_rpm_attr) if (attr_rv != 'ERR' and attr_rv != '0.0'): return True @@ -135,8 +148,7 @@ class Fan(FanBase): A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST depending on fan direction """ - attr_path = HWMON_DIR + self.fan_direction_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_direction_attr) if attr_rv == '2': return self.FAN_DIRECTION_INTAKE @@ -152,8 +164,7 @@ class Fan(FanBase): to 100 (full speed) """ if self.get_presence(): - attr_path = HWMON_DIR + self.fan_pwm_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_pwm_attr) if (attr_rv != 'ERR'): return int(float(attr_rv)) @@ -169,8 +180,7 @@ class Fan(FanBase): Returns: An integer, speed of the fan in RPM """ - attr_path = HWMON_DIR + self.fan_rpm_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_rpm_attr) if (attr_rv != 'ERR'): return int(float(attr_rv)) @@ -185,8 +195,7 @@ class Fan(FanBase): An integer, the percentage of full fan speed, in the range 0 (off) to 100 (full speed) """ - attr_path = HWMON_DIR + self.fan_pwm_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_pwm_attr) if (attr_rv != 'ERR'): return int(float(attr_rv)) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/fan_drawer.py index 75e954576a..3d5f767477 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/fan_drawer.py @@ -28,7 +28,7 @@ class FanDrawer(FanDrawerBase): Returns: string: The name of the device """ - return 'Fan {}'.format(self._index) + return 'Fantray{}'.format(self._index) def get_presence(self): """ diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/psu.py index 941d8faef4..6188c95c76 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/psu.py @@ -8,44 +8,61 @@ try: import logging import os + import glob from sonic_platform_base.psu_base import PsuBase from sonic_platform.fan import Fan except ImportError as e: raise ImportError(str(e) + "- required module not found") -HWMON_DIR = "/sys/class/hwmon/hwmon2/" +HWMON_IPMI_DIR = "/sys/devices/platform/quanta_hwmon_ipmi/hwmon/hwmon*/" class Psu(PsuBase): def __init__(self, index): PsuBase.__init__(self) fan = Fan(index, True) self._fan_list.append(fan) + self.index = index + hwmon_dir=glob.glob(HWMON_IPMI_DIR)[0] - self.psu_index_mapping = { - 1:41, - 2:51, - } - self.psu_powerin_index_mapping = { - 1:40, - 2:50, - } - self.psu_current_index_mapping = { - 1:38, - 2:48, - } - self.psu_voltageout_index_mapping = { - 1:46, - 2:56, - } - self.index = index - self.psu_presence_attr = "power{}_present".format(self.psu_index_mapping[self.index]) - self.psu_status_attr = "curr{}_input".format(self.psu_current_index_mapping[self.index]) - self.psu_power_in_attr = "power{}_input".format(self.psu_powerin_index_mapping[self.index]) - self.psu_power_out_attr = "power{}_input".format(self.psu_index_mapping[self.index]) - self.psu_voltage_out_attr = "in{}_input".format(self.psu_voltageout_index_mapping[self.index]) - self.psu_current_out_attr = "curr{}_input".format(self.psu_current_index_mapping[self.index]) - self.psu_serial_attr = "power{}_sn".format(self.psu_index_mapping[self.index]) - self.psu_model_attr = "power{}_model".format(self.psu_index_mapping[self.index]) + current_in_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_CURRENT_IN".format(self.index), 'curr') + current_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_CURRENT_OUT".format(self.index), 'curr') + power_in_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_POWER_IN".format(self.index), 'power') + power_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_POWER_OUT".format(self.index), 'power') + voltage_in_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_VOLTAGE_IN".format(self.index), 'in') + voltage_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_VOLTAGE_OUT".format(self.index), 'in') + temp1_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_TEMP1".format(self.index), 'temp') + + self.psu_current_in_attr = current_in_prefix + 'input' + self.psu_current_out_attr = current_out_prefix + 'input' + self.psu_power_in_attr = power_in_prefix + 'input' + self.psu_power_out_attr = power_out_prefix + 'input' + self.psu_voltage_in_attr = voltage_in_prefix + 'input' + self.psu_voltage_out_attr = voltage_out_prefix + 'input' + self.psu_status_attr = current_out_prefix + 'input' + self.psu_presence_attr = power_out_prefix + 'present' + self.psu_serial_attr = power_out_prefix + 'sn' + self.psu_model_attr = power_out_prefix + 'model' + self.psu_mfr_id_attr = power_out_prefix + 'mfrid' + self.psu_capacity_attr = power_out_prefix + 'pout_max' + self.psu_type_attr = power_out_prefix + 'vin_type' + self.psu_temp_attr = temp1_prefix + 'input' + + def __get_hwmon_attr_prefix(self, dir, label, type): + + retval = 'ERR' + if not os.path.isdir(dir): + return retval + + try: + for filename in os.listdir(dir): + if filename[-5:] == 'label' and type in filename: + file_path = os.path.join(dir, filename) + if os.path.isfile(file_path) and label == self.__get_attr_value(file_path): + return file_path[0:-5] + except Exception as error: + logging.error("Error when getting {} label path: {}".format(label, error)) + + return retval def __get_attr_value(self, attr_path): @@ -57,10 +74,9 @@ class Psu(PsuBase): with open(attr_path, 'r') as fd: retval = fd.read() except Exception as error: - logging.error("Unable to open " + attr_path + " file !") + logging.error("Unable to open {} file: {}".format(attr_path, error)) retval = retval.rstrip(' \t\n\r') - fd.close() return retval ############################################## @@ -84,10 +100,9 @@ class Psu(PsuBase): bool: True if device is present, False if not """ presence = False - attr_path = HWMON_DIR+self.psu_presence_attr attr_normal = '1' - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_presence_attr) if (attr_rv != 'ERR'): if (attr_rv == attr_normal): presence = True @@ -102,13 +117,26 @@ class Psu(PsuBase): string: Model/part number of device """ model = "N/A" - attr_path = HWMON_DIR+self.psu_model_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_model_attr) if (attr_rv != 'ERR'): model = attr_rv return model + def get_mfr_id(self): + """ + Retrieves the manufacturer's name (or id) of the device + + Returns: + string: Manufacturer's id of device + """ + mfr_id = "N/A" + attr_rv = self.__get_attr_value(self.psu_mfr_id_attr) + if (attr_rv != 'ERR'): + mfr_id = attr_rv + + return mfr_id + def get_serial(self): """ Retrieves the serial number of the device @@ -117,9 +145,7 @@ class Psu(PsuBase): string: Serial number of device """ serial = "N/A" - attr_path = HWMON_DIR+self.psu_serial_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_serial_attr) if (attr_rv != 'ERR'): serial = attr_rv @@ -133,9 +159,7 @@ class Psu(PsuBase): A boolean value, True if device is operating properly, False if not """ status = False - attr_path = HWMON_DIR+self.psu_status_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_status_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) if (int(attr_rv) != 0): @@ -156,9 +180,7 @@ class Psu(PsuBase): e.g. 12.1 """ voltage_out = 0.0 - attr_path = HWMON_DIR+self.psu_voltage_out_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_voltage_out_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) voltage_out = float(attr_rv) / 1000 @@ -173,15 +195,44 @@ class Psu(PsuBase): A float number, the electric current in amperes, e.g 15.4 """ current_out = 0.0 - attr_path = HWMON_DIR+self.psu_current_out_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_current_out_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) current_out = float(attr_rv) / 1000 return current_out + def get_input_voltage(self): + """ + Retrieves current PSU voltage input + + Returns: + A float number, the input voltage in volts, + e.g. 12.1 + """ + voltage_in = 0.0 + attr_rv = self.__get_attr_value(self.psu_voltage_in_attr) + if (attr_rv != 'ERR'): + attr_rv, dummy = attr_rv.split('.', 1) + voltage_in = float(attr_rv) / 1000 + + return voltage_in + + def get_input_current(self): + """ + Retrieves present electric current supplied by PSU + + Returns: + A float number, the electric current in amperes, e.g 15.4 + """ + current_in = 0.0 + attr_rv = self.__get_attr_value(self.psu_current_in_attr) + if (attr_rv != 'ERR'): + attr_rv, dummy = attr_rv.split('.', 1) + current_in = float(attr_rv) / 1000 + + return current_in + def get_power(self): """ Retrieves current energy supplied by PSU @@ -190,9 +241,7 @@ class Psu(PsuBase): A float number, the power in watts, e.g. 302.6 """ power_out = 0.0 - attr_path = HWMON_DIR+self.psu_power_out_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_power_out_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) power_out = float(attr_rv) / 1000 @@ -221,3 +270,50 @@ class Psu(PsuBase): else: return self.STATUS_LED_COLOR_OFF + def get_type(self): + """ + Gets the type of the PSU + + Returns: + A string, the type of PSU (AC/DC) + """ + type = "AC" + attr_rv = self.__get_attr_value(self.psu_type_attr) + if (attr_rv != 'ERR'): + type = attr_rv + + return type + + def get_capacity(self): + """ + Gets the capacity (maximum output power) of the PSU in watts + + Returns: + An integer, the capacity of PSU + """ + capacity = 0 + attr_rv = self.__get_attr_value(self.psu_capacity_attr) + if (attr_rv != 'ERR'): + try: + capacity = int(attr_rv) + except ValueError: + capacity = 0 + + return capacity + + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + + tout = 0.0 + attr_rv = self.__get_attr_value(self.psu_temp_attr) + if (attr_rv != 'ERR'): + tout = float(attr_rv) + + # tout is in milli degree celcius + return float(tout/1000.0) + diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/sfp.py index e7d0146b55..305d78aba4 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/sfp.py @@ -10,13 +10,10 @@ import os import time -#import subprocess -#import sonic_device_util from ctypes import create_string_buffer try: from sonic_platform_base.sfp_base import SfpBase -# from sonic_platform_base.sonic_eeprom import eeprom_dts from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId @@ -175,7 +172,6 @@ class Sfp(SfpBase): # Init index self.index = sfp_index self.port_num = self.index - #self.dom_supported = False self.sfp_type = sfp_type # Init eeprom path eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom' @@ -284,15 +280,6 @@ class Sfp(SfpBase): else: return 'N/A' - def __read_txt_file(self, file_path): - try: - with open(file_path, 'r') as fd: - data = fd.read() - return data.strip() - except IOError: - pass - return "" - def __is_host(self): return os.system(self.HOST_CHK_CMD) == 0 @@ -355,26 +342,6 @@ class Sfp(SfpBase): return eeprom_raw - def __convert_string_to_num(self, value_str): - if "-inf" in value_str: - return 'N/A' - elif "Unknown" in value_str: - return 'N/A' - elif 'dBm' in value_str: - t_str = value_str.rstrip('dBm') - return float(t_str) - elif 'mA' in value_str: - t_str = value_str.rstrip('mA') - return float(t_str) - elif 'C' in value_str: - t_str = value_str.rstrip('C') - return float(t_str) - elif 'Volts' in value_str: - t_str = value_str.rstrip('Volts') - return float(t_str) - else: - return 'N/A' - def _dom_capability_detect(self): if not self.get_presence(): self.dom_supported = False @@ -533,9 +500,7 @@ class Sfp(SfpBase): else: if not self.get_presence(): return transceiver_info_dict - elif i == max_retry-1: - pass - else: + elif i < max_retry-1: time.sleep(0.5) if sfp_interface_bulk_raw is None: @@ -590,7 +555,8 @@ class Sfp(SfpBase): ['data']['Extended Identifier']['value'] transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data \ ['data']['RateIdentifier']['value'] - transceiver_info_dict['type_abbrv_name'] = 'N/A' + transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data \ + ['data']['type_abbrv_name']['value'] if self.sfp_type == QSFP_TYPE: for key in qsfp_cable_length_tup: if key in sfp_interface_bulk_data['data']: @@ -860,7 +826,7 @@ class Sfp(SfpBase): transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['TxBiasLowWarning']['value'] for key in transceiver_dom_threshold_dict: - transceiver_dom_threshold_dict[key] = self.__convert_string_to_num(transceiver_dom_threshold_dict[key]) + transceiver_dom_threshold_dict[key] = self._convert_string_to_num(transceiver_dom_threshold_dict[key]) return transceiver_dom_threshold_dict @@ -908,7 +874,7 @@ class Sfp(SfpBase): transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] for key in transceiver_dom_threshold_info_dict: - transceiver_dom_threshold_info_dict[key] = self.__convert_string_to_num(transceiver_dom_threshold_info_dict[key]) + transceiver_dom_threshold_info_dict[key] = self._convert_string_to_num(transceiver_dom_threshold_info_dict[key]) return transceiver_dom_threshold_info_dict @@ -1453,7 +1419,7 @@ class Sfp(SfpBase): sysfsfile_eeprom = open( sysfs_sfp_i2c_client_eeprom_path, mode="r+b", buffering=0) buffer = create_string_buffer(1) - buffer[0] = chr(tx_disable_ctl) + buffer[0] = tx_disable_ctl # Write to eeprom sysfsfile_eeprom.seek(offset + SFP_STATUS_CONTROL_OFFSET) sysfsfile_eeprom.write(buffer[0]) @@ -1506,7 +1472,7 @@ class Sfp(SfpBase): else: tx_disable_ctl = channel_state & (~channel) buffer = create_string_buffer(1) - buffer[0] = chr(tx_disable_ctl) + buffer[0] = tx_disable_ctl # Write to eeprom sysfsfile_eeprom = open( self.port_to_eeprom_mapping[self.port_num], "r+b") @@ -1594,7 +1560,7 @@ class Sfp(SfpBase): power_set_bit |= 1 << 1 buffer = create_string_buffer(1) - buffer[0] = chr(power_override_bit | power_set_bit) + buffer[0] = power_override_bit | power_set_bit # Write to eeprom sysfsfile_eeprom = open(self.port_to_eeprom_mapping[self.port_num], "r+b") sysfsfile_eeprom.seek(QSFP_POWEROVERRIDE_OFFSET) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/thermal.py index f30bdc8d71..11be0f93ac 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/thermal.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# Inventec d7264 +# Quanta IX8C # # Module contains an implementation of SONiC Platform Base API and # provides the Thermal information @@ -10,44 +10,68 @@ import logging import os +import glob try: from sonic_platform_base.thermal_base import ThermalBase except ImportError as e: raise ImportError(str(e) + "- required module not found") -HWMON_DIR = "/sys/class/hwmon/hwmon2/" +HWMON_IPMI_DIR = "/sys/devices/platform/quanta_hwmon_ipmi/hwmon/hwmon*/" thermal_index_mapping = { - 1:1, - 2:2, - 3:42, - 4:43, - 5:44, - 6:52, - 7:53, - 8:54, - 9:75, - 10:76, - 11:77, - 12:78, - 13:79, - 14:80, - 15:81, - 16:82, - 17:83, - 18:84, + 1:'PSU1_TEMP1', + 2:'PSU1_TEMP2', + 3:'PSU1_TEMP3', + 4:'PSU2_TEMP1', + 5:'PSU2_TEMP2', + 6:'PSU2_TEMP3', + 7:'Temp_1V05_PCH_VR', + 8:'Temp_Ambient_1', + 9:'Temp_Ambient_2', + 10:'Temp_Ambient_3', + 11:'Temp_Ambient_4', + 12:'Temp_Ambient_6', + 13:'Temp_DDRAB_VR', + 14:'Temp_SOC_DIMMA0', + 15:'Temp_VCCGBE_VR', + 16:'Temp_VCCIN_VR', + 17:'Temp_cpu', + 18:'Temp_switch' } + + class Thermal(ThermalBase): """Platform-specific Thermal class""" def __init__(self, thermal_index): - self.index = thermal_index - self.temp_attr = "temp{}_input".format(thermal_index_mapping[self.index]) - self.high_th_attr = "temp{}_crit".format(thermal_index_mapping[self.index]) - self.name_attr = "temp{}_label".format(thermal_index_mapping[self.index]) + self.index = thermal_index + hwmon_dir=glob.glob(HWMON_IPMI_DIR)[0] + thermal_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, thermal_index_mapping[self.index], 'temp') + self.temp_attr = "{}input".format(thermal_prefix) + self.high_th_attr = "{}ncrit".format(thermal_prefix) + self.high_crit_th_attr = "{}crit".format(thermal_prefix) + self.low_th_attr = "{}lncrit".format(thermal_prefix) + self.low_crit_th_attr = "{}lcrit".format(thermal_prefix) + self.name_attr = "{}label".format(thermal_prefix) + def __get_hwmon_attr_prefix(self, dir, label, type): + + retval = 'ERR' + if not os.path.isdir(dir): + return retval + + try: + for filename in os.listdir(dir): + if filename[-5:] == 'label' and type in filename: + file_path = os.path.join(dir, filename) + if os.path.isfile(file_path) and label == self.__get_attr_value(file_path): + return file_path[0:-5] + except Exception as error: + logging.error("Error when getting {} label path: {}".format(label, error)) + + return retval def __get_attr_value(self, attr_path): @@ -59,7 +83,7 @@ class Thermal(ThermalBase): with open(attr_path, 'r') as fd: retval = fd.read() except Exception as error: - logging.error("Unable to open ", attr_path, " file !") + logging.error("Unable to open {} file: {}".format(attr_path, error)) retval = retval.rstrip(' \t\n\r') return retval @@ -71,8 +95,7 @@ class Thermal(ThermalBase): Returns: string: The name of the device """ - attr_path = HWMON_DIR + self.name_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.name_attr) if (attr_rv != 'ERR'): return attr_rv @@ -86,8 +109,7 @@ class Thermal(ThermalBase): Returns: bool: True if device is present, False if not """ - attr_path = HWMON_DIR + self.name_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.name_attr) if (attr_rv != 'ERR'): return True @@ -114,8 +136,37 @@ class Thermal(ThermalBase): A float number of current temperature in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - attr_path = HWMON_DIR + self.temp_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.temp_attr) + + if (attr_rv != 'ERR'): + return float(attr_rv) / 1000 + else: + return None + + def get_low_threshold(self): + """ + Retrieves the low threshold temperature of thermal + + Returns: + A float number, the low threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + attr_rv = self.__get_attr_value(self.low_th_attr) + + if (attr_rv != 'ERR'): + return float(attr_rv) / 1000 + else: + return None + + def get_low_critical_threshold(self): + """ + Retrieves the low critical threshold temperature of thermal + + Returns: + A float number, the low critical threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + attr_rv = self.__get_attr_value(self.low_crit_th_attr) if (attr_rv != 'ERR'): return float(attr_rv) / 1000 @@ -130,8 +181,22 @@ class Thermal(ThermalBase): A float number, the high threshold temperature of thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - attr_path = HWMON_DIR + self.high_th_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.high_th_attr) + + if (attr_rv != 'ERR'): + return float(attr_rv) / 1000 + else: + return None + + def get_high_critical_threshold(self): + """ + Retrieves the high threshold temperature of thermal + + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + attr_rv = self.__get_attr_value(self.high_crit_th_attr) if (attr_rv != 'ERR'): return float(attr_rv) / 1000 diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/watchdog.py new file mode 100644 index 0000000000..0e63d9368c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/watchdog.py @@ -0,0 +1,241 @@ +#!/usr/bin/env python + +############################################################################# +# +# Watchdog contains an implementation of SONiC Platform Base Watchdog API +# +############################################################################# +import fcntl +import os +import array + +try: + from sonic_platform_base.watchdog_base import WatchdogBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +""" ioctl constants """ +IO_WRITE = 0x40000000 +IO_READ = 0x80000000 +IO_READ_WRITE = 0xC0000000 +IO_SIZE_INT = 0x00040000 +IO_SIZE_40 = 0x00280000 +IO_TYPE_WATCHDOG = ord('W') << 8 + +WDR_INT = IO_READ | IO_SIZE_INT | IO_TYPE_WATCHDOG +WDR_40 = IO_READ | IO_SIZE_40 | IO_TYPE_WATCHDOG +WDWR_INT = IO_READ_WRITE | IO_SIZE_INT | IO_TYPE_WATCHDOG + +""" Watchdog ioctl commands """ +WDIOC_GETSUPPORT = 0 | WDR_40 +WDIOC_GETSTATUS = 1 | WDR_INT +WDIOC_GETBOOTSTATUS = 2 | WDR_INT +WDIOC_GETTEMP = 3 | WDR_INT +WDIOC_SETOPTIONS = 4 | WDR_INT +WDIOC_KEEPALIVE = 5 | WDR_INT +WDIOC_SETTIMEOUT = 6 | WDWR_INT +WDIOC_GETTIMEOUT = 7 | WDR_INT +WDIOC_SETPRETIMEOUT = 8 | WDWR_INT +WDIOC_GETPRETIMEOUT = 9 | WDR_INT +WDIOC_GETTIMELEFT = 10 | WDR_INT + +""" Watchdog status constants """ +WDIOS_DISABLECARD = 0x0001 +WDIOS_ENABLECARD = 0x0002 + +WDT_COMMON_ERROR = -1 +WD_MAIN_IDENTITY = "iTCO_wdt" +WDT_SYSFS_PATH = "/sys/class/watchdog/" + +DEFAULT_TIMEOUT=180 +watchdog=0 + +class Watchdog(WatchdogBase): + + def __init__(self): + + self.watchdog, self.wdt_main_dev_name = self._get_wdt() + if self.wdt_main_dev_name is None: + raise Exception("Watchdog device is not instantiated") + + self.status_path = "/sys/class/watchdog/%s/status" % self.wdt_main_dev_name + self.state_path = "/sys/class/watchdog/%s/state" % self.wdt_main_dev_name + self.timeout_path = "/sys/class/watchdog/%s/timeout" % self.wdt_main_dev_name + # Set default value + self._disable() + self.armed = False + self.timeout = DEFAULT_TIMEOUT + + def _is_wd_main(self, dev): + """ + Checks watchdog identity + """ + identity = self._read_file( + "{}/{}/identity".format(WDT_SYSFS_PATH, dev)) + return identity == WD_MAIN_IDENTITY + + def _get_wdt(self): + """ + Retrieves watchdog device + """ + global watchdog + wdt_main_dev_list = [dev for dev in os.listdir( + "/dev/") if dev.startswith("watchdog") and self._is_wd_main(dev)] + if not wdt_main_dev_list: + return (None, None) + wdt_main_dev_name = wdt_main_dev_list[0] + watchdog_device_path = "/dev/{}".format(wdt_main_dev_name) + if not watchdog: + watchdog = os.open(watchdog_device_path, os.O_RDWR) + return watchdog, wdt_main_dev_name + + def _read_file(self, file_path): + """ + Read text file + """ + try: + with open(file_path, "r") as fd: + txt = fd.read() + except IOError: + return WDT_COMMON_ERROR + return txt.strip() + + def _enable(self): + """ + Turn on the watchdog timer + """ + req = array.array('h', [WDIOS_ENABLECARD]) + fcntl.ioctl(self.watchdog, WDIOC_SETOPTIONS, req, False) + + def _disable(self): + """ + Turn off the watchdog timer + """ + req = array.array('h', [WDIOS_DISABLECARD]) + fcntl.ioctl(self.watchdog, WDIOC_SETOPTIONS, req, False) + + def _keepalive(self): + """ + Keep alive watchdog timer + """ + fcntl.ioctl(self.watchdog, WDIOC_KEEPALIVE) + + def _settimeout(self, seconds): + """ + Set watchdog timer timeout + @param seconds - timeout in seconds + @return is the actual set timeout + """ + req = array.array('I', [seconds]) + fcntl.ioctl(self.watchdog, WDIOC_SETTIMEOUT, req, True) + return int(req[0]) + + def _gettimeout(self, timeout_path): + """ + Get watchdog timeout + @return watchdog timeout + """ + req = array.array('I', [0]) + fcntl.ioctl(self.watchdog, WDIOC_GETTIMEOUT, req, True) + + return int(req[0]) + + def _gettimeleft(self): + """ + Get time left before watchdog timer expires + @return time left in seconds + """ + req = array.array('I', [0]) + fcntl.ioctl(self.watchdog, WDIOC_GETTIMELEFT, req, True) + + return int(req[0]) + + ################################################################# + + def arm(self, seconds): + """ + Arm the hardware watchdog with a timeout of seconds. + If the watchdog is currently armed, calling this function will + simply reset the timer to the provided value. If the underlying + hardware does not support the value provided in , this + method should arm the watchdog with the *next greater* available + value. + Returns: + An integer specifying the *actual* number of seconds the watchdog + was armed with. On failure returns -1. + """ + + ret = WDT_COMMON_ERROR + if seconds < 0: + return ret + + try: + if self.timeout != seconds: + self.timeout = self._settimeout(seconds) + if self.armed: + self._keepalive() + else: + self._settimeout(seconds) + self._enable() + self.armed = True + ret = self.timeout + except IOError as e: + pass + + return ret + + def disarm(self): + """ + Disarm the hardware watchdog + Returns: + A boolean, True if watchdog is disarmed successfully, False if not + """ + disarmed = False + if self.is_armed(): + try: + self._disable() + self.armed = False + disarmed = True + except IOError: + pass + + return disarmed + + def is_armed(self): + """ + Retrieves the armed state of the hardware watchdog. + Returns: + A boolean, True if watchdog is armed, False if not + """ + + return self.armed + + def get_remaining_time(self): + """ + If the watchdog is armed, retrieve the number of seconds remaining on + the watchdog timer + Returns: + An integer specifying the number of seconds remaining on thei + watchdog timer. If the watchdog is not armed, returns -1. + """ + + timeleft = WDT_COMMON_ERROR + + if self.armed: + try: + timeleft = self._gettimeleft() + except IOError: + pass + + return timeleft + + def __del__(self): + """ + Close watchdog + """ + + if self.watchdog is not None : + os.close(self.watchdog) + + + diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/utils/quanta_ix8c_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/utils/quanta_ix8c_util.py index f8e8b0f0f9..a7e50d908f 100755 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/utils/quanta_ix8c_util.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/utils/quanta_ix8c_util.py @@ -28,7 +28,7 @@ command: """ import os -import commands +import subprocess import sys, getopt import logging import time @@ -39,8 +39,8 @@ FORCE = 0 i2c_prefix = '/sys/bus/i2c/devices/' if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): global DEBUG @@ -55,9 +55,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -71,34 +71,45 @@ def main(): logging.info('no option') for arg in args: if arg == 'install': - install() + install() elif arg == 'clean': - uninstall() + uninstall() else: show_help() - return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_log(txt): if DEBUG == True: - print "[IX8C-56X]"+txt + print("[IX8C-56X]" + txt) return def exec_cmd(cmd, show): - logging.info('Run :'+cmd) - status, output = commands.getstatusoutput(cmd) + logging.info('Run :' + cmd) + status, output = subprocess.getstatusoutput(cmd) show_log (cmd +"with result:" + str(status)) - show_log (" output:"+output) + show_log (" output:" + output) if status: - logging.info('Failed :'+cmd) + logging.info('Failed :' + cmd) if show: - print('Failed :'+cmd) - return status, output + print('Failed :' + cmd) + return status, output + +pca954x_bus_addr =[ +'0-0072', +'0-0077', +'5-0073', +'6-0073', +'7-0073', +'8-0073', +'9-0073', +'10-0073', +'11-0073' +] instantiate =[ #export pca9698 for qsfp present @@ -201,7 +212,7 @@ drivers =[ 'lpc_ich', 'i2c-i801', 'i2c-dev', -'i2c-mux-pca954x force_deselect_on_exit=1', +'i2c-mux-pca954x', 'gpio-pca953x', 'optoe', 'qci_cpld_sfp28', @@ -232,11 +243,20 @@ def system_install(): exec_cmd("depmod -a ", 1) #install drivers for i in range(0,len(drivers)): - status, output = exec_cmd("modprobe " + drivers[i], 1) - if status: - print output - if FORCE == 0: - return status + status, output = exec_cmd("modprobe " + drivers[i], 1) + if status: + print(output) + #retry quanta_hwmon_ipmi in case it init failed due to ipmi_msghandler init uncompleted + if drivers[i] == 'quanta_hwmon_ipmi': + for _ in range(0, 3): + time.sleep(3) + ret, out = exec_cmd("modprobe quanta_hwmon_ipmi ", 1) + if ret == 0: + break + if ret and FORCE == 0: + return ret + elif FORCE == 0: + return status #reload ethernet drivers in correct order exec_cmd("rmmod ixgbe ", 1) @@ -244,6 +264,10 @@ def system_install(): exec_cmd("modprobe igb ", 1) exec_cmd("modprobe ixgbe ", 1) + # set pca954x idle_state as -2: MUX_IDLE_DISCONNECT + for i in range(0,len(pca954x_bus_addr)): + exec_cmd("echo -2 > /sys/bus/i2c/drivers/pca954x/{}/idle_state".format(pca954x_bus_addr[i]), 1) + #turn on module power exec_cmd("echo 21 > /sys/class/gpio/export ", 1) exec_cmd("echo high > /sys/class/gpio/gpio21/direction ", 1) @@ -263,15 +287,15 @@ def system_install(): exec_cmd("echo 1 >/sys/class/gpio/gpio73/value", 1) #instantiate devices - for i in range(0,len(instantiate)): - status, output = exec_cmd(instantiate[i], 1) - if status: - print output - if FORCE == 0: - return status + for i in range(0, len(instantiate)): + status, output = exec_cmd(instantiate[i], 1) + if status: + print(output) + if FORCE == 0: + return status #QSFP for 1~56 port - for port_number in range(1,57): + for port_number in range(1, 57): bus_number = port_number + 12 os.system("echo %d >/sys/bus/i2c/devices/%d-0050/port_name" % (port_number, bus_number)) @@ -285,35 +309,35 @@ def system_ready(): def install(): if not device_found(): - print "No device, installing...." + print("No device, installing....") status = system_install() if status: if FORCE == 0: - return status + return status status, output = exec_cmd("pip3 install /usr/share/sonic/device/x86_64-quanta_ix8c_bwde-r0/sonic_platform-1.0-py3-none-any.whl",1) if status: - print output - if FORCE == 0: - return status + print(output) + if FORCE == 0: + return status else: - print " ix8c driver already installed...." + print(" ix8c driver already installed....") return def uninstall(): global FORCE #uninstall drivers for i in range(len(un_drivers) - 1, -1, -1): - status, output = exec_cmd("rmmod " + un_drivers[i], 1) + status, output = exec_cmd("rmmod " + un_drivers[i], 1) if status: - print output - if FORCE == 0: - return status + print(output) + if FORCE == 0: + return status status, output = exec_cmd("pip3 uninstall sonic-platform -y ",1) if status: - print output - if FORCE == 0: - return status + print(output) + if FORCE == 0: + return status return diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/modules/qci_cpld_led.c b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/modules/qci_cpld_led.c index fdbc6c6c16..0f0ad02be8 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/modules/qci_cpld_led.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/modules/qci_cpld_led.c @@ -51,7 +51,7 @@ static struct class *cpld_class = NULL; struct cpld_data { struct i2c_client *cpld_client; - char name[8]; + char name[16]; u8 cpld_id; }; diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/modules/qci_platform_ix9.c b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/modules/qci_platform_ix9.c index 803b2b42f4..c243bd5d57 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/modules/qci_platform_ix9.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/modules/qci_platform_ix9.c @@ -141,9 +141,9 @@ static int __init ix9_platform_init(void) } else { - g_client[0] = i2c_new_device(adapter, &ix9_i2c_devices[0]); // pca9546_1 - Address: 0x72 - g_client[1] = i2c_new_device(adapter, &ix9_i2c_devices[1]); // pca9548_1 - Address: 0x77 - g_client[2] = i2c_new_device(adapter, &ix9_i2c_devices[11]); // CPU Linking Board at CPU's I2C Bus - Address: 0x22 + g_client[0] = i2c_new_client_device(adapter, &ix9_i2c_devices[0]); // pca9546_1 - Address: 0x72 + g_client[1] = i2c_new_client_device(adapter, &ix9_i2c_devices[1]); // pca9548_1 - Address: 0x77 + g_client[2] = i2c_new_client_device(adapter, &ix9_i2c_devices[11]); // CPU Linking Board at CPU's I2C Bus - Address: 0x22 i2c_put_adapter(adapter); } @@ -154,8 +154,8 @@ static int __init ix9_platform_init(void) } else { - g_client[3] = i2c_new_device(adapter, &ix9_i2c_devices[8]); // CPLD-IO #2 - Address: 0x38 - g_client[4] = i2c_new_device(adapter, &ix9_i2c_devices[9]); // CPLD-LED #4 - Address: 0x39 + g_client[3] = i2c_new_client_device(adapter, &ix9_i2c_devices[8]); // CPLD-IO #2 - Address: 0x38 + g_client[4] = i2c_new_client_device(adapter, &ix9_i2c_devices[9]); // CPLD-LED #4 - Address: 0x39 i2c_put_adapter(adapter); } @@ -166,8 +166,8 @@ static int __init ix9_platform_init(void) } else { - g_client[5] = i2c_new_device(adapter, &ix9_i2c_devices[8]); // CPLD-IO #3 - Address: 0x38 - g_client[6] = i2c_new_device(adapter, &ix9_i2c_devices[9]); // CPLD-LED #5 - Address: 0x39 + g_client[5] = i2c_new_client_device(adapter, &ix9_i2c_devices[8]); // CPLD-IO #3 - Address: 0x38 + g_client[6] = i2c_new_client_device(adapter, &ix9_i2c_devices[9]); // CPLD-LED #5 - Address: 0x39 i2c_put_adapter(adapter); } @@ -178,7 +178,7 @@ static int __init ix9_platform_init(void) } else { - g_client[7] = i2c_new_device(adapter, &ix9_i2c_devices[3]); // MB_BOARDINFO_EEPROM - Address: 0x54 + g_client[7] = i2c_new_client_device(adapter, &ix9_i2c_devices[3]); // MB_BOARDINFO_EEPROM - Address: 0x54 i2c_put_adapter(adapter); } @@ -189,7 +189,7 @@ static int __init ix9_platform_init(void) } else { - g_client[8] = i2c_new_device(adapter, &ix9_i2c_devices[2]); // tca9539_1 Board ID and QSFP-DD PW EN/PG - Address: 0x74 + g_client[8] = i2c_new_client_device(adapter, &ix9_i2c_devices[2]); // tca9539_1 Board ID and QSFP-DD PW EN/PG - Address: 0x74 i2c_put_adapter(adapter); } @@ -200,7 +200,7 @@ static int __init ix9_platform_init(void) } else { - g_client[9] = i2c_new_device(adapter, &ix9_i2c_devices[4]); // pca9548 #1 QSFPDD - Address: 0x73 + g_client[9] = i2c_new_client_device(adapter, &ix9_i2c_devices[4]); // pca9548 #1 QSFPDD - Address: 0x73 i2c_put_adapter(adapter); } @@ -211,7 +211,7 @@ static int __init ix9_platform_init(void) } else { - g_client[10] = i2c_new_device(adapter, &ix9_i2c_devices[5]); // pca9548 #2 QSFPDD - Address: 0x73 + g_client[10] = i2c_new_client_device(adapter, &ix9_i2c_devices[5]); // pca9548 #2 QSFPDD - Address: 0x73 i2c_put_adapter(adapter); } @@ -222,7 +222,7 @@ static int __init ix9_platform_init(void) } else { - g_client[11] = i2c_new_device(adapter, &ix9_i2c_devices[6]); // pca9548 #3 QSFPDD - Address: 0x73 + g_client[11] = i2c_new_client_device(adapter, &ix9_i2c_devices[6]); // pca9548 #3 QSFPDD - Address: 0x73 i2c_put_adapter(adapter); } @@ -233,7 +233,7 @@ static int __init ix9_platform_init(void) } else { - g_client[12] = i2c_new_device(adapter, &ix9_i2c_devices[7]); // pca9548 #4 QSFPDD - Address: 0x73 + g_client[12] = i2c_new_client_device(adapter, &ix9_i2c_devices[7]); // pca9548 #4 QSFPDD - Address: 0x73 i2c_put_adapter(adapter); } @@ -246,7 +246,7 @@ static int __init ix9_platform_init(void) } else { - g_client_port[i - 13] = i2c_new_device(adapter, &ix9_i2c_devices[10]); // eeprom for loopback module - Address: 0x50 + g_client_port[i - 13] = i2c_new_client_device(adapter, &ix9_i2c_devices[10]); // eeprom for loopback module - Address: 0x50 i2c_put_adapter(adapter); } } diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/modules/quanta_hwmon_ipmi.c b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/modules/quanta_hwmon_ipmi.c index 05a9e044c7..d49ca44856 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/modules/quanta_hwmon_ipmi.c +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/modules/quanta_hwmon_ipmi.c @@ -86,6 +86,8 @@ #define IPMI_TIMEOUT (4 * HZ) #define IPMI_MAX_WAIT_QUEUE 1 +typedef struct ipmi_user *ipmi_user_t; + struct quanta_hwmon_ipmi_data { struct platform_device *ipmi_platform_dev; struct device *ipmi_hwmon_dev; @@ -839,7 +841,7 @@ void ipmi_sdr_set_sensor_threshold(uint8_t idx, struct sdr_record_full_sensor *s /*refer to Table 35-, Get Sensor Event Enable*/ /* // change detect threshold method, keep it for record detail format - // in this version function input is + // in this version function input is "void ipmi_sdr_set_sensor_threshold(uint8_t idx, uint8_t *rec)" #define offset_threshold_enable 9 #define offset_threshold_data 31 @@ -1100,7 +1102,7 @@ int32_t ipmi_get_vin_type(uint8_t idx, uint8_t *retbuf) if (rv) { printk("BMC down at (%d)!!\n", __LINE__); } - else { + else { switch (returnData) { case 0x7: //LVDC @@ -1338,7 +1340,7 @@ static ssize_t show_fanpresent(struct device *dev, struct device_attribute *deva uint8_t returnData[10] = { 0 }; uint8_t msg_data[] = { 0x36, 0xB9, 0x4C, 0x1C, 0x00, 0x02 }; //netfn = 0x36; cmd = 0xB9; - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); fan_idx = (g_sensor_data[attr->index].sensor_idstring[8] - '0') - 1; @@ -1611,7 +1613,7 @@ static int32_t __init quanta_hwmon_ipmi_init(void) goto device_reg_err; } - data->ipmi_hwmon_dev = hwmon_device_register_with_groups(NULL, DRVNAME, NULL, NULL); + data->ipmi_hwmon_dev = hwmon_device_register_with_groups(&data->ipmi_platform_dev->dev, DRVNAME, NULL, NULL); err = IS_ERR(data->ipmi_hwmon_dev); if (err) { printk("hwmon register fail\n"); @@ -1646,7 +1648,7 @@ alloc_err: } static void __exit quanta_hwmon_ipmi_exit(void) -{ +{ remove_sensor_attrs(); hwmon_device_unregister(data->ipmi_hwmon_dev); platform_device_unregister(data->ipmi_platform_dev); @@ -1656,8 +1658,9 @@ static void __exit quanta_hwmon_ipmi_exit(void) mutex_unlock(&ipmi_lock); kfree(g_sensor_data); + g_sensor_data = NULL; kfree(data); - return; + data = NULL; } module_init(quanta_hwmon_ipmi_init); diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/chassis.py index 33f67b0b9d..6a8b760f37 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/chassis.py @@ -8,6 +8,7 @@ try: import sys import time + import syslog from sonic_platform_base.chassis_base import ChassisBase from sonic_platform.eeprom import Eeprom from sonic_platform.psu import Psu @@ -64,6 +65,12 @@ class Chassis(ChassisBase): self._sfp_list.append(sfp) self.__xcvr_presence[index] = self._sfp_list[index-1].get_presence() + # Initialize components + from sonic_platform.component import ComponentBIOS, ComponentBMC, ComponentCPLD, ComponentPCIE + self._component_list.append(ComponentBIOS()) + self._component_list.append(ComponentBMC()) + self._component_list.extend(ComponentCPLD.get_component_list()) + self._component_list.append(ComponentPCIE()) ############################################## # Device methods @@ -72,7 +79,7 @@ class Chassis(ChassisBase): def get_sfp(self, index): """ Retrieves sfp represented by (1-based) index - For Quanta IX8C the index in sfputil.py starts from 1, so override + For Quanta the index in sfputil.py starts from 1, so override Args: index: An integer, the index (1-based) of the sfp to retrieve. @@ -182,9 +189,29 @@ class Chassis(ChassisBase): is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used to pass a description of the reboot cause. """ - #raise NotImplementedError return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Invalid Reason") + ############################################## + # Other methods + ############################################## + def get_watchdog(self): + """ + Retreives hardware watchdog device on this chassis + + Returns: + An object derived from WatchdogBase representing the hardware + watchdog device + """ + try: + if self._watchdog is None: + from sonic_platform.watchdog import Watchdog + # Create the watchdog Instance + self._watchdog = Watchdog() + + except Exception as e: + syslog.syslog(syslog.LOG_ERR, "Fail to load watchdog due to {}".format(e)) + return self._watchdog + def get_change_event(self, timeout=0): """ Currently only support transceiver change events @@ -200,10 +227,10 @@ class Chassis(ChassisBase): cur_xcvr_presence = self._sfp_list[index-1].get_presence() if cur_xcvr_presence != self.__xcvr_presence[index]: if cur_xcvr_presence is True: - xcvr_change_event_dict[str(index)] = '1' + xcvr_change_event_dict[index] = '1' self.__xcvr_presence[index] = True elif cur_xcvr_presence is False: - xcvr_change_event_dict[str(index)] = '0' + xcvr_change_event_dict[index] = '0' self.__xcvr_presence[index] = False event = True diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/component.py new file mode 100644 index 0000000000..49d25f31cb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/component.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python + +######################################################################## +# Quanta IX9 +# +# Name: component.py, version: 1.3 +# Module contains an implementation of SONiC Platform Base API and +# provides the Components' (e.g., BIOS, CPLD, FPGA, etc.) available in +# the platform +# +######################################################################## + +try: + import subprocess + from sonic_platform_base.component_base import ComponentBase + from collections import namedtuple +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Component(ComponentBase): + def __init__(self): + ComponentBase.__init__(self) + self.name = None + self.description = None + + def get_name(self): + return self.name + + def get_description(self): + return self.description + + def install_firmware(self, image_path): + """ + Installs firmware to the component + + Args: + image_path: A string, path to firmware image + + Returns: + A boolean, True if install was successful, False if not + """ + return False + + @staticmethod + def _get_command_result(cmdline): + try: + proc = subprocess.Popen(cmdline, + stdout=subprocess.PIPE, + shell=True, stderr=subprocess.STDOUT, + universal_newlines=True) + stdout = proc.communicate()[0] + rc = proc.wait() + result = stdout.rstrip('\n') + if rc != 0: + raise RuntimeError("Failed to execute command {}, return code {}, {}".format(cmdline, rc, stdout)) + + except OSError as e: + raise RuntimeError("Failed to execute command {} due to {}".format(cmdline, repr(e))) + + return result + + +class ComponentBIOS(Component): + COMPONENT_NAME = 'BIOS' + COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System' + + BIOS_QUERY_VERSION_COMMAND = "dmidecode -s bios-version" + + def __init__(self): + super(ComponentBIOS, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + bios_ver = self._get_command_result(self.BIOS_QUERY_VERSION_COMMAND) + if not bios_ver: + return 'ERR' + else: + return bios_ver + + +class ComponentBMC(Component): + COMPONENT_NAME = 'BMC' + COMPONENT_DESCRIPTION = 'BMC - Board Management Controller' + BMC_QUERY_VERSION_COMMAND = "ipmitool mc info | grep 'Firmware Revision'" + + def __init__(self): + super(ComponentBMC, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + bmc_ver = self._get_command_result(self.BMC_QUERY_VERSION_COMMAND) + if not bmc_ver: + return 'ERR' + else: + bmc_ver = bmc_ver.split(": ")[1] + return bmc_ver.strip() + + +class ComponentCPLD(Component): + Cpld = namedtuple("Cpld", ['name', 'cmd_index', 'description']) + + cplds = { + 1: Cpld("BOOT_CPLD", 1, "Power sequence"), + 2: Cpld("FAN_CPLD", 2, "Fan"), + 3: Cpld("MB_CPLD_IO_1", 3, "Port IO-1"), + 4: Cpld("MB_CPLD_IO_2", 6, "Port IO-2"), + 5: Cpld("MB_CPLD_LED_1", 4, "Port LED-1"), + 6: Cpld("MB_CPLD_LED_2", 5, "Port LED-2"), + } + + def __init__(self, component_index): + super(ComponentCPLD, self).__init__() + self.index = component_index + + def get_name(self): + """ + Retrieves the name of the component + + Returns: + A string containing the name of the component + """ + self.name = self.cplds[self.index].name + + return self.name + + def get_description(self): + """ + Retrieves the description of the component + + Returns: + A string containing the description of the component + """ + self.description = self.cplds[self.index].description + + return self.description + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x01") + res = self._get_command_result("ipmitool raw 0x32 0xff 0x02 {}".format(self.cplds[self.index].cmd_index)) + self._get_command_result("ipmitool raw 0x30 0xe0 0xd0 0x01 0x00") + if not res: + return 'ERR' + else: + return res.split()[3].upper() + res.split()[2].upper() + res.split()[1].upper() + res.split()[0].upper() + + @classmethod + def get_component_list(cls): + component_list = [] + cpld_number = len(cls.cplds) + + for cpld_idx in range(1, cpld_number + 1): + component_list.append(cls(cpld_idx)) + + return component_list + + +class ComponentPCIE(Component): + COMPONENT_NAME = 'PCIe' + COMPONENT_DESCRIPTION = 'ASIC PCIe Firmware' + PCIE_QUERY_VERSION_COMMAND = "bcmcmd 'pciephy fw version' | grep 'FW version'" + + def __init__(self): + super(ComponentPCIE, self).__init__() + + self.name = self.COMPONENT_NAME + self.description = self.COMPONENT_DESCRIPTION + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + version = self._get_command_result(self.PCIE_QUERY_VERSION_COMMAND) + if not version: + return 'ERR' + else: + version = version.split(": ")[1] + return version.strip() diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/fan.py index e668013df9..7b63aa3aed 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/fan.py @@ -11,6 +11,7 @@ try: import logging import os + import glob from sonic_platform_base.fan_base import FanBase except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -19,9 +20,7 @@ except ImportError as e: ############### # Global ############### -HWMON_DIR = "/sys/class/hwmon/hwmon2/" -FAN_INDEX_START = 18 -NUM_FANTRAYS = 6 +HWMON_IPMI_DIR = "/sys/devices/platform/quanta_hwmon_ipmi/hwmon/hwmon*/" FANS_PERTRAY = 2 class Fan(FanBase): @@ -30,30 +29,46 @@ class Fan(FanBase): def __init__(self, index, is_psu_fan=False): self.is_psu_fan = is_psu_fan self.fan_index = index - self.psu_fan_index_mapping = { - 1:37, - 2:47, - } - self.psu_index_mapping = { - 1:39, - 2:49, - } + hwmon_dir=glob.glob(HWMON_IPMI_DIR)[0] + if self.is_psu_fan: - self.fan_presence_attr = "power{}_present".format(self.psu_index_mapping[index]) - self.fan_pwm_attr = "fan{}_pwm".format(self.psu_fan_index_mapping[index]) - self.fan_rpm_attr = "fan{}_input".format(self.psu_fan_index_mapping[index]) - self.fan_direction_attr = "fan{}_direction".format(self.psu_fan_index_mapping[index]) + power_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_POWER_OUT".format(self.fan_index), 'power') + fan_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_Fan".format(self.fan_index), 'fan') + self.fan_presence_attr = power_out_prefix + 'present' + self.fan_pwm_attr = fan_prefix + 'pwm' + self.fan_rpm_attr = fan_prefix + 'input' + self.fan_direction_attr = fan_prefix + 'direction' else: - self.fan_presence_attr = "fan{}_present".format(FAN_INDEX_START+(index-1)) - self.fan_pwm_attr = "fan{}_pwm".format(FAN_INDEX_START+(index-1)) - self.fan_rpm_attr = "fan{}_input".format(FAN_INDEX_START+(index-1)) - self.fan_direction_attr = "fan{}_direction".format(FAN_INDEX_START+(index-1)) + fantray_index = (self.fan_index-1)//FANS_PERTRAY+1 + fan_index_intray = self.fan_index - ((fantray_index-1)*FANS_PERTRAY) + fan_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "Fan_SYS_{}_{}".format(fantray_index, fan_index_intray), 'fan') + self.fan_presence_attr = fan_prefix + 'present' + self.fan_pwm_attr = fan_prefix + 'pwm' + self.fan_rpm_attr = fan_prefix + 'input' + self.fan_direction_attr = fan_prefix + 'direction' ####################### # private function ####################### + def __get_hwmon_attr_prefix(self, dir, label, type): + + retval = 'ERR' + if not os.path.isdir(dir): + return retval + + try: + for filename in os.listdir(dir): + if filename[-5:] == 'label' and type in filename: + file_path = os.path.join(dir, filename) + if os.path.isfile(file_path) and label == self.__get_attr_value(file_path): + return file_path[0:-5] + except Exception as error: + logging.error("Error when getting {} label path: {}".format(label, error)) + + return retval + def __get_attr_value(self, attr_path): retval = 'ERR' @@ -64,7 +79,7 @@ class Fan(FanBase): with open(attr_path, 'r') as fd: retval = fd.read() except Exception as error: - logging.error("Unable to open " + attr_path + " file !") + logging.error("Unable to open {} file: {}".format(attr_path, error)) retval = retval.rstrip(' \t\n\r') return retval @@ -84,7 +99,7 @@ class Fan(FanBase): if self.is_psu_fan: return "PSU-{}_FAN".format(self.fan_index) else: - fantray_index = (self.fan_index-1)/FANS_PERTRAY+1 + fantray_index = (self.fan_index-1)//FANS_PERTRAY+1 fan_index_intray = self.fan_index - ((fantray_index-1)*FANS_PERTRAY) return "Fantray{}_{}".format(fantray_index, fan_index_intray) @@ -95,8 +110,7 @@ class Fan(FanBase): Returns: bool: True if device is present, False if not """ - attr_path = HWMON_DIR + self.fan_presence_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_presence_attr) if (attr_rv != 'ERR'): if (attr_rv == '1'): return True @@ -113,8 +127,7 @@ class Fan(FanBase): A boolean value, True if device is operating properly, False if not """ if self.get_presence(): - attr_path = HWMON_DIR + self.fan_rpm_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_rpm_attr) if (attr_rv != 'ERR' and attr_rv != '0.0'): return True @@ -135,8 +148,7 @@ class Fan(FanBase): A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST depending on fan direction """ - attr_path = HWMON_DIR + self.fan_direction_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_direction_attr) if attr_rv == '2': return self.FAN_DIRECTION_INTAKE @@ -152,8 +164,7 @@ class Fan(FanBase): to 100 (full speed) """ if self.get_presence(): - attr_path = HWMON_DIR + self.fan_pwm_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_pwm_attr) if (attr_rv != 'ERR'): return int(float(attr_rv)) @@ -169,8 +180,7 @@ class Fan(FanBase): Returns: An integer, speed of the fan in RPM """ - attr_path = HWMON_DIR + self.fan_rpm_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_rpm_attr) if (attr_rv != 'ERR'): return int(float(attr_rv)) @@ -185,8 +195,7 @@ class Fan(FanBase): An integer, the percentage of full fan speed, in the range 0 (off) to 100 (full speed) """ - attr_path = HWMON_DIR + self.fan_pwm_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.fan_pwm_attr) if (attr_rv != 'ERR'): return int(float(attr_rv)) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/fan_drawer.py index 75e954576a..3d5f767477 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/fan_drawer.py @@ -28,7 +28,7 @@ class FanDrawer(FanDrawerBase): Returns: string: The name of the device """ - return 'Fan {}'.format(self._index) + return 'Fantray{}'.format(self._index) def get_presence(self): """ diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/psu.py index 1043a4fe18..6188c95c76 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/psu.py @@ -8,57 +8,61 @@ try: import logging import os + import glob from sonic_platform_base.psu_base import PsuBase from sonic_platform.fan import Fan except ImportError as e: raise ImportError(str(e) + "- required module not found") -HWMON_DIR = "/sys/class/hwmon/hwmon2/" +HWMON_IPMI_DIR = "/sys/devices/platform/quanta_hwmon_ipmi/hwmon/hwmon*/" class Psu(PsuBase): def __init__(self, index): PsuBase.__init__(self) fan = Fan(index, True) self._fan_list.append(fan) + self.index = index + hwmon_dir=glob.glob(HWMON_IPMI_DIR)[0] - self.psu_index_mapping = { - 1:39, - 2:49, - } - self.psu_powerin_index_mapping = { - 1:38, - 2:48, - } - self.psu_currentout_index_mapping = { - 1:36, - 2:46, - } - self.psu_currentin_index_mapping = { - 1:35, - 2:45, - } - self.psu_voltageout_index_mapping = { - 1:44, - 2:54, - } - self.psu_voltagein_index_mapping = { - 1:43, - 2:53, - } - self.index = index - self.psu_presence_attr = "power{}_present".format(self.psu_index_mapping[self.index]) - self.psu_status_attr = "curr{}_input".format(self.psu_currentout_index_mapping[self.index]) - self.psu_power_in_attr = "power{}_input".format(self.psu_powerin_index_mapping[self.index]) - self.psu_power_out_attr = "power{}_input".format(self.psu_index_mapping[self.index]) - self.psu_voltage_out_attr = "in{}_input".format(self.psu_voltageout_index_mapping[self.index]) - self.psu_current_out_attr = "curr{}_input".format(self.psu_currentout_index_mapping[self.index]) - self.psu_voltage_in_attr = "in{}_input".format(self.psu_voltagein_index_mapping[self.index]) - self.psu_current_in_attr = "curr{}_input".format(self.psu_currentin_index_mapping[self.index]) - self.psu_serial_attr = "power{}_sn".format(self.psu_index_mapping[self.index]) - self.psu_model_attr = "power{}_model".format(self.psu_index_mapping[self.index]) - self.psu_mfr_id_attr = "power{}_mfrid".format(self.psu_index_mapping[self.index]) - self.psu_capacity_attr = "power{}_pout_max".format(self.psu_index_mapping[self.index]) - self.psu_type_attr = "power{}_vin_type".format(self.psu_index_mapping[self.index]) + current_in_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_CURRENT_IN".format(self.index), 'curr') + current_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_CURRENT_OUT".format(self.index), 'curr') + power_in_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_POWER_IN".format(self.index), 'power') + power_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_POWER_OUT".format(self.index), 'power') + voltage_in_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_VOLTAGE_IN".format(self.index), 'in') + voltage_out_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_VOLTAGE_OUT".format(self.index), 'in') + temp1_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, "PSU{}_TEMP1".format(self.index), 'temp') + + self.psu_current_in_attr = current_in_prefix + 'input' + self.psu_current_out_attr = current_out_prefix + 'input' + self.psu_power_in_attr = power_in_prefix + 'input' + self.psu_power_out_attr = power_out_prefix + 'input' + self.psu_voltage_in_attr = voltage_in_prefix + 'input' + self.psu_voltage_out_attr = voltage_out_prefix + 'input' + self.psu_status_attr = current_out_prefix + 'input' + self.psu_presence_attr = power_out_prefix + 'present' + self.psu_serial_attr = power_out_prefix + 'sn' + self.psu_model_attr = power_out_prefix + 'model' + self.psu_mfr_id_attr = power_out_prefix + 'mfrid' + self.psu_capacity_attr = power_out_prefix + 'pout_max' + self.psu_type_attr = power_out_prefix + 'vin_type' + self.psu_temp_attr = temp1_prefix + 'input' + + def __get_hwmon_attr_prefix(self, dir, label, type): + + retval = 'ERR' + if not os.path.isdir(dir): + return retval + + try: + for filename in os.listdir(dir): + if filename[-5:] == 'label' and type in filename: + file_path = os.path.join(dir, filename) + if os.path.isfile(file_path) and label == self.__get_attr_value(file_path): + return file_path[0:-5] + except Exception as error: + logging.error("Error when getting {} label path: {}".format(label, error)) + + return retval def __get_attr_value(self, attr_path): @@ -70,10 +74,9 @@ class Psu(PsuBase): with open(attr_path, 'r') as fd: retval = fd.read() except Exception as error: - logging.error("Unable to open " + attr_path + " file !") + logging.error("Unable to open {} file: {}".format(attr_path, error)) retval = retval.rstrip(' \t\n\r') - fd.close() return retval ############################################## @@ -97,10 +100,9 @@ class Psu(PsuBase): bool: True if device is present, False if not """ presence = False - attr_path = HWMON_DIR+self.psu_presence_attr attr_normal = '1' - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_presence_attr) if (attr_rv != 'ERR'): if (attr_rv == attr_normal): presence = True @@ -115,8 +117,7 @@ class Psu(PsuBase): string: Model/part number of device """ model = "N/A" - attr_path = HWMON_DIR+self.psu_model_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_model_attr) if (attr_rv != 'ERR'): model = attr_rv @@ -130,8 +131,7 @@ class Psu(PsuBase): string: Manufacturer's id of device """ mfr_id = "N/A" - attr_path = HWMON_DIR+self.psu_mfr_id_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_mfr_id_attr) if (attr_rv != 'ERR'): mfr_id = attr_rv @@ -145,9 +145,7 @@ class Psu(PsuBase): string: Serial number of device """ serial = "N/A" - attr_path = HWMON_DIR+self.psu_serial_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_serial_attr) if (attr_rv != 'ERR'): serial = attr_rv @@ -161,9 +159,7 @@ class Psu(PsuBase): A boolean value, True if device is operating properly, False if not """ status = False - attr_path = HWMON_DIR+self.psu_status_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_status_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) if (int(attr_rv) != 0): @@ -184,9 +180,7 @@ class Psu(PsuBase): e.g. 12.1 """ voltage_out = 0.0 - attr_path = HWMON_DIR+self.psu_voltage_out_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_voltage_out_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) voltage_out = float(attr_rv) / 1000 @@ -201,9 +195,7 @@ class Psu(PsuBase): A float number, the electric current in amperes, e.g 15.4 """ current_out = 0.0 - attr_path = HWMON_DIR+self.psu_current_out_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_current_out_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) current_out = float(attr_rv) / 1000 @@ -212,16 +204,14 @@ class Psu(PsuBase): def get_input_voltage(self): """ - Retrieves current PSU voltage output + Retrieves current PSU voltage input Returns: - A float number, the output voltage in volts, + A float number, the input voltage in volts, e.g. 12.1 """ voltage_in = 0.0 - attr_path = HWMON_DIR+self.psu_voltage_in_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_voltage_in_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) voltage_in = float(attr_rv) / 1000 @@ -236,9 +226,7 @@ class Psu(PsuBase): A float number, the electric current in amperes, e.g 15.4 """ current_in = 0.0 - attr_path = HWMON_DIR+self.psu_current_in_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_current_in_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) current_in = float(attr_rv) / 1000 @@ -253,9 +241,7 @@ class Psu(PsuBase): A float number, the power in watts, e.g. 302.6 """ power_out = 0.0 - attr_path = HWMON_DIR+self.psu_power_out_attr - - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_power_out_attr) if (attr_rv != 'ERR'): attr_rv, dummy = attr_rv.split('.', 1) power_out = float(attr_rv) / 1000 @@ -292,8 +278,7 @@ class Psu(PsuBase): A string, the type of PSU (AC/DC) """ type = "AC" - attr_path = HWMON_DIR+self.psu_type_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_type_attr) if (attr_rv != 'ERR'): type = attr_rv @@ -307,8 +292,7 @@ class Psu(PsuBase): An integer, the capacity of PSU """ capacity = 0 - attr_path = HWMON_DIR+self.psu_capacity_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.psu_capacity_attr) if (attr_rv != 'ERR'): try: capacity = int(attr_rv) @@ -317,3 +301,19 @@ class Psu(PsuBase): return capacity + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + + tout = 0.0 + attr_rv = self.__get_attr_value(self.psu_temp_attr) + if (attr_rv != 'ERR'): + tout = float(attr_rv) + + # tout is in milli degree celcius + return float(tout/1000.0) + diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/sfp.py index 726e18b231..77176ad083 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/sfp.py @@ -278,7 +278,6 @@ class Sfp(SfpBase): # Init index self.index = sfp_index self.port_num = self.index - #self.dom_supported = False self.sfp_type = sfp_type self.reset_path = "/sys/class/cpld-qsfpdd/port-"+str(self.port_num)+"/reset" self.lpmode_path = "/sys/class/cpld-qsfpdd/port-"+str(self.port_num)+"/lpmode" @@ -329,7 +328,7 @@ class Sfp(SfpBase): self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', - 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui', 'application_advertisement'] + 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui', 'application_advertisement', 'type_abbrv_name'] SfpBase.__init__(self) @@ -354,15 +353,6 @@ class Sfp(SfpBase): else: return 'N/A' - def __read_txt_file(self, file_path): - try: - with open(file_path, 'r') as fd: - data = fd.read() - return data.strip() - except IOError: - pass - return "" - def __is_host(self): return os.system(self.HOST_CHK_CMD) == 0 @@ -425,7 +415,7 @@ class Sfp(SfpBase): elif eeprom_raw[0] in QSFP_TYPE_CODE_LIST: self.sfp_type = QSFP_TYPE elif eeprom_raw[0] in QSFP_DD_TYPE_CODE_LIST: - self.sfp_type = QSFP_TYPE + self.sfp_type = QSFP_DD_TYPE else: # we don't regonize this identifier value, treat the xSFP module as the default type self.sfp_type = sfp_type @@ -437,26 +427,6 @@ class Sfp(SfpBase): # in this case we treat it as the default type according to the SKU self.sfp_type = sfp_type - def __convert_string_to_num(self, value_str): - if "-inf" in value_str: - return 'N/A' - elif "Unknown" in value_str: - return 'N/A' - elif 'dBm' in value_str: - t_str = value_str.rstrip('dBm') - return float(t_str) - elif 'mA' in value_str: - t_str = value_str.rstrip('mA') - return float(t_str) - elif 'C' in value_str: - t_str = value_str.rstrip('C') - return float(t_str) - elif 'Volts' in value_str: - t_str = value_str.rstrip('Volts') - return float(t_str) - else: - return 'N/A' - def _dom_capability_detect(self): if not self.get_presence(): self.dom_supported = False @@ -544,6 +514,7 @@ class Sfp(SfpBase): self.dom_rx_tx_power_bias_supported = False else: self.dom_supported = False + self.second_application_list = False self.dom_temp_supported = False self.dom_volt_supported = False self.dom_rx_power_supported = False @@ -620,6 +591,7 @@ class Sfp(SfpBase): return transceiver_info_dict self._detect_sfp_type(self.sfp_type) + self._dom_capability_detect() transceiver_info_dict = {} compliance_code_dict = {} @@ -638,6 +610,7 @@ class Sfp(SfpBase): sfp_type_raw = self._read_eeprom_specific_bytes((offset + OSFP_TYPE_OFFSET), XCVR_TYPE_WIDTH) if sfp_type_raw is not None: sfp_type_data = sfpi_obj.parse_sfp_type(sfp_type_raw, 0) + sfp_type_abbrv_name_data = sfpi_obj.parse_sfp_type_abbrv_name(sfp_type_raw, 0) else: return None @@ -666,6 +639,7 @@ class Sfp(SfpBase): return None transceiver_info_dict['type'] = sfp_type_data['data']['type']['value'] + transceiver_info_dict['type_abbrv_name'] = sfp_type_abbrv_name_data['data']['type_abbrv_name']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] @@ -703,6 +677,7 @@ class Sfp(SfpBase): sfp_type_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_TYPE_OFFSET), XCVR_TYPE_WIDTH) if sfp_type_raw is not None: sfp_type_data = sfpi_obj.parse_sfp_type(sfp_type_raw, 0) + sfp_type_abbrv_name_data = sfpi_obj.parse_sfp_type_abbrv_name(sfp_type_raw, 0) else: return None @@ -791,6 +766,7 @@ class Sfp(SfpBase): return None transceiver_info_dict['type'] = str(sfp_type_data['data']['type']['value']) + transceiver_info_dict['type_abbrv_name'] = sfp_type_abbrv_name_data['data']['type_abbrv_name']['value'] transceiver_info_dict['manufacturer'] = str(sfp_vendor_name_data['data']['Vendor Name']['value']) transceiver_info_dict['model'] = str(sfp_vendor_pn_data['data']['Vendor PN']['value']) transceiver_info_dict['vendor_rev'] = str(sfp_vendor_rev_data['data']['Vendor Rev']['value']) @@ -828,9 +804,7 @@ class Sfp(SfpBase): else: if not self.get_presence(): return transceiver_info_dict - elif i == max_retry-1: - pass - else: + elif i < max_retry-1: time.sleep(0.5) if sfp_interface_bulk_raw is None: @@ -865,6 +839,7 @@ class Sfp(SfpBase): sfp_vendor_date_data = sfpi_obj.parse_vendor_date(sfp_interface_bulk_raw[start : end], 0) transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] + transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data['data']['type_abbrv_name']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] @@ -960,8 +935,6 @@ class Sfp(SfpBase): if not self.get_presence(): return {} - self._dom_capability_detect() - if self.sfp_type == OSFP_TYPE: pass @@ -1302,7 +1275,7 @@ class Sfp(SfpBase): return False elif self.sfp_type == QSFP_TYPE: return False - elif self.sfp_type == OSFP_TYPE or self.sfp_type == QSFP_DD_TYPE: + elif self.sfp_type == QSFP_DD_TYPE: try: reg_file = open(self.reset_path) except IOError as e: @@ -1509,7 +1482,7 @@ class Sfp(SfpBase): return False elif self.sfp_type == QSFP_TYPE: return False - elif self.sfp_type == OSFP_TYPE: + elif self.sfp_type == QSFP_DD_TYPE: try: reg_file = open(self.lpmode_path) except IOError as e: @@ -1899,7 +1872,7 @@ class Sfp(SfpBase): return False elif self.sfp_type == QSFP_TYPE: return False - elif self.sfp_type == OSFP_TYPE: + elif self.sfp_type == QSFP_DD_TYPE: try: reg_file = open(self.reset_path, "r+") except IOError as e: @@ -1957,7 +1930,7 @@ class Sfp(SfpBase): sysfsfile_eeprom = open( sysfs_sfp_i2c_client_eeprom_path, mode="r+b", buffering=0) buffer = create_string_buffer(1) - buffer[0] = chr(tx_disable_ctl) + buffer[0] = tx_disable_ctl # Write to eeprom sysfsfile_eeprom.seek(offset + SFP_STATUS_CONTROL_OFFSET) sysfsfile_eeprom.write(buffer[0]) @@ -2010,7 +1983,7 @@ class Sfp(SfpBase): else: tx_disable_ctl = channel_state & (~channel) buffer = create_string_buffer(1) - buffer[0] = chr(tx_disable_ctl) + buffer[0] = tx_disable_ctl # Write to eeprom sysfsfile_eeprom = open( self.port_to_eeprom_mapping[self.port_num], "r+b") @@ -2045,7 +2018,7 @@ class Sfp(SfpBase): return False elif self.sfp_type == QSFP_TYPE: return False - elif self.sfp_type == OSFP_TYPE: + elif self.sfp_type == QSFP_DD_TYPE: try: reg_file = open(self.lpmode_path, "r+") except IOError as e: @@ -2099,7 +2072,7 @@ class Sfp(SfpBase): power_set_bit |= 1 << 1 buffer = create_string_buffer(1) - buffer[0] = chr(power_override_bit | power_set_bit) + buffer[0] = power_override_bit | power_set_bit # Write to eeprom sysfsfile_eeprom = open(self.port_to_eeprom_mapping[self.port_num], "r+b") sysfsfile_eeprom.seek(QSFP_POWEROVERRIDE_OFFSET) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/thermal.py index 5fb2097492..b3e2c89b79 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/thermal.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# Quanta +# Quanta IX9 # # Module contains an implementation of SONiC Platform Base API and # provides the Thermal information @@ -10,46 +10,69 @@ import logging import os +import glob try: from sonic_platform_base.thermal_base import ThermalBase except ImportError as e: raise ImportError(str(e) + "- required module not found") -HWMON_DIR = "/sys/class/hwmon/hwmon2/" +HWMON_IPMI_DIR = "/sys/devices/platform/quanta_hwmon_ipmi/hwmon/hwmon*/" thermal_index_mapping = { - 1:40, - 2:41, - 3:42, - 4:50, - 5:51, - 6:52, - 7:73, - 8:74, - 9:75, - 10:76, - 11:77, - 12:78, - 13:79, - 14:80, - 15:81, - 16:82, - 17:83, - 18:84, - 19:85 + 1:'PSU1_TEMP1', + 2:'PSU1_TEMP2', + 3:'PSU1_TEMP3', + 4:'PSU2_TEMP1', + 5:'PSU2_TEMP2', + 6:'PSU2_TEMP3', + 7:'Temp_1V05_PCH_VR', + 8:'Temp_Ambient_0', + 9:'Temp_Ambient_1', + 10:'Temp_Ambient_2', + 11:'Temp_Ambient_3', + 12:'Temp_Ambient_4', + 13:'Temp_Ambient_5', + 14:'Temp_CPU', + 15:'Temp_DDRAB_VR', + 16:'Temp_Inlet', + 17:'Temp_SOC_DIMMA0', + 18:'Temp_VCCGBE_VR', + 19:'Temp_VCCIN_VR' } + + class Thermal(ThermalBase): """Platform-specific Thermal class""" def __init__(self, thermal_index): - self.index = thermal_index - self.temp_attr = "temp{}_input".format(thermal_index_mapping[self.index]) - self.high_th_attr = "temp{}_ncrit".format(thermal_index_mapping[self.index]) - self.high_crit_th_attr = "temp{}_crit".format(thermal_index_mapping[self.index]) - self.name_attr = "temp{}_label".format(thermal_index_mapping[self.index]) + self.index = thermal_index + hwmon_dir=glob.glob(HWMON_IPMI_DIR)[0] + thermal_prefix = self.__get_hwmon_attr_prefix(hwmon_dir, thermal_index_mapping[self.index], 'temp') + self.temp_attr = "{}input".format(thermal_prefix) + self.high_th_attr = "{}ncrit".format(thermal_prefix) + self.high_crit_th_attr = "{}crit".format(thermal_prefix) + self.low_th_attr = "{}lncrit".format(thermal_prefix) + self.low_crit_th_attr = "{}lcrit".format(thermal_prefix) + self.name_attr = "{}label".format(thermal_prefix) + def __get_hwmon_attr_prefix(self, dir, label, type): + + retval = 'ERR' + if not os.path.isdir(dir): + return retval + + try: + for filename in os.listdir(dir): + if filename[-5:] == 'label' and type in filename: + file_path = os.path.join(dir, filename) + if os.path.isfile(file_path) and label == self.__get_attr_value(file_path): + return file_path[0:-5] + except Exception as error: + logging.error("Error when getting {} label path: {}".format(label, error)) + + return retval def __get_attr_value(self, attr_path): @@ -61,7 +84,7 @@ class Thermal(ThermalBase): with open(attr_path, 'r') as fd: retval = fd.read() except Exception as error: - logging.error("Unable to open " + attr_path + " file !") + logging.error("Unable to open {} file: {}".format(attr_path, error)) retval = retval.rstrip(' \t\n\r') return retval @@ -73,8 +96,7 @@ class Thermal(ThermalBase): Returns: string: The name of the device """ - attr_path = HWMON_DIR + self.name_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.name_attr) if (attr_rv != 'ERR'): return attr_rv @@ -88,8 +110,7 @@ class Thermal(ThermalBase): Returns: bool: True if device is present, False if not """ - attr_path = HWMON_DIR + self.name_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.name_attr) if (attr_rv != 'ERR'): return True @@ -116,8 +137,37 @@ class Thermal(ThermalBase): A float number of current temperature in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - attr_path = HWMON_DIR + self.temp_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.temp_attr) + + if (attr_rv != 'ERR'): + return float(attr_rv) / 1000 + else: + return None + + def get_low_threshold(self): + """ + Retrieves the low threshold temperature of thermal + + Returns: + A float number, the low threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + attr_rv = self.__get_attr_value(self.low_th_attr) + + if (attr_rv != 'ERR'): + return float(attr_rv) / 1000 + else: + return None + + def get_low_critical_threshold(self): + """ + Retrieves the low critical threshold temperature of thermal + + Returns: + A float number, the low critical threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + attr_rv = self.__get_attr_value(self.low_crit_th_attr) if (attr_rv != 'ERR'): return float(attr_rv) / 1000 @@ -132,8 +182,7 @@ class Thermal(ThermalBase): A float number, the high threshold temperature of thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - attr_path = HWMON_DIR + self.high_th_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.high_th_attr) if (attr_rv != 'ERR'): return float(attr_rv) / 1000 @@ -148,8 +197,7 @@ class Thermal(ThermalBase): A float number, the high threshold temperature of thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - attr_path = HWMON_DIR + self.high_crit_th_attr - attr_rv = self.__get_attr_value(attr_path) + attr_rv = self.__get_attr_value(self.high_crit_th_attr) if (attr_rv != 'ERR'): return float(attr_rv) / 1000 diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/watchdog.py index 282f356f4e..0e63d9368c 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/watchdog.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/watchdog.py @@ -48,12 +48,16 @@ WD_MAIN_IDENTITY = "iTCO_wdt" WDT_SYSFS_PATH = "/sys/class/watchdog/" DEFAULT_TIMEOUT=180 +watchdog=0 class Watchdog(WatchdogBase): def __init__(self): self.watchdog, self.wdt_main_dev_name = self._get_wdt() + if self.wdt_main_dev_name is None: + raise Exception("Watchdog device is not instantiated") + self.status_path = "/sys/class/watchdog/%s/status" % self.wdt_main_dev_name self.state_path = "/sys/class/watchdog/%s/state" % self.wdt_main_dev_name self.timeout_path = "/sys/class/watchdog/%s/timeout" % self.wdt_main_dev_name @@ -74,14 +78,16 @@ class Watchdog(WatchdogBase): """ Retrieves watchdog device """ + global watchdog wdt_main_dev_list = [dev for dev in os.listdir( "/dev/") if dev.startswith("watchdog") and self._is_wd_main(dev)] if not wdt_main_dev_list: - return None + return (None, None) wdt_main_dev_name = wdt_main_dev_list[0] watchdog_device_path = "/dev/{}".format(wdt_main_dev_name) - self.watchdog = os.open(watchdog_device_path, os.O_RDWR) - return self.watchdog, wdt_main_dev_name + if not watchdog: + watchdog = os.open(watchdog_device_path, os.O_RDWR) + return watchdog, wdt_main_dev_name def _read_file(self, file_path): """ @@ -228,7 +234,8 @@ class Watchdog(WatchdogBase): Close watchdog """ - os.close(self.watchdog) + if self.watchdog is not None : + os.close(self.watchdog) diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/utils/quanta_ix9_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/utils/quanta_ix9_util.py index 0554ccbf1b..ec14e10ad6 100755 --- a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/utils/quanta_ix9_util.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/utils/quanta_ix9_util.py @@ -28,27 +28,26 @@ command: """ import os -import commands +import subprocess import sys, getopt import logging +import time DEBUG = False args = [] FORCE = 0 i2c_prefix = '/sys/bus/i2c/devices/' - if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] - + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): global DEBUG global args global FORCE - if len(sys.argv)<2: + if len(sys.argv) < 2: show_help() options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', @@ -56,9 +55,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -72,44 +71,44 @@ def main(): logging.info('no option') for arg in args: if arg == 'install': - install() + install() elif arg == 'clean': - uninstall() + uninstall() else: show_help() return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_log(txt): if DEBUG == True: - print "[IX9-32X]"+txt + print("[IX9-32X]" + txt) return def exec_cmd(cmd, show): - logging.info('Run :'+cmd) - status, output = commands.getstatusoutput(cmd) + logging.info('Run :' + cmd) + status, output = subprocess.getstatusoutput(cmd) show_log (cmd +"with result:" + str(status)) - show_log (" output:"+output) + show_log (" output:" + output) if status: - logging.info('Failed :'+cmd) + logging.info('Failed :' + cmd) if show: - print('Failed :'+cmd) - return status, output + print('Failed :' + cmd) + return status, output + +pca954x_bus_addr =[ +'0-0072', +'0-0077', +'5-0073', +'6-0073', +'7-0073', +'8-0073' +] instantiate =[ -#turn on module power -'echo 21 > /sys/class/gpio/export', -'echo out > /sys/class/gpio/gpio21/direction', -'echo 1 >/sys/class/gpio/gpio21/value', -#Reset fron-ports LED CPLD -'echo 33 > /sys/class/gpio/export', -'echo out > /sys/class/gpio/gpio33/direction', -'echo 0 >/sys/class/gpio/gpio33/value', -'echo 1 >/sys/class/gpio/gpio33/value', #Enable front-ports LED decoding 'echo 1 > /sys/class/cpld-led/CPLDLED-1/led_decode', 'echo 1 > /sys/class/cpld-led/CPLDLED-2/led_decode', @@ -159,7 +158,7 @@ drivers =[ 'lpc_ich', 'i2c-i801', 'i2c-dev', -'i2c-mux-pca954x force_deselect_on_exit=1', +'i2c-mux-pca954x', 'gpio-pca953x', 'optoe', 'qci_cpld_qsfpdd', @@ -190,11 +189,20 @@ def system_install(): exec_cmd("depmod -a ", 1) #install drivers for i in range(0,len(drivers)): - status, output = exec_cmd("modprobe " + drivers[i], 1) - if status: - print output - if FORCE == 0: - return status + status, output = exec_cmd("modprobe " + drivers[i], 1) + if status: + print(output) + #retry quanta_hwmon_ipmi in case it init failed due to ipmi_msghandler init uncompleted + if drivers[i] == 'quanta_hwmon_ipmi': + for _ in range(0, 3): + time.sleep(3) + ret, out = exec_cmd("modprobe quanta_hwmon_ipmi ", 1) + if ret == 0: + break + if ret and FORCE == 0: + return ret + elif FORCE == 0: + return status #reload ethernet drivers in correct order exec_cmd("rmmod ixgbe ", 1) @@ -202,16 +210,32 @@ def system_install(): exec_cmd("modprobe igb ", 1) exec_cmd("modprobe ixgbe ", 1) + # set pca954x idle_state as -2: MUX_IDLE_DISCONNECT + for i in range(0,len(pca954x_bus_addr)): + exec_cmd("echo -2 > /sys/bus/i2c/drivers/pca954x/{}/idle_state".format(pca954x_bus_addr[i]), 1) + + #turn on module power + exec_cmd("echo 21 > /sys/class/gpio/export ", 1) + exec_cmd("echo high > /sys/class/gpio/gpio21/direction ", 1) + + #Reset fron-ports LED CPLD + exec_cmd("echo 33 > /sys/class/gpio/export ", 1) + status, output = exec_cmd("cat /sys/class/gpio/gpio33/value", 1) + if output != '1': + exec_cmd("echo out > /sys/class/gpio/gpio33/direction ", 1) + exec_cmd("echo 0 >/sys/class/gpio/gpio33/value", 1) + exec_cmd("echo 1 >/sys/class/gpio/gpio33/value", 1) + #instantiate devices - for i in range(0,len(instantiate)): - status, output = exec_cmd(instantiate[i], 1) - if status: - print output - if FORCE == 0: - return status + for i in range(0, len(instantiate)): + status, output = exec_cmd(instantiate[i], 1) + if status: + print(output) + if FORCE == 0: + return status #QSFPDD for 1~32 port - for port_number in range(1,33): + for port_number in range(1, 33): bus_number = port_number + 12 os.system("echo %d >/sys/bus/i2c/devices/%d-0050/port_name" % (port_number, bus_number)) @@ -224,35 +248,35 @@ def system_ready(): def install(): if not device_found(): - print "No device, installing...." + print("No device, installing....") status = system_install() if status: if FORCE == 0: - return status + return status status, output = exec_cmd("pip3 install /usr/share/sonic/device/x86_64-quanta_ix9_bwde-r0/sonic_platform-1.0-py3-none-any.whl",1) if status: - print output - if FORCE == 0: - return status + print(output) + if FORCE == 0: + return status else: - print " ix9 driver already installed...." + print(" ix9 driver already installed....") return def uninstall(): global FORCE #uninstall drivers for i in range(len(un_drivers) - 1, -1, -1): - status, output = exec_cmd("rmmod " + un_drivers[i], 1) + status, output = exec_cmd("rmmod " + un_drivers[i], 1) if status: - print output - if FORCE == 0: - return status + print(output) + if FORCE == 0: + return status status, output = exec_cmd("pip3 uninstall sonic-platform -y ",1) if status: - print output - if FORCE == 0: - return status + print(output) + if FORCE == 0: + return status return