Start using .clang-format
Used the one from docs/style/cpp.
Change-Id: I3bdc2b353bf18a437266b362d8205b8463a9ce2b
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/power-sequencer/argument.cpp b/power-sequencer/argument.cpp
index 4e80c53..5325256 100644
--- a/power-sequencer/argument.cpp
+++ b/power-sequencer/argument.cpp
@@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include "argument.hpp"
+
+#include <algorithm>
#include <iostream>
#include <iterator>
-#include <algorithm>
-#include "argument.hpp"
namespace witherspoon
{
@@ -37,11 +38,10 @@
std::cerr << std::flush;
}
-const option ArgumentParser::options[] =
-{
- {"action", required_argument, NULL, 'a'},
+const option ArgumentParser::options[] = {
+ {"action", required_argument, NULL, 'a'},
{"interval", required_argument, NULL, 'i'},
- {"help", no_argument, NULL, 'h'},
+ {"help", no_argument, NULL, 'h'},
{0, 0, 0, 0},
};
@@ -86,5 +86,5 @@
const std::string ArgumentParser::trueString = "true";
const std::string ArgumentParser::emptyString = "";
-}
-}
+} // namespace power
+} // namespace witherspoon
diff --git a/power-sequencer/main.cpp b/power-sequencer/main.cpp
index e383fc1..3e1ca52 100644
--- a/power-sequencer/main.cpp
+++ b/power-sequencer/main.cpp
@@ -13,15 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <chrono>
-#include <iostream>
-#include <phosphor-logging/log.hpp>
-#include <sdeventplus/event.hpp>
#include "argument.hpp"
#include "pgood_monitor.hpp"
#include "runtime_monitor.hpp"
#include "ucd90160.hpp"
+#include <chrono>
+#include <iostream>
+#include <phosphor-logging/log.hpp>
+#include <sdeventplus/event.hpp>
+
using namespace witherspoon::power;
using namespace phosphor::logging;
@@ -46,7 +47,7 @@
std::chrono::milliseconds interval{i};
- auto event = sdeventplus::Event::get_default();
+ auto event = sdeventplus::Event::get_default();
auto bus = sdbusplus::bus::new_default();
bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
@@ -56,17 +57,17 @@
if (action == "pgood-monitor")
{
- //If PGOOD doesn't turn on within a certain
- //time, analyze the device for errors
- monitor = std::make_unique<PGOODMonitor>(
- std::move(device), bus, event, interval);
+ // If PGOOD doesn't turn on within a certain
+ // time, analyze the device for errors
+ monitor = std::make_unique<PGOODMonitor>(std::move(device), bus, event,
+ interval);
}
- else //runtime-monitor
+ else // runtime-monitor
{
- //Continuously monitor this device both by polling
- //and on 'power lost' signals.
- monitor = std::make_unique<RuntimeMonitor>(
- std::move(device), bus, event, interval);
+ // Continuously monitor this device both by polling
+ // and on 'power lost' signals.
+ monitor = std::make_unique<RuntimeMonitor>(std::move(device), bus,
+ event, interval);
}
return monitor->run();
diff --git a/power-sequencer/pgood_monitor.cpp b/power-sequencer/pgood_monitor.cpp
index 29382c9..98c3faa 100644
--- a/power-sequencer/pgood_monitor.cpp
+++ b/power-sequencer/pgood_monitor.cpp
@@ -13,13 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <phosphor-logging/log.hpp>
-#include <org/open_power/Witherspoon/Fault/error.hpp>
#include "config.h"
-#include "elog-errors.hpp"
+
#include "pgood_monitor.hpp"
+
+#include "elog-errors.hpp"
#include "utility.hpp"
+#include <org/open_power/Witherspoon/Fault/error.hpp>
+#include <phosphor-logging/log.hpp>
+
namespace witherspoon
{
namespace power
@@ -37,26 +40,16 @@
int32_t state = 0;
int32_t pgood = 0;
- auto service = util::getService(POWER_OBJ_PATH,
- POWER_INTERFACE,
- bus);
+ auto service = util::getService(POWER_OBJ_PATH, POWER_INTERFACE, bus);
- util::getProperty<int32_t>(POWER_INTERFACE,
- "pgood",
- POWER_OBJ_PATH,
- service,
- bus,
- pgood);
+ util::getProperty<int32_t>(POWER_INTERFACE, "pgood", POWER_OBJ_PATH,
+ service, bus, pgood);
- //When state = 1, system was switched on
- util::getProperty<int32_t>(POWER_INTERFACE,
- "state",
- POWER_OBJ_PATH,
- service,
- bus,
- state);
+ // When state = 1, system was switched on
+ util::getProperty<int32_t>(POWER_INTERFACE, "state", POWER_OBJ_PATH,
+ service, bus, state);
- //On but no PGOOD
+ // On but no PGOOD
if (state && !pgood)
{
pending = true;
@@ -65,13 +58,12 @@
return pending;
}
-
void PGOODMonitor::analyze()
{
- //Timer callback.
- //The timer expired before it was stopped.
- //If PGOOD is still pending (it should be),
- //then there is a real failure.
+ // Timer callback.
+ // The timer expired before it was stopped.
+ // If PGOOD is still pending (it should be),
+ // then there is a real failure.
if (pgoodPending())
{
@@ -81,18 +73,18 @@
report<PowerOnFailure>();
}
- //The pgood-wait service (with a longer timeout)
- //will handle powering off the system.
+ // The pgood-wait service (with a longer timeout)
+ // will handle powering off the system.
timer.get_event().exit(EXIT_SUCCESS);
}
void PGOODMonitor::propertyChanged()
{
- //Multiple properties could have changed here.
- //Keep things simple and just recheck the important ones.
+ // Multiple properties could have changed here.
+ // Keep things simple and just recheck the important ones.
if (!pgoodPending())
{
- //PGOOD is on, or system is off, so we are done.
+ // PGOOD is on, or system is off, so we are done.
timer.get_event().exit(EXIT_SUCCESS);
}
}
@@ -100,11 +92,10 @@
void PGOODMonitor::startListening()
{
match = std::make_unique<sdbusplus::bus::match_t>(
- bus,
- sdbusplus::bus::match::rules::propertiesChanged(
- POWER_OBJ_PATH,
- POWER_INTERFACE),
- [this](auto& msg){this->propertyChanged();});
+ bus,
+ sdbusplus::bus::match::rules::propertiesChanged(POWER_OBJ_PATH,
+ POWER_INTERFACE),
+ [this](auto& msg) { this->propertyChanged(); });
}
int PGOODMonitor::run()
@@ -113,9 +104,9 @@
{
startListening();
- //If PGOOD came up before we got here, we're done.
- //Otherwise if PGOOD doesn't get asserted before
- //the timer expires, it's a failure.
+ // If PGOOD came up before we got here, we're done.
+ // Otherwise if PGOOD doesn't get asserted before
+ // the timer expires, it's a failure.
if (!pgoodPending())
{
return EXIT_SUCCESS;
@@ -129,10 +120,9 @@
log<level::ERR>("Unexpected failure prevented PGOOD checking");
}
- //Letting the service fail won't help anything, so don't do it.
+ // Letting the service fail won't help anything, so don't do it.
return EXIT_SUCCESS;
}
-
-}
-}
+} // namespace power
+} // namespace witherspoon
diff --git a/power-sequencer/pgood_monitor.hpp b/power-sequencer/pgood_monitor.hpp
index ec8e05e..7dbabf9 100644
--- a/power-sequencer/pgood_monitor.hpp
+++ b/power-sequencer/pgood_monitor.hpp
@@ -1,10 +1,11 @@
#pragma once
+#include "device.hpp"
+#include "device_monitor.hpp"
+
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server.hpp>
#include <sdeventplus/event.hpp>
-#include "device.hpp"
-#include "device_monitor.hpp"
namespace witherspoon
{
@@ -25,88 +26,85 @@
*/
class PGOODMonitor : public DeviceMonitor
{
- public:
+ public:
+ PGOODMonitor() = delete;
+ ~PGOODMonitor() = default;
+ PGOODMonitor(const PGOODMonitor&) = delete;
+ PGOODMonitor& operator=(const PGOODMonitor&) = delete;
+ PGOODMonitor(PGOODMonitor&&) = delete;
+ PGOODMonitor& operator=(PGOODMonitor&&) = delete;
- PGOODMonitor() = delete;
- ~PGOODMonitor() = default;
- PGOODMonitor(const PGOODMonitor&) = delete;
- PGOODMonitor& operator=(const PGOODMonitor&) = delete;
- PGOODMonitor(PGOODMonitor&&) = delete;
- PGOODMonitor& operator=(PGOODMonitor&&) = delete;
+ /**
+ * Constructor
+ *
+ * @param[in] d - the device to monitor
+ * @param[in] b - D-Bus bus object
+ * @param[in] e - event object
+ * @param[in] t - time to allow PGOOD to come up
+ */
+ PGOODMonitor(std::unique_ptr<witherspoon::power::Device>&& d,
+ sdbusplus::bus::bus& b, const sdeventplus::Event& e,
+ std::chrono::milliseconds& t) :
+ DeviceMonitor(std::move(d), e, t),
+ bus(b)
+ {
+ }
- /**
- * Constructor
- *
- * @param[in] d - the device to monitor
- * @param[in] b - D-Bus bus object
- * @param[in] e - event object
- * @param[in] t - time to allow PGOOD to come up
- */
- PGOODMonitor(std::unique_ptr<witherspoon::power::Device>&& d,
- sdbusplus::bus::bus& b,
- const sdeventplus::Event& e,
- std::chrono::milliseconds& t) :
- DeviceMonitor(std::move(d), e, t),
- bus(b)
- {
- }
+ /**
+ * Analyzes the power sequencer for fails and then
+ * notifies the event loop that it can exit.
+ *
+ * The timer callback.
+ */
+ void analyze() override;
- /**
- * Analyzes the power sequencer for fails and then
- * notifies the event loop that it can exit.
- *
- * The timer callback.
- */
- void analyze() override;
+ /**
+ * Waits a specified amount of time for PGOOD to
+ * come on, and if it fails to come on in that time
+ * it will analyze the power sequencer for faults.
+ *
+ * It will exit after either PGOOD is asserted or
+ * the device is analyzed for faults.
+ *
+ * @return - the return value from sd_event_loop()
+ */
+ int run() override;
- /**
- * Waits a specified amount of time for PGOOD to
- * come on, and if it fails to come on in that time
- * it will analyze the power sequencer for faults.
- *
- * It will exit after either PGOOD is asserted or
- * the device is analyzed for faults.
- *
- * @return - the return value from sd_event_loop()
- */
- int run() override;
+ private:
+ /**
+ * Enables the properties changed signal callback
+ * on the power object so we can tell when PGOOD
+ * comes on.
+ */
+ void startListening();
- private:
+ /**
+ * The callback function for the properties changed
+ * signal.
+ */
+ void propertyChanged();
- /**
- * Enables the properties changed signal callback
- * on the power object so we can tell when PGOOD
- * comes on.
- */
- void startListening();
+ /**
+ * Returns true if the system has been turned on
+ * but PGOOD isn't up yet.
+ */
+ bool pgoodPending();
- /**
- * The callback function for the properties changed
- * signal.
- */
- void propertyChanged();
+ /**
+ * Used to break out of the event loop in run()
+ */
+ void exitEventLoop();
- /**
- * Returns true if the system has been turned on
- * but PGOOD isn't up yet.
- */
- bool pgoodPending();
+ /**
+ * The D-Bus object
+ */
+ sdbusplus::bus::bus& bus;
- /**
- * Used to break out of the event loop in run()
- */
- void exitEventLoop();
-
- /**
- * The D-Bus object
- */
- sdbusplus::bus::bus& bus;
-
- /**
- * The match object for the properties changed signal
- */
- std::unique_ptr<sdbusplus::bus::match_t> match;
+ /**
+ * The match object for the properties changed signal
+ */
+ std::unique_ptr<sdbusplus::bus::match_t> match;
};
-}
-}
+} // namespace power
+} // namespace witherspoon
diff --git a/power-sequencer/runtime_monitor.cpp b/power-sequencer/runtime_monitor.cpp
index 514ba8f..5d17eb9 100644
--- a/power-sequencer/runtime_monitor.cpp
+++ b/power-sequencer/runtime_monitor.cpp
@@ -13,12 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include "config.h"
+
+#include "runtime_monitor.hpp"
+
+#include "elog-errors.hpp"
+#include "utility.hpp"
+
#include <org/open_power/Witherspoon/Fault/error.hpp>
#include <phosphor-logging/log.hpp>
-#include "config.h"
-#include "elog-errors.hpp"
-#include "runtime_monitor.hpp"
-#include "utility.hpp"
namespace witherspoon
{
@@ -48,18 +51,18 @@
#ifdef UCD90160_DEVICE_ACCESS
device->onFailure();
#endif
- //Note: This application only runs when the system has
- //power, so it will be killed by systemd sometime shortly
- //after this power off is issued.
+ // Note: This application only runs when the system has
+ // power, so it will be killed by systemd sometime shortly
+ // after this power off is issued.
util::powerOff<Shutdown>(bus);
}
catch (std::exception& e)
{
- //No need to crash
+ // No need to crash
log<level::ERR>(e.what());
}
}
-}
-}
+} // namespace power
+} // namespace witherspoon
diff --git a/power-sequencer/runtime_monitor.hpp b/power-sequencer/runtime_monitor.hpp
index fb3dcb1..934aef1 100644
--- a/power-sequencer/runtime_monitor.hpp
+++ b/power-sequencer/runtime_monitor.hpp
@@ -1,10 +1,11 @@
#pragma once
+#include "device.hpp"
+#include "device_monitor.hpp"
+
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server.hpp>
#include <sdeventplus/event.hpp>
-#include "device.hpp"
-#include "device_monitor.hpp"
namespace witherspoon
{
@@ -31,83 +32,76 @@
*/
class RuntimeMonitor : public DeviceMonitor
{
- public:
+ public:
+ RuntimeMonitor() = delete;
+ ~RuntimeMonitor() = default;
+ RuntimeMonitor(const RuntimeMonitor&) = delete;
+ RuntimeMonitor& operator=(const RuntimeMonitor&) = delete;
+ RuntimeMonitor(RuntimeMonitor&&) = delete;
+ RuntimeMonitor& operator=(RuntimeMonitor&&) = delete;
- RuntimeMonitor() = delete;
- ~RuntimeMonitor() = default;
- RuntimeMonitor(const RuntimeMonitor&) = delete;
- RuntimeMonitor& operator=(const RuntimeMonitor&) = delete;
- RuntimeMonitor(RuntimeMonitor&&) = delete;
- RuntimeMonitor& operator=(RuntimeMonitor&&) = delete;
+ /**
+ * Constructor
+ *
+ * @param[in] d - the device to monitor
+ * @param[in] b - D-Bus bus object
+ * @param[in] e - event object
+ * @param[in] i - poll interval
+ */
+ RuntimeMonitor(std::unique_ptr<witherspoon::power::Device>&& d,
+ sdbusplus::bus::bus& b, const sdeventplus::Event& e,
+ std::chrono::milliseconds& i) :
+ DeviceMonitor(std::move(d), e, i),
+ bus(b), match(bus, getMatchString(),
+ std::bind(std::mem_fn(&RuntimeMonitor::onPowerLost), this,
+ std::placeholders::_1))
+ {
+ }
- /**
- * Constructor
- *
- * @param[in] d - the device to monitor
- * @param[in] b - D-Bus bus object
- * @param[in] e - event object
- * @param[in] i - poll interval
- */
- RuntimeMonitor(std::unique_ptr<witherspoon::power::Device>&& d,
- sdbusplus::bus::bus& b,
- const sdeventplus::Event& e,
- std::chrono::milliseconds& i) :
- DeviceMonitor(std::move(d), e, i),
- bus(b),
- match(bus,
- getMatchString(),
- std::bind(std::mem_fn(&RuntimeMonitor::onPowerLost),
- this, std::placeholders::_1))
- {
- }
+ /**
+ * Clears faults and then runs DeviceMonitor::run to
+ * call Device::analyze() on an ongoing interval.
+ *
+ * @return the return value from sd_event_loop()
+ */
+ int run() override;
- /**
- * Clears faults and then runs DeviceMonitor::run to
- * call Device::analyze() on an ongoing interval.
- *
- * @return the return value from sd_event_loop()
- */
- int run() override;
+ private:
+ /**
+ * The PowerLost signal handler.
+ *
+ * After doing an analysis, will issue a power off
+ * as some device has a power fault and needs to be
+ * properly shut down.
+ *
+ * @param[in] msg - D-Bus message for callback
+ */
+ void onPowerLost(sdbusplus::message::message& msg);
- private:
+ /**
+ * Returns the match string for the PowerLost signal
+ */
+ std::string getMatchString()
+ {
+ using namespace sdbusplus::bus::match::rules;
- /**
- * The PowerLost signal handler.
- *
- * After doing an analysis, will issue a power off
- * as some device has a power fault and needs to be
- * properly shut down.
- *
- * @param[in] msg - D-Bus message for callback
- */
- void onPowerLost(sdbusplus::message::message& msg);
+ std::string s = type::signal() + path("/org/openbmc/control/power0") +
+ interface("org.openbmc.control.Power") +
+ member("PowerLost");
- /**
- * Returns the match string for the PowerLost signal
- */
- std::string getMatchString()
- {
- using namespace sdbusplus::bus::match::rules;
+ return s;
+ }
- std::string s =
- type::signal() +
- path("/org/openbmc/control/power0") +
- interface("org.openbmc.control.Power") +
- member("PowerLost");
+ /**
+ * The D-Bus object
+ */
+ sdbusplus::bus::bus& bus;
- return s;
- }
-
- /**
- * The D-Bus object
- */
- sdbusplus::bus::bus& bus;
-
- /**
- * Match object for PowerLost signals
- */
- sdbusplus::bus::match_t match;
+ /**
+ * Match object for PowerLost signals
+ */
+ sdbusplus::bus::match_t match;
};
-}
-}
+} // namespace power
+} // namespace witherspoon
diff --git a/power-sequencer/types.hpp b/power-sequencer/types.hpp
index c473828..fcb30e3 100644
--- a/power-sequencer/types.hpp
+++ b/power-sequencer/types.hpp
@@ -34,8 +34,8 @@
*/
enum class optionFlags
{
- none = 0,
- shutdownOnFault = 1
+ none = 0,
+ shutdownOnFault = 1
};
constexpr auto gpioNumField = 0;
@@ -51,8 +51,8 @@
using ErrorFunction = std::function<void(UCD90160&, const std::string&)>;
-using GPIOGroup = std::tuple<
- std::string, gpio::Value, ErrorFunction, optionFlags, GPIODefinitions>;
+using GPIOGroup = std::tuple<std::string, gpio::Value, ErrorFunction,
+ optionFlags, GPIODefinitions>;
using GPIOAnalysis = std::map<extraAnalysisType, GPIOGroup>;
@@ -62,8 +62,8 @@
constexpr auto pollField = 3;
constexpr auto extraAnalysisField = 4;
-using GPIConfig = std::tuple<
- size_t, size_t, std::string, bool, extraAnalysisType>;
+using GPIConfig =
+ std::tuple<size_t, size_t, std::string, bool, extraAnalysisType>;
using GPIConfigs = std::vector<GPIConfig>;
@@ -74,12 +74,12 @@
constexpr auto gpiConfigField = 2;
constexpr auto gpioAnalysisField = 3;
-using DeviceDefinition = std::tuple<
- std::string, RailNames, GPIConfigs, GPIOAnalysis>;
+using DeviceDefinition =
+ std::tuple<std::string, RailNames, GPIConfigs, GPIOAnalysis>;
-//Maps a device instance to its definition
+// Maps a device instance to its definition
using DeviceMap = std::map<size_t, DeviceDefinition>;
-}
-}
-}
+} // namespace ucd90160
+} // namespace power
+} // namespace witherspoon
diff --git a/power-sequencer/ucd90160.cpp b/power-sequencer/ucd90160.cpp
index bc1177c..08b8a7d 100644
--- a/power-sequencer/ucd90160.cpp
+++ b/power-sequencer/ucd90160.cpp
@@ -13,16 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include "ucd90160.hpp"
+
+#include "names_values.hpp"
+#include "utility.hpp"
+
+#include <elog-errors.hpp>
#include <map>
#include <memory>
+#include <org/open_power/Witherspoon/Fault/error.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
-#include <elog-errors.hpp>
-#include <org/open_power/Witherspoon/Fault/error.hpp>
#include <xyz/openbmc_project/Common/Device/error.hpp>
-#include "names_values.hpp"
-#include "ucd90160.hpp"
-#include "utility.hpp"
namespace witherspoon
{
@@ -44,19 +46,14 @@
using namespace pmbus;
using namespace phosphor::logging;
-namespace device_error = sdbusplus::xyz::openbmc_project::
- Common::Device::Error;
-namespace power_error = sdbusplus::org::open_power::
- Witherspoon::Fault::Error;
+namespace device_error = sdbusplus::xyz::openbmc_project::Common::Device::Error;
+namespace power_error = sdbusplus::org::open_power::Witherspoon::Fault::Error;
UCD90160::UCD90160(size_t instance, sdbusplus::bus::bus& bus) :
- Device(DEVICE_NAME, instance),
- interface(std::get<ucd90160::pathField>(
- deviceMap.find(instance)->second),
- DRIVER_NAME,
- instance),
- gpioDevice(findGPIODevice(interface.path())),
- bus(bus)
+ Device(DEVICE_NAME, instance),
+ interface(std::get<ucd90160::pathField>(deviceMap.find(instance)->second),
+ DRIVER_NAME, instance),
+ gpioDevice(findGPIODevice(interface.path())), bus(bus)
{
}
@@ -68,8 +65,8 @@
auto pgoodError = checkPGOODFaults(false);
- //Not a voltage or PGOOD fault, but we know something
- //failed so still create an error log.
+ // Not a voltage or PGOOD fault, but we know something
+ // failed so still create an error log.
if (!voutError && !pgoodError)
{
createPowerFaultLog();
@@ -89,8 +86,8 @@
{
try
{
- //Note: Voltage faults are always fatal, so they just
- //need to be analyzed in onFailure().
+ // Note: Voltage faults are always fatal, so they just
+ // need to be analyzed in onFailure().
checkPGOODFaults(true);
}
@@ -119,8 +116,8 @@
bool errorCreated = false;
auto statusWord = readStatusWord();
- //The status_word register has a summary bit to tell us
- //if each page even needs to be checked
+ // The status_word register has a summary bit to tell us
+ // if each page even needs to be checked
if (!(statusWord & status_word::VOUT_FAULT))
{
return errorCreated;
@@ -136,20 +133,20 @@
auto statusVout = interface.insertPageNum(STATUS_VOUT, page);
uint8_t vout = interface.read(statusVout, Type::Debug);
- //If any bits are on log them, though some are just
- //warnings so they won't cause errors
+ // If any bits are on log them, though some are just
+ // warnings so they won't cause errors
if (vout)
{
log<level::INFO>("A voltage rail has bits on in STATUS_VOUT",
- entry("STATUS_VOUT=0x%X", vout),
- entry("PAGE=%d", page));
+ entry("STATUS_VOUT=0x%X", vout),
+ entry("PAGE=%d", page));
}
- //Log errors if any non-warning bits on
+ // Log errors if any non-warning bits on
if (vout & ~status_vout::WARNING_MASK)
{
auto& railNames = std::get<ucd90160::railNamesField>(
- deviceMap.find(getInstance())->second);
+ deviceMap.find(getInstance())->second);
auto railName = railNames.at(page);
util::NamesValues nv;
@@ -165,13 +162,12 @@
commit<device_error::ReadFailure>();
}
- using metadata = org::open_power::Witherspoon::Fault::
- PowerSequencerVoltageFault;
+ using metadata =
+ org::open_power::Witherspoon::Fault::PowerSequencerVoltageFault;
report<power_error::PowerSequencerVoltageFault>(
- metadata::RAIL(page),
- metadata::RAIL_NAME(railName.c_str()),
- metadata::RAW_STATUS(nv.get().c_str()));
+ metadata::RAIL(page), metadata::RAIL_NAME(railName.c_str()),
+ metadata::RAW_STATUS(nv.get().c_str()));
setVoutFaultLogged(page);
errorCreated = true;
@@ -185,43 +181,41 @@
{
bool errorCreated = false;
- //While PGOOD faults could show up in MFR_STATUS (and we could then
- //check the summary bit in STATUS_WORD first), they are edge triggered,
- //and as the device driver sends a clear faults command every time we
- //do a read, we will never see them. So, we'll have to just read the
- //real time GPI status GPIO.
+ // While PGOOD faults could show up in MFR_STATUS (and we could then
+ // check the summary bit in STATUS_WORD first), they are edge triggered,
+ // and as the device driver sends a clear faults command every time we
+ // do a read, we will never see them. So, we'll have to just read the
+ // real time GPI status GPIO.
- //Check only the GPIs configured on this system.
+ // Check only the GPIs configured on this system.
auto& gpiConfigs = std::get<ucd90160::gpiConfigField>(
- deviceMap.find(getInstance())->second);
+ deviceMap.find(getInstance())->second);
for (const auto& gpiConfig : gpiConfigs)
{
auto gpiNum = std::get<ucd90160::gpiNumField>(gpiConfig);
auto doPoll = std::get<ucd90160::pollField>(gpiConfig);
- //Can skip this one if there is already an error on this input,
- //or we are polling and these inputs don't need to be polled
+ // Can skip this one if there is already an error on this input,
+ // or we are polling and these inputs don't need to be polled
//(because errors on them are fatal).
if (isPGOODFaultLogged(gpiNum) || (polling && !doPoll))
{
continue;
}
- //The real time status is read via the pin ID
+ // The real time status is read via the pin ID
auto pinID = std::get<ucd90160::pinIDField>(gpiConfig);
auto gpio = gpios.find(pinID);
Value gpiStatus;
try
{
- //The first time through, create the GPIO objects
+ // The first time through, create the GPIO objects
if (gpio == gpios.end())
{
- gpios.emplace(
- pinID,
- std::make_unique<GPIO>(
- gpioDevice, pinID, Direction::input));
+ gpios.emplace(pinID, std::make_unique<GPIO>(gpioDevice, pinID,
+ Direction::input));
gpio = gpios.find(pinID);
}
@@ -239,9 +233,9 @@
if (gpiStatus == Value::low)
{
- //There may be some extra analysis we can do to narrow the
- //error down further. Note that finding an error here won't
- //prevent us from checking this GPI again.
+ // There may be some extra analysis we can do to narrow the
+ // error down further. Note that finding an error here won't
+ // prevent us from checking this GPI again.
errorCreated = doExtraAnalysis(gpiConfig);
if (errorCreated)
@@ -266,13 +260,13 @@
commit<device_error::ReadFailure>();
}
- using metadata = org::open_power::Witherspoon::Fault::
- PowerSequencerPGOODFault;
+ using metadata =
+ org::open_power::Witherspoon::Fault::PowerSequencerPGOODFault;
report<power_error::PowerSequencerPGOODFault>(
- metadata::INPUT_NUM(gpiNum),
- metadata::INPUT_NAME(gpiName.c_str()),
- metadata::RAW_STATUS(nv.get().c_str()));
+ metadata::INPUT_NUM(gpiNum),
+ metadata::INPUT_NAME(gpiName.c_str()),
+ metadata::RAW_STATUS(nv.get().c_str()));
setPGOODFaultLogged(gpiNum);
errorCreated = true;
@@ -297,26 +291,25 @@
commit<device_error::ReadFailure>();
}
- using metadata = org::open_power::Witherspoon::Fault::
- PowerSequencerFault;
+ using metadata = org::open_power::Witherspoon::Fault::PowerSequencerFault;
report<power_error::PowerSequencerFault>(
- metadata::RAW_STATUS(nv.get().c_str()));
+ metadata::RAW_STATUS(nv.get().c_str()));
}
fs::path UCD90160::findGPIODevice(const fs::path& path)
{
fs::path gpioDevicePath;
- //In the driver directory, look for a subdirectory
- //named gpiochipX, where X is some number. Then
- //we'll access the GPIO at /dev/gpiochipX.
+ // In the driver directory, look for a subdirectory
+ // named gpiochipX, where X is some number. Then
+ // we'll access the GPIO at /dev/gpiochipX.
if (fs::is_directory(path))
{
for (auto& f : fs::directory_iterator(path))
{
if (f.path().filename().string().find("gpiochip") !=
- std::string::npos)
+ std::string::npos)
{
gpioDevicePath = "/dev" / f.path().filename();
break;
@@ -327,7 +320,7 @@
if (gpioDevicePath.empty())
{
log<level::ERR>("Could not find GPIO device path",
- entry("BASE_PATH=%s", path.c_str()));
+ entry("BASE_PATH=%s", path.c_str()));
}
return gpioDevicePath;
@@ -342,7 +335,7 @@
return false;
}
- //Currently the only extra analysis to do is to check other GPIOs.
+ // Currently the only extra analysis to do is to check other GPIOs.
return doGPIOAnalysis(type);
}
@@ -352,7 +345,7 @@
bool shutdown = false;
const auto& analysisConfig = std::get<ucd90160::gpioAnalysisField>(
- deviceMap.find(getInstance())->second);
+ deviceMap.find(getInstance())->second);
auto gpioConfig = analysisConfig.find(type);
if (gpioConfig == analysisConfig.end())
@@ -360,19 +353,16 @@
return errorFound;
}
- auto path = std::get<ucd90160::gpioDevicePathField>(
- gpioConfig->second);
+ auto path = std::get<ucd90160::gpioDevicePathField>(gpioConfig->second);
- //The /dev/gpiochipX device
+ // The /dev/gpiochipX device
auto device = findGPIODevice(path);
- //The GPIO value of the fault condition
- auto polarity = std::get<ucd90160::gpioPolarityField>(
- gpioConfig->second);
+ // The GPIO value of the fault condition
+ auto polarity = std::get<ucd90160::gpioPolarityField>(gpioConfig->second);
- //The GPIOs to check
- auto& gpios = std::get<ucd90160::gpioDefinitionField>(
- gpioConfig->second);
+ // The GPIOs to check
+ auto& gpios = std::get<ucd90160::gpioDefinitionField>(gpioConfig->second);
for (const auto& gpio : gpios)
{
@@ -380,8 +370,7 @@
try
{
- GPIO g{device,
- std::get<ucd90160::gpioNumField>(gpio),
+ GPIO g{device, std::get<ucd90160::gpioNumField>(gpio),
Direction::input};
value = g.read();
@@ -390,10 +379,10 @@
{
if (!gpioAccessError)
{
- //GPIO only throws InternalErrors - not worth committing.
+ // GPIO only throws InternalErrors - not worth committing.
log<level::ERR>(
- "GPIO read failed while analyzing a power fault",
- entry("CHIP_PATH=%s", path.c_str()));
+ "GPIO read failed while analyzing a power fault",
+ entry("CHIP_PATH=%s", path.c_str()));
gpioAccessError = true;
}
@@ -413,21 +402,21 @@
continue;
}
- //Look up and call the error creation function
- auto logError = std::get<ucd90160::errorFunctionField>(
- gpioConfig->second);
+ // Look up and call the error creation function
+ auto logError =
+ std::get<ucd90160::errorFunctionField>(gpioConfig->second);
logError(*this, part);
- //Save the part callout so we don't call it out again
+ // Save the part callout so we don't call it out again
setPartCallout(callout);
- //Some errors (like overtemps) require a shutdown
+ // Some errors (like overtemps) require a shutdown
auto actions = static_cast<uint32_t>(
- std::get<ucd90160::optionFlagsField>(gpioConfig->second));
+ std::get<ucd90160::optionFlagsField>(gpioConfig->second));
if (actions & static_cast<decltype(actions)>(
- ucd90160::optionFlags::shutdownOnFault))
+ ucd90160::optionFlags::shutdownOnFault))
{
shutdown = true;
}
@@ -436,7 +425,7 @@
if (shutdown)
{
- //Will be replaced with a GPU specific error in a future commit
+ // Will be replaced with a GPU specific error in a future commit
util::powerOff<power_error::Shutdown>(bus);
}
@@ -461,8 +450,8 @@
using metadata = org::open_power::Witherspoon::Fault::GPUPowerFault;
report<power_error::GPUPowerFault>(
- metadata::RAW_STATUS(nv.get().c_str()),
- metadata::CALLOUT_INVENTORY_PATH(callout.c_str()));
+ metadata::RAW_STATUS(nv.get().c_str()),
+ metadata::CALLOUT_INVENTORY_PATH(callout.c_str()));
}
void UCD90160::gpuOverTempError(const std::string& callout)
@@ -483,9 +472,9 @@
using metadata = org::open_power::Witherspoon::Fault::GPUOverTemp;
report<power_error::GPUOverTemp>(
- metadata::RAW_STATUS(nv.get().c_str()),
- metadata::CALLOUT_INVENTORY_PATH(callout.c_str()));
+ metadata::RAW_STATUS(nv.get().c_str()),
+ metadata::CALLOUT_INVENTORY_PATH(callout.c_str()));
}
-}
-}
+} // namespace power
+} // namespace witherspoon
diff --git a/power-sequencer/ucd90160.hpp b/power-sequencer/ucd90160.hpp
index f14a99e..6213c26 100644
--- a/power-sequencer/ucd90160.hpp
+++ b/power-sequencer/ucd90160.hpp
@@ -1,23 +1,23 @@
#pragma once
+#include "device.hpp"
+#include "gpio.hpp"
+#include "pmbus.hpp"
+#include "types.hpp"
+
#include <algorithm>
#include <experimental/filesystem>
#include <map>
#include <sdbusplus/bus.hpp>
#include <vector>
-#include "device.hpp"
-#include "gpio.hpp"
-#include "pmbus.hpp"
-#include "types.hpp"
namespace witherspoon
{
namespace power
{
-//Error type, callout
-using PartCallout =
- std::tuple<ucd90160::extraAnalysisType, std::string>;
+// Error type, callout
+using PartCallout = std::tuple<ucd90160::extraAnalysisType, std::string>;
/**
* @class UCD90160
@@ -28,284 +28,279 @@
*/
class UCD90160 : public Device
{
- public:
+ public:
+ UCD90160() = delete;
+ ~UCD90160() = default;
+ UCD90160(const UCD90160&) = delete;
+ UCD90160& operator=(const UCD90160&) = delete;
+ UCD90160(UCD90160&&) = default;
+ UCD90160& operator=(UCD90160&&) = default;
- UCD90160() = delete;
- ~UCD90160() = default;
- UCD90160(const UCD90160&) = delete;
- UCD90160& operator=(const UCD90160&) = delete;
- UCD90160(UCD90160&&) = default;
- UCD90160& operator=(UCD90160&&) = default;
+ /**
+ * Constructor
+ *
+ * @param[in] instance - the device instance number
+ * @param[in] bus - D-Bus bus object
+ */
+ UCD90160(size_t instance, sdbusplus::bus::bus& bus);
- /**
- * Constructor
- *
- * @param[in] instance - the device instance number
- * @param[in] bus - D-Bus bus object
- */
- UCD90160(size_t instance, sdbusplus::bus::bus& bus);
+ /**
+ * Analyzes the device for errors when the device is
+ * known to be in an error state. A log will be created.
+ */
+ void onFailure() override;
- /**
- * Analyzes the device for errors when the device is
- * known to be in an error state. A log will be created.
- */
- void onFailure() override;
+ /**
+ * Checks the device for errors and only creates a log
+ * if one is found.
+ */
+ void analyze() override;
- /**
- * Checks the device for errors and only creates a log
- * if one is found.
- */
- void analyze() override;
+ /**
+ * Clears faults in the device
+ */
+ void clearFaults() override
+ {
+ }
- /**
- * Clears faults in the device
- */
- void clearFaults() override
- {
- }
+ private:
+ /**
+ * Reports an error for a GPU PGOOD failure
+ *
+ * @param[in] callout - the GPU callout string
+ */
+ void gpuPGOODError(const std::string& callout);
- private:
+ /**
+ * Reports an error for a GPU OverTemp failure
+ *
+ * @param[in] callout - the GPU callout string
+ */
+ void gpuOverTempError(const std::string& callout);
- /**
- * Reports an error for a GPU PGOOD failure
- *
- * @param[in] callout - the GPU callout string
- */
- void gpuPGOODError(const std::string& callout);
+ /**
+ * Given the device path for a chip, find its gpiochip
+ * path
+ *
+ * @param[in] path - device path, like
+ * /sys/devices/.../i2c-11/11-0064
+ *
+ * @return fs::path - The gpiochip path, like
+ * /dev/gpiochip1
+ */
+ static std::experimental::filesystem::path
+ findGPIODevice(const std::experimental::filesystem::path& path);
- /**
- * Reports an error for a GPU OverTemp failure
- *
- * @param[in] callout - the GPU callout string
- */
- void gpuOverTempError(const std::string& callout);
+ /**
+ * Checks for VOUT faults on the device.
+ *
+ * This device can monitor voltages of its dependent
+ * devices, and VOUT faults are voltage faults
+ * on these devices.
+ *
+ * @return bool - true if an error log was created
+ */
+ bool checkVOUTFaults();
- /**
- * Given the device path for a chip, find its gpiochip
- * path
- *
- * @param[in] path - device path, like
- * /sys/devices/.../i2c-11/11-0064
- *
- * @return fs::path - The gpiochip path, like
- * /dev/gpiochip1
- */
- static std::experimental::filesystem::path findGPIODevice(
- const std::experimental::filesystem::path& path);
+ /**
+ * Checks for PGOOD faults on the device.
+ *
+ * This device can monitor the PGOOD signals of its dependent
+ * devices, and this check will look for faults of
+ * those PGOODs.
+ *
+ * @param[in] polling - If this is running while polling for errors,
+ * as opposing to analyzing a fail condition.
+ *
+ * @return bool - true if an error log was created
+ */
+ bool checkPGOODFaults(bool polling);
- /**
- * Checks for VOUT faults on the device.
- *
- * This device can monitor voltages of its dependent
- * devices, and VOUT faults are voltage faults
- * on these devices.
- *
- * @return bool - true if an error log was created
- */
- bool checkVOUTFaults();
+ /**
+ * Creates an error log when the device has an error
+ * but it isn't a PGOOD or voltage failure.
+ */
+ void createPowerFaultLog();
- /**
- * Checks for PGOOD faults on the device.
- *
- * This device can monitor the PGOOD signals of its dependent
- * devices, and this check will look for faults of
- * those PGOODs.
- *
- * @param[in] polling - If this is running while polling for errors,
- * as opposing to analyzing a fail condition.
- *
- * @return bool - true if an error log was created
- */
- bool checkPGOODFaults(bool polling);
+ /**
+ * Reads the status_word register
+ *
+ * @return uint16_t - the register contents
+ */
+ uint16_t readStatusWord();
- /**
- * Creates an error log when the device has an error
- * but it isn't a PGOOD or voltage failure.
- */
- void createPowerFaultLog();
+ /**
+ * Reads the mfr_status register
+ *
+ * @return uint32_t - the register contents
+ */
+ uint32_t readMFRStatus();
- /**
- * Reads the status_word register
- *
- * @return uint16_t - the register contents
- */
- uint16_t readStatusWord();
+ /**
+ * Does any additional fault analysis based on the
+ * value of the extraAnalysisType field in the GPIOConfig
+ * entry.
+ *
+ * Used to get better callouts.
+ *
+ * @param[in] config - the GPIOConfig entry to use
+ *
+ * @return bool - true if a HW error was found, false else
+ */
+ bool doExtraAnalysis(const ucd90160::GPIConfig& config);
- /**
- * Reads the mfr_status register
- *
- * @return uint32_t - the register contents
- */
- uint32_t readMFRStatus();
+ /**
+ * Does additional fault analysis using GPIOs to
+ * specifically identify the failing part.
+ *
+ * Used when there are too many PGOOD inputs for
+ * the UCD90160 to handle, so just a summary bit
+ * is wired into the chip, and then the specific
+ * fault GPIOs are off of a different GPIO device,
+ * like an IO expander.
+ *
+ * @param[in] type - the type of analysis to do
+ *
+ * @return bool - true if a HW error was found, false else
+ */
+ bool doGPIOAnalysis(ucd90160::extraAnalysisType type);
- /**
- * Does any additional fault analysis based on the
- * value of the extraAnalysisType field in the GPIOConfig
- * entry.
- *
- * Used to get better callouts.
- *
- * @param[in] config - the GPIOConfig entry to use
- *
- * @return bool - true if a HW error was found, false else
- */
- bool doExtraAnalysis(const ucd90160::GPIConfig& config);
+ /**
+ * Says if we've already logged a Vout fault
+ *
+ * The policy is only 1 of the same error will
+ * be logged for the duration of a class instance.
+ *
+ * @param[in] page - the page to check
+ *
+ * @return bool - if we've already logged a fault against
+ * this page
+ */
+ inline bool isVoutFaultLogged(uint32_t page) const
+ {
+ return std::find(voutErrors.begin(), voutErrors.end(), page) !=
+ voutErrors.end();
+ }
- /**
- * Does additional fault analysis using GPIOs to
- * specifically identify the failing part.
- *
- * Used when there are too many PGOOD inputs for
- * the UCD90160 to handle, so just a summary bit
- * is wired into the chip, and then the specific
- * fault GPIOs are off of a different GPIO device,
- * like an IO expander.
- *
- * @param[in] type - the type of analysis to do
- *
- * @return bool - true if a HW error was found, false else
- */
- bool doGPIOAnalysis(ucd90160::extraAnalysisType type);
+ /**
+ * Saves that a Vout fault has been logged
+ *
+ * @param[in] page - the page the error was logged against
+ */
+ inline void setVoutFaultLogged(uint32_t page)
+ {
+ voutErrors.push_back(page);
+ }
- /**
- * Says if we've already logged a Vout fault
- *
- * The policy is only 1 of the same error will
- * be logged for the duration of a class instance.
- *
- * @param[in] page - the page to check
- *
- * @return bool - if we've already logged a fault against
- * this page
- */
- inline bool isVoutFaultLogged(uint32_t page) const
- {
- return std::find(voutErrors.begin(),
- voutErrors.end(),
- page) != voutErrors.end();
- }
+ /**
+ * Says if we've already logged a PGOOD fault
+ *
+ * The policy is only 1 of the same errors will
+ * be logged for the duration of a class instance.
+ *
+ * @param[in] input - the input to check
+ *
+ * @return bool - if we've already logged a fault against
+ * this input
+ */
+ inline bool isPGOODFaultLogged(uint32_t input) const
+ {
+ return std::find(pgoodErrors.begin(), pgoodErrors.end(), input) !=
+ pgoodErrors.end();
+ }
- /**
- * Saves that a Vout fault has been logged
- *
- * @param[in] page - the page the error was logged against
- */
- inline void setVoutFaultLogged(uint32_t page)
- {
- voutErrors.push_back(page);
- }
+ /**
+ * Says if we've already logged a specific fault
+ * against a specific part
+ *
+ * @param[in] callout - error type and name tuple
+ *
+ * @return bool - if we've already logged this fault
+ * against this part
+ */
+ inline bool isPartCalledOut(const PartCallout& callout) const
+ {
+ return std::find(callouts.begin(), callouts.end(), callout) !=
+ callouts.end();
+ }
- /**
- * Says if we've already logged a PGOOD fault
- *
- * The policy is only 1 of the same errors will
- * be logged for the duration of a class instance.
- *
- * @param[in] input - the input to check
- *
- * @return bool - if we've already logged a fault against
- * this input
- */
- inline bool isPGOODFaultLogged(uint32_t input) const
- {
- return std::find(pgoodErrors.begin(),
- pgoodErrors.end(),
- input) != pgoodErrors.end();
- }
+ /**
+ * Saves that a PGOOD fault has been logged
+ *
+ * @param[in] input - the input the error was logged against
+ */
+ inline void setPGOODFaultLogged(uint32_t input)
+ {
+ pgoodErrors.push_back(input);
+ }
- /**
- * Says if we've already logged a specific fault
- * against a specific part
- *
- * @param[in] callout - error type and name tuple
- *
- * @return bool - if we've already logged this fault
- * against this part
- */
- inline bool isPartCalledOut(const PartCallout& callout) const
- {
- return std::find(callouts.begin(),
- callouts.end(),
- callout) != callouts.end();
- }
+ /**
+ * Saves that a specific fault on a specific part has been done
+ *
+ * @param[in] callout - error type and name tuple
+ */
+ inline void setPartCallout(const PartCallout& callout)
+ {
+ callouts.push_back(callout);
+ }
- /**
- * Saves that a PGOOD fault has been logged
- *
- * @param[in] input - the input the error was logged against
- */
- inline void setPGOODFaultLogged(uint32_t input)
- {
- pgoodErrors.push_back(input);
- }
+ /**
+ * List of pages that Vout errors have
+ * already been logged against
+ */
+ std::vector<uint32_t> voutErrors;
- /**
- * Saves that a specific fault on a specific part has been done
- *
- * @param[in] callout - error type and name tuple
- */
- inline void setPartCallout(const PartCallout& callout)
- {
- callouts.push_back(callout);
- }
+ /**
+ * List of inputs that PGOOD errors have
+ * already been logged against
+ */
+ std::vector<uint32_t> pgoodErrors;
- /**
- * List of pages that Vout errors have
- * already been logged against
- */
- std::vector<uint32_t> voutErrors;
+ /**
+ * List of callouts that already been done
+ */
+ std::vector<PartCallout> callouts;
- /**
- * List of inputs that PGOOD errors have
- * already been logged against
- */
- std::vector<uint32_t> pgoodErrors;
+ /**
+ * The read/write interface to this hardware
+ */
+ pmbus::PMBus interface;
- /**
- * List of callouts that already been done
- */
- std::vector<PartCallout> callouts;
+ /**
+ * A map of GPI pin IDs to the GPIO object
+ * used to access them
+ */
+ std::map<size_t, std::unique_ptr<gpio::GPIO>> gpios;
- /**
- * The read/write interface to this hardware
- */
- pmbus::PMBus interface;
+ /**
+ * Keeps track of device access errors to avoid repeatedly
+ * logging errors for bad hardware
+ */
+ bool accessError = false;
- /**
- * A map of GPI pin IDs to the GPIO object
- * used to access them
- */
- std::map<size_t, std::unique_ptr<gpio::GPIO>> gpios;
+ /**
+ * Keeps track of GPIO access errors when doing the in depth
+ * PGOOD fault analysis to avoid repeatedly logging errors
+ * for bad hardware
+ */
+ bool gpioAccessError = false;
- /**
- * Keeps track of device access errors to avoid repeatedly
- * logging errors for bad hardware
- */
- bool accessError = false;
+ /**
+ * The path to the GPIO device used to read
+ * the GPI (PGOOD) status
+ */
+ std::experimental::filesystem::path gpioDevice;
- /**
- * Keeps track of GPIO access errors when doing the in depth
- * PGOOD fault analysis to avoid repeatedly logging errors
- * for bad hardware
- */
- bool gpioAccessError = false;
+ /**
+ * The D-Bus bus object
+ */
+ sdbusplus::bus::bus& bus;
- /**
- * The path to the GPIO device used to read
- * the GPI (PGOOD) status
- */
- std::experimental::filesystem::path gpioDevice;
-
- /**
- * The D-Bus bus object
- */
- sdbusplus::bus::bus& bus;
-
- /**
- * Map of device instance to the instance specific data
- */
- static const ucd90160::DeviceMap deviceMap;
+ /**
+ * Map of device instance to the instance specific data
+ */
+ static const ucd90160::DeviceMap deviceMap;
};
-}
-}
+} // namespace power
+} // namespace witherspoon
diff --git a/power-sequencer/ucd90160_defs.cpp b/power-sequencer/ucd90160_defs.cpp
index 5696061..d271f4b 100644
--- a/power-sequencer/ucd90160_defs.cpp
+++ b/power-sequencer/ucd90160_defs.cpp
@@ -15,7 +15,7 @@
*/
#include "ucd90160.hpp"
-//Separated out to facilitate possible future generation of file.
+// Separated out to facilitate possible future generation of file.
namespace witherspoon
{
@@ -25,96 +25,71 @@
using namespace ucd90160;
using namespace std::string_literals;
-const DeviceMap UCD90160::deviceMap
-{
- {0, DeviceDefinition{
- "/sys/devices/platform/ahb/ahb:apb/ahb:apb:i2c@1e78a000/"
- "1e78a400.i2c-bus/i2c-11/11-0064",
+const DeviceMap UCD90160::deviceMap{
+ {0,
+ DeviceDefinition{
+ "/sys/devices/platform/ahb/ahb:apb/ahb:apb:i2c@1e78a000/"
+ "1e78a400.i2c-bus/i2c-11/11-0064",
- RailNames{
- "5.0VCS"s,
- "12.0V"s,
- "3.3V"s,
- "1.8V"s,
- "1.1V"s,
- "1.0V"s,
- "0.9V"s,
- "VDN-A"s,
- "VDN-B"s,
- "AVDD"s,
- "VIO-A"s,
- "VIO-B"s,
- "VDD-A"s,
- "VDD-B"s,
- "VCS-A"s,
- "VCS-B"s
- },
+ RailNames{"5.0VCS"s, "12.0V"s, "3.3V"s, "1.8V"s, "1.1V"s, "1.0V"s,
+ "0.9V"s, "VDN-A"s, "VDN-B"s, "AVDD"s, "VIO-A"s, "VIO-B"s,
+ "VDD-A"s, "VDD-B"s, "VCS-A"s, "VCS-B"s},
- GPIConfigs{
- GPIConfig{1, 8, "PGOOD_5P0V"s, false,
- extraAnalysisType::none},
- GPIConfig{2, 9, "MEM_GOOD0"s, false,
- extraAnalysisType::none},
- GPIConfig{3, 10, "MEM_GOOD1"s, false,
- extraAnalysisType::none},
- GPIConfig{4, 14, "GPU_PGOOD"s, false,
- extraAnalysisType::gpuPGOOD},
- GPIConfig{5, 17, "GPU_TH_OVERT"s, true,
- extraAnalysisType::gpuOverTemp},
- GPIConfig{6, 11, "SOFTWARE_PGOOD"s, false,
- extraAnalysisType::none}
- },
+ GPIConfigs{
+ GPIConfig{1, 8, "PGOOD_5P0V"s, false, extraAnalysisType::none},
+ GPIConfig{2, 9, "MEM_GOOD0"s, false, extraAnalysisType::none},
+ GPIConfig{3, 10, "MEM_GOOD1"s, false, extraAnalysisType::none},
+ GPIConfig{4, 14, "GPU_PGOOD"s, false, extraAnalysisType::gpuPGOOD},
+ GPIConfig{5, 17, "GPU_TH_OVERT"s, true,
+ extraAnalysisType::gpuOverTemp},
+ GPIConfig{6, 11, "SOFTWARE_PGOOD"s, false,
+ extraAnalysisType::none}},
- GPIOAnalysis{
- {extraAnalysisType::gpuPGOOD,
- GPIOGroup{
- "/sys/devices/platform/ahb/ahb:apb/ahb:apb:i2c@"
- "1e78a000/1e78a400.i2c-bus/i2c-11/11-0060",
- gpio::Value::low,
- [](auto& ucd, const auto& callout)
- { ucd.gpuPGOODError(callout); },
- optionFlags::none,
- GPIODefinitions{
- GPIODefinition{8,
- "/system/chassis/motherboard/gv100card0"s},
- GPIODefinition{9,
- "/system/chassis/motherboard/gv100card1"s},
- GPIODefinition{10,
- "/system/chassis/motherboard/gv100card2"s},
- GPIODefinition{11,
- "/system/chassis/motherboard/gv100card3"s},
- GPIODefinition{12,
- "/system/chassis/motherboard/gv100card4"s},
- GPIODefinition{13,
- "/system/chassis/motherboard/gv100card5"s}}
- }},
+ GPIOAnalysis{
+ {extraAnalysisType::gpuPGOOD,
+ GPIOGroup{
+ "/sys/devices/platform/ahb/ahb:apb/ahb:apb:i2c@"
+ "1e78a000/1e78a400.i2c-bus/i2c-11/11-0060",
+ gpio::Value::low,
+ [](auto& ucd, const auto& callout) {
+ ucd.gpuPGOODError(callout);
+ },
+ optionFlags::none,
+ GPIODefinitions{
+ GPIODefinition{8,
+ "/system/chassis/motherboard/gv100card0"s},
+ GPIODefinition{9,
+ "/system/chassis/motherboard/gv100card1"s},
+ GPIODefinition{10,
+ "/system/chassis/motherboard/gv100card2"s},
+ GPIODefinition{11,
+ "/system/chassis/motherboard/gv100card3"s},
+ GPIODefinition{12,
+ "/system/chassis/motherboard/gv100card4"s},
+ GPIODefinition{
+ 13, "/system/chassis/motherboard/gv100card5"s}}}},
- {extraAnalysisType::gpuOverTemp,
- GPIOGroup{
- "/sys/devices/platform/ahb/ahb:apb/ahb:apb:i2c@"
- "1e78a000/1e78a400.i2c-bus/i2c-11/11-0060",
- gpio::Value::low,
- [](auto& ucd, const auto& callout)
- { ucd.gpuOverTempError(callout); },
- optionFlags::shutdownOnFault,
- GPIODefinitions{
- GPIODefinition{2,
- "/system/chassis/motherboard/gv100card0"s},
- GPIODefinition{3,
- "/system/chassis/motherboard/gv100card1"s},
- GPIODefinition{4,
- "/system/chassis/motherboard/gv100card2"s},
- GPIODefinition{5,
- "/system/chassis/motherboard/gv100card3"s},
- GPIODefinition{6,
- "/system/chassis/motherboard/gv100card4"s},
- GPIODefinition{7,
- "/system/chassis/motherboard/gv100card5"s}}
- }}
- }
- }
- }
-};
+ {extraAnalysisType::gpuOverTemp,
+ GPIOGroup{
+ "/sys/devices/platform/ahb/ahb:apb/ahb:apb:i2c@"
+ "1e78a000/1e78a400.i2c-bus/i2c-11/11-0060",
+ gpio::Value::low,
+ [](auto& ucd,
+ const auto& callout) { ucd.gpuOverTempError(callout); },
+ optionFlags::shutdownOnFault,
+ GPIODefinitions{
+ GPIODefinition{2,
+ "/system/chassis/motherboard/gv100card0"s},
+ GPIODefinition{3,
+ "/system/chassis/motherboard/gv100card1"s},
+ GPIODefinition{4,
+ "/system/chassis/motherboard/gv100card2"s},
+ GPIODefinition{5,
+ "/system/chassis/motherboard/gv100card3"s},
+ GPIODefinition{6,
+ "/system/chassis/motherboard/gv100card4"s},
+ GPIODefinition{
+ 7, "/system/chassis/motherboard/gv100card5"s}}}}}}}};
-}
-}
+} // namespace power
+} // namespace witherspoon