From 4b33a41ddbb3dc745a41248070f02d69e21ddf46 Mon Sep 17 00:00:00 2001 From: wangjue Date: Mon, 11 Nov 2024 15:29:45 +0800 Subject: [PATCH] Enable Orange LED to indicate if dimm is present Signed-off-by: wangjue --- fault-monitor/fru-fault-monitor.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fault-monitor/fru-fault-monitor.cpp b/fault-monitor/fru-fault-monitor.cpp index fffb6f7..aa7b8cc 100644 --- a/fault-monitor/fru-fault-monitor.cpp +++ b/fault-monitor/fru-fault-monitor.cpp @@ -42,7 +42,7 @@ static constexpr auto logService = "xyz.openbmc_project.Logging"; #define SET_GREEN_LED(x) (~(uint8_t(1 << (x*2)))) #define SET_RED_LED(x) (~(uint8_t(1 << (x*2 + 1)))) -#define SET_ORANGE_LED(x) (SET_GREEN_LED(x) | SET_RED_LED(x)) +#define SET_ORANGE_LED(x) (SET_GREEN_LED(x) & SET_RED_LED(x)) #define UNSET_GREEN_LED(x) (uint8_t(1 << (x*2))) #define UNSET_RED_LED(x) (uint8_t(1 << (x*2 + 1))) #define SET_LED_OFF(x) ((uint8_t(1 << (x*2))) | (uint8_t(1 << (x*2+1)))) @@ -1008,10 +1008,6 @@ void Add::updateDimmLed(int cpuId, int dimmRank, std::string ledState) int ret = -1; std::string i2cBus = "/dev/i2c-5"; - if constexpr (debug) { - std::cout << "cpuId: " << cpuId << " dimmrank: " << dimmRank << " ledState: " << ledState <= 3) { @@ -1041,11 +1037,16 @@ void Add::updateDimmLed(int cpuId, int dimmRank, std::string ledState) wdata = (readBuf[0] & SET_RED_LED(ledSlot)) | UNSET_GREEN_LED(ledSlot); else if(ledState == "OFF") wdata = readBuf[0] | SET_LED_OFF(ledSlot); - else if(ledState == "WAR") - wdata = readBuf[0] | SET_LED_OFF(ledSlot); + else if(ledState == "NA") + wdata = readBuf[0] & SET_ORANGE_LED(ledSlot); else std::cerr << " Invalid DIMM CPU" << cpuId << " rank" << dimmRank << " LED State " << ledState << "\n"; + if constexpr (debug) { + std::cout << "cpuId: " << cpuId << " dimmrank: " << dimmRank << " ledState: " << ledState << " wdata:" + << (int)wdata <