• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef FSP1_1_UTIL_H
4 #define FSP1_1_UTIL_H
5 
6 #include <cpu/cpu.h>
7 #include <fsp/api.h>
8 /* Current users expect to get the SoC's FSP definitions by including util.h. */
9 #include <fsp/soc_binding.h>
10 #include <program_loading.h>
11 #include <commonlib/region.h>
12 
13 /* find_fsp() should only be called from assembly code. */
14 FSP_INFO_HEADER *find_fsp(uintptr_t fsp_base_address);
15 /* Set FSP's runtime information. */
16 void fsp_set_runtime(FSP_INFO_HEADER *fih, void *hob_list);
17 /* Use a new FSP_INFO_HEADER at runtime. */
18 void fsp_update_fih(FSP_INFO_HEADER *fih);
19 /* fsp_get_fih() is only valid after calling fsp_set_runtime(). */
20 FSP_INFO_HEADER *fsp_get_fih(void);
21 /* fsp_get_hob_list() is only valid after calling fsp_set_runtime(). */
22 void *fsp_get_hob_list(void);
23 void fsp_early_init(FSP_INFO_HEADER *fsp_info);
24 void fsp_notify(u32 phase);
25 void print_hob_type_structure(u16 hob_type, void *hob_list_ptr);
26 void print_fsp_info(FSP_INFO_HEADER *fsp_header);
27 void *get_resource_hob(const EFI_GUID *guid, const void *hob_start);
28 void fsp_display_upd_value(const char *name, uint32_t size, uint64_t old,
29 	uint64_t new);
30 void report_fsp_output(void);
31 
32 /* Return version of FSP associated with FIH. */
fsp_version(FSP_INFO_HEADER * fih)33 static inline uint32_t fsp_version(FSP_INFO_HEADER *fih)
34 {
35 	return fih->ImageRevision;
36 }
37 
38 /*
39  * Relocate FSP entire binary into ram. Returns < 0 on error, 0 on success.
40  * The CBFS file name of the FSP source and the relocation information
41  * is encoded in a struct prog with its entry point set to the FSP info header.
42  */
43 int fsp_relocate(struct prog *fsp_relocd);
44 
45 /* Additional HOB types not included in the FSP:
46  * #define EFI_HOB_TYPE_HANDOFF 0x0001
47  * #define EFI_HOB_TYPE_MEMORY_ALLOCATION 0x0002
48  * #define EFI_HOB_TYPE_RESOURCE_DESCRIPTOR 0x0003
49  * #define EFI_HOB_TYPE_GUID_EXTENSION 0x0004
50  * #define EFI_HOB_TYPE_FV 0x0005
51  * #define EFI_HOB_TYPE_CPU 0x0006
52  * #define EFI_HOB_TYPE_MEMORY_POOL 0x0007
53  * #define EFI_HOB_TYPE_CV 0x0008
54  * #define EFI_HOB_TYPE_UNUSED 0xFFFE
55  * #define EFI_HOB_TYPE_END_OF_HOB_LIST 0xffff
56  */
57 #define EFI_HOB_TYPE_HANDOFF		0x0001
58 #define EFI_HOB_TYPE_MEMORY_POOL	0x0007
59 
60 /* The offset in bytes from the start of the info structure */
61 #define FSP_IMAGE_SIG_LOC			0
62 #define FSP_IMAGE_ID_LOC			16
63 #define FSP_IMAGE_BASE_LOC			28
64 #define FSP_IMAGE_ATTRIBUTE_LOC			32
65 #define  GRAPHICS_SUPPORT_BIT			(1 << 0)
66 
67 #define ERROR_NO_FV_SIG				1
68 #define ERROR_NO_FFS_GUID			2
69 #define ERROR_NO_INFO_HEADER			3
70 #define ERROR_IMAGEBASE_MISMATCH		4
71 #define ERROR_INFO_HEAD_SIG_MISMATCH		5
72 #define ERROR_FSP_SIG_MISMATCH			6
73 #define ERROR_FSP_REV_MISMATCH			7
74 
75 #if ENV_RAMSTAGE
76 extern void *FspHobListPtr;
77 #endif
78 
79 void *get_hob_list(void);
80 void *get_guid_hob(const EFI_GUID *guid, const void *hob_start);
81 
82 asmlinkage void chipset_teardown_car_main(void);
83 
84 #endif	/* FSP1_1_UTIL_H */
85