mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [RFC 2/3] MIPS: boot: realize _start in C
Date: Sat, 24 Nov 2012 20:18:09 +0400	[thread overview]
Message-ID: <CAA4bVAGVQGgDcxvRJtSfwGGgYb6DBy9wsdh3gWiu+yBxfDXKfQ@mail.gmail.com> (raw)
In-Reply-To: <20121120075818.GB10369@pengutronix.de>

Sorry for delay.

On 20 November 2012 11:58, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> On Sat, Nov 17, 2012 at 04:10:38PM +0400, Antony Pavlov wrote:
>> The pbl will be incharge of the lowlevel init and
>> barebox relocation. So we can skip it in barebox itself
>> and use simple _start.
>>
>> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
>> ---
>>  arch/mips/boot/Makefile     |    1 -
>>  arch/mips/boot/main_entry.c |   18 ++++++
>>  arch/mips/boot/start.S      |  142 -------------------------------------------
>>  3 files changed, 18 insertions(+), 143 deletions(-)
>>  delete mode 100644 arch/mips/boot/start.S
>>
>> diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
>> index 6b093f1..4f11a48 100644
>> --- a/arch/mips/boot/Makefile
>> +++ b/arch/mips/boot/Makefile
>> @@ -1,4 +1,3 @@
>> -obj-y += start.o
>>  obj-y += main_entry.o
>>
>>  pbl-y += start-pbl.o main_entry-pbl.o
>> diff --git a/arch/mips/boot/main_entry.c b/arch/mips/boot/main_entry.c
>> index 0a33c45..422d40b 100644
>> --- a/arch/mips/boot/main_entry.c
>> +++ b/arch/mips/boot/main_entry.c
>> @@ -22,6 +22,8 @@
>>  #include <asm/cpu-features.h>
>>  #include <asm/mipsregs.h>
>>  #include <asm/addrspace.h>
>> +#include <asm/regdef.h>
>> +#include <asm-generic/memory_layout.h>
>>
>>  extern void start_barebox(void);
>>  extern void handle_reserved(void);
>> @@ -92,3 +94,19 @@ void main_entry(void)
>>
>>       start_barebox();
>>  }
>> +
>> +void __naked __section(.text_entry) _start(void)
>> +{
>> +     u32 r;
>> +
>> +     /* setup the stack */
>> +     r = STACK_BASE + STACK_SIZE - 16;
>> +
>> +     __asm__ __volatile__(
>> +             "move\t$sp, %0\n\t"
>> +             : /* no outputs */
>> +             : "r" (r)
>> +     );
>> +
>> +     main_entry();
>
> I wonder that the C function skips several things the Assembler version
> does. Is this done in the pbl now?

Yes, all lowlevel init is in pbl after this patch.

> Does this patch make the pbl mandatory?

Not at all, but the patch decrease pbl-free barebox "survival".

> We haven't done this on Arm, mostly because we were not
> confident enough that it works on every board. That may be different on
> mips, but should be mentioned in the commit log. But maybe I am
> misreading the patches...

Now I think you are right and we must postpone this patch. It make
sense to introduce this patch after full ELF support adding. If we had
ELF support, we should load barebox ELF image without pbl and drop
bin-image support in bootm.

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-11-24 16:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-17 12:10 [RFC 0/3] MIPS: add pre-bootloader (pbl) image support Antony Pavlov
2012-11-17 12:10 ` [RFC 1/3] " Antony Pavlov
2012-11-20  7:59   ` Sascha Hauer
2012-11-24 15:45     ` Antony Pavlov
2012-11-26  8:05       ` Sascha Hauer
2012-11-17 12:10 ` [RFC 2/3] MIPS: boot: realize _start in C Antony Pavlov
2012-11-20  7:58   ` Sascha Hauer
2012-11-24 16:18     ` Antony Pavlov [this message]
2012-11-17 12:10 ` [RFC 3/3] MIPS: qemu-malta_defconfig: use pbl Antony Pavlov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA4bVAGVQGgDcxvRJtSfwGGgYb6DBy9wsdh3gWiu+yBxfDXKfQ@mail.gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox