blob: f03ed554fc778a497db1af3508e64d79c2eae515 [file] [log] [blame]
Lee Leahyeef40eb2017-03-23 10:54:57 -07001/*
Martin Roth0443ac22019-08-30 21:29:41 -06002 * This file is part of the coreboot project.
Lee Leahyeef40eb2017-03-23 10:54:57 -07003 *
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 Leahy48dbc662017-05-08 16:56:03 -070015#ifndef __COMMONLIB_STORAGE_STORAGE_H__
16#define __COMMONLIB_STORAGE_STORAGE_H__
Lee Leahyeef40eb2017-03-23 10:54:57 -070017
18#include <stdint.h>
Lee Leahy48dbc662017-05-08 16:56:03 -070019#include <commonlib/storage.h>
Lee Leahyeef40eb2017-03-23 10:54:57 -070020
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]; \
Felix Held8d2ec862019-06-20 14:26:09 +020026 type *name = (type *) ALIGN_UP((uintptr_t)__##name, DMA_MINALIGN)
Lee Leahyeef40eb2017-03-23 10:54:57 -070027
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 */
33int storage_startup(struct storage_media *media);
34int storage_block_setup(struct storage_media *media, uint64_t start,
35 uint64_t count, int is_read);
36
Lee Leahy48dbc662017-05-08 16:56:03 -070037#endif /* __COMMONLIB_STORAGE_STORAGE_H__ */