[U-Boot] [PATCH] block: Add SPL_BLOCK_CACHE and default n

Adam Ford aford173 at gmail.com
Sat Jun 9 14:04:16 UTC 2018


On Sat, Jun 9, 2018 at 8:26 AM Alex Kiernan <alex.kiernan at gmail.com> wrote:
>
> On Fri, Jun 8, 2018 at 9:48 PM Adam Ford <aford173 at gmail.com> wrote:
> >
> > When enabling BLOCK_CACHE on devices with limited RAM during SPL,
> > some devices may not boot.  This creates an option to enable
> > block caching in SPL by defaults off.  It is dependant on BLOCK_CACHE
> > and SPL_BLK
> >
> > Fixes: 46960ad6d09b ("block: Have BLOCK_CACHE default to y in some cases")
> >
> > Signed-off-by: Adam Ford <aford173 at gmail.com>
> >
> > diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
> > index 0792373cfc..8ef363b3d4 100644
> > --- a/drivers/block/Kconfig
> > +++ b/drivers/block/Kconfig
> > @@ -37,6 +37,13 @@ config BLOCK_CACHE
> >           it will prevent repeated reads from directory structures and other
> >           filesystem data structures.
> >
> > +config SPL_BLOCK_CACHE
> > +       bool "Use block device cache in SPL"
> > +       depends on BLOCK_CACHE && SPL_BLK
> > +       default n
> > +       help
> > +         This option enables the disk-block cache in SPL
> > +
> >  config IDE
> >         bool "Support IDE controllers"
> >         select HAVE_BLOCK_DEVICE
> > diff --git a/drivers/block/Makefile b/drivers/block/Makefile
> > index 5fcafb193e..a9af28a552 100644
> > --- a/drivers/block/Makefile
> > +++ b/drivers/block/Makefile
> > @@ -11,4 +11,9 @@ endif
> >
> >  obj-$(CONFIG_IDE) += ide.o
> >  obj-$(CONFIG_SANDBOX) += sandbox.o
> > +ifdef CONFIG_SPL_BUILD
> > +obj-$(SPL_BLOCK_CACHE) += blkcache.o
>
> CONFIG_SPL_BLOCK_CACHE?
>
> > +endif
> > +ifndef CONFIG_SPL_BUILD
> >  obj-$(CONFIG_BLOCK_CACHE) += blkcache.o
> > +endif
>
> Could this all get replaced by:
>
> obj-$(CONFIG_$(SPL_)BLOCK_CACHE) += blkcache.o
>
Nicely done.  I am not that familiar with Makefiles and how to clean
that up, but it seems to work work this way at least for the AM3517
EVM.

> > diff --git a/include/blk.h b/include/blk.h
> > index fc0c239e46..c17c5eb047 100644
> > --- a/include/blk.h
> > +++ b/include/blk.h
> > @@ -111,7 +111,8 @@ struct blk_desc {
> >  #define PAD_TO_BLOCKSIZE(size, blk_desc) \
> >         (PAD_SIZE(size, blk_desc->blksz))
> >
> > -#ifdef CONFIG_BLOCK_CACHE
> > +#if (defined(CONFIG_BLOCK_CACHE) && !defined(CONFIG_SPL_BUILD)) || \
> > +        (defined(CONFIG_SPL_BLOCK_CACHE) && defined(CONFIG_SPL_BUILD))
> >  /**
>
> Replace with CONFIG_IS_ENABLED?

I tried replacing 'defined(x)' with 'CONFIG_IS_ENABLED(x)' and I got a
bunch of build errors.
The only way I could get it to work was using 'defined(x)'

adam
>
> >   * blkcache_read() - attempt to read a set of blocks from cache
> >   *
> > --
> > 2.17.1
> >
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot at lists.denx.de
> > https://lists.denx.de/listinfo/u-boot
>
>
>
> --
> Alex Kiernan


More information about the U-Boot mailing list