aboutsummaryrefslogtreecommitdiff
path: root/hw/fsp/fsp-epow.c
diff options
context:
space:
mode:
authorAnshuman Khandual <khandual@linux.vnet.ibm.com>2014-07-31 16:11:37 +0530
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-08-01 16:02:27 +1000
commitdbac1e776bd8cfd928ab0394924a6aca7c681c37 (patch)
treeaff89d8799ad55c0dbc8903035782be4e83804d5 /hw/fsp/fsp-epow.c
parentfbee90cf8076eefeac333c1640cb940957acfa40 (diff)
downloadskiboot-dbac1e776bd8cfd928ab0394924a6aca7c681c37.zip
skiboot-dbac1e776bd8cfd928ab0394924a6aca7c681c37.tar.gz
skiboot-dbac1e776bd8cfd928ab0394924a6aca7c681c37.tar.bz2
epow: Change how the old and the new system epow status are maintained
This patch changes the way how the old and the new system epow status are maintained. After receiving FSP EPOW async message, only reset those parts of system EPOW status which will be updated with the new FSP async message. This patch also fixes a problem with comparing the contents of the new and the old system EPOW status. Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'hw/fsp/fsp-epow.c')
-rw-r--r--hw/fsp/fsp-epow.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/fsp/fsp-epow.c b/hw/fsp/fsp-epow.c
index c04880a..6ab7cd9 100644
--- a/hw/fsp/fsp-epow.c
+++ b/hw/fsp/fsp-epow.c
@@ -48,6 +48,9 @@ static struct lock epow_lock = LOCK_UNLOCKED;
/* Process FSP sent SPCN based information */
static void epow_process_base_event(u8 *epow)
{
+
+ epow_status[OPAL_SYSEPOW_POWER] &= ~(OPAL_SYSPOWER_CHNG |
+ OPAL_SYSPOWER_FAIL | OPAL_SYSPOWER_INCL);
/*
* FIXME: As of now, SPCN_FAULT_LOG event is not being used
* as it does not map to any generic defined OPAL EPOW event.
@@ -78,6 +81,9 @@ static void epow_process_base_event(u8 *epow)
/* Process FSP sent EPOW based information */
static void epow_process_ex1_event(u8 *epow)
{
+ epow_status[OPAL_SYSEPOW_POWER] &= ~OPAL_SYSPOWER_UPS;
+ epow_status[OPAL_SYSEPOW_TEMP] &= ~(OPAL_SYSTEMP_AMB | OPAL_SYSTEMP_INT);
+
if (epow[4] == EPOW_ON_UPS) {
printf(PREFIX "FSP message with EPOW_ON_UPS\n");
epow_status[OPAL_SYSEPOW_POWER] |= OPAL_SYSPOWER_UPS;
@@ -105,7 +111,6 @@ static void fsp_epow_update(u8 *epow, int epow_type)
/* Copy over and clear system EPOW status */
memcpy(old_epow_status, epow_status, sizeof(old_epow_status));
- memset(epow_status, 0, sizeof(epow_status));
switch(epow_type) {
case EPOW_NORMAL:
epow_process_base_event(epow);
@@ -127,7 +132,7 @@ static void fsp_epow_update(u8 *epow, int epow_type)
}
unlock(&epow_lock);
- if (epow_status != old_epow_status)
+ if (memcmp(epow_status, old_epow_status, sizeof(epow_status)))
epow_changed = true;
/* Send OPAL message notification */