[PATCH] powerpc: fixing endianness of flash_block_list in rtas_flash

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Fri Aug 1 19:32:53 EST 2014


On 07/25/2014 11:17 PM, Thomas Falcon wrote:
> 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 <tlfalcon at linux.vnet.ibm.com>
> ---
>   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);
  }


-Vasant



More information about the Linuxppc-dev mailing list