summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--control/argument.cpp5
-rw-r--r--control/fan.cpp10
-rw-r--r--control/fan.hpp5
-rw-r--r--control/main.cpp11
-rw-r--r--control/manager.cpp8
-rw-r--r--control/manager.hpp6
-rw-r--r--control/zone.cpp9
-rw-r--r--control/zone.hpp10
8 files changed, 62 insertions, 2 deletions
diff --git a/control/argument.cpp b/control/argument.cpp
index d9b832d..e4ffb65 100644
--- a/control/argument.cpp
+++ b/control/argument.cpp
@@ -1,5 +1,6 @@
/**
* Copyright © 2017 IBM Corporation
+ * Copyright © 2017-2018 Raptor Engineering, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -69,6 +70,7 @@ void ArgumentParser::usage(char** argv)
std::cerr << " --help Print this menu\n";
std::cerr << " --init Sets fans to full speed, delays, exits\n";
std::cerr << " --control Start fan control algorithm\n";
+ std::cerr << " --shutdown Shut down fan control algorithm *and* fans. ONLY use after chassis powerdown!\n";
std::cerr << std::flush;
}
@@ -76,11 +78,12 @@ const option ArgumentParser::options[] =
{
{ "init", no_argument, NULL, 'i' },
{ "control", no_argument, NULL, 'c' },
+ { "shutdown", no_argument, NULL, 's' },
{ "help", no_argument, NULL, 'h' },
{ 0, 0, 0, 0},
};
-const char* ArgumentParser::optionstr = "ich?";
+const char* ArgumentParser::optionstr = "icsh?";
const std::string ArgumentParser::true_string = "true";
const std::string ArgumentParser::empty_string = "";
diff --git a/control/fan.cpp b/control/fan.cpp
index b0881da..8250c5c 100644
--- a/control/fan.cpp
+++ b/control/fan.cpp
@@ -1,5 +1,6 @@
/**
* Copyright © 2017 IBM Corporation
+ * Copyright © 2017-2018 Raptor Engineering, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -101,6 +102,15 @@ void Fan::setSpeed(uint64_t speed)
_targetSpeed = speed;
}
+void Fan::disableRotor()
+{
+ // TODO
+ // This should set the enable value of the hwmon PWM entry
+ // For now, just set the fan speed to 0
+
+ setSpeed(0);
+}
+
}
}
}
diff --git a/control/fan.hpp b/control/fan.hpp
index e7f3067..fd44c8a 100644
--- a/control/fan.hpp
+++ b/control/fan.hpp
@@ -56,6 +56,11 @@ class Fan
return _targetSpeed;
}
+ /**
+ * Disables the fan, stopping the rotor
+ */
+ void disableRotor();
+
private:
/**
diff --git a/control/main.cpp b/control/main.cpp
index cde71d0..dd49c93 100644
--- a/control/main.cpp
+++ b/control/main.cpp
@@ -1,5 +1,6 @@
/**
* Copyright © 2017 IBM Corporation
+ * Copyright © 2017-2018 Raptor Engineering, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,6 +45,10 @@ int main(int argc, char* argv[])
{
mode = Mode::control;
}
+ else if (args["shutdown"] == "true")
+ {
+ mode = Mode::shutdown;
+ }
else
{
args.usage(argv);
@@ -72,6 +77,12 @@ int main(int argc, char* argv[])
manager.doInit();
return 0;
}
+ //Shutdown mode will disable fans and exit
+ else if (mode == Mode::shutdown)
+ {
+ manager.doShutdown();
+ return 0;
+ }
else
{
r = sd_event_loop(eventPtr.get());
diff --git a/control/manager.cpp b/control/manager.cpp
index d5f97d7..e48981d 100644
--- a/control/manager.cpp
+++ b/control/manager.cpp
@@ -1,5 +1,6 @@
/**
* Copyright © 2017 IBM Corporation
+ * Copyright © 2017-2018 Raptor Engineering, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -169,6 +170,13 @@ void Manager::doInit()
startFanControlReadyTarget();
}
+void Manager::doShutdown()
+{
+ for (auto& z : _zones)
+ {
+ z.second->disableRotors();
+ }
+}
void Manager::startFanControlReadyTarget()
{
diff --git a/control/manager.hpp b/control/manager.hpp
index d5b75fc..a09445b 100644
--- a/control/manager.hpp
+++ b/control/manager.hpp
@@ -50,6 +50,12 @@ class Manager
*/
void doInit();
+ /**
+ * Does the fan control and chassis fan shutdown, which
+ * disables the fans entirely (stops all rotors)
+ */
+ void doShutdown();
+
private:
/**
diff --git a/control/zone.cpp b/control/zone.cpp
index 325a5b8..8e665f0 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -1,5 +1,6 @@
/**
* Copyright © 2017 IBM Corporation
+ * Copyright © 2017-2018 Raptor Engineering, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -103,6 +104,14 @@ void Zone::setFullSpeed()
}
}
+void Zone::disableRotors()
+{
+ for (auto& fan : _fans)
+ {
+ fan->disableRotor();
+ }
+}
+
void Zone::setActiveAllow(const Group* group, bool isActiveAllow)
{
_active[*(group)] = isActiveAllow;
diff --git a/control/zone.hpp b/control/zone.hpp
index cd7e5d6..2185afa 100644
--- a/control/zone.hpp
+++ b/control/zone.hpp
@@ -19,11 +19,13 @@ namespace control
* The mode fan control will run in:
* - init - only do the initialization steps
* - control - run normal control algorithms
+ * - init - shutdown fans, stopping all rotors
*/
enum class Mode
{
init,
- control
+ control,
+ shutdown
};
/**
@@ -70,6 +72,12 @@ class Zone
void setFullSpeed();
/**
+ * Disables the zone and stops all zone fans regardless of
+ * zone's active state
+ */
+ void disableRotors();
+
+ /**
* @brief Sets the automatic fan control allowed active state
*
* @param[in] group - A group that affects the active state
OpenPOWER on IntegriCloud