diff options
author | Robert Lippert <rlippert@google.com> | 2017-11-20 11:40:52 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-11-20 20:36:07 -0600 |
commit | c5cf392b75dceee478a2e73012bbcf3b439fc0c1 (patch) | |
tree | 9f5900234687f02bdf5361491d75c7cf726cf49f /core/direct-controls.c | |
parent | 27c35b967a84788a45260579802b8ffa66ed05e8 (diff) | |
download | skiboot-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>
Diffstat (limited to 'core/direct-controls.c')
-rw-r--r-- | core/direct-controls.c | 21 |
1 files changed, 21 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; |