Skip to content

Commit f570322

Browse files
committed
[crorc] Fix CRORC QSFP status addressing
1 parent 49477fa commit f570322

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

src/Crorc/Constants.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,10 @@ static constexpr uint32_t SIU_RANDCIFST(0x00000002);
399399
static constexpr uint32_t LINK_DOWN(0x00002000);
400400

401401
// Registers containing Optical Power information
402-
static constexpr IntervalRegister OPT_POWER_QSFP0(0x00000144, 0x4);
403-
static constexpr IntervalRegister OPT_POWER_QSFP1(0x00000158, 0x4);
402+
// Odd link number, bits [31-16], even link number bits [15-0]
403+
static constexpr Register OPT_POWER_QSFP10(0x00000144);
404+
static constexpr Register OPT_POWER_QSFP32(0x00000148);
405+
static constexpr Register OPT_POWER_QSFP54(0x00000158);
404406

405407
// Registers for RX FIFO configuration
406408
static constexpr Register RX_FIFO_ADDR_LOW(0x00000038);

src/Crorc/CrorcBar.cxx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,22 @@ void CrorcBar::getOpticalPowers(std::map<int, Crorc::Link>& linkMap)
232232
for (auto& el : linkMap) {
233233
auto linkNo = el.first;
234234
auto& link = el.second;
235-
if (linkNo < 4) {
236-
link.opticalPower = readRegister(Crorc::Registers::OPT_POWER_QSFP0.get(linkNo).index) & 0xffff;
235+
236+
uint32_t opt;
237+
238+
if (linkNo < 2) {
239+
opt = readRegister(Crorc::Registers::OPT_POWER_QSFP10.index);
240+
} else if (linkNo < 4) {
241+
opt = readRegister(Crorc::Registers::OPT_POWER_QSFP32.index);
242+
} else {
243+
opt = readRegister(Crorc::Registers::OPT_POWER_QSFP54.index);
244+
}
245+
if (linkNo % 2 == 0) {
246+
opt &= 0xffff;
237247
} else {
238-
link.opticalPower = readRegister(Crorc::Registers::OPT_POWER_QSFP1.get(linkNo % 4).index) & 0xffff;
248+
opt = (opt & 0xffff0000) >> 16;
239249
}
240-
link.opticalPower /= 10;
250+
link.opticalPower = opt / 10;
241251
}
242252
}
243253

0 commit comments

Comments
 (0)