@@ -34,43 +34,6 @@
static int bert_disable;
-static void __init bert_print_all(struct acpi_bert_region *region,
- unsigned int region_len)
-{
- struct acpi_hest_generic_status *estatus =
- (struct acpi_hest_generic_status *)region;
- int remain = region_len;
- u32 estatus_len;
-
- if (!estatus->block_status)
- return;
-
- while (remain > sizeof(struct acpi_bert_region)) {
- if (cper_estatus_check(estatus)) {
- pr_err(FW_BUG "Invalid error record.\n");
- return;
- }
-
- estatus_len = cper_estatus_len(estatus);
- if (remain < estatus_len) {
- pr_err(FW_BUG "Truncated status block (length: %u).\n",
- estatus_len);
- return;
- }
-
- pr_info_once("Error records from previous boot:\n");
-
- cper_estatus_print(KERN_INFO HW_ERR, estatus);
-
- estatus = (void *)estatus + estatus_len;
- /* No more error records. */
- if (!estatus->block_status)
- return;
-
- remain -= estatus_len;
- }
-}
-
static int __init setup_bert_disable(char *str)
{
bert_disable = 1;
@@ -82,7 +45,7 @@ __setup("bert_disable", setup_bert_disable);
static int __init bert_check_table(struct acpi_table_bert *bert_tab)
{
if (bert_tab->header.length < sizeof(struct acpi_table_bert) ||
- bert_tab->region_length < sizeof(struct acpi_bert_region))
+ bert_tab->region_length < sizeof(struct acpi_hest_generic_status))
return -EINVAL;
return 0;
@@ -91,7 +54,7 @@ static int __init bert_check_table(struct acpi_table_bert *bert_tab)
static int __init bert_init(void)
{
struct apei_resources bert_resources;
- struct acpi_bert_region *boot_error_region;
+ struct acpi_hest_generic_status *boot_error_region;
struct acpi_table_bert *bert_tab;
unsigned int region_len;
acpi_status status;
@@ -131,7 +94,16 @@ static int __init bert_init(void)
goto out_fini;
boot_error_region = ioremap_cache(bert_tab->address, region_len);
if (boot_error_region) {
- bert_print_all(boot_error_region, region_len);
+ if (boot_error_region->block_status) {
+ rc = cper_estatus_check(boot_error_region);
+ if (rc) {
+ pr_err(FW_BUG "Invalid error record.\n");
+ iounmap(boot_error_region);
+ return rc;
+ }
+ pr_info("Error records from previous boot:\n");
+ cper_estatus_print(KERN_INFO HW_ERR, boot_error_region);
+ }
iounmap(boot_error_region);
} else {
rc = -ENOMEM;