treewide: Move device_tree to commonlib
[coreboot2.git] / payloads / libpayload / include / boot_device.h
bloba946545792b3419d4a479cc2854ddf6ab4426813
1 /* SPDX-License-Identifier: BSD-3-Clause */
3 #ifndef _BOOT_DEVICE_H
4 #define _BOOT_DEVICE_H
6 #include <stddef.h>
8 /**
9 * This is a boot device access function, which is used by libpayload to read data from
10 * the flash memory (or other boot device). It has to be implemented by payloads that want
11 * to use FMAP or libcbfs.
13 * @param buf The output buffer to which the data should be written to.
14 * @param offset Absolute offset in bytes of the requested boot device memory area. Not aligned.
15 * @param size Size in bytes of the requested boot device memory area. Not aligned.
17 * @returns Number of bytes returned to the buffer, or negative value on error. Typically should
18 * be equal to the `size`, and not aligned forcefully.
20 ssize_t boot_device_read(void *buf, size_t offset, size_t size);
22 #endif /* _BOOT_DEVICE_H */