1 /* SPDX-License-Identifier: Intel */ 2 /* 3 * Copyright (C) 2013, Intel Corporation 4 * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com> 5 */ 6 7 #ifndef __FSP_SUPPORT_H__ 8 #define __FSP_SUPPORT_H__ 9 10 #include <signatures.h> 11 12 #include <asm/fsp/fsp_bootmode.h> 13 #include <asm/fsp/fsp_fv.h> 14 #include <asm/fsp/fsp_hob.h> 15 #include <asm/fsp/fsp_infoheader.h> 16 #include <asm/fsp_arch.h> 17 #include <asm/fsp/fsp_azalia.h> 18 19 #define FSP_LOWMEM_BASE 0x100000UL 20 #define FSP_HIGHMEM_BASE 0x100000000ULL 21 #define UPD_TERMINATOR 0x55AA 22 23 /** 24 * fsp_find_header() - Find FSP header offset in FSP image 25 * 26 * @return the offset of FSP header. If signature is invalid, returns 0. 27 */ 28 struct fsp_header *fsp_find_header(void); 29 30 /** 31 * fsp_notify() - FSP notification wrapper function 32 * 33 * @fsp_hdr: Pointer to FSP information header 34 * @phase: FSP initialization phase defined in enum fsp_phase 35 * 36 * @return compatible status code with EFI_STATUS defined in PI spec 37 */ 38 u32 fsp_notify(struct fsp_header *fsp_hdr, u32 phase); 39 40 /** 41 * fsp_get_usable_lowmem_top() - retrieves the top of usable low memory 42 * 43 * @hob_list: A HOB list pointer. 44 * 45 * @return Usable low memory top. 46 */ 47 u32 fsp_get_usable_lowmem_top(const void *hob_list); 48 49 /** 50 * fsp_get_usable_highmem_top() - retrieves the top of usable high memory 51 * 52 * @hob_list: A HOB list pointer. 53 * 54 * @return Usable high memory top. 55 */ 56 u64 fsp_get_usable_highmem_top(const void *hob_list); 57 58 /** 59 * fsp_get_reserved_mem_from_guid() - retrieves a special reserved memory region 60 * 61 * @hob_list: A HOB list pointer. 62 * @len: A pointer to the GUID HOB data buffer length. 63 * If the GUID HOB is located, the length will be updated. 64 * @guid: A pointer to the owner guild. 65 * 66 * @return Reserved region start address. 67 * 0 if this region does not exist. 68 */ 69 u64 fsp_get_reserved_mem_from_guid(const void *hob_list, 70 u64 *len, const efi_guid_t *guid); 71 72 /** 73 * fsp_get_fsp_reserved_mem() - retrieves the FSP reserved normal memory 74 * 75 * @hob_list: A HOB list pointer. 76 * @len: A pointer to the FSP reserved memory length buffer. 77 * If the GUID HOB is located, the length will be updated. 78 * @return FSP reserved memory base 79 * 0 if this region does not exist. 80 */ 81 u32 fsp_get_fsp_reserved_mem(const void *hob_list, u32 *len); 82 83 /** 84 * fsp_get_tseg_reserved_mem() - retrieves the TSEG reserved normal memory 85 * 86 * @hob_list: A HOB list pointer. 87 * @len: A pointer to the TSEG reserved memory length buffer. 88 * If the GUID HOB is located, the length will be updated. 89 * 90 * @return NULL: Failed to find the TSEG reserved memory. 91 * @return others: TSEG reserved memory base. 92 */ 93 u32 fsp_get_tseg_reserved_mem(const void *hob_list, u32 *len); 94 95 /** 96 * fsp_get_nvs_data() - retrieves FSP Non-volatile Storage HOB buffer and size 97 * 98 * @hob_list: A HOB list pointer. 99 * @len: A pointer to the NVS data buffer length. 100 * If the HOB is located, the length will be updated. 101 * 102 * @return NULL: Failed to find the NVS HOB. 103 * @return others: FSP NVS data buffer pointer. 104 */ 105 void *fsp_get_nvs_data(const void *hob_list, u32 *len); 106 107 /** 108 * fsp_get_var_nvs_data() - get FSP variable Non-volatile Storage HOB buffer 109 * 110 * @hob_list: A HOB list pointer. 111 * @len: A pointer to the NVS data buffer length. 112 * If the HOB is located, the length will be updated. 113 * 114 * @return NULL: Failed to find the NVS HOB. 115 * @return others: FSP NVS data buffer pointer. 116 */ 117 void *fsp_get_var_nvs_data(const void *hob_list, u32 *len); 118 119 /** 120 * fsp_get_graphics_info() - retrieves graphics information. 121 * 122 * @hob_list: A HOB list pointer. 123 * @len: A pointer to the graphics info HOB length. 124 * If the HOB is located, the length will be updated. 125 * 126 * @return NULL: Failed to find the graphics info HOB. 127 * @return others: A pointer to struct hob_graphics_info. 128 */ 129 void *fsp_get_graphics_info(const void *hob_list, u32 *len); 130 131 /** 132 * fsp_init_phase_pci() - Tell the FSP that we have completed PCI init 133 * 134 * @return 0 if OK, -EPERM if the FSP gave an error. 135 */ 136 int fsp_init_phase_pci(void); 137 138 /** 139 * fsp_scan_for_ram_size() - Scan the HOB list to find the RAM size 140 * 141 * This sets gd->ram_size based on what it finds. 142 * 143 * @return 0 if OK, -ve on error 144 */ 145 int fsp_scan_for_ram_size(void); 146 147 /** 148 * fsp_notify() - FSP notification wrapper function 149 * 150 * @fsp_hdr: Pointer to FSP information header 151 * @phase: FSP initialization phase defined in enum fsp_phase 152 * 153 * @return compatible status code with EFI_STATUS defined in PI spec 154 */ 155 u32 fsp_notify(struct fsp_header *fsp_hdr, u32 phase); 156 157 #endif 158