[U-Boot] [PATCH 17/38] x86: fsp: Create a common fsp_support.h header
Simon Glass
sjg at chromium.org
Mon Aug 26 15:59:22 UTC 2019
Many support functions are common between FSP1 and FSP2. Add a new header
to handle this.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
arch/x86/include/asm/fsp/fsp_support.h | 128 ++++++++++++++++++++++++
arch/x86/include/asm/fsp1/fsp_support.h | 123 +----------------------
drivers/pci/pci-uclass.c | 2 +-
3 files changed, 132 insertions(+), 121 deletions(-)
create mode 100644 arch/x86/include/asm/fsp/fsp_support.h
diff --git a/arch/x86/include/asm/fsp/fsp_support.h b/arch/x86/include/asm/fsp/fsp_support.h
new file mode 100644
index 0000000000..0ecd5cb6c5
--- /dev/null
+++ b/arch/x86/include/asm/fsp/fsp_support.h
@@ -0,0 +1,128 @@
+/* SPDX-License-Identifier: Intel */
+/*
+ * Copyright (C) 2013, Intel Corporation
+ * Copyright (C) 2014, Bin Meng <bmeng.cn at gmail.com>
+ */
+
+#ifndef __FSP_SUPPORT_H__
+#define __FSP_SUPPORT_H__
+
+#include <asm/fsp/fsp_bootmode.h>
+#include <asm/fsp/fsp_fv.h>
+#include <asm/fsp/fsp_hob.h>
+#include <asm/fsp/fsp_infoheader.h>
+#include <asm/fsp/fsp_types.h>
+#include <asm/fsp_arch.h>
+#include <asm/fsp/fsp_azalia.h>
+
+#define FSP_LOWMEM_BASE 0x100000UL
+#define FSP_HIGHMEM_BASE 0x100000000ULL
+#define UPD_TERMINATOR 0x55AA
+
+struct fspinit_rtbuf;
+struct fsp_config_data;
+
+/**
+ * Find FSP header offset in FSP image
+ *
+ * @retval: the offset of FSP header. If signature is invalid, returns 0.
+ */
+struct fsp_header *fsp_find_header(void);
+
+/**
+ * FSP notification wrapper function
+ *
+ * @fsp_hdr: Pointer to FSP information header
+ * @phase: FSP initialization phase defined in enum fsp_phase
+ *
+ * @retval: compatible status code with EFI_STATUS defined in PI spec
+ */
+u32 fsp_notify(struct fsp_header *fsp_hdr, u32 phase);
+
+/**
+ * This function retrieves the top of usable low memory.
+ *
+ * @hob_list: A HOB list pointer.
+ *
+ * @retval: Usable low memory top.
+ */
+u32 fsp_get_usable_lowmem_top(const void *hob_list);
+
+/**
+ * This function retrieves the top of usable high memory.
+ *
+ * @hob_list: A HOB list pointer.
+ *
+ * @retval: Usable high memory top.
+ */
+u64 fsp_get_usable_highmem_top(const void *hob_list);
+
+/**
+ * This function retrieves a special reserved memory region.
+ *
+ * @hob_list: A HOB list pointer.
+ * @len: A pointer to the GUID HOB data buffer length.
+ * If the GUID HOB is located, the length will be updated.
+ * @guid: A pointer to the owner guild.
+ *
+ * @retval: Reserved region start address.
+ * 0 if this region does not exist.
+ */
+u64 fsp_get_reserved_mem_from_guid(const void *hob_list,
+ u64 *len, const efi_guid_t *guid);
+
+/**
+ * This function retrieves the FSP reserved normal memory.
+ *
+ * @hob_list: A HOB list pointer.
+ * @len: A pointer to the FSP reserved memory length buffer.
+ * If the GUID HOB is located, the length will be updated.
+ * @retval: FSP reserved memory base
+ * 0 if this region does not exist.
+ */
+u32 fsp_get_fsp_reserved_mem(const void *hob_list, u32 *len);
+
+/**
+ * This function retrieves the TSEG reserved normal memory.
+ *
+ * @hob_list: A HOB list pointer.
+ * @len: A pointer to the TSEG reserved memory length buffer.
+ * If the GUID HOB is located, the length will be updated.
+ *
+ * @retval NULL: Failed to find the TSEG reserved memory.
+ * @retval others: TSEG reserved memory base.
+ */
+u32 fsp_get_tseg_reserved_mem(const void *hob_list, u32 *len);
+
+/**
+ * This function retrieves FSP Non-volatile Storage HOB buffer and size.
+ *
+ * @hob_list: A HOB list pointer.
+ * @len: A pointer to the NVS data buffer length.
+ * If the HOB is located, the length will be updated.
+ *
+ * @retval NULL: Failed to find the NVS HOB.
+ * @retval others: FSP NVS data buffer pointer.
+ */
+void *fsp_get_nvs_data(const void *hob_list, u32 *len);
+
+/**
+ * This function retrieves graphics information.
+ *
+ * @hob_list: A HOB list pointer.
+ * @len: A pointer to the graphics info HOB length.
+ * If the HOB is located, the length will be updated.
+ *
+ * @retval NULL: Failed to find the graphics info HOB.
+ * @retval others: A pointer to struct hob_graphics_info.
+ */
+void *fsp_get_graphics_info(const void *hob_list, u32 *len);
+
+/**
+ * fsp_init_phase_pci() - Tell the FSP that we have completed PCI init
+ *
+ * @return 0 if OK, -EPERM if the FSP gave an error.
+ */
+int fsp_init_phase_pci(void);
+
+#endif
diff --git a/arch/x86/include/asm/fsp1/fsp_support.h b/arch/x86/include/asm/fsp1/fsp_support.h
index 945a45c0fe..15c3a462e2 100644
--- a/arch/x86/include/asm/fsp1/fsp_support.h
+++ b/arch/x86/include/asm/fsp1/fsp_support.h
@@ -4,25 +4,11 @@
* Copyright (C) 2014, Bin Meng <bmeng.cn at gmail.com>
*/
-#ifndef __FSP_SUPPORT_H__
-#define __FSP_SUPPORT_H__
+#ifndef __FSP1_SUPPORT_H__
+#define __FSP1_SUPPORT_H__
-#include <asm/fsp/fsp_bootmode.h>
-#include <asm/fsp/fsp_fv.h>
-#include <asm/fsp/fsp_hob.h>
-#include <asm/fsp/fsp_infoheader.h>
-#include <asm/fsp/fsp_types.h>
+#include <asm/fsp/fsp_support.h>
#include "fsp_ffs.h"
-#include <asm/fsp_arch.h>
-#include <asm/fsp/fsp_azalia.h>
-
-#define FSP_LOWMEM_BASE 0x100000UL
-#define FSP_HIGHMEM_BASE 0x100000000ULL
-#define UPD_TERMINATOR 0x55AA
-
-struct efi_guid;
-struct fspinit_rtbuf;
-struct fsp_config_data;
/**
* FSP Continuation assembly helper routine
@@ -51,13 +37,6 @@ void fsp_init_done(void *hob_list);
*/
void fsp_continue(u32 status, void *hob_list);
-/**
- * Find FSP header offset in FSP image
- *
- * @retval: the offset of FSP header. If signature is invalid, returns 0.
- */
-struct fsp_header *fsp_find_header(void);
-
/**
* FSP initialization wrapper function.
*
@@ -67,83 +46,6 @@ struct fsp_header *fsp_find_header(void);
*/
void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf);
-/**
- * FSP notification wrapper function
- *
- * @fsp_hdr: Pointer to FSP information header
- * @phase: FSP initialization phase defined in enum fsp_phase
- *
- * @retval: compatible status code with EFI_STATUS defined in PI spec
- */
-u32 fsp_notify(struct fsp_header *fsp_hdr, u32 phase);
-
-/**
- * This function retrieves the top of usable low memory.
- *
- * @hob_list: A HOB list pointer.
- *
- * @retval: Usable low memory top.
- */
-u32 fsp_get_usable_lowmem_top(const void *hob_list);
-
-/**
- * This function retrieves the top of usable high memory.
- *
- * @hob_list: A HOB list pointer.
- *
- * @retval: Usable high memory top.
- */
-u64 fsp_get_usable_highmem_top(const void *hob_list);
-
-/**
- * This function retrieves a special reserved memory region.
- *
- * @hob_list: A HOB list pointer.
- * @len: A pointer to the GUID HOB data buffer length.
- * If the GUID HOB is located, the length will be updated.
- * @guid: A pointer to the owner guild.
- *
- * @retval: Reserved region start address.
- * 0 if this region does not exist.
- */
-u64 fsp_get_reserved_mem_from_guid(const void *hob_list,
- u64 *len, const efi_guid_t *guid);
-
-/**
- * This function retrieves the FSP reserved normal memory.
- *
- * @hob_list: A HOB list pointer.
- * @len: A pointer to the FSP reserved memory length buffer.
- * If the GUID HOB is located, the length will be updated.
- * @retval: FSP reserved memory base
- * 0 if this region does not exist.
- */
-u32 fsp_get_fsp_reserved_mem(const void *hob_list, u32 *len);
-
-/**
- * This function retrieves the TSEG reserved normal memory.
- *
- * @hob_list: A HOB list pointer.
- * @len: A pointer to the TSEG reserved memory length buffer.
- * If the GUID HOB is located, the length will be updated.
- *
- * @retval NULL: Failed to find the TSEG reserved memory.
- * @retval others: TSEG reserved memory base.
- */
-u32 fsp_get_tseg_reserved_mem(const void *hob_list, u32 *len);
-
-/**
- * This function retrieves FSP Non-volatile Storage HOB buffer and size.
- *
- * @hob_list: A HOB list pointer.
- * @len: A pointer to the NVS data buffer length.
- * If the HOB is located, the length will be updated.
- *
- * @retval NULL: Failed to find the NVS HOB.
- * @retval others: FSP NVS data buffer pointer.
- */
-void *fsp_get_nvs_data(const void *hob_list, u32 *len);
-
/**
* This function retrieves Bootloader temporary stack buffer and size.
*
@@ -156,18 +58,6 @@ void *fsp_get_nvs_data(const void *hob_list, u32 *len);
*/
void *fsp_get_bootloader_tmp_mem(const void *hob_list, u32 *len);
-/**
- * This function retrieves graphics information.
- *
- * @hob_list: A HOB list pointer.
- * @len: A pointer to the graphics info HOB length.
- * If the HOB is located, the length will be updated.
- *
- * @retval NULL: Failed to find the graphics info HOB.
- * @retval others: A pointer to struct hob_graphics_info.
- */
-void *fsp_get_graphics_info(const void *hob_list, u32 *len);
-
/**
* This function overrides the default configurations of FSP.
*
@@ -179,11 +69,4 @@ void *fsp_get_graphics_info(const void *hob_list, u32 *len);
void fsp_update_configs(struct fsp_config_data *config,
struct fspinit_rtbuf *rt_buf);
-/**
- * fsp_init_phase_pci() - Tell the FSP that we have completed PCI init
- *
- * @return 0 if OK, -EPERM if the FSP gave an error.
- */
-int fsp_init_phase_pci(void);
-
#endif
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index b73d0cd70a..ab3e1310eb 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -12,7 +12,7 @@
#include <dm/device-internal.h>
#include <dm/lists.h>
#if defined(CONFIG_X86) && defined(CONFIG_HAVE_FSP)
-#include <asm/fsp1/fsp_support.h>
+#include <asm/fsp/fsp_support.h>
#endif
#include "pci_internal.h"
--
2.23.0.187.g17f5b7556c-goog
More information about the U-Boot
mailing list