Commit 2d6b63bbdd7a649ea17fae19f8bab07d4b292a09

Authored by Anton Blanchard
Committed by Benjamin Herrenschmidt
1 parent 3441f04b4b

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>

Showing 2 changed files with 11 additions and 6 deletions Side-by-side Diff

arch/powerpc/include/asm/opal.h
... ... @@ -868,8 +868,8 @@
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);
arch/powerpc/platforms/powernv/opal-dump.c
... ... @@ -209,15 +209,20 @@
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",