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_bootmode.h>
11 #include <asm/fsp/fsp_fv.h>
12 #include <asm/fsp/fsp_hob.h>
13 #include <asm/fsp/fsp_infoheader.h>
14 #include <asm/fsp/fsp_types.h>
15 #include <asm/fsp_arch.h>
16 #include <asm/fsp/fsp_azalia.h>
18 #define FSP_LOWMEM_BASE 0x100000UL
19 #define FSP_HIGHMEM_BASE 0x100000000ULL
20 #define UPD_TERMINATOR 0x55AA
23 * fsp_find_header() - Find FSP header offset in FSP image
25 * @return the offset of FSP header. If signature is invalid, returns 0.
27 struct fsp_header *fsp_find_header(void);
30 * fsp_notify() - FSP notification wrapper function
32 * @fsp_hdr: Pointer to FSP information header
33 * @phase: FSP initialization phase defined in enum fsp_phase
35 * @return compatible status code with EFI_STATUS defined in PI spec
37 u32 fsp_notify(struct fsp_header *fsp_hdr, u32 phase);
40 * fsp_get_usable_lowmem_top() - retrieves the top of usable low memory
42 * @hob_list: A HOB list pointer.
44 * @return Usable low memory top.
46 u32 fsp_get_usable_lowmem_top(const void *hob_list);
49 * fsp_get_usable_highmem_top() - retrieves the top of usable high memory
51 * @hob_list: A HOB list pointer.
53 * @return Usable high memory top.
55 u64 fsp_get_usable_highmem_top(const void *hob_list);
58 * fsp_get_reserved_mem_from_guid() - retrieves a special reserved memory region
60 * @hob_list: A HOB list pointer.
61 * @len: A pointer to the GUID HOB data buffer length.
62 * If the GUID HOB is located, the length will be updated.
63 * @guid: A pointer to the owner guild.
65 * @return Reserved region start address.
66 * 0 if this region does not exist.
68 u64 fsp_get_reserved_mem_from_guid(const void *hob_list,
69 u64 *len, const efi_guid_t *guid);
72 * fsp_get_fsp_reserved_mem() - retrieves the FSP reserved normal memory
74 * @hob_list: A HOB list pointer.
75 * @len: A pointer to the FSP reserved memory length buffer.
76 * If the GUID HOB is located, the length will be updated.
77 * @return FSP reserved memory base
78 * 0 if this region does not exist.
80 u32 fsp_get_fsp_reserved_mem(const void *hob_list, u32 *len);
83 * fsp_get_tseg_reserved_mem() - retrieves the TSEG reserved normal memory
85 * @hob_list: A HOB list pointer.
86 * @len: A pointer to the TSEG reserved memory length buffer.
87 * If the GUID HOB is located, the length will be updated.
89 * @return NULL: Failed to find the TSEG reserved memory.
90 * @return others: TSEG reserved memory base.
92 u32 fsp_get_tseg_reserved_mem(const void *hob_list, u32 *len);
95 * fsp_get_nvs_data() - retrieves FSP Non-volatile Storage HOB buffer and size
97 * @hob_list: A HOB list pointer.
98 * @len: A pointer to the NVS data buffer length.
99 * If the HOB is located, the length will be updated.
101 * @return NULL: Failed to find the NVS HOB.
102 * @return others: FSP NVS data buffer pointer.
104 void *fsp_get_nvs_data(const void *hob_list, u32 *len);
107 * fsp_get_var_nvs_data() - get FSP variable Non-volatile Storage HOB buffer
109 * @hob_list: A HOB list pointer.
110 * @len: A pointer to the NVS data buffer length.
111 * If the HOB is located, the length will be updated.
113 * @return NULL: Failed to find the NVS HOB.
114 * @return others: FSP NVS data buffer pointer.
116 void *fsp_get_var_nvs_data(const void *hob_list, u32 *len);
119 * fsp_get_graphics_info() - retrieves graphics information.
121 * @hob_list: A HOB list pointer.
122 * @len: A pointer to the graphics info HOB length.
123 * If the HOB is located, the length will be updated.
125 * @return NULL: Failed to find the graphics info HOB.
126 * @return others: A pointer to struct hob_graphics_info.
128 void *fsp_get_graphics_info(const void *hob_list, u32 *len);
131 * fsp_init_phase_pci() - Tell the FSP that we have completed PCI init
133 * @return 0 if OK, -EPERM if the FSP gave an error.
135 int fsp_init_phase_pci(void);
138 * fsp_scan_for_ram_size() - Scan the HOB list to find the RAM size
140 * This sets gd->ram_size based on what it finds.
142 * @return 0 if OK, -ve on error
144 int fsp_scan_for_ram_size(void);
147 * fsp_notify() - FSP notification wrapper function
149 * @fsp_hdr: Pointer to FSP information header
150 * @phase: FSP initialization phase defined in enum fsp_phase
152 * @return compatible status code with EFI_STATUS defined in PI spec
154 u32 fsp_notify(struct fsp_header *fsp_hdr, u32 phase);