]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
blkcache: Extend blkcache_init to cover CONFIG_NEEDS_MANUAL_RELOC
authorOvidiu Panait <ovidiu.panait@windriver.com>
Fri, 24 Jul 2020 11:12:24 +0000 (14:12 +0300)
committerTom Rini <trini@konsulko.com>
Thu, 6 Aug 2020 22:08:22 +0000 (18:08 -0400)
Extend manual relocation of block_cache list pointers to all platforms that
enable CONFIG_NEEDS_MANUAL_RELOC. Remove m68k-specific checks and provide a
single implementation that adds gd->reloc_off to the pre-relocation
pointers.

Acked-by: Angelo Dureghello <angelo.dureghello@timesys.com>
Tested-by: Angelo Dureghello <angelo.dureghello@timesys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Eric Nelson <eric@nelint.com>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
[trini: Add guard around DECLARE_GLOBAL_DATA_PTR to avoid size growth]
Signed-off-by: Tom Rini <trini@konsulko.com>
common/board_r.c
drivers/block/blkcache.c

index 3b2c6e092b5e33e3ffbe8c9d3dc21dc9db0b48a2..53792e9a31ba64d0f30135bfd20af9354af696ec 100644 (file)
@@ -848,7 +848,7 @@ static init_fnc_t init_sequence_r[] = {
 #if defined(CONFIG_PRAM)
        initr_mem,
 #endif
-#if defined(CONFIG_M68K) && defined(CONFIG_BLOCK_CACHE)
+#if defined(CONFIG_NEEDS_MANUAL_RELOC) && defined(CONFIG_BLOCK_CACHE)
        blkcache_init,
 #endif
        run_main_loop,
index b6fc72fe983e0ac01a506de718675314440ff581..eca66198edf72dfe9bfc81e0a1f09c338fe45732 100644 (file)
 #include <linux/ctype.h>
 #include <linux/list.h>
 
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
 struct block_cache_node {
        struct list_head lh;
        int iftype;
@@ -22,21 +26,20 @@ struct block_cache_node {
        char *cache;
 };
 
-#ifndef CONFIG_M68K
 static LIST_HEAD(block_cache);
-#else
-static struct list_head block_cache;
-#endif
 
 static struct block_cache_stats _stats = {
        .max_blocks_per_entry = 8,
        .max_entries = 32
 };
 
-#ifdef CONFIG_M68K
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
 int blkcache_init(void)
 {
-       INIT_LIST_HEAD(&block_cache);
+       struct list_head *head = &block_cache;
+
+       head->next = (uintptr_t)head->next + gd->reloc_off;
+       head->prev = (uintptr_t)head->prev + gd->reloc_off;
 
        return 0;
 }