aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Lippert <rlippert@google.com>2017-11-20 11:40:52 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-11-20 20:36:07 -0600
commitc5cf392b75dceee478a2e73012bbcf3b439fc0c1 (patch)
tree9f5900234687f02bdf5361491d75c7cf726cf49f
parent27c35b967a84788a45260579802b8ffa66ed05e8 (diff)
downloadskiboot-c5cf392b75dceee478a2e73012bbcf3b439fc0c1.zip
skiboot-c5cf392b75dceee478a2e73012bbcf3b439fc0c1.tar.gz
skiboot-c5cf392b75dceee478a2e73012bbcf3b439fc0c1.tar.bz2
core/direct-controls: add function to read core gated state
Change-Id: Ib534503f2528de4d8b1633d9859ae9ff5d010f98 Signed-off-by: Robert Lippert <rlippert@google.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--core/direct-controls.c21
-rw-r--r--include/cpu.h1
2 files changed, 22 insertions, 0 deletions
diff --git a/core/direct-controls.c b/core/direct-controls.c
index 0ed00c1..c5ba80e 100644
--- a/core/direct-controls.c
+++ b/core/direct-controls.c
@@ -35,6 +35,7 @@
#define P9_SPWKUP_SET PPC_BIT(0)
#define P9_EC_PPM_SSHHYP 0x0114
+#define P9_CORE_GATED PPC_BIT(0)
#define P9_SPECIAL_WKUP_DONE PPC_BIT(1)
/* Waking may take up to 5ms for deepest sleep states. Set timeout to 100ms */
@@ -280,6 +281,26 @@ out:
return rc;
}
+int dctl_core_is_gated(struct cpu_thread *t)
+{
+ struct cpu_thread *c = t->primary;
+ uint32_t chip_id = pir_to_chip_id(c->pir);
+ uint32_t core_id = pir_to_core_id(c->pir);
+ uint32_t sshhyp_addr;
+ uint64_t val;
+
+ sshhyp_addr = XSCOM_ADDR_P9_EC_SLAVE(core_id, P9_EC_PPM_SSHHYP);
+
+ if (xscom_read(chip_id, sshhyp_addr, &val)) {
+ prlog(PR_ERR, "Could not query core gated on %u:%u:"
+ " Unable to read PPM_SSHHYP.\n",
+ chip_id, core_id);
+ return OPAL_HARDWARE;
+ }
+
+ return !!(val & P9_CORE_GATED);
+}
+
static int dctl_stop(struct cpu_thread *t)
{
struct cpu_thread *c = t->primary;
diff --git a/include/cpu.h b/include/cpu.h
index d4b7a42..5db4ccb 100644
--- a/include/cpu.h
+++ b/include/cpu.h
@@ -297,5 +297,6 @@ extern void cpu_fast_reboot_complete(void);
int dctl_set_special_wakeup(struct cpu_thread *t);
int dctl_clear_special_wakeup(struct cpu_thread *t);
+int dctl_core_is_gated(struct cpu_thread *t);
#endif /* __CPU_H */