[U-Boot] [PATCH] x86: Add a default implementation for cleanup_before_linux.
Gabe Black
gabeblack at google.com
Tue Dec 6 06:55:40 CET 2011
On Mon, Dec 5, 2011 at 9:04 PM, Graeme Russ <graeme.russ at gmail.com> wrote:
> Hi Gabe,
>
> On Tue, Dec 6, 2011 at 12:55 PM, Gabe Black <gabeblack at chromium.org>
> wrote:
> > This function provides an opportunity for some last minute cleanup and
> > reconfiguration before control is handed over to Linux. It's possible
> this
> > may need to do something in the future, but for now it's left empty.
> It's set
> > up as a weak symbol so it can be overridden if necessary on a case by
> case
> > basis.
> >
> > Signed-off-by: Gabe Black <gabeblack at chromium.org>
> > ---
> > arch/x86/cpu/cpu.c | 8 ++++++++
> > arch/x86/include/asm/u-boot-x86.h | 1 +
> > 2 files changed, 9 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
> > index 61d0b69..3a2a64a 100644
> > --- a/arch/x86/cpu/cpu.c
> > +++ b/arch/x86/cpu/cpu.c
> > @@ -86,6 +86,14 @@ static void reload_gdt(void)
> > : : "m" (gdt) : "ecx");
> > }
> >
> > +int x86_cleanup_before_linux(void)
> > +{
> > + return 0;
> > +}
> > +int cleanup_before_linux(void)
> > + __attribute__((weak, alias("x86_cleanup_before_linux")));
> > +
> > +
> > int x86_cpu_init_f(void)
> > {
> > const u32 em_rst = ~X86_CR0_EM;
> > diff --git a/arch/x86/include/asm/u-boot-x86.h
> b/arch/x86/include/asm/u-boot-x86.h
> > index 755f88a..8cc4be6 100644
> > --- a/arch/x86/include/asm/u-boot-x86.h
> > +++ b/arch/x86/include/asm/u-boot-x86.h
> > @@ -37,6 +37,7 @@ int x86_cpu_init_r(void);
> > int cpu_init_r(void);
> > int x86_cpu_init_f(void);
> > int cpu_init_f(void);
> > +int cleanup_before_linux(void);
> >
> > /* cpu/.../timer.c */
> > void timer_isr(void *);
> > --
> > 1.7.3.1
>
> Hmmm, interesting...
>
> sc520 already has a function to put the board into maximal PC/AT
> compatibility mode because, quite frankly, that was the easiest way to get
> Linux working. So this seems to be a logical extension of that hook...
>
> However, I while ago I had a crack at cleaning up the U-Boot init sequence
> using a concept blantantly stolen from Linux[1],[2]. I wonder if it might
> be worth looking at a similar solution here. That would allow CPU, arch
> and board specific 'cleanups' to be dynamically defined without having to
> do a whole bunch of background plumbing...
>
> Regards,
>
> Graeme
>
> [1] http://patchwork.ozlabs.org/patch/110316/ and
> [2] http://patchwork.ozlabs.org/patch/110515/
>
This is primarily to get otherwise generic code which uses this function to
compile for x86. It could be expanded to actually do something useful which
the commit message suggests. That would go in a follow on commit since it's
outside the scope of what I'm trying to do here.
Gabe
More information about the U-Boot
mailing list