Julius Werner | 1cd013b | 2019-12-11 16:50:02 -0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #ifndef _CBFS_GLUE_H_ |
| 4 | #define _CBFS_GLUE_H_ |
| 5 | |
| 6 | #include <commonlib/region.h> |
| 7 | #include <console/console.h> |
| 8 | |
| 9 | #define CBFS_ENABLE_HASHING 0 |
| 10 | |
| 11 | #define ERROR(...) printk(BIOS_ERR, "CBFS ERROR: " __VA_ARGS__) |
| 12 | #define LOG(...) printk(BIOS_ERR, "CBFS: " __VA_ARGS__) |
| 13 | #define DEBUG(...) do { \ |
| 14 | if (CONFIG(DEBUG_CBFS)) \ |
| 15 | printk(BIOS_SPEW, "CBFS DEBUG: " __VA_ARGS__); \ |
| 16 | } while (0) |
| 17 | |
| 18 | typedef const struct region_device *cbfs_dev_t; |
| 19 | |
| 20 | static inline ssize_t cbfs_dev_read(cbfs_dev_t dev, void *buffer, size_t offset, size_t size) |
| 21 | { |
| 22 | return rdev_readat(dev, buffer, offset, size); |
| 23 | } |
| 24 | |
| 25 | static inline size_t cbfs_dev_size(cbfs_dev_t dev) |
| 26 | { |
| 27 | return region_device_sz(dev); |
| 28 | } |
| 29 | |
| 30 | #endif /* _CBFS_GLUE_H_ */ |