Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Lee Leahy | eef40eb | 2017-03-23 10:54:57 -0700 | [diff] [blame] | 2 | |
Lee Leahy | 48dbc66 | 2017-05-08 16:56:03 -0700 | [diff] [blame] | 3 | #ifndef __COMMONLIB_STORAGE_STORAGE_H__ |
| 4 | #define __COMMONLIB_STORAGE_STORAGE_H__ |
Lee Leahy | eef40eb | 2017-03-23 10:54:57 -0700 | [diff] [blame] | 5 | |
| 6 | #include <stdint.h> |
Lee Leahy | 48dbc66 | 2017-05-08 16:56:03 -0700 | [diff] [blame] | 7 | #include <commonlib/storage.h> |
Lee Leahy | eef40eb | 2017-03-23 10:54:57 -0700 | [diff] [blame] | 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]; \ |
Elyes Haouas | 995dfef | 2022-11-18 15:22:07 +0100 | [diff] [blame] | 14 | type *name = (type *)ALIGN_UP((uintptr_t)__##name, DMA_MINALIGN) |
Lee Leahy | eef40eb | 2017-03-23 10:54:57 -0700 | [diff] [blame] | 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 | |
Lee Leahy | 48dbc66 | 2017-05-08 16:56:03 -0700 | [diff] [blame] | 25 | #endif /* __COMMONLIB_STORAGE_STORAGE_H__ */ |