Re: [PATCH] powerpc: fixing endianness of flash_block_list in rtas_flash

From
Thomas Falcon <hidden>
Date
2014-08-01 17:07:34
Reply to
Vasant Hegde, 2014-08-01
On 08/01/2014 04:32 AM, Vasant Hegde wrote:
quoted hunk ↗ jump to hunk
On 07/25/2014 11:17 PM, Thomas Falcon wrote:
quoted
The function rtas_flash_firmware passes the address of a data structure,
flash_block_list, when making the update-flash-64-and-reboot rtas call.
While the endianness of the address is handled correctly, the endianness
of the data is not.  This patch ensures that the data in flash_block_list
is big endian when passed to rtas on little endian hosts.

Signed-off-by: Thomas Falcon <redacted>
---
  arch/powerpc/kernel/rtas_flash.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
Tom,

In validate_flash rtas call returns  update_results in BE.. I think we need below changes as well.

Rest looks good.
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index db2b482..1eae0d8 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -449,7 +449,7 @@ error:
 static void validate_flash(struct rtas_validate_flash_t *args_buf)
 {
        int token = rtas_token("ibm,validate-flash-image");
-       int update_results;
+       __be32 update_results;
        s32 rc;

        rc = 0;
@@ -463,7 +463,7 @@ static void validate_flash(struct rtas_validate_flash_t *args_buf)
        } while (rtas_busy_delay(rc));

        args_buf->status = rc;
-       args_buf->update_results = update_results;
+       args_buf->update_results = be32_to_cpu(update_results);
 }
I do not think this conversion is needed.  Any integers returned are converted to cpu endian in the rtas_call function.

tom
-Vasant
-- 
Thread (4 messages) 4 messages, 3 authors, last reply 2014-08-01
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help