/* Detect EPOW event */ staticbool detect_epow(void)
{
u16 epow; int i, rc;
__be16 epow_classes;
__be16 opal_epow_status[OPAL_SYSEPOW_MAX] = {0};
/* * Check for EPOW event. Kernel sends supported EPOW classes info * to OPAL. OPAL returns EPOW info along with classes present.
*/
epow_classes = cpu_to_be16(OPAL_SYSEPOW_MAX);
rc = opal_get_epow_status(opal_epow_status, &epow_classes); if (rc != OPAL_SUCCESS) {
pr_err("Failed to get EPOW event information\n"); returnfalse;
}
/* Look for EPOW events present */ for (i = 0; i < be16_to_cpu(epow_classes); i++) {
epow = be16_to_cpu(opal_epow_status[i]);
/* Filter events which do not need shutdown. */ if (i == OPAL_SYSEPOW_POWER)
epow &= ~(OPAL_SYSPOWER_CHNG | OPAL_SYSPOWER_FAIL |
OPAL_SYSPOWER_INCL); if (epow) returntrue;
}
returnfalse;
}
/* Check for existing EPOW, DPO events */ staticbool __init poweroff_pending(void)
{ int rc;
__be64 opal_dpo_timeout;
/* Check for DPO event */
rc = opal_get_dpo_status(&opal_dpo_timeout); if (rc == OPAL_SUCCESS) {
pr_info("Existing DPO event detected.\n"); returntrue;
}
/* Check for EPOW event */ if (detect_epow()) {
pr_info("Existing EPOW event detected.\n"); returntrue;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.