fsp_support.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. /* SPDX-License-Identifier: Intel */
  2. /*
  3. * Copyright (C) 2013, Intel Corporation
  4. * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
  5. */
  6. #ifndef __FSP_SUPPORT_H__
  7. #define __FSP_SUPPORT_H__
  8. #include "fsp_types.h"
  9. #include "fsp_fv.h"
  10. #include "fsp_ffs.h"
  11. #include "fsp_api.h"
  12. #include "fsp_hob.h"
  13. #include "fsp_infoheader.h"
  14. #include "fsp_bootmode.h"
  15. #include "fsp_azalia.h"
  16. #include <asm/arch/fsp/fsp_vpd.h>
  17. #include <asm/arch/fsp/fsp_configs.h>
  18. #define FSP_LOWMEM_BASE 0x100000UL
  19. #define FSP_HIGHMEM_BASE 0x100000000ULL
  20. #define UPD_TERMINATOR 0x55AA
  21. /**
  22. * FSP Continuation assembly helper routine
  23. *
  24. * This routine jumps to the C version of FSP continuation function
  25. */
  26. void asm_continuation(void);
  27. /**
  28. * FSP initialization complete
  29. *
  30. * This is the function that indicates FSP initialization is complete and jumps
  31. * back to the bootloader with HOB list pointer as the parameter.
  32. *
  33. * @hob_list: HOB list pointer
  34. */
  35. void fsp_init_done(void *hob_list);
  36. /**
  37. * FSP Continuation function
  38. *
  39. * @status: Always 0
  40. * @hob_list: HOB list pointer
  41. *
  42. * @retval: Never returns
  43. */
  44. void fsp_continue(u32 status, void *hob_list);
  45. /**
  46. * Find FSP header offset in FSP image
  47. *
  48. * @retval: the offset of FSP header. If signature is invalid, returns 0.
  49. */
  50. struct fsp_header *find_fsp_header(void);
  51. /**
  52. * FSP initialization wrapper function.
  53. *
  54. * @stack_top: bootloader stack top address
  55. * @boot_mode: boot mode defined in fsp_bootmode.h
  56. * @nvs_buf: Non-volatile memory buffer pointer
  57. */
  58. void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf);
  59. /**
  60. * FSP notification wrapper function
  61. *
  62. * @fsp_hdr: Pointer to FSP information header
  63. * @phase: FSP initialization phase defined in enum fsp_phase
  64. *
  65. * @retval: compatible status code with EFI_STATUS defined in PI spec
  66. */
  67. u32 fsp_notify(struct fsp_header *fsp_hdr, u32 phase);
  68. /**
  69. * This function retrieves the top of usable low memory.
  70. *
  71. * @hob_list: A HOB list pointer.
  72. *
  73. * @retval: Usable low memory top.
  74. */
  75. u32 fsp_get_usable_lowmem_top(const void *hob_list);
  76. /**
  77. * This function retrieves the top of usable high memory.
  78. *
  79. * @hob_list: A HOB list pointer.
  80. *
  81. * @retval: Usable high memory top.
  82. */
  83. u64 fsp_get_usable_highmem_top(const void *hob_list);
  84. /**
  85. * This function retrieves a special reserved memory region.
  86. *
  87. * @hob_list: A HOB list pointer.
  88. * @len: A pointer to the GUID HOB data buffer length.
  89. * If the GUID HOB is located, the length will be updated.
  90. * @guid: A pointer to the owner guild.
  91. *
  92. * @retval: Reserved region start address.
  93. * 0 if this region does not exist.
  94. */
  95. u64 fsp_get_reserved_mem_from_guid(const void *hob_list,
  96. u64 *len, struct efi_guid *guid);
  97. /**
  98. * This function retrieves the FSP reserved normal memory.
  99. *
  100. * @hob_list: A HOB list pointer.
  101. * @len: A pointer to the FSP reserved memory length buffer.
  102. * If the GUID HOB is located, the length will be updated.
  103. * @retval: FSP reserved memory base
  104. * 0 if this region does not exist.
  105. */
  106. u32 fsp_get_fsp_reserved_mem(const void *hob_list, u32 *len);
  107. /**
  108. * This function retrieves the TSEG reserved normal memory.
  109. *
  110. * @hob_list: A HOB list pointer.
  111. * @len: A pointer to the TSEG reserved memory length buffer.
  112. * If the GUID HOB is located, the length will be updated.
  113. *
  114. * @retval NULL: Failed to find the TSEG reserved memory.
  115. * @retval others: TSEG reserved memory base.
  116. */
  117. u32 fsp_get_tseg_reserved_mem(const void *hob_list, u32 *len);
  118. /**
  119. * Returns the next instance of a HOB type from the starting HOB.
  120. *
  121. * @type: HOB type to search
  122. * @hob_list: A pointer to the HOB list
  123. *
  124. * @retval: A HOB object with matching type; Otherwise NULL.
  125. */
  126. const struct hob_header *fsp_get_next_hob(uint type, const void *hob_list);
  127. /**
  128. * Returns the next instance of the matched GUID HOB from the starting HOB.
  129. *
  130. * @guid: GUID to search
  131. * @hob_list: A pointer to the HOB list
  132. *
  133. * @retval: A HOB object with matching GUID; Otherwise NULL.
  134. */
  135. const struct hob_header *fsp_get_next_guid_hob(const struct efi_guid *guid,
  136. const void *hob_list);
  137. /**
  138. * This function retrieves a GUID HOB data buffer and size.
  139. *
  140. * @hob_list: A HOB list pointer.
  141. * @len: A pointer to the GUID HOB data buffer length.
  142. * If the GUID HOB is located, the length will be updated.
  143. * @guid A pointer to HOB GUID.
  144. *
  145. * @retval NULL: Failed to find the GUID HOB.
  146. * @retval others: GUID HOB data buffer pointer.
  147. */
  148. void *fsp_get_guid_hob_data(const void *hob_list, u32 *len,
  149. struct efi_guid *guid);
  150. /**
  151. * This function retrieves FSP Non-volatile Storage HOB buffer and size.
  152. *
  153. * @hob_list: A HOB list pointer.
  154. * @len: A pointer to the NVS data buffer length.
  155. * If the HOB is located, the length will be updated.
  156. *
  157. * @retval NULL: Failed to find the NVS HOB.
  158. * @retval others: FSP NVS data buffer pointer.
  159. */
  160. void *fsp_get_nvs_data(const void *hob_list, u32 *len);
  161. /**
  162. * This function retrieves Bootloader temporary stack buffer and size.
  163. *
  164. * @hob_list: A HOB list pointer.
  165. * @len: A pointer to the bootloader temporary stack length.
  166. * If the HOB is located, the length will be updated.
  167. *
  168. * @retval NULL: Failed to find the bootloader temporary stack HOB.
  169. * @retval others: Bootloader temporary stackbuffer pointer.
  170. */
  171. void *fsp_get_bootloader_tmp_mem(const void *hob_list, u32 *len);
  172. /**
  173. * This function retrieves graphics information.
  174. *
  175. * @hob_list: A HOB list pointer.
  176. * @len: A pointer to the graphics info HOB length.
  177. * If the HOB is located, the length will be updated.
  178. *
  179. * @retval NULL: Failed to find the graphics info HOB.
  180. * @retval others: A pointer to struct hob_graphics_info.
  181. */
  182. void *fsp_get_graphics_info(const void *hob_list, u32 *len);
  183. /**
  184. * This function overrides the default configurations of FSP.
  185. *
  186. * @config: A pointer to the FSP configuration data structure
  187. * @rt_buf: A pointer to the FSP runtime buffer data structure
  188. *
  189. * @return: None
  190. */
  191. void update_fsp_configs(struct fsp_config_data *config,
  192. struct fspinit_rtbuf *rt_buf);
  193. /**
  194. * fsp_init_phase_pci() - Tell the FSP that we have completed PCI init
  195. *
  196. * @return 0 if OK, -EPERM if the FSP gave an error.
  197. */
  198. int fsp_init_phase_pci(void);
  199. #endif