int __init opal_elog_init(void) { int rc = 0, irq; /* ELOG not supported by firmware */ if (!opal_check_token(OPAL_ELOG_READ)) return -1; elog_kset = kset_create_and_add("elog", NULL, opal_kobj); if (!elog_kset) { pr_warn("%s: failed to create elog kset\n", __func__); return -1; } irq = opal_event_request(ilog2(OPAL_EVENT_ERROR_LOG_AVAIL)); if (!irq) { pr_err("%s: Can't register OPAL event irq (%d)\n", __func__, irq); return irq; } rc = request_irq(irq, elog_event, IRQ_TYPE_LEVEL_HIGH, "opal-elog", NULL); if (rc) { pr_err("%s: Can't request OPAL event irq (%d)\n", __func__, rc); return rc; } /* We are now ready to pull error logs from opal. */ if (opal_check_token(OPAL_ELOG_RESEND)) opal_resend_pending_logs(); return 0; }
int __init opal_elog_init(void) { int rc = 0; /* ELOG not supported by firmware */ if (!opal_check_token(OPAL_ELOG_READ)) return -1; elog_kset = kset_create_and_add("elog", NULL, opal_kobj); if (!elog_kset) { pr_warn("%s: failed to create elog kset\n", __func__); return -1; } rc = opal_notifier_register(&elog_nb); if (rc) { pr_err("%s: Can't register OPAL event notifier (%d)\n", __func__, rc); return rc; } /* We are now ready to pull error logs from opal. */ opal_resend_pending_logs(); return 0; }
void __init opal_platform_dump_init(void) { int rc; dump_kset = kset_create_and_add("dump", NULL, opal_kobj); if (!dump_kset) { pr_warn("%s: Failed to create dump kset\n", __func__); return; } rc = sysfs_create_group(&dump_kset->kobj, &initiate_attr_group); if (rc) { pr_warn("%s: Failed to create initiate dump attr group\n", __func__); kobject_put(&dump_kset->kobj); return; } rc = opal_notifier_register(&dump_nb); if (rc) { pr_warn("%s: Can't register OPAL event notifier (%d)\n", __func__, rc); return; } if (opal_check_token(OPAL_DUMP_RESEND)) opal_dump_resend_notification(); }
static int __init opal_register_exception_handlers(void) { #ifdef __BIG_ENDIAN__ u64 glue; if (!(powerpc_firmware_features & FW_FEATURE_OPAL)) return -ENODEV; /* Hookup some exception handlers except machine check. We use the * fwnmi area at 0x7000 to provide the glue space to OPAL */ glue = 0x7000; /* * Check if we are running on newer firmware that exports * OPAL_HANDLE_HMI token. If yes, then don't ask OPAL to patch * the HMI interrupt and we catch it directly in Linux. * * For older firmware (i.e currently released POWER8 System Firmware * as of today <= SV810_087), we fallback to old behavior and let OPAL * patch the HMI vector and handle it inside OPAL firmware. * * For newer firmware (in development/yet to be released) we will * start catching/handling HMI directly in Linux. */ if (!opal_check_token(OPAL_HANDLE_HMI)) { pr_info("opal: Old firmware detected, OPAL handles HMIs.\n"); opal_register_exception_handler( OPAL_HYPERVISOR_MAINTENANCE_HANDLER, 0, glue); glue += 128; } opal_register_exception_handler(OPAL_SOFTPATCH_HANDLER, 0, glue); #endif return 0; }