]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
common: add blkcache init
authorAngelo Durgehello <angelo.dureghello@timesys.com>
Tue, 21 Jan 2020 09:37:27 +0000 (10:37 +0100)
committerTom Rini <trini@konsulko.com>
Sat, 25 Jan 2020 17:04:36 +0000 (12:04 -0500)
On m68k, block_cache list is relocated, but next and prev list
pointers are not adjusted to the relocated struct list_head address,
so the first iteration over the block_cache list hangs.

This patch initializes the block_cache list after relocation.

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
Reviewed-by: Eric Nelson <eric@nelint.com>
common/board_r.c
drivers/block/blkcache.c
include/blk.h

index 8a0c1114e77ac2ed644f2324cbaaa0c7cf5cae72..4f56c19fcc977432d0cf2dcba37ada488569b7c9 100644 (file)
@@ -864,6 +864,9 @@ static init_fnc_t init_sequence_r[] = {
 #endif
 #if defined(CONFIG_PRAM)
        initr_mem,
+#endif
+#ifdef CONFIG_BLOCK_CACHE
+       blkcache_init,
 #endif
        run_main_loop,
 };
index 1fa64989d3f2fcc5c9e0b3e6991f72b1fc5d96d5..f603aa129d4699351c243c2aa38d9aae80bbda58 100644 (file)
@@ -21,13 +21,20 @@ struct block_cache_node {
        char *cache;
 };
 
-static LIST_HEAD(block_cache);
+static struct list_head block_cache;
 
 static struct block_cache_stats _stats = {
        .max_blocks_per_entry = 8,
        .max_entries = 32
 };
 
+int blkcache_init(void)
+{
+       INIT_LIST_HEAD(&block_cache);
+
+       return 0;
+}
+
 static struct block_cache_node *cache_find(int iftype, int devnum,
                                           lbaint_t start, lbaint_t blkcnt,
                                           unsigned long blksz)
index d0c033aece0fb7986a614cef5a9176dc6bca2f44..65db69f5d9eb771d6c91709da27ba3b24e2afb3e 100644 (file)
@@ -113,6 +113,12 @@ struct blk_desc {
        (PAD_SIZE(size, blk_desc->blksz))
 
 #if CONFIG_IS_ENABLED(BLOCK_CACHE)
+
+/**
+ * blkcache_init() - initialize the block cache list pointers
+ */
+int blkcache_init(void);
+
 /**
  * blkcache_read() - attempt to read a set of blocks from cache
  *