summaryrefslogtreecommitdiffstats
path: root/powercap.cpp
diff options
context:
space:
mode:
authorAndrew Geissler <andrewg@us.ibm.com>2017-07-10 15:13:33 -0500
committerAndrew Geissler <andrewg@us.ibm.com>2017-07-18 13:52:09 -0500
commit4cea4d2b36a0bfc212f34e72792cfa00e43384e9 (patch)
treedf51bb8e01368e8cf3b6623ec17930623f0049ed /powercap.cpp
parent52cf26a821d914dc073b8d40a98b26cf2c6abe84 (diff)
downloadopenpower-occ-control-4cea4d2b36a0bfc212f34e72792cfa00e43384e9.zip
openpower-occ-control-4cea4d2b36a0bfc212f34e72792cfa00e43384e9.tar.gz
Determine pcap value to send to occ
Change-Id: Ie60aac151f5fd8ce091020ce756834e4877cbc93 Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
Diffstat (limited to 'powercap.cpp')
-rw-r--r--powercap.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/powercap.cpp b/powercap.cpp
index 2ecad0c..7e8c0db 100644
--- a/powercap.cpp
+++ b/powercap.cpp
@@ -54,6 +54,19 @@ std::string PowerCap::getService(std::string path,
return mapperResponse.begin()->first;
}
+uint32_t PowerCap::getOccInput(uint32_t pcap, bool pcapEnabled)
+{
+ if (!pcapEnabled)
+ {
+ // Pcap disabled, return 0 to indicate disabled
+ return 0;
+ }
+
+ // If pcap is not disabled then just return the pcap with the derating
+ // factor applied.
+ return( (static_cast<uint64_t>(pcap) * PS_DERATING_FACTOR) /100);
+}
+
uint32_t PowerCap::getPcap()
{
auto settingService = getService(PCAP_PATH,PCAP_INTERFACE);
@@ -144,7 +157,9 @@ void PowerCap::pcapChanged(sdbusplus::message::message& msg)
entry("PCAP_ENABLED=%u",pcapEnabled));
// Determine desired action to write to occ
- // TODO
+ auto occInput = getOccInput(pcap, pcapEnabled);
+ log<level::DEBUG>("Writing new power cap setting to OCC",
+ entry("OCC_PCAP_VAL=%u",occInput));
// Write action to occ
// TODO
OpenPOWER on IntegriCloud