diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig | 29 | ||||
-rw-r--r-- | lib/lmb.c | 8 |
2 files changed, 35 insertions, 2 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index e46c51f123..6d2d41de30 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -707,14 +707,41 @@ config LMB help Support the library logical memory blocks. +config LMB_USE_MAX_REGIONS + bool "Use a commun number of memory and reserved regions in lmb lib" + depends on LMB + default y + help + Define the number of supported memory regions in the library logical + memory blocks. + This feature allow to reduce the lmb library size by using compiler + optimization when LMB_MEMORY_REGIONS == LMB_RESERVED_REGIONS. config LMB_MAX_REGIONS int "Number of memory and reserved regions in lmb lib" - depends on LMB + depends on LMB && LMB_USE_MAX_REGIONS default 8 help Define the number of supported regions, memory and reserved, in the library logical memory blocks. + +config LMB_MEMORY_REGIONS + int "Number of memory regions in lmb lib" + depends on LMB && !LMB_USE_MAX_REGIONS + default 8 + help + Define the number of supported memory regions in the library logical + memory blocks. + The minimal value is CONFIG_NR_DRAM_BANKS. + +config LMB_RESERVED_REGIONS + int "Number of reserved regions in lmb lib" + depends on LMB && !LMB_USE_MAX_REGIONS + default 8 + help + Define the number of supported reserved regions in the library logical + memory blocks. + endmenu config PHANDLE_CHECK_SEQ @@ -95,9 +95,15 @@ static void lmb_coalesce_regions(struct lmb_region *rgn, unsigned long r1, void lmb_init(struct lmb *lmb) { +#if IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS) lmb->memory.max = CONFIG_LMB_MAX_REGIONS; lmb->reserved.max = CONFIG_LMB_MAX_REGIONS; - +#else + lmb->memory.max = CONFIG_LMB_MEMORY_REGIONS; + lmb->reserved.max = CONFIG_LMB_RESERVED_REGIONS; + lmb->memory.region = lmb->memory_regions; + lmb->reserved.region = lmb->reserved_regions; +#endif lmb->memory.cnt = 0; lmb->reserved.cnt = 0; } |