Add GPU error logging functions
Add functions to log the GPU PGOOD and overtemp
errors.
Change-Id: I6f58d76883f8a78a3301481dbacd111c74b396d4
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/elog-errors.hpp b/elog-errors.hpp
index 676d754..3f7936e 100644
--- a/elog-errors.hpp
+++ b/elog-errors.hpp
@@ -41,6 +41,26 @@
{
namespace Error
{
+ struct PowerSequencerFault;
+} // namespace Error
+} // namespace Fault
+} // namespace Power
+} // namespace openbmc_project
+} // namespace xyz
+} // namespace sdbusplus
+
+namespace sdbusplus
+{
+namespace xyz
+{
+namespace openbmc_project
+{
+namespace Power
+{
+namespace Fault
+{
+namespace Error
+{
struct PowerSequencerPGOODFault;
} // namespace Error
} // namespace Fault
@@ -61,7 +81,7 @@
{
namespace Error
{
- struct PowerSequencerVoltageFault;
+ struct GPUPowerFault;
} // namespace Error
} // namespace Fault
} // namespace Power
@@ -81,7 +101,27 @@
{
namespace Error
{
- struct PowerSequencerFault;
+ struct GPUOverTemp;
+} // namespace Error
+} // namespace Fault
+} // namespace Power
+} // namespace openbmc_project
+} // namespace xyz
+} // namespace sdbusplus
+
+namespace sdbusplus
+{
+namespace xyz
+{
+namespace openbmc_project
+{
+namespace Power
+{
+namespace Fault
+{
+namespace Error
+{
+ struct PowerSequencerVoltageFault;
} // namespace Error
} // namespace Fault
} // namespace Power
@@ -369,6 +409,118 @@
}
+namespace xyz
+{
+namespace openbmc_project
+{
+namespace Power
+{
+namespace Fault
+{
+namespace _GPUPowerFault
+{
+
+struct RAW_STATUS
+{
+ static constexpr auto str = "RAW_STATUS=%s";
+ static constexpr auto str_short = "RAW_STATUS";
+ using type = std::tuple<std::decay_t<decltype(str)>,const char*>;
+ explicit constexpr RAW_STATUS(const char* a) : _entry(entry(str, a)) {};
+ type _entry;
+};
+struct GPU
+{
+ static constexpr auto str = "GPU=%s";
+ static constexpr auto str_short = "GPU";
+ using type = std::tuple<std::decay_t<decltype(str)>,const char*>;
+ explicit constexpr GPU(const char* a) : _entry(entry(str, a)) {};
+ type _entry;
+};
+
+} // namespace _GPUPowerFault
+
+struct GPUPowerFault
+{
+ static constexpr auto L = level::ERR;
+ using RAW_STATUS = _GPUPowerFault::RAW_STATUS;
+ using GPU = _GPUPowerFault::GPU;
+ using metadata_types = std::tuple<RAW_STATUS, GPU>;
+
+};
+
+} // namespace Fault
+} // namespace Power
+} // namespace openbmc_project
+} // namespace xyz
+
+
+namespace details
+{
+
+template <>
+struct map_exception_type<sdbusplus::xyz::openbmc_project::Power::Fault::Error::GPUPowerFault>
+{
+ using type = xyz::openbmc_project::Power::Fault::GPUPowerFault;
+};
+
+}
+
+namespace xyz
+{
+namespace openbmc_project
+{
+namespace Power
+{
+namespace Fault
+{
+namespace _GPUOverTemp
+{
+
+struct RAW_STATUS
+{
+ static constexpr auto str = "RAW_STATUS=%s";
+ static constexpr auto str_short = "RAW_STATUS";
+ using type = std::tuple<std::decay_t<decltype(str)>,const char*>;
+ explicit constexpr RAW_STATUS(const char* a) : _entry(entry(str, a)) {};
+ type _entry;
+};
+struct GPU
+{
+ static constexpr auto str = "GPU=%s";
+ static constexpr auto str_short = "GPU";
+ using type = std::tuple<std::decay_t<decltype(str)>,const char*>;
+ explicit constexpr GPU(const char* a) : _entry(entry(str, a)) {};
+ type _entry;
+};
+
+} // namespace _GPUOverTemp
+
+struct GPUOverTemp
+{
+ static constexpr auto L = level::ERR;
+ using RAW_STATUS = _GPUOverTemp::RAW_STATUS;
+ using GPU = _GPUOverTemp::GPU;
+ using metadata_types = std::tuple<RAW_STATUS, GPU>;
+
+};
+
+} // namespace Fault
+} // namespace Power
+} // namespace openbmc_project
+} // namespace xyz
+
+
+namespace details
+{
+
+template <>
+struct map_exception_type<sdbusplus::xyz::openbmc_project::Power::Fault::Error::GPUOverTemp>
+{
+ using type = xyz::openbmc_project::Power::Fault::GPUOverTemp;
+};
+
+}
+
} // namespace logging
diff --git a/power-sequencer/ucd90160.cpp b/power-sequencer/ucd90160.cpp
index c819d66..8317837 100644
--- a/power-sequencer/ucd90160.cpp
+++ b/power-sequencer/ucd90160.cpp
@@ -283,5 +283,31 @@
return gpioDevicePath;
}
+void UCD90160::gpuPGOODError(const std::string& callout)
+{
+ util::NamesValues nv;
+ nv.add("STATUS_WORD", readStatusWord());
+ nv.add("MFR_STATUS", readMFRStatus());
+
+ using metadata = xyz::openbmc_project::Power::Fault::GPUPowerFault;
+
+ report<GPUPowerFault>(
+ metadata::RAW_STATUS(nv.get().c_str()),
+ metadata::GPU(callout.c_str()));
+}
+
+void UCD90160::gpuOverTempError(const std::string& callout)
+{
+ util::NamesValues nv;
+ nv.add("STATUS_WORD", readStatusWord());
+ nv.add("MFR_STATUS", readMFRStatus());
+
+ using metadata = xyz::openbmc_project::Power::Fault::GPUOverTemp;
+
+ report<GPUOverTemp>(
+ metadata::RAW_STATUS(nv.get().c_str()),
+ metadata::GPU(callout.c_str()));
+}
+
}
}
diff --git a/power-sequencer/ucd90160.hpp b/power-sequencer/ucd90160.hpp
index e470614..cf4baad 100644
--- a/power-sequencer/ucd90160.hpp
+++ b/power-sequencer/ucd90160.hpp
@@ -61,6 +61,20 @@
private:
/**
+ * Reports an error for a GPU PGOOD failure
+ *
+ * @param[in] callout - the GPU callout string
+ */
+ void gpuPGOODError(const std::string& callout);
+
+ /**
+ * Reports an error for a GPU OverTemp failure
+ *
+ * @param[in] callout - the GPU callout string
+ */
+ void gpuOverTempError(const std::string& callout);
+
+ /**
* Given the device path for a chip, find its gpiochip
* path
*