mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-19 05:31:32 +00:00
common: add blkcache init
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>
This commit is contained in:
parent
5cde44e12a
commit
1526bcce0f
3 changed files with 17 additions and 1 deletions
|
@ -864,6 +864,9 @@ static init_fnc_t init_sequence_r[] = {
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_PRAM)
|
#if defined(CONFIG_PRAM)
|
||||||
initr_mem,
|
initr_mem,
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_BLOCK_CACHE
|
||||||
|
blkcache_init,
|
||||||
#endif
|
#endif
|
||||||
run_main_loop,
|
run_main_loop,
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,13 +21,20 @@ struct block_cache_node {
|
||||||
char *cache;
|
char *cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
static LIST_HEAD(block_cache);
|
static struct list_head block_cache;
|
||||||
|
|
||||||
static struct block_cache_stats _stats = {
|
static struct block_cache_stats _stats = {
|
||||||
.max_blocks_per_entry = 8,
|
.max_blocks_per_entry = 8,
|
||||||
.max_entries = 32
|
.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,
|
static struct block_cache_node *cache_find(int iftype, int devnum,
|
||||||
lbaint_t start, lbaint_t blkcnt,
|
lbaint_t start, lbaint_t blkcnt,
|
||||||
unsigned long blksz)
|
unsigned long blksz)
|
||||||
|
|
|
@ -113,6 +113,12 @@ struct blk_desc {
|
||||||
(PAD_SIZE(size, blk_desc->blksz))
|
(PAD_SIZE(size, blk_desc->blksz))
|
||||||
|
|
||||||
#if CONFIG_IS_ENABLED(BLOCK_CACHE)
|
#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
|
* blkcache_read() - attempt to read a set of blocks from cache
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue