1 /* SPDX-License-Identifier: Intel */
2 /*
3  * Copyright (C) 2015-2016 Intel Corp.
4  * (Written by Andrey Petrov <andrey.petrov@intel.com> for Intel Corp.)
5  * (Written by Alexandru Gagniuc <alexandrux.gagniuc@intel.com> for Intel Corp.)
6  * Mostly taken from coreboot fsp2_0/memory_init.c
7  */
8 
9 #ifndef __ASM_FSP2_API_H
10 #define __ASM_FSP2_API_H
11 
12 #include <asm/fsp/fsp_api.h>
13 
14 struct fspm_upd;
15 struct fsps_upd;
16 struct hob_header;
17 
18 enum fsp_boot_mode {
19 	FSP_BOOT_WITH_FULL_CONFIGURATION = 0x00,
20 	FSP_BOOT_WITH_MINIMAL_CONFIGURATION = 0x01,
21 	FSP_BOOT_ASSUMING_NO_CONFIGURATION_CHANGES = 0x02,
22 	FSP_BOOT_ON_S4_RESUME = 0x05,
23 	FSP_BOOT_ON_S3_RESUME = 0x11,
24 	FSP_BOOT_ON_FLASH_UPDATE = 0x12,
25 	FSP_BOOT_IN_RECOVERY_MODE = 0x20
26 };
27 
28 struct __packed fsp_upd_header {
29 	u64	signature;
30 	u8	revision;
31 	u8	reserved[23];
32 };
33 
34 /**
35  * fsp_memory_init() - Init the SDRAM
36  *
37  * @s3wake: true if we are booting from resume, so cannot reinit the mememory
38  *	from scatch since we will lose its contents
39  * @use_spi_flash: true to use the fast SPI driver to read FSP, otherwise use
40  *	mapped SPI
41  * @return 0 if OK, -ve on error
42  */
43 int fsp_memory_init(bool s3wake, bool use_spi_flash);
44 
45 typedef asmlinkage int (*fsp_memory_init_func)(struct fspm_upd *params,
46 					       struct hob_header **hobp);
47 
48 /**
49  * fsp_silicon_init() - Init the silicon
50  *
51  * This calls the FSP's 'silicon init' entry point
52  *
53  * @s3wake: true if we are booting from resume, so cannot reinit the mememory
54  *	from scatch since we will lose its contents
55  * @use_spi_flash: true to use the fast SPI driver to read FSP, otherwise use
56  *	mapped SPI
57  * @return 0 if OK, -ve on error
58  */
59 int fsp_silicon_init(bool s3wake, bool use_spi_flash);
60 
61 typedef asmlinkage int (*fsp_silicon_init_func)(struct fsps_upd *params);
62 
63 #endif
64