Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/powernv: Fix little endian issues in OPAL dump code

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Anton Blanchard and committed by
Benjamin Herrenschmidt
2d6b63bb 3441f04b

+11 -6
+2 -2
arch/powerpc/include/asm/opal.h
··· 868 868 int64_t opal_manage_flash(uint8_t op); 869 869 int64_t opal_update_flash(uint64_t blk_list); 870 870 int64_t opal_dump_init(uint8_t dump_type); 871 - int64_t opal_dump_info(uint32_t *dump_id, uint32_t *dump_size); 872 - int64_t opal_dump_info2(uint32_t *dump_id, uint32_t *dump_size, uint32_t *dump_type); 871 + int64_t opal_dump_info(__be32 *dump_id, __be32 *dump_size); 872 + int64_t opal_dump_info2(__be32 *dump_id, __be32 *dump_size, __be32 *dump_type); 873 873 int64_t opal_dump_read(uint32_t dump_id, uint64_t buffer); 874 874 int64_t opal_dump_ack(uint32_t dump_id); 875 875 int64_t opal_dump_resend_notification(void);
+9 -4
arch/powerpc/platforms/powernv/opal-dump.c
··· 209 209 .default_attrs = dump_default_attrs, 210 210 }; 211 211 212 - static int64_t dump_read_info(uint32_t *id, uint32_t *size, uint32_t *type) 212 + static int64_t dump_read_info(uint32_t *dump_id, uint32_t *dump_size, uint32_t *dump_type) 213 213 { 214 + __be32 id, size, type; 214 215 int rc; 215 - *type = 0xffffffff; 216 216 217 - rc = opal_dump_info2(id, size, type); 217 + type = cpu_to_be32(0xffffffff); 218 218 219 + rc = opal_dump_info2(&id, &size, &type); 219 220 if (rc == OPAL_PARAMETER) 220 - rc = opal_dump_info(id, size); 221 + rc = opal_dump_info(&id, &size); 222 + 223 + *dump_id = be32_to_cpu(id); 224 + *dump_size = be32_to_cpu(size); 225 + *dump_type = be32_to_cpu(type); 221 226 222 227 if (rc) 223 228 pr_warn("%s: Failed to get dump info (%d)\n",