[U-Boot] [PATCH v3 5/8] sandbox: Add concept of sandbox state

Simon Glass sjg at chromium.org
Wed Feb 15 23:46:25 CET 2012


Hi Mike,

On Tue, Jan 24, 2012 at 3:05 PM, Mike Frysinger <vapier at gentoo.org> wrote:
> On Monday 23 January 2012 01:48:50 Simon Glass wrote:
>> --- a/arch/sandbox/cpu/start.c
>> +++ b/arch/sandbox/cpu/start.c
>>
>>  int main(int argc, char *argv[])
>>  {
>> +     struct sandbox_state *state = NULL;
>> +     int err;
>> +
>> +     err = state_init();
>> +     if (!err) {
>> +             state = state_get_current();
>> +             assert(state);
>> +     }
>
> i guess a lot of this checking/plumbing only makes sense in the context of
> future work where the state represents a lot more stuff

Well we use it for a few things so we need something here, but yes.

>
>> --- /dev/null
>> +++ b/arch/sandbox/cpu/state.c
>>
>> +struct sandbox_state main_state;
>> +struct sandbox_state *state; /* Pointer to current state record */
>
> static

Done

>
>> +int state_is_processor_reset(void)
>> +{
>> +     return 1;
>> +}
>
> if the cpu is in reset, then u-boot is dead ...

That code should not be there, sorry, have removed it.

>
>> +struct sandbox_state *state_get_current(void)
>> +{
>> +     assert(state);
>> +     return state;
>> +}
>
> you assert() here and in main() ... i think we can get rid of the one in the
> main() func
>
>> --- /dev/null
>> +++ b/arch/sandbox/include/asm/arch-sandbox/state.h
>
> needs ifdef protection against multiple inclusion

Done

>
>> +/* The complete state of the test system */
>> +struct sandbox_state {
>> +     const char *cmd;                /* Command to execute */
>> +     enum exit_type_id exit_type;    /* How we exited U-Boot */
>> +};
>
> the argc/argv given to main() should be in here
> -mike

OK I will add this in the last patch which deals with arguments.

Regards,
Simon


More information about the U-Boot mailing list