162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * UEFI Common Platform Error Record (CPER) support
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2017, The Linux Foundation. All rights reserved.
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include <linux/kernel.h>
962306a36Sopenharmony_ci#include <linux/module.h>
1062306a36Sopenharmony_ci#include <linux/time.h>
1162306a36Sopenharmony_ci#include <linux/cper.h>
1262306a36Sopenharmony_ci#include <linux/dmi.h>
1362306a36Sopenharmony_ci#include <linux/acpi.h>
1462306a36Sopenharmony_ci#include <linux/pci.h>
1562306a36Sopenharmony_ci#include <linux/printk.h>
1662306a36Sopenharmony_ci#include <linux/bcd.h>
1762306a36Sopenharmony_ci#include <acpi/ghes.h>
1862306a36Sopenharmony_ci#include <ras/ras_event.h>
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_cistatic const char * const arm_reg_ctx_strs[] = {
2162306a36Sopenharmony_ci	"AArch32 general purpose registers",
2262306a36Sopenharmony_ci	"AArch32 EL1 context registers",
2362306a36Sopenharmony_ci	"AArch32 EL2 context registers",
2462306a36Sopenharmony_ci	"AArch32 secure context registers",
2562306a36Sopenharmony_ci	"AArch64 general purpose registers",
2662306a36Sopenharmony_ci	"AArch64 EL1 context registers",
2762306a36Sopenharmony_ci	"AArch64 EL2 context registers",
2862306a36Sopenharmony_ci	"AArch64 EL3 context registers",
2962306a36Sopenharmony_ci	"Misc. system register structure",
3062306a36Sopenharmony_ci};
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_cistatic const char * const arm_err_trans_type_strs[] = {
3362306a36Sopenharmony_ci	"Instruction",
3462306a36Sopenharmony_ci	"Data Access",
3562306a36Sopenharmony_ci	"Generic",
3662306a36Sopenharmony_ci};
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_cistatic const char * const arm_bus_err_op_strs[] = {
3962306a36Sopenharmony_ci	"Generic error (type cannot be determined)",
4062306a36Sopenharmony_ci	"Generic read (type of instruction or data request cannot be determined)",
4162306a36Sopenharmony_ci	"Generic write (type of instruction of data request cannot be determined)",
4262306a36Sopenharmony_ci	"Data read",
4362306a36Sopenharmony_ci	"Data write",
4462306a36Sopenharmony_ci	"Instruction fetch",
4562306a36Sopenharmony_ci	"Prefetch",
4662306a36Sopenharmony_ci};
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_cistatic const char * const arm_cache_err_op_strs[] = {
4962306a36Sopenharmony_ci	"Generic error (type cannot be determined)",
5062306a36Sopenharmony_ci	"Generic read (type of instruction or data request cannot be determined)",
5162306a36Sopenharmony_ci	"Generic write (type of instruction of data request cannot be determined)",
5262306a36Sopenharmony_ci	"Data read",
5362306a36Sopenharmony_ci	"Data write",
5462306a36Sopenharmony_ci	"Instruction fetch",
5562306a36Sopenharmony_ci	"Prefetch",
5662306a36Sopenharmony_ci	"Eviction",
5762306a36Sopenharmony_ci	"Snooping (processor initiated a cache snoop that resulted in an error)",
5862306a36Sopenharmony_ci	"Snooped (processor raised a cache error caused by another processor or device snooping its cache)",
5962306a36Sopenharmony_ci	"Management",
6062306a36Sopenharmony_ci};
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_cistatic const char * const arm_tlb_err_op_strs[] = {
6362306a36Sopenharmony_ci	"Generic error (type cannot be determined)",
6462306a36Sopenharmony_ci	"Generic read (type of instruction or data request cannot be determined)",
6562306a36Sopenharmony_ci	"Generic write (type of instruction of data request cannot be determined)",
6662306a36Sopenharmony_ci	"Data read",
6762306a36Sopenharmony_ci	"Data write",
6862306a36Sopenharmony_ci	"Instruction fetch",
6962306a36Sopenharmony_ci	"Prefetch",
7062306a36Sopenharmony_ci	"Local management operation (processor initiated a TLB management operation that resulted in an error)",
7162306a36Sopenharmony_ci	"External management operation (processor raised a TLB error caused by another processor or device broadcasting TLB operations)",
7262306a36Sopenharmony_ci};
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_cistatic const char * const arm_bus_err_part_type_strs[] = {
7562306a36Sopenharmony_ci	"Local processor originated request",
7662306a36Sopenharmony_ci	"Local processor responded to request",
7762306a36Sopenharmony_ci	"Local processor observed",
7862306a36Sopenharmony_ci	"Generic",
7962306a36Sopenharmony_ci};
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_cistatic const char * const arm_bus_err_addr_space_strs[] = {
8262306a36Sopenharmony_ci	"External Memory Access",
8362306a36Sopenharmony_ci	"Internal Memory Access",
8462306a36Sopenharmony_ci	"Unknown",
8562306a36Sopenharmony_ci	"Device Memory Access",
8662306a36Sopenharmony_ci};
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_cistatic void cper_print_arm_err_info(const char *pfx, u32 type,
8962306a36Sopenharmony_ci				    u64 error_info)
9062306a36Sopenharmony_ci{
9162306a36Sopenharmony_ci	u8 trans_type, op_type, level, participation_type, address_space;
9262306a36Sopenharmony_ci	u16 mem_attributes;
9362306a36Sopenharmony_ci	bool proc_context_corrupt, corrected, precise_pc, restartable_pc;
9462306a36Sopenharmony_ci	bool time_out, access_mode;
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci	/* If the type is unknown, bail. */
9762306a36Sopenharmony_ci	if (type > CPER_ARM_MAX_TYPE)
9862306a36Sopenharmony_ci		return;
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci	/*
10162306a36Sopenharmony_ci	 * Vendor type errors have error information values that are vendor
10262306a36Sopenharmony_ci	 * specific.
10362306a36Sopenharmony_ci	 */
10462306a36Sopenharmony_ci	if (type == CPER_ARM_VENDOR_ERROR)
10562306a36Sopenharmony_ci		return;
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci	if (error_info & CPER_ARM_ERR_VALID_TRANSACTION_TYPE) {
10862306a36Sopenharmony_ci		trans_type = ((error_info >> CPER_ARM_ERR_TRANSACTION_SHIFT)
10962306a36Sopenharmony_ci			      & CPER_ARM_ERR_TRANSACTION_MASK);
11062306a36Sopenharmony_ci		if (trans_type < ARRAY_SIZE(arm_err_trans_type_strs)) {
11162306a36Sopenharmony_ci			printk("%stransaction type: %s\n", pfx,
11262306a36Sopenharmony_ci			       arm_err_trans_type_strs[trans_type]);
11362306a36Sopenharmony_ci		}
11462306a36Sopenharmony_ci	}
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci	if (error_info & CPER_ARM_ERR_VALID_OPERATION_TYPE) {
11762306a36Sopenharmony_ci		op_type = ((error_info >> CPER_ARM_ERR_OPERATION_SHIFT)
11862306a36Sopenharmony_ci			   & CPER_ARM_ERR_OPERATION_MASK);
11962306a36Sopenharmony_ci		switch (type) {
12062306a36Sopenharmony_ci		case CPER_ARM_CACHE_ERROR:
12162306a36Sopenharmony_ci			if (op_type < ARRAY_SIZE(arm_cache_err_op_strs)) {
12262306a36Sopenharmony_ci				printk("%soperation type: %s\n", pfx,
12362306a36Sopenharmony_ci				       arm_cache_err_op_strs[op_type]);
12462306a36Sopenharmony_ci			}
12562306a36Sopenharmony_ci			break;
12662306a36Sopenharmony_ci		case CPER_ARM_TLB_ERROR:
12762306a36Sopenharmony_ci			if (op_type < ARRAY_SIZE(arm_tlb_err_op_strs)) {
12862306a36Sopenharmony_ci				printk("%soperation type: %s\n", pfx,
12962306a36Sopenharmony_ci				       arm_tlb_err_op_strs[op_type]);
13062306a36Sopenharmony_ci			}
13162306a36Sopenharmony_ci			break;
13262306a36Sopenharmony_ci		case CPER_ARM_BUS_ERROR:
13362306a36Sopenharmony_ci			if (op_type < ARRAY_SIZE(arm_bus_err_op_strs)) {
13462306a36Sopenharmony_ci				printk("%soperation type: %s\n", pfx,
13562306a36Sopenharmony_ci				       arm_bus_err_op_strs[op_type]);
13662306a36Sopenharmony_ci			}
13762306a36Sopenharmony_ci			break;
13862306a36Sopenharmony_ci		}
13962306a36Sopenharmony_ci	}
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci	if (error_info & CPER_ARM_ERR_VALID_LEVEL) {
14262306a36Sopenharmony_ci		level = ((error_info >> CPER_ARM_ERR_LEVEL_SHIFT)
14362306a36Sopenharmony_ci			 & CPER_ARM_ERR_LEVEL_MASK);
14462306a36Sopenharmony_ci		switch (type) {
14562306a36Sopenharmony_ci		case CPER_ARM_CACHE_ERROR:
14662306a36Sopenharmony_ci			printk("%scache level: %d\n", pfx, level);
14762306a36Sopenharmony_ci			break;
14862306a36Sopenharmony_ci		case CPER_ARM_TLB_ERROR:
14962306a36Sopenharmony_ci			printk("%sTLB level: %d\n", pfx, level);
15062306a36Sopenharmony_ci			break;
15162306a36Sopenharmony_ci		case CPER_ARM_BUS_ERROR:
15262306a36Sopenharmony_ci			printk("%saffinity level at which the bus error occurred: %d\n",
15362306a36Sopenharmony_ci			       pfx, level);
15462306a36Sopenharmony_ci			break;
15562306a36Sopenharmony_ci		}
15662306a36Sopenharmony_ci	}
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci	if (error_info & CPER_ARM_ERR_VALID_PROC_CONTEXT_CORRUPT) {
15962306a36Sopenharmony_ci		proc_context_corrupt = ((error_info >> CPER_ARM_ERR_PC_CORRUPT_SHIFT)
16062306a36Sopenharmony_ci					& CPER_ARM_ERR_PC_CORRUPT_MASK);
16162306a36Sopenharmony_ci		if (proc_context_corrupt)
16262306a36Sopenharmony_ci			printk("%sprocessor context corrupted\n", pfx);
16362306a36Sopenharmony_ci		else
16462306a36Sopenharmony_ci			printk("%sprocessor context not corrupted\n", pfx);
16562306a36Sopenharmony_ci	}
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci	if (error_info & CPER_ARM_ERR_VALID_CORRECTED) {
16862306a36Sopenharmony_ci		corrected = ((error_info >> CPER_ARM_ERR_CORRECTED_SHIFT)
16962306a36Sopenharmony_ci			     & CPER_ARM_ERR_CORRECTED_MASK);
17062306a36Sopenharmony_ci		if (corrected)
17162306a36Sopenharmony_ci			printk("%sthe error has been corrected\n", pfx);
17262306a36Sopenharmony_ci		else
17362306a36Sopenharmony_ci			printk("%sthe error has not been corrected\n", pfx);
17462306a36Sopenharmony_ci	}
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_ci	if (error_info & CPER_ARM_ERR_VALID_PRECISE_PC) {
17762306a36Sopenharmony_ci		precise_pc = ((error_info >> CPER_ARM_ERR_PRECISE_PC_SHIFT)
17862306a36Sopenharmony_ci			      & CPER_ARM_ERR_PRECISE_PC_MASK);
17962306a36Sopenharmony_ci		if (precise_pc)
18062306a36Sopenharmony_ci			printk("%sPC is precise\n", pfx);
18162306a36Sopenharmony_ci		else
18262306a36Sopenharmony_ci			printk("%sPC is imprecise\n", pfx);
18362306a36Sopenharmony_ci	}
18462306a36Sopenharmony_ci
18562306a36Sopenharmony_ci	if (error_info & CPER_ARM_ERR_VALID_RESTARTABLE_PC) {
18662306a36Sopenharmony_ci		restartable_pc = ((error_info >> CPER_ARM_ERR_RESTARTABLE_PC_SHIFT)
18762306a36Sopenharmony_ci				  & CPER_ARM_ERR_RESTARTABLE_PC_MASK);
18862306a36Sopenharmony_ci		if (restartable_pc)
18962306a36Sopenharmony_ci			printk("%sProgram execution can be restarted reliably at the PC associated with the error.\n", pfx);
19062306a36Sopenharmony_ci	}
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci	/* The rest of the fields are specific to bus errors */
19362306a36Sopenharmony_ci	if (type != CPER_ARM_BUS_ERROR)
19462306a36Sopenharmony_ci		return;
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ci	if (error_info & CPER_ARM_ERR_VALID_PARTICIPATION_TYPE) {
19762306a36Sopenharmony_ci		participation_type = ((error_info >> CPER_ARM_ERR_PARTICIPATION_TYPE_SHIFT)
19862306a36Sopenharmony_ci				      & CPER_ARM_ERR_PARTICIPATION_TYPE_MASK);
19962306a36Sopenharmony_ci		if (participation_type < ARRAY_SIZE(arm_bus_err_part_type_strs)) {
20062306a36Sopenharmony_ci			printk("%sparticipation type: %s\n", pfx,
20162306a36Sopenharmony_ci			       arm_bus_err_part_type_strs[participation_type]);
20262306a36Sopenharmony_ci		}
20362306a36Sopenharmony_ci	}
20462306a36Sopenharmony_ci
20562306a36Sopenharmony_ci	if (error_info & CPER_ARM_ERR_VALID_TIME_OUT) {
20662306a36Sopenharmony_ci		time_out = ((error_info >> CPER_ARM_ERR_TIME_OUT_SHIFT)
20762306a36Sopenharmony_ci			    & CPER_ARM_ERR_TIME_OUT_MASK);
20862306a36Sopenharmony_ci		if (time_out)
20962306a36Sopenharmony_ci			printk("%srequest timed out\n", pfx);
21062306a36Sopenharmony_ci	}
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_ci	if (error_info & CPER_ARM_ERR_VALID_ADDRESS_SPACE) {
21362306a36Sopenharmony_ci		address_space = ((error_info >> CPER_ARM_ERR_ADDRESS_SPACE_SHIFT)
21462306a36Sopenharmony_ci				 & CPER_ARM_ERR_ADDRESS_SPACE_MASK);
21562306a36Sopenharmony_ci		if (address_space < ARRAY_SIZE(arm_bus_err_addr_space_strs)) {
21662306a36Sopenharmony_ci			printk("%saddress space: %s\n", pfx,
21762306a36Sopenharmony_ci			       arm_bus_err_addr_space_strs[address_space]);
21862306a36Sopenharmony_ci		}
21962306a36Sopenharmony_ci	}
22062306a36Sopenharmony_ci
22162306a36Sopenharmony_ci	if (error_info & CPER_ARM_ERR_VALID_MEM_ATTRIBUTES) {
22262306a36Sopenharmony_ci		mem_attributes = ((error_info >> CPER_ARM_ERR_MEM_ATTRIBUTES_SHIFT)
22362306a36Sopenharmony_ci				  & CPER_ARM_ERR_MEM_ATTRIBUTES_MASK);
22462306a36Sopenharmony_ci		printk("%smemory access attributes:0x%x\n", pfx, mem_attributes);
22562306a36Sopenharmony_ci	}
22662306a36Sopenharmony_ci
22762306a36Sopenharmony_ci	if (error_info & CPER_ARM_ERR_VALID_ACCESS_MODE) {
22862306a36Sopenharmony_ci		access_mode = ((error_info >> CPER_ARM_ERR_ACCESS_MODE_SHIFT)
22962306a36Sopenharmony_ci			       & CPER_ARM_ERR_ACCESS_MODE_MASK);
23062306a36Sopenharmony_ci		if (access_mode)
23162306a36Sopenharmony_ci			printk("%saccess mode: normal\n", pfx);
23262306a36Sopenharmony_ci		else
23362306a36Sopenharmony_ci			printk("%saccess mode: secure\n", pfx);
23462306a36Sopenharmony_ci	}
23562306a36Sopenharmony_ci}
23662306a36Sopenharmony_ci
23762306a36Sopenharmony_civoid cper_print_proc_arm(const char *pfx,
23862306a36Sopenharmony_ci			 const struct cper_sec_proc_arm *proc)
23962306a36Sopenharmony_ci{
24062306a36Sopenharmony_ci	int i, len, max_ctx_type;
24162306a36Sopenharmony_ci	struct cper_arm_err_info *err_info;
24262306a36Sopenharmony_ci	struct cper_arm_ctx_info *ctx_info;
24362306a36Sopenharmony_ci	char newpfx[64], infopfx[64];
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_ci	printk("%sMIDR: 0x%016llx\n", pfx, proc->midr);
24662306a36Sopenharmony_ci
24762306a36Sopenharmony_ci	len = proc->section_length - (sizeof(*proc) +
24862306a36Sopenharmony_ci		proc->err_info_num * (sizeof(*err_info)));
24962306a36Sopenharmony_ci	if (len < 0) {
25062306a36Sopenharmony_ci		printk("%ssection length: %d\n", pfx, proc->section_length);
25162306a36Sopenharmony_ci		printk("%ssection length is too small\n", pfx);
25262306a36Sopenharmony_ci		printk("%sfirmware-generated error record is incorrect\n", pfx);
25362306a36Sopenharmony_ci		printk("%sERR_INFO_NUM is %d\n", pfx, proc->err_info_num);
25462306a36Sopenharmony_ci		return;
25562306a36Sopenharmony_ci	}
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_ci	if (proc->validation_bits & CPER_ARM_VALID_MPIDR)
25862306a36Sopenharmony_ci		printk("%sMultiprocessor Affinity Register (MPIDR): 0x%016llx\n",
25962306a36Sopenharmony_ci			pfx, proc->mpidr);
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ci	if (proc->validation_bits & CPER_ARM_VALID_AFFINITY_LEVEL)
26262306a36Sopenharmony_ci		printk("%serror affinity level: %d\n", pfx,
26362306a36Sopenharmony_ci			proc->affinity_level);
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_ci	if (proc->validation_bits & CPER_ARM_VALID_RUNNING_STATE) {
26662306a36Sopenharmony_ci		printk("%srunning state: 0x%x\n", pfx, proc->running_state);
26762306a36Sopenharmony_ci		printk("%sPower State Coordination Interface state: %d\n",
26862306a36Sopenharmony_ci			pfx, proc->psci_state);
26962306a36Sopenharmony_ci	}
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_ci	snprintf(newpfx, sizeof(newpfx), "%s ", pfx);
27262306a36Sopenharmony_ci
27362306a36Sopenharmony_ci	err_info = (struct cper_arm_err_info *)(proc + 1);
27462306a36Sopenharmony_ci	for (i = 0; i < proc->err_info_num; i++) {
27562306a36Sopenharmony_ci		printk("%sError info structure %d:\n", pfx, i);
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ci		printk("%snum errors: %d\n", pfx, err_info->multiple_error + 1);
27862306a36Sopenharmony_ci
27962306a36Sopenharmony_ci		if (err_info->validation_bits & CPER_ARM_INFO_VALID_FLAGS) {
28062306a36Sopenharmony_ci			if (err_info->flags & CPER_ARM_INFO_FLAGS_FIRST)
28162306a36Sopenharmony_ci				printk("%sfirst error captured\n", newpfx);
28262306a36Sopenharmony_ci			if (err_info->flags & CPER_ARM_INFO_FLAGS_LAST)
28362306a36Sopenharmony_ci				printk("%slast error captured\n", newpfx);
28462306a36Sopenharmony_ci			if (err_info->flags & CPER_ARM_INFO_FLAGS_PROPAGATED)
28562306a36Sopenharmony_ci				printk("%spropagated error captured\n",
28662306a36Sopenharmony_ci				       newpfx);
28762306a36Sopenharmony_ci			if (err_info->flags & CPER_ARM_INFO_FLAGS_OVERFLOW)
28862306a36Sopenharmony_ci				printk("%soverflow occurred, error info is incomplete\n",
28962306a36Sopenharmony_ci				       newpfx);
29062306a36Sopenharmony_ci		}
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ci		printk("%serror_type: %d, %s\n", newpfx, err_info->type,
29362306a36Sopenharmony_ci			err_info->type < ARRAY_SIZE(cper_proc_error_type_strs) ?
29462306a36Sopenharmony_ci			cper_proc_error_type_strs[err_info->type] : "unknown");
29562306a36Sopenharmony_ci		if (err_info->validation_bits & CPER_ARM_INFO_VALID_ERR_INFO) {
29662306a36Sopenharmony_ci			printk("%serror_info: 0x%016llx\n", newpfx,
29762306a36Sopenharmony_ci			       err_info->error_info);
29862306a36Sopenharmony_ci			snprintf(infopfx, sizeof(infopfx), "%s ", newpfx);
29962306a36Sopenharmony_ci			cper_print_arm_err_info(infopfx, err_info->type,
30062306a36Sopenharmony_ci						err_info->error_info);
30162306a36Sopenharmony_ci		}
30262306a36Sopenharmony_ci		if (err_info->validation_bits & CPER_ARM_INFO_VALID_VIRT_ADDR)
30362306a36Sopenharmony_ci			printk("%svirtual fault address: 0x%016llx\n",
30462306a36Sopenharmony_ci				newpfx, err_info->virt_fault_addr);
30562306a36Sopenharmony_ci		if (err_info->validation_bits & CPER_ARM_INFO_VALID_PHYSICAL_ADDR)
30662306a36Sopenharmony_ci			printk("%sphysical fault address: 0x%016llx\n",
30762306a36Sopenharmony_ci				newpfx, err_info->physical_fault_addr);
30862306a36Sopenharmony_ci		err_info += 1;
30962306a36Sopenharmony_ci	}
31062306a36Sopenharmony_ci
31162306a36Sopenharmony_ci	ctx_info = (struct cper_arm_ctx_info *)err_info;
31262306a36Sopenharmony_ci	max_ctx_type = ARRAY_SIZE(arm_reg_ctx_strs) - 1;
31362306a36Sopenharmony_ci	for (i = 0; i < proc->context_info_num; i++) {
31462306a36Sopenharmony_ci		int size = sizeof(*ctx_info) + ctx_info->size;
31562306a36Sopenharmony_ci
31662306a36Sopenharmony_ci		printk("%sContext info structure %d:\n", pfx, i);
31762306a36Sopenharmony_ci		if (len < size) {
31862306a36Sopenharmony_ci			printk("%ssection length is too small\n", newpfx);
31962306a36Sopenharmony_ci			printk("%sfirmware-generated error record is incorrect\n", pfx);
32062306a36Sopenharmony_ci			return;
32162306a36Sopenharmony_ci		}
32262306a36Sopenharmony_ci		if (ctx_info->type > max_ctx_type) {
32362306a36Sopenharmony_ci			printk("%sInvalid context type: %d (max: %d)\n",
32462306a36Sopenharmony_ci				newpfx, ctx_info->type, max_ctx_type);
32562306a36Sopenharmony_ci			return;
32662306a36Sopenharmony_ci		}
32762306a36Sopenharmony_ci		printk("%sregister context type: %s\n", newpfx,
32862306a36Sopenharmony_ci			arm_reg_ctx_strs[ctx_info->type]);
32962306a36Sopenharmony_ci		print_hex_dump(newpfx, "", DUMP_PREFIX_OFFSET, 16, 4,
33062306a36Sopenharmony_ci				(ctx_info + 1), ctx_info->size, 0);
33162306a36Sopenharmony_ci		len -= size;
33262306a36Sopenharmony_ci		ctx_info = (struct cper_arm_ctx_info *)((long)ctx_info + size);
33362306a36Sopenharmony_ci	}
33462306a36Sopenharmony_ci
33562306a36Sopenharmony_ci	if (len > 0) {
33662306a36Sopenharmony_ci		printk("%sVendor specific error info has %u bytes:\n", pfx,
33762306a36Sopenharmony_ci		       len);
33862306a36Sopenharmony_ci		print_hex_dump(newpfx, "", DUMP_PREFIX_OFFSET, 16, 4, ctx_info,
33962306a36Sopenharmony_ci				len, true);
34062306a36Sopenharmony_ci	}
34162306a36Sopenharmony_ci}
342