aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/tigerlake/pmutil.c
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2020-05-14 13:24:21 -0600
committerPatrick Georgi <pgeorgi@google.com>2020-05-20 09:49:26 +0000
commit2c26108208e4aa48de21be576ab6cad9286d7934 (patch)
tree116400f80c526296d6f76a729497e75923db219d /src/soc/intel/tigerlake/pmutil.c
parent6d20d0c1400a07b8ca3d709693263dbc45ca564f (diff)
soc/intel/tigerlake: Move pmc_soc_set_afterg3_en to pmutil
pmc.c was included in the SMM object, but only needed the one function, pmc_soc_set_afterg3_en. pmutil.c was already doing power management- related functionality, and was included in SMM, so moving pmc_soc_set_afterg3_en to pmutil.c allows pmc.c to be removed from the SMM build. Change-Id: I87f65fd10d35f1f75516e804501d5319b81a0383 Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41407 Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel/tigerlake/pmutil.c')
-rw-r--r--src/soc/intel/tigerlake/pmutil.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/soc/intel/tigerlake/pmutil.c b/src/soc/intel/tigerlake/pmutil.c
index bd6a46c788..befc4fc48b 100644
--- a/src/soc/intel/tigerlake/pmutil.c
+++ b/src/soc/intel/tigerlake/pmutil.c
@@ -275,3 +275,20 @@ uint16_t get_pmbase(void)
{
return (uint16_t) ACPI_BASE_ADDRESS;
}
+
+/*
+ * Set which power state system will be after reapplying
+ * the power (from G3 State)
+ */
+void pmc_soc_set_afterg3_en(const bool on)
+{
+ uint8_t reg8;
+ uint8_t *const pmcbase = pmc_mmio_regs();
+
+ reg8 = read8(pmcbase + GEN_PMCON_A);
+ if (on)
+ reg8 &= ~SLEEP_AFTER_POWER_FAIL;
+ else
+ reg8 |= SLEEP_AFTER_POWER_FAIL;
+ write8(pmcbase + GEN_PMCON_A, reg8);
+}