1 /* SPDX-License-Identifier: BSD-3-Clause */
3 #ifndef _CBFS_CBFS_GLUE_H
4 #define _CBFS_CBFS_GLUE_H
6 #include <libpayload-config.h>
7 #include <boot_device.h>
11 #define CBFS_ENABLE_HASHING CONFIG(LP_CBFS_VERIFICATION)
12 #define CBFS_HASH_HWCRYPTO cbfs_hwcrypto_allowed()
14 #define ERROR(...) printf("CBFS ERROR: " __VA_ARGS__)
15 #define LOG(...) printf("CBFS: " __VA_ARGS__)
18 if (CONFIG(LP_DEBUG_CBFS)) \
19 printf("CBFS DEBUG: " __VA_ARGS__); \
27 struct cbfs_boot_device
{
33 typedef const struct cbfs_dev
*cbfs_dev_t
;
35 static inline ssize_t
cbfs_dev_read(cbfs_dev_t dev
, void *buffer
, size_t offset
, size_t size
)
37 if (offset
+ size
< offset
|| offset
+ size
> dev
->size
)
40 return boot_device_read(buffer
, dev
->offset
+ offset
, size
);
43 static inline size_t cbfs_dev_size(cbfs_dev_t dev
)
48 bool cbfs_hwcrypto_allowed(void);
50 #endif /* _CBFS_CBFS_GLUE_H */