Commit 223ca9d8 authored by Anton Blanchard's avatar Anton Blanchard Committed by Benjamin Herrenschmidt

powerpc/powernv: Fix endian issues in memory error handling code

struct OpalMemoryErrorData is passed to us from firmware, so we
have to byteswap it.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 2213fb14
...@@ -510,7 +510,7 @@ enum OpalMemErr_DynErrType { ...@@ -510,7 +510,7 @@ enum OpalMemErr_DynErrType {
struct OpalMemoryErrorData { struct OpalMemoryErrorData {
enum OpalMemErr_Version version:8; /* 0x00 */ enum OpalMemErr_Version version:8; /* 0x00 */
enum OpalMemErrType type:8; /* 0x01 */ enum OpalMemErrType type:8; /* 0x01 */
uint16_t flags; /* 0x02 */ __be16 flags; /* 0x02 */
uint8_t reserved_1[4]; /* 0x04 */ uint8_t reserved_1[4]; /* 0x04 */
union { union {
...@@ -518,15 +518,15 @@ struct OpalMemoryErrorData { ...@@ -518,15 +518,15 @@ struct OpalMemoryErrorData {
struct { struct {
enum OpalMemErr_ResilErrType resil_err_type:8; enum OpalMemErr_ResilErrType resil_err_type:8;
uint8_t reserved_1[7]; uint8_t reserved_1[7];
uint64_t physical_address_start; __be64 physical_address_start;
uint64_t physical_address_end; __be64 physical_address_end;
} resilience; } resilience;
/* Dynamic memory deallocation error info */ /* Dynamic memory deallocation error info */
struct { struct {
enum OpalMemErr_DynErrType dyn_err_type:8; enum OpalMemErr_DynErrType dyn_err_type:8;
uint8_t reserved_1[7]; uint8_t reserved_1[7];
uint64_t physical_address_start; __be64 physical_address_start;
uint64_t physical_address_end; __be64 physical_address_end;
} dyn_dealloc; } dyn_dealloc;
} u; } u;
}; };
......
...@@ -47,12 +47,12 @@ static void handle_memory_error_event(struct OpalMemoryErrorData *merr_evt) ...@@ -47,12 +47,12 @@ static void handle_memory_error_event(struct OpalMemoryErrorData *merr_evt)
__func__, merr_evt->type); __func__, merr_evt->type);
switch (merr_evt->type) { switch (merr_evt->type) {
case OPAL_MEM_ERR_TYPE_RESILIENCE: case OPAL_MEM_ERR_TYPE_RESILIENCE:
paddr_start = merr_evt->u.resilience.physical_address_start; paddr_start = be64_to_cpu(merr_evt->u.resilience.physical_address_start);
paddr_end = merr_evt->u.resilience.physical_address_end; paddr_end = be64_to_cpu(merr_evt->u.resilience.physical_address_end);
break; break;
case OPAL_MEM_ERR_TYPE_DYN_DALLOC: case OPAL_MEM_ERR_TYPE_DYN_DALLOC:
paddr_start = merr_evt->u.dyn_dealloc.physical_address_start; paddr_start = be64_to_cpu(merr_evt->u.dyn_dealloc.physical_address_start);
paddr_end = merr_evt->u.dyn_dealloc.physical_address_end; paddr_end = be64_to_cpu(merr_evt->u.dyn_dealloc.physical_address_end);
break; break;
default: default:
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment