| 1 | /* SPDX-License-Identifier: BSD-3-Clause */ |
| 2 | |
| 3 | #ifndef _BOOT_DEVICE_H |
| 4 | #define _BOOT_DEVICE_H |
| 5 | |
| 6 | #include <stddef.h> |
| 7 | |
| 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. |
| 12 | * |
| 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. |
| 16 | * |
| 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. |
| 19 | */ |
| 20 | ssize_t boot_device_read(void *buf, size_t offset, size_t size); |
| 21 | |
| 22 | #endif /* _BOOT_DEVICE_H */ |