diff mbox

powerpc: fixing endianness of flash_block_list in rtas_flash

Message ID 53DB5EC5.5000703@linux.vnet.ibm.com (mailing list archive)
State Rejected
Headers show

Commit Message

Vasant Hegde Aug. 1, 2014, 9:32 a.m. UTC
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@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.


-Vasant

Comments

Thomas Falcon Aug. 1, 2014, 5:07 p.m. UTC | #1
On 08/01/2014 04:32 AM, Vasant Hegde wrote:
> 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@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);
>  }
>
I do not think this conversion is needed.  Any integers returned are 
converted to cpu endian in the rtas_call function.

tom
>
> -Vasant
>
diff mbox

Patch

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);
  }