Trigger periodic OCC POLL commands when the OCCs are running
The OCC control app will periodically trigger kernel poll commands
to the OCC when the OCCs are active.
Code change also adds an interface to allow any OCC command to be
sent to an OCC. The pass-through interface was also updated to
use the new command object.
Tested: I did several IPLs on multiple Rainier systems to verify
the changes. I forced OCC resets to ensure polling stopped when
OCCs were disabled and restarted after it came out of reset.
Change-Id: I56970e781a988bb94f17ac38173ace8a68bb5fad
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/occ_pass_through.hpp b/occ_pass_through.hpp
index a28eb6a..0c01ae4 100644
--- a/occ_pass_through.hpp
+++ b/occ_pass_through.hpp
@@ -1,6 +1,11 @@
#pragma once
+#include "occ_command.hpp"
+
+#include <fmt/core.h>
+
#include <org/open_power/OCC/PassThrough/server.hpp>
+#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/object.hpp>
#include <string>
@@ -23,6 +28,7 @@
{
public:
PassThrough() = delete;
+ ~PassThrough() = default;
PassThrough(const PassThrough&) = delete;
PassThrough& operator=(const PassThrough&) = delete;
PassThrough(PassThrough&&) = default;
@@ -34,17 +40,18 @@
*/
PassThrough(sdbusplus::bus::bus& bus, const char* path);
- ~PassThrough()
- {
- closeDevice();
- }
-
- /** @brief Pass through command to OCC
+ /** @brief Pass through command to OCC from dbus
* @param[in] command - command to pass-through
* @returns OCC response as an array
*/
std::vector<std::int32_t> send(std::vector<std::int32_t> command) override;
+ /** @brief Pass through command to OCC from openpower-occ-control
+ * @param[in] command - command to pass-through
+ * @returns OCC response as an array
+ */
+ std::vector<std::uint8_t> send(std::vector<std::uint8_t> command);
+
private:
/** @brief Pass-through occ path on the bus */
std::string path;
@@ -58,12 +65,12 @@
*/
std::string devicePath;
+ /** @brief OCC instance number */
+ int occInstance;
+
/** @brief Indicates whether or not the OCC is currently active */
bool occActive = false;
- /** brief file descriptor associated with occ device */
- int fd = -1;
-
/** @brief Subscribe to OCC Status signal
*
* Once the OCC status gets to active, only then we will get /dev/occ2
@@ -71,11 +78,8 @@
*/
sdbusplus::bus::match_t activeStatusSignal;
- /** Opens devicePath and populates file descritor */
- void openDevice();
-
- /** Closed the fd associated with opened device */
- void closeDevice();
+ /** @brief Object to send commands to the OCC */
+ OccCommand occCmd;
/** @brief Callback function on OCC Status change signals
*