xref: /openbmc/u-boot/include/spl.h (revision 65f2e689)
183d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */
247f7bcaeSTom Rini /*
347f7bcaeSTom Rini  * (C) Copyright 2012
447f7bcaeSTom Rini  * Texas Instruments, <www.ti.com>
547f7bcaeSTom Rini  */
647f7bcaeSTom Rini #ifndef	_SPL_H_
747f7bcaeSTom Rini #define	_SPL_H_
847f7bcaeSTom Rini 
98bee2d25SSimon Glass #include <binman_sym.h>
108bee2d25SSimon Glass 
1147f7bcaeSTom Rini /* Platform-specific defines */
126507f133STom Rini #include <linux/compiler.h>
1347f7bcaeSTom Rini #include <asm/spl.h>
14b0edea3cSSimon Glass #include <handoff.h>
1547f7bcaeSTom Rini 
1632ba8952SSimon Glass /* Value in r0 indicates we booted from U-Boot */
1732ba8952SSimon Glass #define UBOOT_NOT_LOADED_FROM_SPL	0x13578642
18773b5940SDan Murphy 
1947f7bcaeSTom Rini /* Boot type */
2047f7bcaeSTom Rini #define MMCSD_MODE_UNDEFINED	0
2147f7bcaeSTom Rini #define MMCSD_MODE_RAW		1
22205b4f33SGuillaume GARDET #define MMCSD_MODE_FS		2
237dbe63bcSTom Rini #define MMCSD_MODE_EMMCBOOT	3
2447f7bcaeSTom Rini 
25e945a726SSimon Glass /*
26e945a726SSimon Glass  * u_boot_first_phase() - check if this is the first U-Boot phase
27e945a726SSimon Glass  *
28e945a726SSimon Glass  * U-Boot has up to three phases: TPL, SPL and U-Boot proper. Depending on the
29e945a726SSimon Glass  * build flags we can determine whether the current build is for the first
30e945a726SSimon Glass  * phase of U-Boot or not. If there is no SPL, then this is U-Boot proper. If
31e945a726SSimon Glass  * there is SPL but no TPL, the the first phase is SPL. If there is TPL, then
32e945a726SSimon Glass  * it is the first phase.
33e945a726SSimon Glass  *
34e945a726SSimon Glass  * @returns true if this is the first phase of U-Boot
35e945a726SSimon Glass  *
36e945a726SSimon Glass  */
u_boot_first_phase(void)37e945a726SSimon Glass static inline bool u_boot_first_phase(void)
38e945a726SSimon Glass {
39e945a726SSimon Glass 	if (IS_ENABLED(CONFIG_TPL)) {
40e945a726SSimon Glass 		if (IS_ENABLED(CONFIG_TPL_BUILD))
41e945a726SSimon Glass 			return true;
42e945a726SSimon Glass 	} else if (IS_ENABLED(CONFIG_SPL)) {
43e945a726SSimon Glass 		if (IS_ENABLED(CONFIG_SPL_BUILD))
44e945a726SSimon Glass 			return true;
45e945a726SSimon Glass 	} else {
46e945a726SSimon Glass 		return true;
47e945a726SSimon Glass 	}
48e945a726SSimon Glass 
49e945a726SSimon Glass 	return false;
50e945a726SSimon Glass }
51e945a726SSimon Glass 
52d6330064SSimon Glass /* A string name for SPL or TPL */
53d6330064SSimon Glass #ifdef CONFIG_SPL_BUILD
54d6330064SSimon Glass # ifdef CONFIG_TPL_BUILD
558fb2391eSHeiko Schocher #  define SPL_TPL_NAME	"TPL"
56d6330064SSimon Glass # else
578fb2391eSHeiko Schocher #  define SPL_TPL_NAME	"SPL"
58d6330064SSimon Glass # endif
59d6330064SSimon Glass # define SPL_TPL_PROMPT	SPL_TPL_NAME ": "
60d6330064SSimon Glass #else
61d6330064SSimon Glass # define SPL_TPL_NAME	""
62d6330064SSimon Glass # define SPL_TPL_PROMPT	""
63d6330064SSimon Glass #endif
64d6330064SSimon Glass 
6547f7bcaeSTom Rini struct spl_image_info {
6647f7bcaeSTom Rini 	const char *name;
6747f7bcaeSTom Rini 	u8 os;
68f2efe678SPhilipp Tomsich 	uintptr_t load_addr;
69f2efe678SPhilipp Tomsich 	uintptr_t entry_point;
7075014470SPhilipp Tomsich #if CONFIG_IS_ENABLED(LOAD_FIT)
7175014470SPhilipp Tomsich 	void *fdt_addr;
7275014470SPhilipp Tomsich #endif
73de5dd4c4SPhilipp Tomsich 	u32 boot_device;
7447f7bcaeSTom Rini 	u32 size;
75022b4975SStefan Roese 	u32 flags;
765bf5250eSVikas Manocha 	void *arg;
77dae5c2dcSSimon Goldschmidt #ifdef CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK
78dae5c2dcSSimon Goldschmidt 	ulong dcrc_data;
79dae5c2dcSSimon Goldschmidt 	ulong dcrc_length;
80dae5c2dcSSimon Goldschmidt 	ulong dcrc;
81dae5c2dcSSimon Goldschmidt #endif
8247f7bcaeSTom Rini };
8347f7bcaeSTom Rini 
84f1dcee59SSimon Glass /*
85f1dcee59SSimon Glass  * Information required to load data from a device
86f1dcee59SSimon Glass  *
87f1dcee59SSimon Glass  * @dev: Pointer to the device, e.g. struct mmc *
88f1dcee59SSimon Glass  * @priv: Private data for the device
89f1dcee59SSimon Glass  * @bl_len: Block length for reading in bytes
90eafd5410SLokesh Vutla  * @filename: Name of the fit image file.
91f1dcee59SSimon Glass  * @read: Function to call to read from the device
92f1dcee59SSimon Glass  */
93f1dcee59SSimon Glass struct spl_load_info {
94f1dcee59SSimon Glass 	void *dev;
95f1dcee59SSimon Glass 	void *priv;
96f1dcee59SSimon Glass 	int bl_len;
97eafd5410SLokesh Vutla 	const char *filename;
98f1dcee59SSimon Glass 	ulong (*read)(struct spl_load_info *load, ulong sector, ulong count,
99f1dcee59SSimon Glass 		      void *buf);
100f1dcee59SSimon Glass };
101f1dcee59SSimon Glass 
1028bee2d25SSimon Glass /*
1038bee2d25SSimon Glass  * We need to know the position of U-Boot in memory so we can jump to it. We
1048bee2d25SSimon Glass  * allow any U-Boot binary to be used (u-boot.bin, u-boot-nodtb.bin,
1058bee2d25SSimon Glass  * u-boot.img), hence the '_any'. These is no checking here that the correct
1068bee2d25SSimon Glass  * image is found. For * example if u-boot.img is used we don't check that
1078bee2d25SSimon Glass  * spl_parse_image_header() can parse a valid header.
1088bee2d25SSimon Glass  */
109dbf6be9fSSimon Glass binman_sym_extern(ulong, u_boot_any, image_pos);
1108bee2d25SSimon Glass 
111eafd5410SLokesh Vutla /**
112*65f2e689SAndreas Dannenberg  * spl_load_simple_fit_skip_processing() - Hook to allow skipping the FIT
113*65f2e689SAndreas Dannenberg  *	image processing during spl_load_simple_fit().
114*65f2e689SAndreas Dannenberg  *
115*65f2e689SAndreas Dannenberg  * Return true to skip FIT processing, false to preserve the full code flow
116*65f2e689SAndreas Dannenberg  * of spl_load_simple_fit().
117*65f2e689SAndreas Dannenberg  */
118*65f2e689SAndreas Dannenberg bool spl_load_simple_fit_skip_processing(void);
119*65f2e689SAndreas Dannenberg 
120*65f2e689SAndreas Dannenberg /**
121eafd5410SLokesh Vutla  * spl_load_simple_fit() - Loads a fit image from a device.
122f4d7d859SSimon Glass  * @spl_image:	Image description to set up
123eafd5410SLokesh Vutla  * @info:	Structure containing the information required to load data.
124eafd5410SLokesh Vutla  * @sector:	Sector number where FIT image is located in the device
125eafd5410SLokesh Vutla  * @fdt:	Pointer to the copied FIT header.
126eafd5410SLokesh Vutla  *
127eafd5410SLokesh Vutla  * Reads the FIT image @sector in the device. Loads u-boot image to
128eafd5410SLokesh Vutla  * specified load address and copies the dtb to end of u-boot image.
129eafd5410SLokesh Vutla  * Returns 0 on success.
130eafd5410SLokesh Vutla  */
131f4d7d859SSimon Glass int spl_load_simple_fit(struct spl_image_info *spl_image,
132f4d7d859SSimon Glass 			struct spl_load_info *info, ulong sector, void *fdt);
133f1dcee59SSimon Glass 
134022b4975SStefan Roese #define SPL_COPY_PAYLOAD_ONLY	1
135e246bfcfSYe Li #define SPL_FIT_FOUND		2
136022b4975SStefan Roese 
13747f7bcaeSTom Rini /* SPL common functions */
13847f7bcaeSTom Rini void preloader_console_init(void);
13947f7bcaeSTom Rini u32 spl_boot_device(void);
1402b1cdafaSMarek Vasut u32 spl_boot_mode(const u32 boot_device);
14135a66960SPatrick Delaunay int spl_boot_partition(const u32 boot_device);
142d1fc0a31SYork Sun void spl_set_bd(void);
143d95ceb97SSimon Glass 
144d95ceb97SSimon Glass /**
145d95ceb97SSimon Glass  * spl_set_header_raw_uboot() - Set up a standard SPL image structure
146d95ceb97SSimon Glass  *
147d95ceb97SSimon Glass  * This sets up the given spl_image which the standard values obtained from
148d95ceb97SSimon Glass  * config options: CONFIG_SYS_MONITOR_LEN, CONFIG_SYS_UBOOT_START,
149d95ceb97SSimon Glass  * CONFIG_SYS_TEXT_BASE.
150d95ceb97SSimon Glass  *
15171316c1dSSimon Glass  * @spl_image: Image description to set up
152d95ceb97SSimon Glass  */
153d95ceb97SSimon Glass void spl_set_header_raw_uboot(struct spl_image_info *spl_image);
154d95ceb97SSimon Glass 
15571316c1dSSimon Glass /**
15671316c1dSSimon Glass  * spl_parse_image_header() - parse the image header and set up info
15771316c1dSSimon Glass  *
15871316c1dSSimon Glass  * This parses the legacy image header information at @header and sets up
15971316c1dSSimon Glass  * @spl_image according to what is found. If no image header is found, then
16071316c1dSSimon Glass  * a raw image or bootz is assumed. If CONFIG_SPL_PANIC_ON_RAW_IMAGE is
16124eb39b5SAndrew F. Davis  * enabled, then this causes a panic. If CONFIG_SPL_RAW_IMAGE_SUPPORT is not
16271316c1dSSimon Glass  * enabled then U-Boot gives up. Otherwise U-Boot sets up the image using
16371316c1dSSimon Glass  * spl_set_header_raw_uboot(), or possibly the bootz header.
16471316c1dSSimon Glass  *
16571316c1dSSimon Glass  * @spl_image: Image description to set up
16671316c1dSSimon Glass  * @header image header to parse
16771316c1dSSimon Glass  * @return 0 if a header was correctly parsed, -ve on error
16871316c1dSSimon Glass  */
16971316c1dSSimon Glass int spl_parse_image_header(struct spl_image_info *spl_image,
17071316c1dSSimon Glass 			   const struct image_header *header);
17171316c1dSSimon Glass 
17247f7bcaeSTom Rini void spl_board_prepare_for_linux(void);
1733a3b9147SMichal Simek void spl_board_prepare_for_boot(void);
174bf55cd4fSLadislav Michl int spl_board_ubi_load_image(u32 boot_device);
175ca12e65cSSimon Glass 
176ca12e65cSSimon Glass /**
177ca12e65cSSimon Glass  * jump_to_image_linux() - Jump to a Linux kernel from SPL
178ca12e65cSSimon Glass  *
179ca12e65cSSimon Glass  * This jumps into a Linux kernel using the information in @spl_image.
180ca12e65cSSimon Glass  *
181ca12e65cSSimon Glass  * @spl_image: Image description to set up
182ca12e65cSSimon Glass  */
1835bf5250eSVikas Manocha void __noreturn jump_to_image_linux(struct spl_image_info *spl_image);
184f59961e3SSimon Glass 
185f59961e3SSimon Glass /**
186f59961e3SSimon Glass  * spl_start_uboot() - Check if SPL should start the kernel or U-Boot
187f59961e3SSimon Glass  *
188f59961e3SSimon Glass  * This is called by the various SPL loaders to determine whether the board
189f59961e3SSimon Glass  * wants to load the kernel or U-Boot. This function should be provided by
190f59961e3SSimon Glass  * the board.
191f59961e3SSimon Glass  *
192f59961e3SSimon Glass  * @return 0 if SPL should start the kernel, 1 if U-Boot must be started
193f59961e3SSimon Glass  */
19447f7bcaeSTom Rini int spl_start_uboot(void);
195f59961e3SSimon Glass 
196a807ab33SSimon Glass /**
197a807ab33SSimon Glass  * spl_display_print() - Display a board-specific message in SPL
198a807ab33SSimon Glass  *
199a807ab33SSimon Glass  * If CONFIG_SPL_DISPLAY_PRINT is enabled, U-Boot will call this function
200a807ab33SSimon Glass  * immediately after displaying the SPL console banner ("U-Boot SPL ...").
201a807ab33SSimon Glass  * This function should be provided by the board.
202a807ab33SSimon Glass  */
20347f7bcaeSTom Rini void spl_display_print(void);
20447f7bcaeSTom Rini 
205ecdfd69aSSimon Glass /**
206ecdfd69aSSimon Glass  * struct spl_boot_device - Describes a boot device used by SPL
207ecdfd69aSSimon Glass  *
208ecdfd69aSSimon Glass  * @boot_device: A number indicating the BOOT_DEVICE type. There are various
209ecdfd69aSSimon Glass  * BOOT_DEVICE... #defines and enums in U-Boot and they are not consistently
210ecdfd69aSSimon Glass  * numbered.
211ecdfd69aSSimon Glass  * @boot_device_name: Named boot device, or NULL if none.
212ecdfd69aSSimon Glass  *
213ecdfd69aSSimon Glass  * Note: Additional fields can be added here, bearing in mind that SPL is
214ecdfd69aSSimon Glass  * size-sensitive and common fields will be present on all boards. This
215ecdfd69aSSimon Glass  * struct can also be used to return additional information about the load
216ecdfd69aSSimon Glass  * process if that becomes useful.
217ecdfd69aSSimon Glass  */
218ecdfd69aSSimon Glass struct spl_boot_device {
219ecdfd69aSSimon Glass 	uint boot_device;
220ecdfd69aSSimon Glass 	const char *boot_device_name;
221ecdfd69aSSimon Glass };
222ecdfd69aSSimon Glass 
223a0a80290SSimon Glass /**
224a0a80290SSimon Glass  * Holds information about a way of loading an SPL image
225a0a80290SSimon Glass  *
226ebc4ef61SSimon Glass  * @name: User-friendly name for this method (e.g. "MMC")
227a0a80290SSimon Glass  * @boot_device: Boot device that this loader supports
228a0a80290SSimon Glass  * @load_image: Function to call to load image
229a0a80290SSimon Glass  */
230a0a80290SSimon Glass struct spl_image_loader {
231ebc4ef61SSimon Glass #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
232ebc4ef61SSimon Glass 	const char *name;
233ebc4ef61SSimon Glass #endif
234a0a80290SSimon Glass 	uint boot_device;
235a0a80290SSimon Glass 	/**
236a0a80290SSimon Glass 	 * load_image() - Load an SPL image
237a0a80290SSimon Glass 	 *
2382a2ee2acSSimon Glass 	 * @spl_image: place to put image information
239a0a80290SSimon Glass 	 * @bootdev: describes the boot device to load from
240a0a80290SSimon Glass 	 */
2412a2ee2acSSimon Glass 	int (*load_image)(struct spl_image_info *spl_image,
2422a2ee2acSSimon Glass 			  struct spl_boot_device *bootdev);
243a0a80290SSimon Glass };
244a0a80290SSimon Glass 
245a0a80290SSimon Glass /* Declare an SPL image loader */
246a0a80290SSimon Glass #define SPL_LOAD_IMAGE(__name)					\
247a0a80290SSimon Glass 	ll_entry_declare(struct spl_image_loader, __name, spl_image_loader)
248a0a80290SSimon Glass 
249a0a80290SSimon Glass /*
2500d3b0591SSimon Glass  * _priority is the priority of this method, 0 meaning it will be the top
251a0a80290SSimon Glass  * choice for this device, 9 meaning it is the bottom choice.
2520d3b0591SSimon Glass  * _boot_device is the BOOT_DEVICE_... value
2530d3b0591SSimon Glass  * _method is the load_image function to call
254a0a80290SSimon Glass  */
255ebc4ef61SSimon Glass #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
256ebc4ef61SSimon Glass #define SPL_LOAD_IMAGE_METHOD(_name, _priority, _boot_device, _method) \
257ebc4ef61SSimon Glass 	SPL_LOAD_IMAGE(_method ## _priority ## _boot_device) = { \
258ebc4ef61SSimon Glass 		.name = _name, \
259ebc4ef61SSimon Glass 		.boot_device = _boot_device, \
260ebc4ef61SSimon Glass 		.load_image = _method, \
261ebc4ef61SSimon Glass 	}
262ebc4ef61SSimon Glass #else
263ebc4ef61SSimon Glass #define SPL_LOAD_IMAGE_METHOD(_name, _priority, _boot_device, _method) \
2640d3b0591SSimon Glass 	SPL_LOAD_IMAGE(_method ## _priority ## _boot_device) = { \
2650d3b0591SSimon Glass 		.boot_device = _boot_device, \
2660d3b0591SSimon Glass 		.load_image = _method, \
267a0a80290SSimon Glass 	}
268ebc4ef61SSimon Glass #endif
269a0a80290SSimon Glass 
270773b5940SDan Murphy /* SPL FAT image functions */
271710e9ca5SSimon Glass int spl_load_image_fat(struct spl_image_info *spl_image,
272710e9ca5SSimon Glass 		       struct blk_desc *block_dev, int partition,
2734101f687SSimon Glass 		       const char *filename);
274710e9ca5SSimon Glass int spl_load_image_fat_os(struct spl_image_info *spl_image,
275710e9ca5SSimon Glass 			  struct blk_desc *block_dev, int partition);
276773b5940SDan Murphy 
277ce048224SJeroen Hofstee void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image);
278ce048224SJeroen Hofstee 
279592f9222SGuillaume GARDET /* SPL EXT image functions */
280b4a6c2aaSSimon Glass int spl_load_image_ext(struct spl_image_info *spl_image,
281b4a6c2aaSSimon Glass 		       struct blk_desc *block_dev, int partition,
2824101f687SSimon Glass 		       const char *filename);
283b4a6c2aaSSimon Glass int spl_load_image_ext_os(struct spl_image_info *spl_image,
284b4a6c2aaSSimon Glass 			  struct blk_desc *block_dev, int partition);
285592f9222SGuillaume GARDET 
286070d00b8SSimon Glass /**
287340f418aSEddie Cai  * spl_early_init() - Set up device tree and driver model in SPL if enabled
288070d00b8SSimon Glass  *
289070d00b8SSimon Glass  * Call this function in board_init_f() if you want to use device tree and
290340f418aSEddie Cai  * driver model early, before board_init_r() is called.
291340f418aSEddie Cai  *
292340f418aSEddie Cai  * If this is not called, then driver model will be inactive in SPL's
293340f418aSEddie Cai  * board_init_f(), and no device tree will be available.
294340f418aSEddie Cai  */
295340f418aSEddie Cai int spl_early_init(void);
296340f418aSEddie Cai 
297340f418aSEddie Cai /**
298340f418aSEddie Cai  * spl_init() - Set up device tree and driver model in SPL if enabled
299340f418aSEddie Cai  *
300340f418aSEddie Cai  * You can optionally call spl_early_init(), then optionally call spl_init().
301340f418aSEddie Cai  * This function will be called from board_init_r() if not called earlier.
302340f418aSEddie Cai  *
303340f418aSEddie Cai  * Both spl_early_init() and spl_init() perform a similar function except that
304340f418aSEddie Cai  * the latter will not set up the malloc() area if
305340f418aSEddie Cai  * CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN is enabled, since it is assumed to
306340f418aSEddie Cai  * already be done by a calll to spl_relocate_stack_gd() before board_init_r()
307340f418aSEddie Cai  * is reached.
308340f418aSEddie Cai  *
309340f418aSEddie Cai  * This function will be called from board_init_r() if not called earlier.
310070d00b8SSimon Glass  *
311070d00b8SSimon Glass  * If this is not called, then driver model will be inactive in SPL's
312070d00b8SSimon Glass  * board_init_f(), and no device tree will be available.
313070d00b8SSimon Glass  */
314070d00b8SSimon Glass int spl_init(void);
315070d00b8SSimon Glass 
31647f7bcaeSTom Rini #ifdef CONFIG_SPL_BOARD_INIT
31747f7bcaeSTom Rini void spl_board_init(void);
31847f7bcaeSTom Rini #endif
31932ba8952SSimon Glass 
32032ba8952SSimon Glass /**
32132ba8952SSimon Glass  * spl_was_boot_source() - check if U-Boot booted from SPL
32232ba8952SSimon Glass  *
32332ba8952SSimon Glass  * This will normally be true, but if U-Boot jumps to second U-Boot, it will
32432ba8952SSimon Glass  * be false. This should be implemented by board-specific code.
32532ba8952SSimon Glass  *
32632ba8952SSimon Glass  * @return true if U-Boot booted from SPL, else false
32732ba8952SSimon Glass  */
32832ba8952SSimon Glass bool spl_was_boot_source(void);
32932ba8952SSimon Glass 
33052f2acc5SB, Ravi /**
33152f2acc5SB, Ravi  * spl_dfu_cmd- run dfu command with chosen mmc device interface
33252f2acc5SB, Ravi  * @param usb_index - usb controller number
33352f2acc5SB, Ravi  * @param mmc_dev -  mmc device nubmer
33452f2acc5SB, Ravi  *
33552f2acc5SB, Ravi  * @return 0 on success, otherwise error code
33652f2acc5SB, Ravi  */
33752f2acc5SB, Ravi int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr);
338e50d76ccSSimon Glass 
33909410c65SMarek Vasut int spl_mmc_load_image(struct spl_image_info *spl_image,
34009410c65SMarek Vasut 		       struct spl_boot_device *bootdev);
34109410c65SMarek Vasut 
342f2efe678SPhilipp Tomsich /**
343*65f2e689SAndreas Dannenberg  * spl_mmc_load() - Load an image file from MMC/SD media
344*65f2e689SAndreas Dannenberg  *
345*65f2e689SAndreas Dannenberg  * @param spl_image	Image data filled in by loading process
346*65f2e689SAndreas Dannenberg  * @param bootdev	Describes which device to load from
347*65f2e689SAndreas Dannenberg  * @param filename	Name of file to load (in FS mode)
348*65f2e689SAndreas Dannenberg  * @param raw_part	Partition to load from (in RAW mode)
349*65f2e689SAndreas Dannenberg  * @param raw_sect	Sector to load from (in RAW mode)
350*65f2e689SAndreas Dannenberg  *
351*65f2e689SAndreas Dannenberg  * @return 0 on success, otherwise error code
352*65f2e689SAndreas Dannenberg  */
353*65f2e689SAndreas Dannenberg int spl_mmc_load(struct spl_image_info *spl_image,
354*65f2e689SAndreas Dannenberg 		 struct spl_boot_device *bootdev,
355*65f2e689SAndreas Dannenberg 		 const char *filename,
356*65f2e689SAndreas Dannenberg 		 int raw_part,
357*65f2e689SAndreas Dannenberg 		 unsigned long raw_sect);
358*65f2e689SAndreas Dannenberg 
359*65f2e689SAndreas Dannenberg /**
360f2efe678SPhilipp Tomsich  * spl_invoke_atf - boot using an ARM trusted firmware image
361f2efe678SPhilipp Tomsich  */
362f2efe678SPhilipp Tomsich void spl_invoke_atf(struct spl_image_info *spl_image);
363225d30b7SPhilipp Tomsich 
364225d30b7SPhilipp Tomsich /**
36570fe2876SKever Yang  * spl_optee_entry - entry function for optee
36670fe2876SKever Yang  *
36770fe2876SKever Yang  * args defind in op-tee project
36870fe2876SKever Yang  * https://github.com/OP-TEE/optee_os/
36970fe2876SKever Yang  * core/arch/arm/kernel/generic_entry_a32.S
37070fe2876SKever Yang  * @arg0: pagestore
37170fe2876SKever Yang  * @arg1: (ARMv7 standard bootarg #1)
37270fe2876SKever Yang  * @arg2: device tree address, (ARMv7 standard bootarg #2)
37370fe2876SKever Yang  * @arg3: non-secure entry address (ARMv7 bootarg #0)
37470fe2876SKever Yang  */
37570fe2876SKever Yang void spl_optee_entry(void *arg0, void *arg1, void *arg2, void *arg3);
37670fe2876SKever Yang 
37770fe2876SKever Yang /**
378225d30b7SPhilipp Tomsich  * board_return_to_bootrom - allow for boards to continue with the boot ROM
379225d30b7SPhilipp Tomsich  *
380225d30b7SPhilipp Tomsich  * If a board (e.g. the Rockchip RK3368 boards) provide some
381225d30b7SPhilipp Tomsich  * supporting functionality for SPL in their boot ROM and the SPL
382225d30b7SPhilipp Tomsich  * stage wants to return to the ROM code to continue booting, boards
383225d30b7SPhilipp Tomsich  * can implement 'board_return_to_bootrom'.
384225d30b7SPhilipp Tomsich  */
385225d30b7SPhilipp Tomsich void board_return_to_bootrom(void);
386de5dd4c4SPhilipp Tomsich 
387de5dd4c4SPhilipp Tomsich /**
38828ded1f3SPeng Fan  * board_spl_fit_post_load - allow process images after loading finished
38928ded1f3SPeng Fan  *
39028ded1f3SPeng Fan  */
39128ded1f3SPeng Fan void board_spl_fit_post_load(ulong load_addr, size_t length);
39228ded1f3SPeng Fan 
39328ded1f3SPeng Fan /**
39428ded1f3SPeng Fan  * board_spl_fit_size_align - specific size align before processing payload
39528ded1f3SPeng Fan  *
39628ded1f3SPeng Fan  */
39728ded1f3SPeng Fan ulong board_spl_fit_size_align(ulong size);
39828ded1f3SPeng Fan 
39928ded1f3SPeng Fan /**
400de5dd4c4SPhilipp Tomsich  * spl_perform_fixups() - arch/board-specific callback before processing
401de5dd4c4SPhilipp Tomsich  *                        the boot-payload
402de5dd4c4SPhilipp Tomsich  */
403de5dd4c4SPhilipp Tomsich void spl_perform_fixups(struct spl_image_info *spl_image);
40404ce5427SMarek Vasut 
40504ce5427SMarek Vasut /*
40604ce5427SMarek Vasut  * spl_get_load_buffer() - get buffer for loading partial image data
40704ce5427SMarek Vasut  *
40804ce5427SMarek Vasut  * Returns memory area which can be populated by partial image data,
40904ce5427SMarek Vasut  * ie. uImage or fitImage header.
41004ce5427SMarek Vasut  */
41104ce5427SMarek Vasut struct image_header *spl_get_load_buffer(ssize_t offset, size_t size);
41204ce5427SMarek Vasut 
41347f7bcaeSTom Rini #endif
414