Lee Leahy | eef40eb | 2017-03-23 10:54:57 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 Intel Corporation |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation; either version 2 of |
| 7 | * the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | */ |
| 14 | |
Lee Leahy | 48dbc66 | 2017-05-08 16:56:03 -0700 | [diff] [blame] | 15 | #ifndef __COMMONLIB_STORAGE_STORAGE_H__ |
| 16 | #define __COMMONLIB_STORAGE_STORAGE_H__ |
Lee Leahy | eef40eb | 2017-03-23 10:54:57 -0700 | [diff] [blame] | 17 | |
| 18 | #include <stdint.h> |
Lee Leahy | 48dbc66 | 2017-05-08 16:56:03 -0700 | [diff] [blame] | 19 | #include <commonlib/storage.h> |
Lee Leahy | eef40eb | 2017-03-23 10:54:57 -0700 | [diff] [blame] | 20 | |
| 21 | #define DMA_MINALIGN (64) |
| 22 | #define ROUND(a, b) (((a) + (b) - 1) & ~((b) - 1)) |
| 23 | #define ALLOC_CACHE_ALIGN_BUFFER(type, name, size) \ |
| 24 | char __##name[ROUND(size * sizeof(type), DMA_MINALIGN) + \ |
| 25 | DMA_MINALIGN - 1]; \ |
| 26 | type *name = (type *) ALIGN((uintptr_t)__##name, DMA_MINALIGN) |
| 27 | |
| 28 | /* NOOPs mirroring ARM's cache API, since x86 devices usually cache snoop */ |
| 29 | #define dcache_invalidate_by_mva(addr, len) |
| 30 | #define dcache_clean_invalidate_by_mva(addr, len) |
| 31 | |
| 32 | /* Storage support routines */ |
| 33 | int storage_startup(struct storage_media *media); |
| 34 | int storage_block_setup(struct storage_media *media, uint64_t start, |
| 35 | uint64_t count, int is_read); |
| 36 | |
Lee Leahy | 48dbc66 | 2017-05-08 16:56:03 -0700 | [diff] [blame] | 37 | #endif /* __COMMONLIB_STORAGE_STORAGE_H__ */ |