Skip to contentSkip to conversation

x86: fsp: Move platform-specific config to chipset directory

PATCH New Bin Meng 2 participants 28 messages Dec 11, 2015 – Dec 21, 2015 x86

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

v2 cover x86: fsp: Move platform-specific config to chipset directory

All FSP spec v1.0 complaint FSP binary uses struct fspinit_rtbuf as defined by the 1.0 spec, however there are FSPs that do not follow 1.0 spec, like Intel FSP for 3rd generation Intel Core and Intel Celeron processors with mobile Intel HM76 and QM77 chipsets platform (formerly Chief River Platform: Ivy Bridge and Panther Point). Although Intel website says this FSP conforms to FSP v1.0 specification which defines the UPD usage, it is not really the case. This might possible due to that FSP predates the 1.0 spec. Also future FSP binary that is complaint to v1.1 spec defines an optional paltform-specific runtime data in the struct fspinit_rtbuf.

Besides this fspinit_rtbuf, the IvyBridge FSP does not support UPD either, so that current codes in arch/x86/lib/fsp/fsp_support.c won't work for that FSP. We need some flexibility, hence move those platform-specific config to chipset directory.

Right now we still use hardcoded 'const struct' table (in flash) to pass the Azalia (Intel HD Audio) verb table to FSP, because different FSP may use different verb table format (at least for Queensbay and BayTrail), we cannot handle this in the common FSP support codes. But with this series, we are now able to get Azalia verb table from device tree, just like what we did for overriding UPD data configuration. This can be done in future patch set.

Changes in v2:
- Include a common struct fsp_cfg_common in the struct fsp_config_data.
- New patch to introduce CONFIG_FSP_USE_UPD Kconfig option
- split this patch from v1 patch#7

Bin Meng (9):
x86: fsp: Simplify fsp_continue()
x86: fsp: Avoid cast stack_top in struct shared_data
x86: fsp: Add boot_mode as a member of struct shared_data
x86: fsp: Rename shared_data to fsp_config_data
x86: fsp: Rename update_fsp_upd() and change its signature
x86: fsp: Introduce CONFIG_FSP_USE_UPD Kconfig option
x86: queensbay: Remove invalid comments in update_fsp_configs()
x86: fsp: Move struct fspinit_rtbuf definition to chipset header
x86: fsp: Set up init runtime buffer in update_fsp_configs()

 arch/x86/Kconfig                                   |  9 ++++
 arch/x86/cpu/baytrail/fsp_configs.c                | 11 +++-
 arch/x86/cpu/queensbay/fsp_configs.c               | 14 +++---
 .../include/asm/arch-baytrail/fsp/fsp_configs.h    | 19 +++++++
 .../include/asm/arch-queensbay/fsp/fsp_configs.h   | 19 +++++++
 arch/x86/include/asm/fsp/fsp_api.h                 | 12 ++++-
 arch/x86/include/asm/fsp/fsp_platform.h            | 15 ------
 arch/x86/include/asm/fsp/fsp_support.h             | 20 +++-----
 arch/x86/lib/fsp/fsp_support.c                     | 58 ++++++++--------------
 9 files changed, 102 insertions(+), 75 deletions(-)
 create mode 100644 arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h
 create mode 100644 arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h
 delete mode 100644 arch/x86/include/asm/fsp/fsp_platform.h
Signature · 1 line
1.8.2.1
author
#1 lore raw

PATCH v2 1/9 x86: fsp: Simplify fsp_continue()

There is no need to pass shared_data to fsp_continue() so we can remove unnecessary codes that simplifies the function a lot.

---

Changes in v2: None

 arch/x86/include/asm/fsp/fsp_support.h |  4 +---
 arch/x86/lib/fsp/fsp_support.c         | 29 ++++++-----------------------
 2 files changed, 7 insertions(+), 26 deletions(-)
arch/x86/include/asm/fsp/fsp_support.h +1 -3
index 7317dda..f30d7b4 100644
@@ -49,14 +49,12 @@ void fsp_init_done(void *hob_list);
 /**
  * FSP Continuation function
  *
- * @shared_data: Shared data base before stack migration
  * @status:      Always 0
  * @hob_list:    HOB list pointer
  *
  * @retval:      Never returns
  */
-void fsp_continue(struct shared_data *shared_data, u32 status,
-		  void *hob_list);
+void fsp_continue(u32 status, void *hob_list);
 
 /**
  * Find FSP header offset in FSP image
arch/x86/lib/fsp/fsp_support.c +6 -23
index 1d48ff4..0408b5d 100644
@@ -87,28 +87,12 @@ struct fsp_header *__attribute__((optimize("O0"))) find_fsp_header(void)
 	return (struct fsp_header *)fsp;
 }
 
-void fsp_continue(struct shared_data *shared_data, u32 status, void *hob_list)
+void fsp_continue(u32 status, void *hob_list)
 {
-	u32 stack_len;
-	u32 stack_base;
-	u32 stack_top;
-
 	post_code(POST_MRC);
 
 	assert(status == 0);
 
-	/* Get the migrated stack in normal memory */
-	stack_base = (u32)fsp_get_bootloader_tmp_mem(hob_list, &stack_len);
-	assert(stack_base != 0);
-	stack_top  = stack_base + stack_len - sizeof(u32);
-
-	/*
-	 * Old stack base is stored at the very end of the stack top,
-	 * use it to calculate the migrated shared data base
-	 */
-	shared_data = (struct shared_data *)(stack_base +
-			((u32)shared_data - *(u32 *)stack_top));
-
 	/* The boot loader main function entry */
 	fsp_init_done(hob_list);
 }
@@ -176,19 +160,18 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
 	setup_fsp_gdt();
 
 	/*
-	 * Use ASM code to ensure the register value in EAX & ECX
-	 * will be passed into BlContinuationFunc
+	 * Use ASM code to ensure the register value in EAX & EDX
+	 * will be passed into fsp_continue
 	 */
 	asm volatile (
 		"pushl	%0;"
 		"call	*%%eax;"
 		".global asm_continuation;"
 		"asm_continuation:;"
-		"movl	%%ebx, %%eax;"		/* shared_data */
-		"movl	4(%%esp), %%edx;"	/* status */
-		"movl	8(%%esp), %%ecx;"	/* hob_list */
+		"movl	4(%%esp), %%eax;"	/* status */
+		"movl	8(%%esp), %%edx;"	/* hob_list */
 		"jmp	fsp_continue;"
-		: : "m"(params_ptr), "a"(init), "b"(&shared_data)
+		: : "m"(params_ptr), "a"(init)
 	);
 
 	/*
Signature · 1 line
1.8.2.1
#2 lore raw

PATCH v2 1/9 x86: fsp: Simplify fsp_continue()

Quoted 5 lines · Bin Meng

There is no need to pass shared_data to fsp_continue() so we can remove unnecessary codes that simplifies the function a lot.

Quoted 7 lines

---

Changes in v2: None

 arch/x86/include/asm/fsp/fsp_support.h |  4 +---
 arch/x86/lib/fsp/fsp_support.c         | 29 ++++++-----------------------
 2 files changed, 7 insertions(+), 26 deletions(-)

Tested on Minnowmax:

author
#3 lore raw

PATCH v2 1/9 x86: fsp: Simplify fsp_continue()

Quoted 8 lines · Simon Glass
Quoted 7 lines · Bin Meng

There is no need to pass shared_data to fsp_continue() so we can remove unnecessary codes that simplifies the function a lot.

---

Quoted 8 lines
Quoted 5 lines

Changes in v2: None

 arch/x86/include/asm/fsp/fsp_support.h |  4 +---
 arch/x86/lib/fsp/fsp_support.c         | 29 ++++++-----------------------
 2 files changed, 7 insertions(+), 26 deletions(-)

Tested on Minnowmax:

applied to u-boot-x86/next, thanks!

author
#4 lore raw

PATCH v2 2/9 x86: fsp: Avoid cast stack_top in struct shared_data

In reply to Bin Meng

Declare stack_top as u32 in struct shared_data and struct common_buf so that we can avoid casting in fsp_init().

---

Changes in v2: None

 arch/x86/include/asm/fsp/fsp_api.h     | 2 +-
 arch/x86/include/asm/fsp/fsp_support.h | 2 +-
 arch/x86/lib/fsp/fsp_support.c         | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/include/asm/fsp/fsp_api.h +1 -1
index 2d34d13..db83e35 100644
@@ -30,7 +30,7 @@ struct common_buf {
 	 * Stack top pointer used by the bootloader. The new stack frame will be
 	 * set up at this location after FspInit API call.
 	 */
-	u32	*stack_top;
+	u32	stack_top;
 	u32	boot_mode;	/* Current system boot mode */
 	void	*upd_data;	/* User platform configuraiton data region */
 	u32	reserved[7];	/* Reserved */
arch/x86/include/asm/fsp/fsp_support.h +1 -1
index f30d7b4..685778e 100644
@@ -20,7 +20,7 @@
 
 struct shared_data {
 	struct fsp_header	*fsp_hdr;
-	u32			*stack_top;
+	u32			stack_top;
 	struct upd_region	fsp_upd;
 };
 
arch/x86/lib/fsp/fsp_support.c +2 -2
index 0408b5d..df62ba8 100644
@@ -122,7 +122,7 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
 	memset(&rt_buf, 0, sizeof(struct fspinit_rtbuf));
 
 	/* Reserve a gap in stack top */
-	rt_buf.common.stack_top = (u32 *)stack_top - 32;
+	rt_buf.common.stack_top = stack_top - 32;
 	rt_buf.common.boot_mode = boot_mode;
 	rt_buf.common.upd_data = fsp_upd;
 
@@ -152,7 +152,7 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
 	params_ptr = &params;
 
 	shared_data.fsp_hdr = fsp_hdr;
-	shared_data.stack_top = (u32 *)stack_top;
+	shared_data.stack_top = stack_top;
 
 	post_code(POST_PRE_MRC);
 
Signature · 1 line
1.8.2.1
#5 lore raw

PATCH v2 2/9 x86: fsp: Avoid cast stack_top in struct shared_data

Quoted 5 lines · Bin Meng

Declare stack_top as u32 in struct shared_data and struct common_buf so that we can avoid casting in fsp_init().

Quoted 8 lines

---

Changes in v2: None

 arch/x86/include/asm/fsp/fsp_api.h     | 2 +-
 arch/x86/include/asm/fsp/fsp_support.h | 2 +-
 arch/x86/lib/fsp/fsp_support.c         | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

Tested on Minnowmax:

author
#6 lore raw

PATCH v2 2/9 x86: fsp: Avoid cast stack_top in struct shared_data

Quoted 10 lines · Simon Glass
Quoted 9 lines · Bin Meng

Declare stack_top as u32 in struct shared_data and struct common_buf so that we can avoid casting in fsp_init().

---

Changes in v2: None

Quoted 7 lines
Quoted 4 lines
 arch/x86/include/asm/fsp/fsp_api.h     | 2 +-
 arch/x86/include/asm/fsp/fsp_support.h | 2 +-
 arch/x86/lib/fsp/fsp_support.c         | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

Tested on Minnowmax:

applied to u-boot-x86/next, thanks!

author
#7 lore raw

PATCH v2 3/9 x86: fsp: Add boot_mode as a member of struct shared_data

In reply to Bin Meng

Save boot_mode in struct shared_data for future refactoring.

---

Changes in v2: None

 arch/x86/include/asm/fsp/fsp_support.h | 1 +
 arch/x86/lib/fsp/fsp_support.c         | 1 +
 2 files changed, 2 insertions(+)
arch/x86/include/asm/fsp/fsp_support.h +1 -0
index 685778e..18e2d21 100644
@@ -21,6 +21,7 @@
 struct shared_data {
 	struct fsp_header	*fsp_hdr;
 	u32			stack_top;
+	u32			boot_mode;
 	struct upd_region	fsp_upd;
 };
 
arch/x86/lib/fsp/fsp_support.c +1 -0
index df62ba8..083d855 100644
@@ -153,6 +153,7 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
 
 	shared_data.fsp_hdr = fsp_hdr;
 	shared_data.stack_top = stack_top;
+	shared_data.boot_mode = boot_mode;
 
 	post_code(POST_PRE_MRC);
 
Signature · 1 line
1.8.2.1
author
#9 lore raw

PATCH v2 3/9 x86: fsp: Add boot_mode as a member of struct shared_data

Quoted 7 lines · Simon Glass
Quoted 6 lines · Bin Meng

Save boot_mode in struct shared_data for future refactoring.

---

Quoted 8 lines
Quoted 5 lines

Changes in v2: None

 arch/x86/include/asm/fsp/fsp_support.h | 1 +
 arch/x86/lib/fsp/fsp_support.c         | 1 +
 2 files changed, 2 insertions(+)

Tested on Minnowmax:

applied to u-boot-x86/next, thanks!

author
#10 lore raw

PATCH v2 4/9 x86: fsp: Rename shared_data to fsp_config_data

In reply to Bin Meng

FSP has several config data like UPD, HDA verb table which can be overridden or provided by bootloader. Currently in U-Boot only UPD is handled via struct shared_data. To accommodate any platform, we rename shared_data to fsp_config_data and move the definition from common place fsp_support.h to platform-specific place fsp_configs.h.

---

Changes in v2:
- Include a common struct fsp_cfg_common in the struct fsp_config_data.

 arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h  | 15 +++++++++++++++
 arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h | 15 +++++++++++++++
 arch/x86/include/asm/fsp/fsp_api.h                    | 10 ++++++++++
 arch/x86/include/asm/fsp/fsp_support.h                |  8 +-------
 arch/x86/lib/fsp/fsp_support.c                        | 10 +++++-----
 5 files changed, 46 insertions(+), 12 deletions(-)
 create mode 100644 arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h
 create mode 100644 arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h
arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h new file +15 -0
new file mode 100644
index 0000000..87c7d35
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2015, Bin Meng <[email protected]>
+ *
+ * SPDX-License-Identifier:	Intel
+ */
+
+#ifndef __FSP_CONFIGS_H__
+#define __FSP_CONFIGS_H__
+
+struct fsp_config_data {
+	struct fsp_cfg_common	common;
+	struct upd_region	fsp_upd;
+};
+
+#endif /* __FSP_CONFIGS_H__ */
arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h new file +15 -0
new file mode 100644
index 0000000..87c7d35
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2015, Bin Meng <[email protected]>
+ *
+ * SPDX-License-Identifier:	Intel
+ */
+
+#ifndef __FSP_CONFIGS_H__
+#define __FSP_CONFIGS_H__
+
+struct fsp_config_data {
+	struct fsp_cfg_common	common;
+	struct upd_region	fsp_upd;
+};
+
+#endif /* __FSP_CONFIGS_H__ */
arch/x86/include/asm/fsp/fsp_api.h +10 -0
index db83e35..afafb30 100644
@@ -11,6 +11,16 @@
 #include <linux/linkage.h>
 
 /*
+ * FSP common configuration structure.
+ * This needs to be included in the platform-specific struct fsp_config_data.
+ */
+struct fsp_cfg_common {
+	struct fsp_header	*fsp_hdr;
+	u32			stack_top;
+	u32			boot_mode;
+};
+
+/*
  * FspInit continuation function prototype.
  * Control will be returned to this callback function after FspInit API call.
  */
arch/x86/include/asm/fsp/fsp_support.h +1 -7
index 18e2d21..39b2864 100644
@@ -17,13 +17,7 @@
 #include "fsp_infoheader.h"
 #include "fsp_bootmode.h"
 #include <asm/arch/fsp/fsp_vpd.h>
-
-struct shared_data {
-	struct fsp_header	*fsp_hdr;
-	u32			stack_top;
-	u32			boot_mode;
-	struct upd_region	fsp_upd;
-};
+#include <asm/arch/fsp/fsp_configs.h>
 
 #define FSP_LOWMEM_BASE		0x100000UL
 #define FSP_HIGHMEM_BASE	0x100000000ULL
arch/x86/lib/fsp/fsp_support.c +5 -5
index 083d855..60e61c4 100644
@@ -99,7 +99,7 @@ void fsp_continue(u32 status, void *hob_list)
 
 void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
 {
-	struct shared_data shared_data;
+	struct fsp_config_data config_data;
 	fsp_init_f init;
 	struct fsp_init_params params;
 	struct fspinit_rtbuf rt_buf;
@@ -118,7 +118,7 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
 		panic("Invalid FSP header");
 	}
 
-	fsp_upd = &shared_data.fsp_upd;
+	fsp_upd = &config_data.fsp_upd;
 	memset(&rt_buf, 0, sizeof(struct fspinit_rtbuf));
 
 	/* Reserve a gap in stack top */
@@ -151,9 +151,9 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
 	init = (fsp_init_f)(fsp_hdr->img_base + fsp_hdr->fsp_init);
 	params_ptr = &params;
 
-	shared_data.fsp_hdr = fsp_hdr;
-	shared_data.stack_top = stack_top;
-	shared_data.boot_mode = boot_mode;
+	config_data.common.fsp_hdr = fsp_hdr;
+	config_data.common.stack_top = stack_top;
+	config_data.common.boot_mode = boot_mode;
 
 	post_code(POST_PRE_MRC);
 
Signature · 1 line
1.8.2.1
#11 lore raw

PATCH v2 4/9 x86: fsp: Rename shared_data to fsp_config_data

Quoted 13 lines · Bin Meng

FSP has several config data like UPD, HDA verb table which can be overridden or provided by bootloader. Currently in U-Boot only UPD is handled via struct shared_data. To accommodate any platform, we rename shared_data to fsp_config_data and move the definition from common place fsp_support.h to platform-specific place fsp_configs.h.

---

Changes in v2:
- Include a common struct fsp_cfg_common in the struct fsp_config_data.

Quoted 8 lines
 arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h  | 15 +++++++++++++++
 arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h | 15 +++++++++++++++
 arch/x86/include/asm/fsp/fsp_api.h                    | 10 ++++++++++
 arch/x86/include/asm/fsp/fsp_support.h                |  8 +-------
 arch/x86/lib/fsp/fsp_support.c                        | 10 +++++-----
 5 files changed, 46 insertions(+), 12 deletions(-)
 create mode 100644 arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h
 create mode 100644 arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h

Tested on Minnowmax:

author
#12 lore raw

PATCH v2 4/9 x86: fsp: Rename shared_data to fsp_config_data

Quoted 23 lines · Simon Glass
Quoted 13 lines · Bin Meng

FSP has several config data like UPD, HDA verb table which can be overridden or provided by bootloader. Currently in U-Boot only UPD is handled via struct shared_data. To accommodate any platform, we rename shared_data to fsp_config_data and move the definition from common place fsp_support.h to platform-specific place fsp_configs.h.

---

Changes in v2:
- Include a common struct fsp_cfg_common in the struct fsp_config_data.

Quoted 8 lines
 arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h  | 15 +++++++++++++++
 arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h | 15 +++++++++++++++
 arch/x86/include/asm/fsp/fsp_api.h                    | 10 ++++++++++
 arch/x86/include/asm/fsp/fsp_support.h                |  8 +-------
 arch/x86/lib/fsp/fsp_support.c                        | 10 +++++-----
 5 files changed, 46 insertions(+), 12 deletions(-)
 create mode 100644 arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h
 create mode 100644 arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h
Quoted 3 lines

Tested on Minnowmax:

applied to u-boot-x86/next, thanks!

author
#13 lore raw

PATCH v2 5/9 x86: fsp: Rename update_fsp_upd() and change its signature

In reply to Bin Meng

To support platform-specific configurations (might not always be UPD on some platform), use a better name update_fsp_configs() and accepct struct fsp_config_data as its parameter so that platform codes can handle whatever configuration data for that FSP.

---

Changes in v2: None

 arch/x86/cpu/baytrail/fsp_configs.c    |  5 +++--
 arch/x86/cpu/queensbay/fsp_configs.c   |  2 +-
 arch/x86/include/asm/fsp/fsp_support.h |  6 +++---
 arch/x86/lib/fsp/fsp_support.c         | 12 ++++++------
 4 files changed, 13 insertions(+), 12 deletions(-)
arch/x86/cpu/baytrail/fsp_configs.c +3 -2
index a72d615..9810921 100644
@@ -121,12 +121,13 @@ const struct pch_azalia_config azalia_config = {
 };
 
 /**
- * Override the FSP's UPD.
+ * Override the FSP's configuration data.
  * If the device tree does not specify an integer setting, use the default
  * provided in Intel's Baytrail_FSP_Gold4.tgz release FSP/BayleyBayFsp.bsf file.
  */
-void update_fsp_upd(struct upd_region *fsp_upd)
+void update_fsp_configs(struct fsp_config_data *config)
 {
+	struct upd_region *fsp_upd = &config->fsp_upd;
 	struct memory_down_data *mem;
 	const void *blob = gd->fdt_blob;
 	int node;
arch/x86/cpu/queensbay/fsp_configs.c +1 -1
index 78bc966..f84ae30 100644
@@ -8,7 +8,7 @@
 #include <common.h>
 #include <asm/fsp/fsp_support.h>
 
-void update_fsp_upd(struct upd_region *fsp_upd)
+void update_fsp_configs(struct fsp_config_data *config)
 {
 	/* Override any UPD setting if required */
 
arch/x86/include/asm/fsp/fsp_support.h +3 -3
index 39b2864..67741cc 100644
@@ -192,13 +192,13 @@ 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 overrides the default configurations in the UPD data region.
+ * This function overrides the default configurations of FSP.
  *
- * @fsp_upd: A pointer to the upd_region data strcture
+ * @config:  A pointer to the FSP configuration data structure
  *
  * @return:  None
  */
-void update_fsp_upd(struct upd_region *fsp_upd);
+void update_fsp_configs(struct fsp_config_data *config);
 
 /**
  * fsp_init_phase_pci() - Tell the FSP that we have completed PCI init
arch/x86/lib/fsp/fsp_support.c +6 -6
index 60e61c4..9257745 100644
@@ -118,6 +118,10 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
 		panic("Invalid FSP header");
 	}
 
+	config_data.common.fsp_hdr = fsp_hdr;
+	config_data.common.stack_top = stack_top;
+	config_data.common.boot_mode = boot_mode;
+
 	fsp_upd = &config_data.fsp_upd;
 	memset(&rt_buf, 0, sizeof(struct fspinit_rtbuf));
 
@@ -140,8 +144,8 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
 	/* Verify the UPD data region is valid */
 	assert(fsp_upd->terminator == UPD_TERMINATOR);
 
-	/* Override any UPD setting if required */
-	update_fsp_upd(fsp_upd);
+	/* Override any configuration if required */
+	update_fsp_configs(&config_data);
 
 	memset(&params, 0, sizeof(struct fsp_init_params));
 	params.nvs_buf = nvs_buf;
@@ -151,10 +155,6 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
 	init = (fsp_init_f)(fsp_hdr->img_base + fsp_hdr->fsp_init);
 	params_ptr = &params;
 
-	config_data.common.fsp_hdr = fsp_hdr;
-	config_data.common.stack_top = stack_top;
-	config_data.common.boot_mode = boot_mode;
-
 	post_code(POST_PRE_MRC);
 
 	/* Load GDT for FSP */
Signature · 1 line
1.8.2.1
#14 lore raw

PATCH v2 5/9 x86: fsp: Rename update_fsp_upd() and change its signature

Quoted 9 lines · Bin Meng

To support platform-specific configurations (might not always be UPD on some platform), use a better name update_fsp_configs() and accepct struct fsp_config_data as its parameter so that platform codes can handle whatever configuration data for that FSP.

---

Quoted 7 lines

Changes in v2: None

 arch/x86/cpu/baytrail/fsp_configs.c    |  5 +++--
 arch/x86/cpu/queensbay/fsp_configs.c   |  2 +-
 arch/x86/include/asm/fsp/fsp_support.h |  6 +++---
 arch/x86/lib/fsp/fsp_support.c         | 12 ++++++------
 4 files changed, 13 insertions(+), 12 deletions(-)

Tested on Minnowmax:

author
#15 lore raw

PATCH v2 5/9 x86: fsp: Rename update_fsp_upd() and change its signature

Quoted 12 lines · Simon Glass
Quoted 11 lines · Bin Meng

To support platform-specific configurations (might not always be UPD on some platform), use a better name update_fsp_configs() and accepct struct fsp_config_data as its parameter so that platform codes can handle whatever configuration data for that FSP.

---

Changes in v2: None

Quoted 8 lines
Quoted 5 lines
 arch/x86/cpu/baytrail/fsp_configs.c    |  5 +++--
 arch/x86/cpu/queensbay/fsp_configs.c   |  2 +-
 arch/x86/include/asm/fsp/fsp_support.h |  6 +++---
 arch/x86/lib/fsp/fsp_support.c         | 12 ++++++------
 4 files changed, 13 insertions(+), 12 deletions(-)

Tested on Minnowmax:

applied to u-boot-x86/next, thanks!

author
#16 lore raw

PATCH v2 6/9 x86: fsp: Introduce CONFIG_FSP_USE_UPD Kconfig option

In reply to Bin Meng

Not every FSP supports UPD, thus we introduce a Kconfig option CONFIG_FSP_USE_UPD and use it to wrap these common UPD handling codes in fsp_support.c.

---

Changes in v2:
- New patch to introduce CONFIG_FSP_USE_UPD Kconfig option

 arch/x86/Kconfig               |  9 +++++++++
 arch/x86/lib/fsp/fsp_support.c | 23 ++++++++++++++---------
 2 files changed, 23 insertions(+), 9 deletions(-)
arch/x86/Kconfig +9 -0
index 7e7cb61..f07567c 100644
@@ -242,6 +242,15 @@ config FSP_SYS_MALLOC_F_LEN
 	help
 	  Additional size of malloc() pool before relocation.
 
+config FSP_USE_UPD
+	bool
+	depends on HAVE_FSP
+	default y
+	help
+	  Most FSPs use UPD data region for some FSP customization. But there
+	  are still some FSPs that might not even have UPD. For such FSPs,
+	  override this to n in their platform Kconfig files.
+
 config ENABLE_MRC_CACHE
 	bool "Enable MRC cache"
 	depends on !EFI && !SYS_COREBOOT
arch/x86/lib/fsp/fsp_support.c +14 -9
index 9257745..d86a511 100644
@@ -103,10 +103,12 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
 	fsp_init_f init;
 	struct fsp_init_params params;
 	struct fspinit_rtbuf rt_buf;
-	struct vpd_region *fsp_vpd;
 	struct fsp_header *fsp_hdr;
 	struct fsp_init_params *params_ptr;
+#ifdef CONFIG_FSP_USE_UPD
+	struct vpd_region *fsp_vpd;
 	struct upd_region *fsp_upd;
+#endif
 
 #ifdef CONFIG_DEBUG_UART
 	setup_early_uart();
@@ -122,14 +124,7 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
 	config_data.common.stack_top = stack_top;
 	config_data.common.boot_mode = boot_mode;
 
-	fsp_upd = &config_data.fsp_upd;
-	memset(&rt_buf, 0, sizeof(struct fspinit_rtbuf));
-
-	/* Reserve a gap in stack top */
-	rt_buf.common.stack_top = stack_top - 32;
-	rt_buf.common.boot_mode = boot_mode;
-	rt_buf.common.upd_data = fsp_upd;
-
+#ifdef CONFIG_FSP_USE_UPD
 	/* Get VPD region start */
 	fsp_vpd = (struct vpd_region *)(fsp_hdr->img_base +
 			fsp_hdr->cfg_region_off);
@@ -137,12 +132,22 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
 	/* Verify the VPD data region is valid */
 	assert(fsp_vpd->sign == VPD_IMAGE_ID);
 
+	fsp_upd = &config_data.fsp_upd;
+
 	/* Copy default data from Flash */
 	memcpy(fsp_upd, (void *)(fsp_hdr->img_base + fsp_vpd->upd_offset),
 	       sizeof(struct upd_region));
 
 	/* Verify the UPD data region is valid */
 	assert(fsp_upd->terminator == UPD_TERMINATOR);
+#endif
+
+	memset(&rt_buf, 0, sizeof(struct fspinit_rtbuf));
+
+	/* Initialize runtime buffer for fsp_init() */
+	rt_buf.common.stack_top = stack_top - 32;
+	rt_buf.common.boot_mode = boot_mode;
+	rt_buf.common.upd_data = fsp_upd;
 
 	/* Override any configuration if required */
 	update_fsp_configs(&config_data);
Signature · 1 line
1.8.2.1
#17 lore raw

PATCH v2 6/9 x86: fsp: Introduce CONFIG_FSP_USE_UPD Kconfig option

Quoted 6 lines · Bin Meng

Not every FSP supports UPD, thus we introduce a Kconfig option CONFIG_FSP_USE_UPD and use it to wrap these common UPD handling codes in fsp_support.c.

Quoted 8 lines

---

Changes in v2:
- New patch to introduce CONFIG_FSP_USE_UPD Kconfig option

 arch/x86/Kconfig               |  9 +++++++++
 arch/x86/lib/fsp/fsp_support.c | 23 ++++++++++++++---------
 2 files changed, 23 insertions(+), 9 deletions(-)

Tested on Minnowmax:

author
#18 lore raw

PATCH v2 6/9 x86: fsp: Introduce CONFIG_FSP_USE_UPD Kconfig option

Quoted 12 lines · Simon Glass
Quoted 11 lines · Bin Meng

Not every FSP supports UPD, thus we introduce a Kconfig option CONFIG_FSP_USE_UPD and use it to wrap these common UPD handling codes in fsp_support.c.

---

Changes in v2:
- New patch to introduce CONFIG_FSP_USE_UPD Kconfig option

Quoted 7 lines
Quoted 3 lines
 arch/x86/Kconfig               |  9 +++++++++
 arch/x86/lib/fsp/fsp_support.c | 23 ++++++++++++++---------
 2 files changed, 23 insertions(+), 9 deletions(-)

Tested on Minnowmax:

applied to u-boot-x86/next, thanks!

author
#19 lore raw

PATCH v2 7/9 x86: queensbay: Remove invalid comments in update_fsp_configs()

In reply to Bin Meng

Those comments in update_fsp_configs() are not correct. Remove them.

---

Changes in v2: None

 arch/x86/cpu/queensbay/fsp_configs.c | 6 ------
 1 file changed, 6 deletions(-)
arch/x86/cpu/queensbay/fsp_configs.c +0 -6
index f84ae30..25a92f7 100644
@@ -11,10 +11,4 @@
 void update_fsp_configs(struct fsp_config_data *config)
 {
 	/* Override any UPD setting if required */
-
-	/* Uncomment the line below to enable DEBUG message */
-	/* fsp_upd->serial_dbgport_type = 1; */
-
-	/* Examples on how to initialize the pointers in UPD region */
-	/* fsp_upd->pcd_example = (EXAMPLE_DATA *)&example; */
 }
Signature · 1 line
1.8.2.1
author
#21 lore raw

PATCH v2 7/9 x86: queensbay: Remove invalid comments in update_fsp_configs()

Quoted 8 lines · Simon Glass
Quoted 7 lines · Bin Meng

Those comments in update_fsp_configs() are not correct. Remove them.

---

Quoted 7 lines
Quoted 4 lines

Changes in v2: None

 arch/x86/cpu/queensbay/fsp_configs.c | 6 ------
 1 file changed, 6 deletions(-)

Tested on Minnowmax:

applied to u-boot-x86/next, thanks!

author
#22 lore raw

PATCH v2 8/9 x86: fsp: Move struct fspinit_rtbuf definition to chipset header

In reply to Bin Meng

All FSP spec v1.0 complaint FSP binary uses struct fspinit_rtbuf as defined by the 1.0 spec, however there are FSPs that does not follow 1.0 spec (possible due to that FSP predates the 1.0 spec), and future FSP binary that is complaint to v1.1 spec defines an optional paltform-specific runtime data in the struct fspinit_rtbuf. Hence move the definition to chipset header.

---

Changes in v2: None

 arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h  |  4 ++++
 arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h |  4 ++++
 arch/x86/include/asm/fsp/fsp_platform.h               | 15 ---------------
 arch/x86/include/asm/fsp/fsp_support.h                |  1 -
 4 files changed, 8 insertions(+), 16 deletions(-)
 delete mode 100644 arch/x86/include/asm/fsp/fsp_platform.h
arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h +4 -0
index 87c7d35..e539890 100644
@@ -12,4 +12,8 @@ struct fsp_config_data {
 	struct upd_region	fsp_upd;
 };
 
+struct fspinit_rtbuf {
+	struct common_buf	common;	/* FSP common runtime data structure */
+};
+
 #endif /* __FSP_CONFIGS_H__ */
arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h +4 -0
index 87c7d35..e539890 100644
@@ -12,4 +12,8 @@ struct fsp_config_data {
 	struct upd_region	fsp_upd;
 };
 
+struct fspinit_rtbuf {
+	struct common_buf	common;	/* FSP common runtime data structure */
+};
+
 #endif /* __FSP_CONFIGS_H__ */
arch/x86/include/asm/fsp/fsp_platform.h deleted +0 -15
deleted file mode 100644
index 61286ce..0000000
@@ -1,15 +0,0 @@
-/*
- * Copyright (C) 2013, Intel Corporation
- * Copyright (C) 2014, Bin Meng <[email protected]>
- *
- * SPDX-License-Identifier:	Intel
- */
-
-#ifndef __FSP_PLATFORM_H__
-#define __FSP_PLATFORM_H__
-
-struct fspinit_rtbuf {
-	struct common_buf	common;	/* FSP common runtime data structure */
-};
-
-#endif
arch/x86/include/asm/fsp/fsp_support.h +0 -1
index 67741cc..e65a130 100644
@@ -13,7 +13,6 @@
 #include "fsp_ffs.h"
 #include "fsp_api.h"
 #include "fsp_hob.h"
-#include "fsp_platform.h"
 #include "fsp_infoheader.h"
 #include "fsp_bootmode.h"
 #include <asm/arch/fsp/fsp_vpd.h>
Signature · 1 line
1.8.2.1
#23 lore raw

PATCH v2 8/9 x86: fsp: Move struct fspinit_rtbuf definition to chipset header

Quoted 11 lines · Bin Meng

All FSP spec v1.0 complaint FSP binary uses struct fspinit_rtbuf as defined by the 1.0 spec, however there are FSPs that does not follow 1.0 spec (possible due to that FSP predates the 1.0 spec), and future FSP binary that is complaint to v1.1 spec defines an optional paltform-specific runtime data in the struct fspinit_rtbuf. Hence move the definition to chipset header.

---

Quoted 8 lines

Changes in v2: None

 arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h  |  4 ++++
 arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h |  4 ++++
 arch/x86/include/asm/fsp/fsp_platform.h               | 15 ---------------
 arch/x86/include/asm/fsp/fsp_support.h                |  1 -
 4 files changed, 8 insertions(+), 16 deletions(-)
 delete mode 100644 arch/x86/include/asm/fsp/fsp_platform.h

Tested on Minnowmax:

author
#24 lore raw

PATCH v2 8/9 x86: fsp: Move struct fspinit_rtbuf definition to chipset header

Quoted 21 lines · Simon Glass
Quoted 11 lines · Bin Meng

All FSP spec v1.0 complaint FSP binary uses struct fspinit_rtbuf as defined by the 1.0 spec, however there are FSPs that does not follow 1.0 spec (possible due to that FSP predates the 1.0 spec), and future FSP binary that is complaint to v1.1 spec defines an optional paltform-specific runtime data in the struct fspinit_rtbuf. Hence move the definition to chipset header.

---

Quoted 8 lines

Changes in v2: None

 arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h  |  4 ++++
 arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h |  4 ++++
 arch/x86/include/asm/fsp/fsp_platform.h               | 15 ---------------
 arch/x86/include/asm/fsp/fsp_support.h                |  1 -
 4 files changed, 8 insertions(+), 16 deletions(-)
 delete mode 100644 arch/x86/include/asm/fsp/fsp_platform.h
Quoted 2 lines

Tested on Minnowmax:

applied to u-boot-x86/next, thanks!

author
#25 lore raw

PATCH v2 9/9 x86: fsp: Set up init runtime buffer in update_fsp_configs()

In reply to Bin Meng

fsp_init() runtime buffer parameter might be different across different platforms. Move this to update_fsp_configs().

---

Changes in v2:
- split this patch from v1 patch#7

 arch/x86/cpu/baytrail/fsp_configs.c    | 8 +++++++-
 arch/x86/cpu/queensbay/fsp_configs.c   | 8 +++++++-
 arch/x86/include/asm/fsp/fsp_support.h | 4 +++-
 arch/x86/lib/fsp/fsp_support.c         | 7 +------
 4 files changed, 18 insertions(+), 9 deletions(-)
arch/x86/cpu/baytrail/fsp_configs.c +7 -1
index 9810921..d49b8d2 100644
@@ -125,13 +125,19 @@ const struct pch_azalia_config azalia_config = {
  * If the device tree does not specify an integer setting, use the default
  * provided in Intel's Baytrail_FSP_Gold4.tgz release FSP/BayleyBayFsp.bsf file.
  */
-void update_fsp_configs(struct fsp_config_data *config)
+void update_fsp_configs(struct fsp_config_data *config,
+			struct fspinit_rtbuf *rt_buf)
 {
 	struct upd_region *fsp_upd = &config->fsp_upd;
 	struct memory_down_data *mem;
 	const void *blob = gd->fdt_blob;
 	int node;
 
+	/* Initialize runtime buffer for fsp_init() */
+	rt_buf->common.stack_top = config->common.stack_top - 32;
+	rt_buf->common.boot_mode = config->common.boot_mode;
+	rt_buf->common.upd_data = &config->fsp_upd;
+
 	fsp_upd->azalia_config_ptr = (uint32_t)&azalia_config;
 
 	node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_BAYTRAIL_FSP);
arch/x86/cpu/queensbay/fsp_configs.c +7 -1
index 25a92f7..f83bb5f 100644
@@ -8,7 +8,13 @@
 #include <common.h>
 #include <asm/fsp/fsp_support.h>
 
-void update_fsp_configs(struct fsp_config_data *config)
+void update_fsp_configs(struct fsp_config_data *config,
+			struct fspinit_rtbuf *rt_buf)
 {
+	/* Initialize runtime buffer for fsp_init() */
+	rt_buf->common.stack_top = config->common.stack_top - 32;
+	rt_buf->common.boot_mode = config->common.boot_mode;
+	rt_buf->common.upd_data = &config->fsp_upd;
+
 	/* Override any UPD setting if required */
 }
arch/x86/include/asm/fsp/fsp_support.h +3 -1
index e65a130..61d811f 100644
@@ -194,10 +194,12 @@ void *fsp_get_bootloader_tmp_mem(const void *hob_list, u32 *len);
  * This function overrides the default configurations of FSP.
  *
  * @config:  A pointer to the FSP configuration data structure
+ * @rt_buf:  A pointer to the FSP runtime buffer data structure
  *
  * @return:  None
  */
-void update_fsp_configs(struct fsp_config_data *config);
+void update_fsp_configs(struct fsp_config_data *config,
+			struct fspinit_rtbuf *rt_buf);
 
 /**
  * fsp_init_phase_pci() - Tell the FSP that we have completed PCI init
arch/x86/lib/fsp/fsp_support.c +1 -6
index d86a511..875c96a 100644
@@ -144,13 +144,8 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
 
 	memset(&rt_buf, 0, sizeof(struct fspinit_rtbuf));
 
-	/* Initialize runtime buffer for fsp_init() */
-	rt_buf.common.stack_top = stack_top - 32;
-	rt_buf.common.boot_mode = boot_mode;
-	rt_buf.common.upd_data = fsp_upd;
-
 	/* Override any configuration if required */
-	update_fsp_configs(&config_data);
+	update_fsp_configs(&config_data, &rt_buf);
 
 	memset(&params, 0, sizeof(struct fsp_init_params));
 	params.nvs_buf = nvs_buf;
Signature · 1 line
1.8.2.1
#26 lore raw

PATCH v2 9/9 x86: fsp: Set up init runtime buffer in update_fsp_configs()

Quoted 7 lines · Bin Meng

fsp_init() runtime buffer parameter might be different across different platforms. Move this to update_fsp_configs().

---

Quoted 8 lines

Changes in v2:
- split this patch from v1 patch#7

 arch/x86/cpu/baytrail/fsp_configs.c    | 8 +++++++-
 arch/x86/cpu/queensbay/fsp_configs.c   | 8 +++++++-
 arch/x86/include/asm/fsp/fsp_support.h | 4 +++-
 arch/x86/lib/fsp/fsp_support.c         | 7 +------
 4 files changed, 18 insertions(+), 9 deletions(-)

Tested on Minnowmax:

author
#27 lore raw

PATCH v2 9/9 x86: fsp: Set up init runtime buffer in update_fsp_configs()

Quoted 17 lines · Simon Glass
Quoted 7 lines · Bin Meng

fsp_init() runtime buffer parameter might be different across different platforms. Move this to update_fsp_configs().

---

Quoted 8 lines

Changes in v2:
- split this patch from v1 patch#7

 arch/x86/cpu/baytrail/fsp_configs.c    | 8 +++++++-
 arch/x86/cpu/queensbay/fsp_configs.c   | 8 +++++++-
 arch/x86/include/asm/fsp/fsp_support.h | 4 +++-
 arch/x86/lib/fsp/fsp_support.c         | 7 +------
 4 files changed, 18 insertions(+), 9 deletions(-)
Quoted 3 lines

Tested on Minnowmax:

applied to u-boot-x86/next, thanks!