Patchwork [U-Boot,2/2] microblaze: Fix bdiinfo pointer

login
register
mail settings
Submitter Michal Simek
Date Dec. 21, 2010, 12:58 p.m.
Message ID <4D10A473.2030202@monstr.eu>
Download mbox | patch
Permalink /patch/76289/
State Superseded
Headers show

Comments

Michal Simek - Dec. 21, 2010, 12:58 p.m.
Wolfgang Denk wrote:
> Dear Michal Simek,
> 
> In message <1292933384-3032-3-git-send-email-monstr@monstr.eu> you wrote:
>> Patch "Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value"
>> (sha1: 25ddd1fb0a2281b182529afbc8fda5de2dc16d96)
>> introduce GENERATED_GBL_DATA_SIZE which is sizeof aligned gd_t
>> (currently 0x40).
>> Microblaze configs used 0x40(128) because this place also contained
>> board info structure which lies on the top of ram.
>>
>> This patch is fixing this scheme by extending CONFIG_SYS_GBL_DATA_OFFSET
>> value. Doubled GENERATED_GBL_DATA_SIZE size is enough to store
>> gd_t and bd_t structures.
> 
> No, I will not accept this.
> 
> Please do not make assumptions abouth the size of bd_t compared to
> GENERATED_GBL_DATA_SIZE.  Use the correct size instead, as you can
> easily get using the sizeof() operator (plus some padding eventually
> to guarantee alignment, if needed).

I would like to do it but it is not easy to use sizeof because there are 
some dependencies in macros in common.h(lines 193-201) because I am 
using CONFIG_SYS_GBL_DATA_OFFSET for monitor/malloc areas.

The best will be to be able to generate this value in lib/asm-offsets.c

Not sure if you are ok with it.



Michal
Wolfgang Denk - Dec. 21, 2010, 1:48 p.m.
Dear Michal Simek,

In message <4D10A473.2030202@monstr.eu> you wrote:
>
> I would like to do it but it is not easy to use sizeof because there are 
> some dependencies in macros in common.h(lines 193-201) because I am 
> using CONFIG_SYS_GBL_DATA_OFFSET for monitor/malloc areas.
> 
> The best will be to be able to generate this value in lib/asm-offsets.c
> 
> Not sure if you are ok with it.

Yes, this is OK.

> diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
> index 2209561..36fc198 100644
> --- a/lib/asm-offsets.c
> +++ b/lib/asm-offsets.c
> @@ -24,6 +24,8 @@ int main(void)
>          /* Round up to make sure size gives nice stack alignment */
>          DEFINE(GENERATED_GBL_DATA_SIZE,
>                  (sizeof(struct global_data)+15) & ~15);
> +       DEFINE(GENERATED_BD_INFO_SIZE,
> +               (sizeof(struct bd_info)+15) & ~15);
> 
>          return 0;
>   }

This patch is white-space corrupted, though.

Best regards,

Wolfgang Denk
Michal Simek - Dec. 21, 2010, 1:51 p.m.
Wolfgang Denk wrote:
> Dear Michal Simek,
> 
> In message <4D10A473.2030202@monstr.eu> you wrote:
>> I would like to do it but it is not easy to use sizeof because there are 
>> some dependencies in macros in common.h(lines 193-201) because I am 
>> using CONFIG_SYS_GBL_DATA_OFFSET for monitor/malloc areas.
>>
>> The best will be to be able to generate this value in lib/asm-offsets.c
>>
>> Not sure if you are ok with it.
> 
> Yes, this is OK.
> 
>> diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
>> index 2209561..36fc198 100644
>> --- a/lib/asm-offsets.c
>> +++ b/lib/asm-offsets.c
>> @@ -24,6 +24,8 @@ int main(void)
>>          /* Round up to make sure size gives nice stack alignment */
>>          DEFINE(GENERATED_GBL_DATA_SIZE,
>>                  (sizeof(struct global_data)+15) & ~15);
>> +       DEFINE(GENERATED_BD_INFO_SIZE,
>> +               (sizeof(struct bd_info)+15) & ~15);
>>
>>          return 0;
>>   }
> 
> This patch is white-space corrupted, though.

It wasn't intended as a patch just show if this approach will be acceptable.

I will generate patches based on this.

Thanks,
Michal

Patch

diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
index 2209561..36fc198 100644
--- a/lib/asm-offsets.c
+++ b/lib/asm-offsets.c
@@ -24,6 +24,8 @@  int main(void)
         /* Round up to make sure size gives nice stack alignment */
         DEFINE(GENERATED_GBL_DATA_SIZE,
                 (sizeof(struct global_data)+15) & ~15);
+       DEFINE(GENERATED_BD_INFO_SIZE,
+               (sizeof(struct bd_info)+15) & ~15);

         return 0;
  }