aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorShilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>2017-07-28 00:45:29 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-07-28 14:53:19 +1000
commit5bec6cdf92f984cccc09dbe57579760a6e593b79 (patch)
tree97b5725aa4ea39a0513f7992083e9c813c8bfb33 /include
parentc6aabe3f2eb51cf1df7da83432b15a37200f1adb (diff)
downloadskiboot-5bec6cdf92f984cccc09dbe57579760a6e593b79.zip
skiboot-5bec6cdf92f984cccc09dbe57579760a6e593b79.tar.gz
skiboot-5bec6cdf92f984cccc09dbe57579760a6e593b79.tar.bz2
psr: occ: Add support to change power-shifting-ratio
Add support to set the CPU-GPU power shifting ratio which is used by the OCC power capping algorithm. PSR value of 100 takes all power away from CPU first and a PSR value of 0 caps GPU first. Documentation enhanced by Stewart Smith. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/opal-api.h4
-rw-r--r--include/psr.h46
2 files changed, 49 insertions, 1 deletions
diff --git a/include/opal-api.h b/include/opal-api.h
index 3ad4898..8d33c08 100644
--- a/include/opal-api.h
+++ b/include/opal-api.h
@@ -210,7 +210,9 @@
#define OPAL_IMC_COUNTERS_STOP 151
#define OPAL_GET_POWERCAP 152
#define OPAL_SET_POWERCAP 153
-#define OPAL_LAST 153
+#define OPAL_GET_POWER_SHIFT_RATIO 154
+#define OPAL_SET_POWER_SHIFT_RATIO 155
+#define OPAL_LAST 155
/* Device tree flags */
diff --git a/include/psr.h b/include/psr.h
new file mode 100644
index 0000000..92c0aa5
--- /dev/null
+++ b/include/psr.h
@@ -0,0 +1,46 @@
+/* Copyright 2017 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __PSR_H
+#define __PSR_H
+
+#include <opal.h>
+
+enum psr_class {
+ PSR_CLASS_OCC,
+};
+
+/*
+ * PSR handle is defined as u32. The first and last bytes are
+ * used to indicate the class and type. RID indiactes psr class
+ * specific data. For PSR_CLASS_OCC psr class RID is the chip index.
+ *
+ * | Class |Reserved| RID | Type |
+ * |-------|--------|------|------|
+ */
+
+#define psr_make_handle(class, rid, type) (((class & 0xF) << 24) | \
+ ((rid & 0xF) << 8) | (type & 0xF))
+
+#define psr_get_class(handle) ((handle >> 24) & 0xF)
+#define psr_get_rid(handle) ((handle >> 8) & 0xF)
+#define psr_get_type(handle) (handle & 0xF)
+
+/* Powercap OCC interface */
+int occ_get_psr(u32 handle, u32 *ratio);
+int occ_set_psr(u32 handle, int token, u32 ratio);
+
+#endif /* __PSR_H */