fsp_support.h 6.3 KB

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