diff mbox series

[RESEND,v3,5/7] board: Add a gd flag for chain loading

Message ID 20200408185755.116336-5-sjg@chromium.org
State Superseded
Headers show
Series x86: Improve support for chain-loading U-Boot | expand

Commit Message

Simon Glass April 8, 2020, 6:57 p.m. UTC
When U-Boot is run from another boot loader, much of the low-level init
needs to be skipped.

Add a flag for this and adjust ll_boot_init() to use it.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v3:
- Add a new patch with a gd flag for chain loading

Changes in v2: None

 include/asm-generic/global_data.h | 1 +
 include/init.h                    | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Bin Meng April 23, 2020, 11:03 a.m. UTC | #1
Hi Simon,

On Thu, Apr 9, 2020 at 2:58 AM Simon Glass <sjg at chromium.org> wrote:
>
> When U-Boot is run from another boot loader, much of the low-level init
> needs to be skipped.
>
> Add a flag for this and adjust ll_boot_init() to use it.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> Changes in v3:
> - Add a new patch with a gd flag for chain loading
>
> Changes in v2: None
>
>  include/asm-generic/global_data.h | 1 +
>  include/init.h                    | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> index 5d027329fe0..3dc51e49ef7 100644
> --- a/include/asm-generic/global_data.h
> +++ b/include/asm-generic/global_data.h
> @@ -166,5 +166,6 @@ typedef struct global_data {
>  #define GD_FLG_SPL_EARLY_INIT  0x04000 /* Early SPL init is done          */
>  #define GD_FLG_LOG_READY       0x08000 /* Log system is ready for use     */
>  #define GD_FLG_WDT_READY       0x10000 /* Watchdog is ready for use       */
> +#define GD_FLG_NO_LL_INIT      0x20000 /* Don't perform low-level init    */

How about GD_FLG_SKIP_LL_INIT ?

>
>  #endif /* __ASM_GENERIC_GBL_DATA_H */
> diff --git a/include/init.h b/include/init.h
> index 2a33a3fd1e4..64fdf124916 100644
> --- a/include/init.h
> +++ b/include/init.h
> @@ -20,7 +20,7 @@ struct global_data;
>  #ifdef CONFIG_EFI_STUB
>  #define ll_boot_init() false
>  #else
> -#define ll_boot_init() true
> +#define ll_boot_init() (!(gd->flags & GD_FLG_NO_LL_INIT))
>  #endif

Regards,
Bin
Bin Meng April 23, 2020, 2 p.m. UTC | #2
Hi Simon,


On Thu, Apr 23, 2020 at 7:03 PM Bin Meng <bmeng.cn at gmail.com> wrote:
>
> Hi Simon,
>
> On Thu, Apr 9, 2020 at 2:58 AM Simon Glass <sjg at chromium.org> wrote:
> >
> > When U-Boot is run from another boot loader, much of the low-level init
> > needs to be skipped.
> >
> > Add a flag for this and adjust ll_boot_init() to use it.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > Changes in v3:
> > - Add a new patch with a gd flag for chain loading
> >
> > Changes in v2: None
> >
> >  include/asm-generic/global_data.h | 1 +
> >  include/init.h                    | 2 +-
> >  2 files changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> > index 5d027329fe0..3dc51e49ef7 100644
> > --- a/include/asm-generic/global_data.h
> > +++ b/include/asm-generic/global_data.h
> > @@ -166,5 +166,6 @@ typedef struct global_data {
> >  #define GD_FLG_SPL_EARLY_INIT  0x04000 /* Early SPL init is done          */
> >  #define GD_FLG_LOG_READY       0x08000 /* Log system is ready for use     */
> >  #define GD_FLG_WDT_READY       0x10000 /* Watchdog is ready for use       */
> > +#define GD_FLG_NO_LL_INIT      0x20000 /* Don't perform low-level init    */
>
> How about GD_FLG_SKIP_LL_INIT ?

Just noticed that there is an ad-hoc config macro (not converted to
Kconfig yet) CONFIG_SKIP_LOWLEVEL_INIT.

I suspect we can do some clean up and consolidation here ?

>
> >
> >  #endif /* __ASM_GENERIC_GBL_DATA_H */
> > diff --git a/include/init.h b/include/init.h
> > index 2a33a3fd1e4..64fdf124916 100644
> > --- a/include/init.h
> > +++ b/include/init.h
> > @@ -20,7 +20,7 @@ struct global_data;
> >  #ifdef CONFIG_EFI_STUB
> >  #define ll_boot_init() false
> >  #else
> > -#define ll_boot_init() true
> > +#define ll_boot_init() (!(gd->flags & GD_FLG_NO_LL_INIT))
> >  #endif

Regards,
Bin
Simon Glass April 26, 2020, 7:45 p.m. UTC | #3
Hi Bin,

On Thu, 23 Apr 2020 at 08:00, Bin Meng <bmeng.cn at gmail.com> wrote:
>
> Hi Simon,
>
>
> On Thu, Apr 23, 2020 at 7:03 PM Bin Meng <bmeng.cn at gmail.com> wrote:
> >
> > Hi Simon,
> >
> > On Thu, Apr 9, 2020 at 2:58 AM Simon Glass <sjg at chromium.org> wrote:
> > >
> > > When U-Boot is run from another boot loader, much of the low-level init
> > > needs to be skipped.
> > >
> > > Add a flag for this and adjust ll_boot_init() to use it.
> > >
> > > Signed-off-by: Simon Glass <sjg at chromium.org>
> > > ---
> > >
> > > Changes in v3:
> > > - Add a new patch with a gd flag for chain loading
> > >
> > > Changes in v2: None
> > >
> > >  include/asm-generic/global_data.h | 1 +
> > >  include/init.h                    | 2 +-
> > >  2 files changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> > > index 5d027329fe0..3dc51e49ef7 100644
> > > --- a/include/asm-generic/global_data.h
> > > +++ b/include/asm-generic/global_data.h
> > > @@ -166,5 +166,6 @@ typedef struct global_data {
> > >  #define GD_FLG_SPL_EARLY_INIT  0x04000 /* Early SPL init is done          */
> > >  #define GD_FLG_LOG_READY       0x08000 /* Log system is ready for use     */
> > >  #define GD_FLG_WDT_READY       0x10000 /* Watchdog is ready for use       */
> > > +#define GD_FLG_NO_LL_INIT      0x20000 /* Don't perform low-level init    */
> >
> > How about GD_FLG_SKIP_LL_INIT ?
>
> Just noticed that there is an ad-hoc config macro (not converted to
> Kconfig yet) CONFIG_SKIP_LOWLEVEL_INIT.

OK

>
> I suspect we can do some clean up and consolidation here ?

Yes this is quite similar. I agree some clean-up could be done here.
But that option has many build-time effects. I suspect it would be
possible to remove those and do it all at runtime, but it would be a
fair bit of work to do it for all these boards.

[..]

Regards,
Simon
diff mbox series

Patch

diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 5d027329fe0..3dc51e49ef7 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -166,5 +166,6 @@  typedef struct global_data {
 #define GD_FLG_SPL_EARLY_INIT	0x04000 /* Early SPL init is done	   */
 #define GD_FLG_LOG_READY	0x08000 /* Log system is ready for use	   */
 #define GD_FLG_WDT_READY	0x10000 /* Watchdog is ready for use	   */
+#define GD_FLG_NO_LL_INIT	0x20000	/* Don't perform low-level init	   */
 
 #endif /* __ASM_GENERIC_GBL_DATA_H */
diff --git a/include/init.h b/include/init.h
index 2a33a3fd1e4..64fdf124916 100644
--- a/include/init.h
+++ b/include/init.h
@@ -20,7 +20,7 @@  struct global_data;
 #ifdef CONFIG_EFI_STUB
 #define ll_boot_init()	false
 #else
-#define ll_boot_init()	true
+#define ll_boot_init()	(!(gd->flags & GD_FLG_NO_LL_INIT))
 #endif
 
 /*