Shaunak Saha has uploaded this change for review. ( https://review.coreboot.org/21755
Change subject: soc/intel/common/block: Move power button SMI functions to common PMC block ......................................................................
soc/intel/common/block: Move power button SMI functions to common PMC block
This patch moves the functions update_pm1_enable and read_pm1_enable to common block PMC. We rename the functions to pmc_update_pm1_enable and pmc_read_pm1_enable to keep semantics consistent.
Change-Id: I9a73a6348fc22367ee2e68bf2c31823ebfefc525 Signed-off-by: Shaunak Saha shaunak.saha@intel.com --- M src/soc/intel/common/block/include/intelblocks/pmclib.h M src/soc/intel/common/block/pmc/pmclib.c 2 files changed, 22 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/55/21755/1
diff --git a/src/soc/intel/common/block/include/intelblocks/pmclib.h b/src/soc/intel/common/block/include/intelblocks/pmclib.h index 4093599..fe0a765 100644 --- a/src/soc/intel/common/block/include/intelblocks/pmclib.h +++ b/src/soc/intel/common/block/include/intelblocks/pmclib.h @@ -42,6 +42,11 @@ */ int soc_prev_sleep_state(const struct chipset_power_state *ps, int prev_sleep_state); + +/* PM1 */ +void pmc_update_pm1_enable(uint16_t events); +uint16_t pmc_read_pm1_enable(void); + /* * Function to print, clear, and return SMI status bits in SMI_STS * register. This function internally calls pmc_reset_smi_status with diff --git a/src/soc/intel/common/block/pmc/pmclib.c b/src/soc/intel/common/block/pmc/pmclib.c index e741332..78b43e4 100644 --- a/src/soc/intel/common/block/pmc/pmclib.c +++ b/src/soc/intel/common/block/pmc/pmclib.c @@ -72,6 +72,23 @@ return smi_sts; }
+/* + * Update supplied events in PM1_EN register. This does not disable any already + * set events. + */ +void pmc_update_pm1_enable(u16 events) +{ + u16 pm1_en = pmc_read_pm1_enable(); + pm1_en |= events; + pmc_enable_pm1(pm1_en); +} + +/* Read events set in PM1_EN register. */ +uint16_t pmc_read_pm1_enable(void) +{ + return inw(ACPI_BASE_ADDRESS + PM1_EN); +} + uint32_t pmc_clear_smi_status(void) { uint32_t sts = pmc_reset_smi_status();