Loading drivers/acpi/apei/erst.c +23 −28 Original line number Original line Diff line number Diff line Loading @@ -39,7 +39,8 @@ #include "apei-internal.h" #include "apei-internal.h" #define ERST_PFX "ERST: " #undef pr_fmt #define pr_fmt(fmt) "ERST: " fmt /* ERST command status */ /* ERST command status */ #define ERST_STATUS_SUCCESS 0x0 #define ERST_STATUS_SUCCESS 0x0 Loading Loading @@ -109,8 +110,7 @@ static inline int erst_errno(int command_status) static int erst_timedout(u64 *t, u64 spin_unit) static int erst_timedout(u64 *t, u64 spin_unit) { { if ((s64)*t < spin_unit) { if ((s64)*t < spin_unit) { pr_warning(FW_WARN ERST_PFX pr_warn(FW_WARN "Firmware does not respond in time.\n"); "Firmware does not respond in time\n"); return 1; return 1; } } *t -= spin_unit; *t -= spin_unit; Loading Loading @@ -186,8 +186,8 @@ static int erst_exec_stall(struct apei_exec_context *ctx, if (ctx->value > FIRMWARE_MAX_STALL) { if (ctx->value > FIRMWARE_MAX_STALL) { if (!in_nmi()) if (!in_nmi()) pr_warning(FW_WARN ERST_PFX pr_warn(FW_WARN "Too long stall time for stall instruction: %llx.\n", "Too long stall time for stall instruction: 0x%llx.\n", ctx->value); ctx->value); stall_time = FIRMWARE_MAX_STALL; stall_time = FIRMWARE_MAX_STALL; } else } else Loading @@ -206,8 +206,8 @@ static int erst_exec_stall_while_true(struct apei_exec_context *ctx, if (ctx->var1 > FIRMWARE_MAX_STALL) { if (ctx->var1 > FIRMWARE_MAX_STALL) { if (!in_nmi()) if (!in_nmi()) pr_warning(FW_WARN ERST_PFX pr_warn(FW_WARN "Too long stall time for stall while true instruction: %llx.\n", "Too long stall time for stall while true instruction: 0x%llx.\n", ctx->var1); ctx->var1); stall_time = FIRMWARE_MAX_STALL; stall_time = FIRMWARE_MAX_STALL; } else } else Loading Loading @@ -271,8 +271,7 @@ static int erst_exec_move_data(struct apei_exec_context *ctx, /* ioremap does not work in interrupt context */ /* ioremap does not work in interrupt context */ if (in_interrupt()) { if (in_interrupt()) { pr_warning(ERST_PFX pr_warn("MOVE_DATA can not be used in interrupt context.\n"); "MOVE_DATA can not be used in interrupt context"); return -EBUSY; return -EBUSY; } } Loading Loading @@ -522,8 +521,7 @@ static int __erst_record_id_cache_add_one(void) ERST_RECORD_ID_CACHE_SIZE_MAX); ERST_RECORD_ID_CACHE_SIZE_MAX); if (new_size <= erst_record_id_cache.size) { if (new_size <= erst_record_id_cache.size) { if (printk_ratelimit()) if (printk_ratelimit()) pr_warning(FW_WARN ERST_PFX pr_warn(FW_WARN "too many record IDs!\n"); "too many record ID!\n"); return 0; return 0; } } alloc_size = new_size * sizeof(entries[0]); alloc_size = new_size * sizeof(entries[0]); Loading Loading @@ -759,8 +757,7 @@ static int __erst_clear_from_storage(u64 record_id) static void pr_unimpl_nvram(void) static void pr_unimpl_nvram(void) { { if (printk_ratelimit()) if (printk_ratelimit()) pr_warning(ERST_PFX pr_warn("NVRAM ERST Log Address Range not implemented yet.\n"); "NVRAM ERST Log Address Range is not implemented yet\n"); } } static int __erst_write_to_nvram(const struct cper_record_header *record) static int __erst_write_to_nvram(const struct cper_record_header *record) Loading Loading @@ -1120,7 +1117,7 @@ static int __init erst_init(void) goto err; goto err; if (erst_disable) { if (erst_disable) { pr_info(ERST_PFX pr_info( "Error Record Serialization Table (ERST) support is disabled.\n"); "Error Record Serialization Table (ERST) support is disabled.\n"); goto err; goto err; } } Loading @@ -1131,14 +1128,14 @@ static int __init erst_init(void) goto err; goto err; else if (ACPI_FAILURE(status)) { else if (ACPI_FAILURE(status)) { const char *msg = acpi_format_exception(status); const char *msg = acpi_format_exception(status); pr_err(ERST_PFX "Failed to get table, %s\n", msg); pr_err("Failed to get table, %s\n", msg); rc = -EINVAL; rc = -EINVAL; goto err; goto err; } } rc = erst_check_table(erst_tab); rc = erst_check_table(erst_tab); if (rc) { if (rc) { pr_err(FW_BUG ERST_PFX "ERST table is invalid\n"); pr_err(FW_BUG "ERST table is invalid.\n"); goto err; goto err; } } Loading @@ -1156,21 +1153,19 @@ static int __init erst_init(void) rc = erst_get_erange(&erst_erange); rc = erst_get_erange(&erst_erange); if (rc) { if (rc) { if (rc == -ENODEV) if (rc == -ENODEV) pr_info(ERST_PFX pr_info( "The corresponding hardware device or firmware implementation " "The corresponding hardware device or firmware implementation " "is not available.\n"); "is not available.\n"); else else pr_err(ERST_PFX pr_err("Failed to get Error Log Address Range.\n"); "Failed to get Error Log Address Range.\n"); goto err_unmap_reg; goto err_unmap_reg; } } r = request_mem_region(erst_erange.base, erst_erange.size, "APEI ERST"); r = request_mem_region(erst_erange.base, erst_erange.size, "APEI ERST"); if (!r) { if (!r) { pr_err(ERST_PFX pr_err("Can not request [mem %#010llx-%#010llx] for ERST.\n", "Can not request iomem region <0x%16llx-0x%16llx> for ERST.\n", (unsigned long long)erst_erange.base, (unsigned long long)erst_erange.base, (unsigned long long)erst_erange.base + erst_erange.size); (unsigned long long)erst_erange.base + erst_erange.size - 1); rc = -EIO; rc = -EIO; goto err_unmap_reg; goto err_unmap_reg; } } Loading @@ -1180,7 +1175,7 @@ static int __init erst_init(void) if (!erst_erange.vaddr) if (!erst_erange.vaddr) goto err_release_erange; goto err_release_erange; pr_info(ERST_PFX pr_info( "Error Record Serialization Table (ERST) support is initialized.\n"); "Error Record Serialization Table (ERST) support is initialized.\n"); buf = kmalloc(erst_erange.size, GFP_KERNEL); buf = kmalloc(erst_erange.size, GFP_KERNEL); Loading @@ -1192,15 +1187,15 @@ static int __init erst_init(void) rc = pstore_register(&erst_info); rc = pstore_register(&erst_info); if (rc) { if (rc) { if (rc != -EPERM) if (rc != -EPERM) pr_info(ERST_PFX pr_info( "Could not register with persistent store\n"); "Could not register with persistent store.\n"); erst_info.buf = NULL; erst_info.buf = NULL; erst_info.bufsize = 0; erst_info.bufsize = 0; kfree(buf); kfree(buf); } } } else } else pr_err(ERST_PFX pr_err( "Failed to allocate %lld bytes for persistent store error log\n", "Failed to allocate %lld bytes for persistent store error log.\n", erst_erange.size); erst_erange.size); return 0; return 0; Loading Loading
drivers/acpi/apei/erst.c +23 −28 Original line number Original line Diff line number Diff line Loading @@ -39,7 +39,8 @@ #include "apei-internal.h" #include "apei-internal.h" #define ERST_PFX "ERST: " #undef pr_fmt #define pr_fmt(fmt) "ERST: " fmt /* ERST command status */ /* ERST command status */ #define ERST_STATUS_SUCCESS 0x0 #define ERST_STATUS_SUCCESS 0x0 Loading Loading @@ -109,8 +110,7 @@ static inline int erst_errno(int command_status) static int erst_timedout(u64 *t, u64 spin_unit) static int erst_timedout(u64 *t, u64 spin_unit) { { if ((s64)*t < spin_unit) { if ((s64)*t < spin_unit) { pr_warning(FW_WARN ERST_PFX pr_warn(FW_WARN "Firmware does not respond in time.\n"); "Firmware does not respond in time\n"); return 1; return 1; } } *t -= spin_unit; *t -= spin_unit; Loading Loading @@ -186,8 +186,8 @@ static int erst_exec_stall(struct apei_exec_context *ctx, if (ctx->value > FIRMWARE_MAX_STALL) { if (ctx->value > FIRMWARE_MAX_STALL) { if (!in_nmi()) if (!in_nmi()) pr_warning(FW_WARN ERST_PFX pr_warn(FW_WARN "Too long stall time for stall instruction: %llx.\n", "Too long stall time for stall instruction: 0x%llx.\n", ctx->value); ctx->value); stall_time = FIRMWARE_MAX_STALL; stall_time = FIRMWARE_MAX_STALL; } else } else Loading @@ -206,8 +206,8 @@ static int erst_exec_stall_while_true(struct apei_exec_context *ctx, if (ctx->var1 > FIRMWARE_MAX_STALL) { if (ctx->var1 > FIRMWARE_MAX_STALL) { if (!in_nmi()) if (!in_nmi()) pr_warning(FW_WARN ERST_PFX pr_warn(FW_WARN "Too long stall time for stall while true instruction: %llx.\n", "Too long stall time for stall while true instruction: 0x%llx.\n", ctx->var1); ctx->var1); stall_time = FIRMWARE_MAX_STALL; stall_time = FIRMWARE_MAX_STALL; } else } else Loading Loading @@ -271,8 +271,7 @@ static int erst_exec_move_data(struct apei_exec_context *ctx, /* ioremap does not work in interrupt context */ /* ioremap does not work in interrupt context */ if (in_interrupt()) { if (in_interrupt()) { pr_warning(ERST_PFX pr_warn("MOVE_DATA can not be used in interrupt context.\n"); "MOVE_DATA can not be used in interrupt context"); return -EBUSY; return -EBUSY; } } Loading Loading @@ -522,8 +521,7 @@ static int __erst_record_id_cache_add_one(void) ERST_RECORD_ID_CACHE_SIZE_MAX); ERST_RECORD_ID_CACHE_SIZE_MAX); if (new_size <= erst_record_id_cache.size) { if (new_size <= erst_record_id_cache.size) { if (printk_ratelimit()) if (printk_ratelimit()) pr_warning(FW_WARN ERST_PFX pr_warn(FW_WARN "too many record IDs!\n"); "too many record ID!\n"); return 0; return 0; } } alloc_size = new_size * sizeof(entries[0]); alloc_size = new_size * sizeof(entries[0]); Loading Loading @@ -759,8 +757,7 @@ static int __erst_clear_from_storage(u64 record_id) static void pr_unimpl_nvram(void) static void pr_unimpl_nvram(void) { { if (printk_ratelimit()) if (printk_ratelimit()) pr_warning(ERST_PFX pr_warn("NVRAM ERST Log Address Range not implemented yet.\n"); "NVRAM ERST Log Address Range is not implemented yet\n"); } } static int __erst_write_to_nvram(const struct cper_record_header *record) static int __erst_write_to_nvram(const struct cper_record_header *record) Loading Loading @@ -1120,7 +1117,7 @@ static int __init erst_init(void) goto err; goto err; if (erst_disable) { if (erst_disable) { pr_info(ERST_PFX pr_info( "Error Record Serialization Table (ERST) support is disabled.\n"); "Error Record Serialization Table (ERST) support is disabled.\n"); goto err; goto err; } } Loading @@ -1131,14 +1128,14 @@ static int __init erst_init(void) goto err; goto err; else if (ACPI_FAILURE(status)) { else if (ACPI_FAILURE(status)) { const char *msg = acpi_format_exception(status); const char *msg = acpi_format_exception(status); pr_err(ERST_PFX "Failed to get table, %s\n", msg); pr_err("Failed to get table, %s\n", msg); rc = -EINVAL; rc = -EINVAL; goto err; goto err; } } rc = erst_check_table(erst_tab); rc = erst_check_table(erst_tab); if (rc) { if (rc) { pr_err(FW_BUG ERST_PFX "ERST table is invalid\n"); pr_err(FW_BUG "ERST table is invalid.\n"); goto err; goto err; } } Loading @@ -1156,21 +1153,19 @@ static int __init erst_init(void) rc = erst_get_erange(&erst_erange); rc = erst_get_erange(&erst_erange); if (rc) { if (rc) { if (rc == -ENODEV) if (rc == -ENODEV) pr_info(ERST_PFX pr_info( "The corresponding hardware device or firmware implementation " "The corresponding hardware device or firmware implementation " "is not available.\n"); "is not available.\n"); else else pr_err(ERST_PFX pr_err("Failed to get Error Log Address Range.\n"); "Failed to get Error Log Address Range.\n"); goto err_unmap_reg; goto err_unmap_reg; } } r = request_mem_region(erst_erange.base, erst_erange.size, "APEI ERST"); r = request_mem_region(erst_erange.base, erst_erange.size, "APEI ERST"); if (!r) { if (!r) { pr_err(ERST_PFX pr_err("Can not request [mem %#010llx-%#010llx] for ERST.\n", "Can not request iomem region <0x%16llx-0x%16llx> for ERST.\n", (unsigned long long)erst_erange.base, (unsigned long long)erst_erange.base, (unsigned long long)erst_erange.base + erst_erange.size); (unsigned long long)erst_erange.base + erst_erange.size - 1); rc = -EIO; rc = -EIO; goto err_unmap_reg; goto err_unmap_reg; } } Loading @@ -1180,7 +1175,7 @@ static int __init erst_init(void) if (!erst_erange.vaddr) if (!erst_erange.vaddr) goto err_release_erange; goto err_release_erange; pr_info(ERST_PFX pr_info( "Error Record Serialization Table (ERST) support is initialized.\n"); "Error Record Serialization Table (ERST) support is initialized.\n"); buf = kmalloc(erst_erange.size, GFP_KERNEL); buf = kmalloc(erst_erange.size, GFP_KERNEL); Loading @@ -1192,15 +1187,15 @@ static int __init erst_init(void) rc = pstore_register(&erst_info); rc = pstore_register(&erst_info); if (rc) { if (rc) { if (rc != -EPERM) if (rc != -EPERM) pr_info(ERST_PFX pr_info( "Could not register with persistent store\n"); "Could not register with persistent store.\n"); erst_info.buf = NULL; erst_info.buf = NULL; erst_info.bufsize = 0; erst_info.bufsize = 0; kfree(buf); kfree(buf); } } } else } else pr_err(ERST_PFX pr_err( "Failed to allocate %lld bytes for persistent store error log\n", "Failed to allocate %lld bytes for persistent store error log.\n", erst_erange.size); erst_erange.size); return 0; return 0; Loading