Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS to change independently the max number of the regions in lmb library.
Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in bootm when the number of reserved regions (not adjacent) is reached: + 1 region for relocated U-Boot + 1 region for initrd + 1 region for relocated linux device tree + reserved memory regions present in Linux device tree. The current limit of 8 regions is reached with only 5 reserved regions in DT. Signed-off-by: Patrick Delaunay <patrick.delau...@foss.st.com> --- include/lmb.h | 6 ++---- lib/Kconfig | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/lmb.h b/include/lmb.h index df543028d5..97be24ed66 100644 --- a/include/lmb.h +++ b/include/lmb.h @@ -12,8 +12,6 @@ * Copyright (C) 2001 Peter Bergner, IBM Corp. */ -#define MAX_LMB_REGIONS 8 - /** * struct lmb_property - Description of one region. * @@ -54,8 +52,8 @@ struct lmb_region { struct lmb { struct lmb_region memory; struct lmb_region reserved; - struct lmb_property memory_regions[MAX_LMB_REGIONS + 1]; - struct lmb_property reserved_regions[MAX_LMB_REGIONS + 1]; + struct lmb_property memory_regions[CONFIG_LMB_MEMORY_REGIONS + 1]; + struct lmb_property reserved_regions[CONFIG_LMB_RESERVED_REGIONS + 1]; }; extern void lmb_init(struct lmb *lmb); diff --git a/lib/Kconfig b/lib/Kconfig index 43bd7190b9..4249399b6f 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -706,6 +706,22 @@ config LMB help Support the library logical memory blocks. +config LMB_MEMORY_REGIONS + int "Number of memory regions in lmb lib" + depends on LMB + default 8 + help + Define the number of supported memory regions in the library logical + memory blocks. + +config LMB_RESERVED_REGIONS + int "Number of reserved regions in lmb lib" + depends on LMB + default 8 + help + Define the number of supported reserved regions in the library logical + memory blocks. + endmenu config PHANDLE_CHECK_SEQ -- 2.17.1