xref: /openbmc/u-boot/include/fs_loader.h (revision 77c07e7e)
162030004STien Fong Chee /*
262030004STien Fong Chee  * Copyright (C) 2018 Intel Corporation <www.intel.com>
362030004STien Fong Chee  *
462030004STien Fong Chee  * SPDX-License-Identifier:    GPL-2.0
562030004STien Fong Chee  */
662030004STien Fong Chee #ifndef _FS_LOADER_H_
762030004STien Fong Chee #define _FS_LOADER_H_
862030004STien Fong Chee 
962030004STien Fong Chee #include <dm.h>
1062030004STien Fong Chee 
1162030004STien Fong Chee /**
1262030004STien Fong Chee  * struct phandle_part - A place for storing phandle of node and its partition
1362030004STien Fong Chee  *
1462030004STien Fong Chee  * This holds information about a phandle of the block device, and its
1562030004STien Fong Chee  * partition where the firmware would be loaded from.
1662030004STien Fong Chee  *
1762030004STien Fong Chee  * @phandle: Phandle of storage device node
1862030004STien Fong Chee  * @partition: Partition of block device
1962030004STien Fong Chee  */
2062030004STien Fong Chee struct phandle_part {
2162030004STien Fong Chee 	u32 phandle;
2262030004STien Fong Chee 	u32 partition;
2362030004STien Fong Chee };
2462030004STien Fong Chee 
2562030004STien Fong Chee /**
2662030004STien Fong Chee  * struct phandle_part - A place for storing all supported storage devices
2762030004STien Fong Chee  *
2862030004STien Fong Chee  * This holds information about all supported storage devices for driver use.
2962030004STien Fong Chee  *
3062030004STien Fong Chee  * @phandlepart: Attribute data for block device.
3162030004STien Fong Chee  * @mtdpart: MTD partition for ubi partition.
3262030004STien Fong Chee  * @ubivol: UBI volume-name for ubifsmount.
3362030004STien Fong Chee  */
3462030004STien Fong Chee struct device_platdata {
3562030004STien Fong Chee 	struct phandle_part phandlepart;
3662030004STien Fong Chee 	char *mtdpart;
3762030004STien Fong Chee 	char *ubivol;
3862030004STien Fong Chee };
3962030004STien Fong Chee 
4062030004STien Fong Chee /**
4162030004STien Fong Chee  * request_firmware_into_buf - Load firmware into a previously allocated buffer.
42*31a2cf1cSTien Fong Chee  * @dev: An instance of a driver.
4362030004STien Fong Chee  * @name: Name of firmware file.
4462030004STien Fong Chee  * @buf: Address of buffer to load firmware into.
4562030004STien Fong Chee  * @size: Size of buffer.
4662030004STien Fong Chee  * @offset: Offset of a file for start reading into buffer.
4762030004STien Fong Chee  *
48*31a2cf1cSTien Fong Chee  * The firmware is loaded directly into the buffer pointed to by @buf.
4962030004STien Fong Chee  *
5062030004STien Fong Chee  * Return: Size of total read, negative value when error.
5162030004STien Fong Chee  */
52*31a2cf1cSTien Fong Chee int request_firmware_into_buf(struct udevice *dev,
5362030004STien Fong Chee 			      const char *name,
54*31a2cf1cSTien Fong Chee 			      void *buf, size_t size, u32 offset);
5562030004STien Fong Chee #endif
56