1 /* SPDX-License-Identifier: Intel */
3 * Copyright (C) 2013, Intel Corporation
4 * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
7 #ifndef __FSP_SUPPORT_H__
8 #define __FSP_SUPPORT_H__
10 #include <asm/fsp/fsp_fv.h>
11 #include <asm/fsp/fsp_types.h>
14 #include "fsp_infoheader.h"
15 #include "fsp_bootmode.h"
16 #include <asm/fsp_arch.h>
17 #include <asm/fsp/fsp_azalia.h>
19 #define FSP_LOWMEM_BASE 0x100000UL
20 #define FSP_HIGHMEM_BASE 0x100000000ULL
21 #define UPD_TERMINATOR 0x55AA
24 * FSP Continuation assembly helper routine
26 * This routine jumps to the C version of FSP continuation function
28 void asm_continuation(void);
31 * FSP initialization complete
33 * This is the function that indicates FSP initialization is complete and jumps
34 * back to the bootloader with HOB list pointer as the parameter.
36 * @hob_list: HOB list pointer
38 void fsp_init_done(void *hob_list);
41 * FSP Continuation function
44 * @hob_list: HOB list pointer
46 * @retval: Never returns
48 void fsp_continue(u32 status, void *hob_list);
51 * Find FSP header offset in FSP image
53 * @retval: the offset of FSP header. If signature is invalid, returns 0.
55 struct fsp_header *find_fsp_header(void);
58 * FSP initialization wrapper function.
60 * @stack_top: bootloader stack top address
61 * @boot_mode: boot mode defined in fsp_bootmode.h
62 * @nvs_buf: Non-volatile memory buffer pointer
64 void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf);
67 * FSP notification wrapper function
69 * @fsp_hdr: Pointer to FSP information header
70 * @phase: FSP initialization phase defined in enum fsp_phase
72 * @retval: compatible status code with EFI_STATUS defined in PI spec
74 u32 fsp_notify(struct fsp_header *fsp_hdr, u32 phase);
77 * This function retrieves the top of usable low memory.
79 * @hob_list: A HOB list pointer.
81 * @retval: Usable low memory top.
83 u32 fsp_get_usable_lowmem_top(const void *hob_list);
86 * This function retrieves the top of usable high memory.
88 * @hob_list: A HOB list pointer.
90 * @retval: Usable high memory top.
92 u64 fsp_get_usable_highmem_top(const void *hob_list);
95 * This function retrieves a special reserved memory region.
97 * @hob_list: A HOB list pointer.
98 * @len: A pointer to the GUID HOB data buffer length.
99 * If the GUID HOB is located, the length will be updated.
100 * @guid: A pointer to the owner guild.
102 * @retval: Reserved region start address.
103 * 0 if this region does not exist.
105 u64 fsp_get_reserved_mem_from_guid(const void *hob_list,
106 u64 *len, const efi_guid_t *guid);
109 * This function retrieves the FSP reserved normal memory.
111 * @hob_list: A HOB list pointer.
112 * @len: A pointer to the FSP reserved memory length buffer.
113 * If the GUID HOB is located, the length will be updated.
114 * @retval: FSP reserved memory base
115 * 0 if this region does not exist.
117 u32 fsp_get_fsp_reserved_mem(const void *hob_list, u32 *len);
120 * This function retrieves the TSEG reserved normal memory.
122 * @hob_list: A HOB list pointer.
123 * @len: A pointer to the TSEG reserved memory length buffer.
124 * If the GUID HOB is located, the length will be updated.
126 * @retval NULL: Failed to find the TSEG reserved memory.
127 * @retval others: TSEG reserved memory base.
129 u32 fsp_get_tseg_reserved_mem(const void *hob_list, u32 *len);
132 * This function retrieves FSP Non-volatile Storage HOB buffer and size.
134 * @hob_list: A HOB list pointer.
135 * @len: A pointer to the NVS data buffer length.
136 * If the HOB is located, the length will be updated.
138 * @retval NULL: Failed to find the NVS HOB.
139 * @retval others: FSP NVS data buffer pointer.
141 void *fsp_get_nvs_data(const void *hob_list, u32 *len);
144 * This function retrieves Bootloader temporary stack buffer and size.
146 * @hob_list: A HOB list pointer.
147 * @len: A pointer to the bootloader temporary stack length.
148 * If the HOB is located, the length will be updated.
150 * @retval NULL: Failed to find the bootloader temporary stack HOB.
151 * @retval others: Bootloader temporary stackbuffer pointer.
153 void *fsp_get_bootloader_tmp_mem(const void *hob_list, u32 *len);
156 * This function retrieves graphics information.
158 * @hob_list: A HOB list pointer.
159 * @len: A pointer to the graphics info HOB length.
160 * If the HOB is located, the length will be updated.
162 * @retval NULL: Failed to find the graphics info HOB.
163 * @retval others: A pointer to struct hob_graphics_info.
165 void *fsp_get_graphics_info(const void *hob_list, u32 *len);
168 * This function overrides the default configurations of FSP.
170 * @config: A pointer to the FSP configuration data structure
171 * @rt_buf: A pointer to the FSP runtime buffer data structure
175 void update_fsp_configs(struct fsp_config_data *config,
176 struct fspinit_rtbuf *rt_buf);
179 * fsp_init_phase_pci() - Tell the FSP that we have completed PCI init
181 * @return 0 if OK, -EPERM if the FSP gave an error.
183 int fsp_init_phase_pci(void);