summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAppaRao Puli <apparao.puli@linux.intel.com>2019-10-09 15:34:22 +0300
committerPuli, Apparao <apparao.puli@intel.com>2019-10-14 21:00:16 +0300
commitbcd0161bbf097e4dc6721901fd387f183b8f183e (patch)
tree8825a191aca6e80d2881e0a4130a210d6bbaf2fe
parent687dbaa1d412ab795ed72313573c8a3f76bb39d8 (diff)
downloadprovingground-bcd0161bbf097e4dc6721901fd387f183b8f183e.tar.xz
PFR: PFR manager ad-hoc fixes
PFR manager miscellaneous fixes - Updated redfish EventLog ID and Args. - Updated panic/recovery reasons as per new spec. - Corrected referrence pointer in readCpldReg function. Tested: Loaded image in wht and validate Redfish event logs Change-Id: I4bccbfe650271bcfcc24037c50d385c5fa17dbf1 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
-rw-r--r--intel-pfr-manager/libpfr/inc/pfr.hpp3
-rw-r--r--intel-pfr-manager/libpfr/src/pfr.cpp10
-rw-r--r--intel-pfr-manager/service/src/mainapp.cpp67
3 files changed, 41 insertions, 39 deletions
diff --git a/intel-pfr-manager/libpfr/inc/pfr.hpp b/intel-pfr-manager/libpfr/inc/pfr.hpp
index cd1b4f2..42af3f7 100644
--- a/intel-pfr-manager/libpfr/inc/pfr.hpp
+++ b/intel-pfr-manager/libpfr/inc/pfr.hpp
@@ -41,9 +41,10 @@ enum class ActionType
minorError
};
+std::string toHexString(const uint8_t val);
std::string getVersionInfoCPLD(ImageType &imgType);
int getProvisioningStatus(bool &ufmLocked, bool &ufmProvisioned);
-int readCpldReg(const ActionType &action, uint8_t value);
+int readCpldReg(const ActionType &action, uint8_t &value);
int setBMCBootCheckpoint(const uint8_t checkPoint);
} // namespace pfr
diff --git a/intel-pfr-manager/libpfr/src/pfr.cpp b/intel-pfr-manager/libpfr/src/pfr.cpp
index c30ef5b..955b6d7 100644
--- a/intel-pfr-manager/libpfr/src/pfr.cpp
+++ b/intel-pfr-manager/libpfr/src/pfr.cpp
@@ -54,11 +54,11 @@ static constexpr uint8_t bmcRecoveryMinorVersion = 0x1F;
static constexpr uint8_t ufmLockedMask = (0x1 << 0x04);
static constexpr uint8_t ufmProvisionedMask = (0x1 << 0x05);
-template <typename T> std::string int_to_hexstring(T i)
+std::string toHexString(const uint8_t val)
{
std::stringstream stream;
- stream << std::setfill('0') << std::setw(sizeof(T) * 2) << std::hex
- << static_cast<int>(i);
+ stream << std::setfill('0') << std::setw(2) << std::hex
+ << static_cast<int>(val);
return stream.str();
}
@@ -110,7 +110,7 @@ std::string getVersionInfoCPLD(ImageType& imgType)
uint8_t majorVer = cpldDev.i2cReadByteData(majorReg);
uint8_t minorVer = cpldDev.i2cReadByteData(minorReg);
std::string version =
- int_to_hexstring(majorVer) + "." + int_to_hexstring(minorVer);
+ toHexString(majorVer) + "." + toHexString(minorVer);
return version;
}
catch (const std::exception& e)
@@ -141,7 +141,7 @@ int getProvisioningStatus(bool& ufmLocked, bool& ufmProvisioned)
}
}
-int readCpldReg(const ActionType& action, uint8_t value)
+int readCpldReg(const ActionType& action, uint8_t& value)
{
uint8_t cpldReg;
diff --git a/intel-pfr-manager/service/src/mainapp.cpp b/intel-pfr-manager/service/src/mainapp.cpp
index 103ab22..ae92f65 100644
--- a/intel-pfr-manager/service/src/mainapp.cpp
+++ b/intel-pfr-manager/service/src/mainapp.cpp
@@ -56,33 +56,32 @@ static std::vector<std::tuple<std::string, ImageType, std::string>>
static std::map<uint8_t, std::string> recoveryReasonMap = {
{0x01, "PCH active authentication failure"},
{0x02, "PCH recovery authentication failure"},
- {0x03, "ACM launch failure"},
- {0x04, "IBB launch failure"},
- {0x05, "OBB launch failure"},
- {0x06, "BMC active authentication failure"},
- {0x07, "BMC recovery authentication failure"},
- {0x08, "BMC launch failure"},
- {0x09, "CPLD watchdog expired"}};
+ {0x03, "ME launch failure"},
+ {0x04, "ACM launch failure"},
+ {0x05, "IBB launch failure"},
+ {0x06, "OBB launch failure"},
+ {0x07, "BMC active authentication failure"},
+ {0x08, "BMC recovery authentication failure"},
+ {0x09, "BMC launch failure"},
+ {0x0A, "CPLD watchdog expired"}};
// Panic Reason map. { <CPLD association>, <Panic reason> }
static std::map<uint8_t, std::string> panicReasonMap = {
- {0x01, "CPLD WDT expired"},
- {0x02, "BMC WDT expired"},
- {0x03, "ME WDT expired"},
- {0x04, "ACM WDT expired"},
- {0x05, "IBB WDT expired"},
- {0x06, "OBB WDT expired"},
+ {0x01, "CPLD watchdog expired"},
+ {0x02, "BMC watchdog expired"},
+ {0x03, "ME watchdog expired"},
+ {0x04, "ACM watchdog expired"},
+ {0x05, "IBB watchdog expired"},
+ {0x06, "OBB watchdog expired"},
{0x07, "BMC active authentication failure"},
{0x08, "BMC recovery authentication failure"},
{0x09, "PCH active authentication failure"},
{0x0A, "PCH recovery authentication failure"},
- {0x0B, "IBB authentication failure"},
- {0x0C, "OBB authentication failure"},
- {0x0D, "BMC authentication failure"},
- {0x0E, "PCH active update intent"},
- {0x0F, "BMC active update intent"},
- {0x10, "PCH recovery update intent"},
- {0x11, "BMC recovery update intent"}};
+ {0x0B, "ME authentication failure"},
+ {0x0C, "ACM or IBB or OBB authentication failure"},
+ {0x0D, "PCH update intent"},
+ {0x0E, "BMC update intent"},
+ {0x0F, "BMC reset detected"}};
static void updateDbusPropertiesCache()
{
@@ -115,10 +114,10 @@ static void logLastRecoveryEvent()
return;
}
- sd_journal_send("MESSAGE=%s", "Platform firmware recovered.", "PRIORITY=%i",
- LOG_ERR, "REDFISH_MESSAGE_ID=%s",
- "OpenBMC.0.1.PlatformFWRecovered",
- "REDFISH_MESSAGE_ARGS=%s", it->second.c_str(), NULL);
+ sd_journal_send(
+ "MESSAGE=%s", "Platform firmware recovered.", "PRIORITY=%i", LOG_ERR,
+ "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.PlatformFirmwareEvent",
+ "REDFISH_MESSAGE_ARGS=%s,%s", "recovery", it->second.c_str(), NULL);
}
static void logLastPanicEvent()
@@ -138,10 +137,10 @@ static void logLastPanicEvent()
return;
}
- sd_journal_send("MESSAGE=%s", "Platform panic event triggered.",
- "PRIORITY=%i", LOG_ERR, "REDFISH_MESSAGE_ID=%s",
- "OpenBMC.0.1.PlatformFWPanicTriggered",
- "REDFISH_MESSAGE_ARGS=%s", it->second.c_str(), NULL);
+ sd_journal_send(
+ "MESSAGE=%s", "Platform panic event triggered.", "PRIORITY=%i", LOG_ERR,
+ "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.PlatformFirmwareEvent",
+ "REDFISH_MESSAGE_ARGS=%s,%s", "panic", it->second.c_str(), NULL);
}
static void checkAndLogEvents()
@@ -184,11 +183,13 @@ static void checkAndLogEvents()
if (majorErr || minorErr)
{
- sd_journal_send(
- "MESSAGE=%s", "Error occurred on platform firmware.",
- "PRIORITY=%i", LOG_ERR, "REDFISH_MESSAGE_ID=%s",
- "OpenBMC.0.1.PlatformFWErrorOccurred",
- "REDFISH_MESSAGE_ARGS=%i,%i", majorErr, minorErr, NULL);
+ std::string errorStr =
+ toHexString(majorErr) + "." + toHexString(minorErr);
+ sd_journal_send("MESSAGE=%s",
+ "Error occurred on platform firmware.",
+ "PRIORITY=%i", LOG_ERR, "REDFISH_MESSAGE_ID=%s",
+ "OpenBMC.0.1.PlatformFirmwareError",
+ "REDFISH_MESSAGE_ARGS=%s", errorStr, NULL);
}
}
}