/ src / commonlib / storage / storage.h
storage.h
 1  /* SPDX-License-Identifier: GPL-2.0-or-later */
 2  
 3  #ifndef __COMMONLIB_STORAGE_STORAGE_H__
 4  #define __COMMONLIB_STORAGE_STORAGE_H__
 5  
 6  #include <stdint.h>
 7  #include <commonlib/storage.h>
 8  
 9  #define DMA_MINALIGN (64)
10  #define ROUND(a, b) (((a) + (b) - 1) & ~((b) - 1))
11  #define ALLOC_CACHE_ALIGN_BUFFER(type, name, size)                   \
12  	char __##name[ROUND(size * sizeof(type), DMA_MINALIGN) +     \
13  		      DMA_MINALIGN - 1];                             \
14  	type *name = (type *)ALIGN_UP((uintptr_t)__##name, DMA_MINALIGN)
15  
16  /* NOOPs mirroring ARM's cache API, since x86 devices usually cache snoop */
17  #define dcache_invalidate_by_mva(addr, len)
18  #define dcache_clean_invalidate_by_mva(addr, len)
19  
20  /* Storage support routines */
21  int storage_startup(struct storage_media *media);
22  int storage_block_setup(struct storage_media *media, uint64_t start,
23  	uint64_t count, int is_read);
24  
25  #endif /* __COMMONLIB_STORAGE_STORAGE_H__ */