[U-Boot] [PATCH v2 0/9] 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

There is no need to pass shared_data to fsp_continue() so we can remove unnecessary codes that simplifies the function a lot.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org ---
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(-)
diff --git a/arch/x86/include/asm/fsp/fsp_support.h b/arch/x86/include/asm/fsp/fsp_support.h index 7317dda..f30d7b4 100644 --- a/arch/x86/include/asm/fsp/fsp_support.h +++ b/arch/x86/include/asm/fsp/fsp_support.h @@ -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 diff --git a/arch/x86/lib/fsp/fsp_support.c b/arch/x86/lib/fsp/fsp_support.c index 1d48ff4..0408b5d 100644 --- a/arch/x86/lib/fsp/fsp_support.c +++ b/arch/x86/lib/fsp/fsp_support.c @@ -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) );
/*

On 10 December 2015 at 23:02, Bin Meng bmeng.cn@gmail.com wrote:
There is no need to pass shared_data to fsp_continue() so we can remove unnecessary codes that simplifies the function a lot.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org
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: Tested-by: Simon Glass sjg@chromium.org

On Sat, Dec 19, 2015 at 10:51 AM, Simon Glass sjg@chromium.org wrote:
On 10 December 2015 at 23:02, Bin Meng bmeng.cn@gmail.com wrote:
There is no need to pass shared_data to fsp_continue() so we can remove unnecessary codes that simplifies the function a lot.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org
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: Tested-by: Simon Glass sjg@chromium.org
applied to u-boot-x86/next, thanks!

Declare stack_top as u32 in struct shared_data and struct common_buf so that we can avoid casting in fsp_init().
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org ---
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(-)
diff --git a/arch/x86/include/asm/fsp/fsp_api.h b/arch/x86/include/asm/fsp/fsp_api.h index 2d34d13..db83e35 100644 --- a/arch/x86/include/asm/fsp/fsp_api.h +++ b/arch/x86/include/asm/fsp/fsp_api.h @@ -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 */ diff --git a/arch/x86/include/asm/fsp/fsp_support.h b/arch/x86/include/asm/fsp/fsp_support.h index f30d7b4..685778e 100644 --- a/arch/x86/include/asm/fsp/fsp_support.h +++ b/arch/x86/include/asm/fsp/fsp_support.h @@ -20,7 +20,7 @@
struct shared_data { struct fsp_header *fsp_hdr; - u32 *stack_top; + u32 stack_top; struct upd_region fsp_upd; };
diff --git a/arch/x86/lib/fsp/fsp_support.c b/arch/x86/lib/fsp/fsp_support.c index 0408b5d..df62ba8 100644 --- a/arch/x86/lib/fsp/fsp_support.c +++ b/arch/x86/lib/fsp/fsp_support.c @@ -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 = ¶ms;
shared_data.fsp_hdr = fsp_hdr; - shared_data.stack_top = (u32 *)stack_top; + shared_data.stack_top = stack_top;
post_code(POST_PRE_MRC);

On 10 December 2015 at 23:02, Bin Meng bmeng.cn@gmail.com wrote:
Declare stack_top as u32 in struct shared_data and struct common_buf so that we can avoid casting in fsp_init().
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org
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: Tested-by: Simon Glass sjg@chromium.org

On Sat, Dec 19, 2015 at 10:51 AM, Simon Glass sjg@chromium.org wrote:
On 10 December 2015 at 23:02, Bin Meng bmeng.cn@gmail.com wrote:
Declare stack_top as u32 in struct shared_data and struct common_buf so that we can avoid casting in fsp_init().
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org
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: Tested-by: Simon Glass sjg@chromium.org
applied to u-boot-x86/next, thanks!

Save boot_mode in struct shared_data for future refactoring.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org ---
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(+)
diff --git a/arch/x86/include/asm/fsp/fsp_support.h b/arch/x86/include/asm/fsp/fsp_support.h index 685778e..18e2d21 100644 --- a/arch/x86/include/asm/fsp/fsp_support.h +++ b/arch/x86/include/asm/fsp/fsp_support.h @@ -21,6 +21,7 @@ struct shared_data { struct fsp_header *fsp_hdr; u32 stack_top; + u32 boot_mode; struct upd_region fsp_upd; };
diff --git a/arch/x86/lib/fsp/fsp_support.c b/arch/x86/lib/fsp/fsp_support.c index df62ba8..083d855 100644 --- a/arch/x86/lib/fsp/fsp_support.c +++ b/arch/x86/lib/fsp/fsp_support.c @@ -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);

On 10 December 2015 at 23:02, Bin Meng bmeng.cn@gmail.com wrote:
Save boot_mode in struct shared_data for future refactoring.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org
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: Tested-by: Simon Glass sjg@chromium.org

On Sat, Dec 19, 2015 at 10:51 AM, Simon Glass sjg@chromium.org wrote:
On 10 December 2015 at 23:02, Bin Meng bmeng.cn@gmail.com wrote:
Save boot_mode in struct shared_data for future refactoring.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org
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: Tested-by: Simon Glass sjg@chromium.org
applied to u-boot-x86/next, thanks!

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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
---
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
diff --git a/arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h b/arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h new file mode 100644 index 0000000..87c7d35 --- /dev/null +++ b/arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2015, Bin Meng bmeng.cn@gmail.com + * + * 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__ */ diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h new file mode 100644 index 0000000..87c7d35 --- /dev/null +++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2015, Bin Meng bmeng.cn@gmail.com + * + * 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__ */ diff --git a/arch/x86/include/asm/fsp/fsp_api.h b/arch/x86/include/asm/fsp/fsp_api.h index db83e35..afafb30 100644 --- a/arch/x86/include/asm/fsp/fsp_api.h +++ b/arch/x86/include/asm/fsp/fsp_api.h @@ -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. */ diff --git a/arch/x86/include/asm/fsp/fsp_support.h b/arch/x86/include/asm/fsp/fsp_support.h index 18e2d21..39b2864 100644 --- a/arch/x86/include/asm/fsp/fsp_support.h +++ b/arch/x86/include/asm/fsp/fsp_support.h @@ -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 diff --git a/arch/x86/lib/fsp/fsp_support.c b/arch/x86/lib/fsp/fsp_support.c index 083d855..60e61c4 100644 --- a/arch/x86/lib/fsp/fsp_support.c +++ b/arch/x86/lib/fsp/fsp_support.c @@ -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 = ¶ms;
- 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);

On 10 December 2015 at 23:02, Bin Meng bmeng.cn@gmail.com wrote:
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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
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
Acked-by: Simon Glass sjg@chromium.org Tested on Minnowmax: Tested-by: Simon Glass sjg@chromium.org

On Sat, Dec 19, 2015 at 10:51 AM, Simon Glass sjg@chromium.org wrote:
On 10 December 2015 at 23:02, Bin Meng bmeng.cn@gmail.com wrote:
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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
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
Acked-by: Simon Glass sjg@chromium.org Tested on Minnowmax: Tested-by: Simon Glass sjg@chromium.org
applied to u-boot-x86/next, thanks!

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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org ---
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(-)
diff --git a/arch/x86/cpu/baytrail/fsp_configs.c b/arch/x86/cpu/baytrail/fsp_configs.c index a72d615..9810921 100644 --- a/arch/x86/cpu/baytrail/fsp_configs.c +++ b/arch/x86/cpu/baytrail/fsp_configs.c @@ -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; diff --git a/arch/x86/cpu/queensbay/fsp_configs.c b/arch/x86/cpu/queensbay/fsp_configs.c index 78bc966..f84ae30 100644 --- a/arch/x86/cpu/queensbay/fsp_configs.c +++ b/arch/x86/cpu/queensbay/fsp_configs.c @@ -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 */
diff --git a/arch/x86/include/asm/fsp/fsp_support.h b/arch/x86/include/asm/fsp/fsp_support.h index 39b2864..67741cc 100644 --- a/arch/x86/include/asm/fsp/fsp_support.h +++ b/arch/x86/include/asm/fsp/fsp_support.h @@ -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 diff --git a/arch/x86/lib/fsp/fsp_support.c b/arch/x86/lib/fsp/fsp_support.c index 60e61c4..9257745 100644 --- a/arch/x86/lib/fsp/fsp_support.c +++ b/arch/x86/lib/fsp/fsp_support.c @@ -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(¶ms, 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 = ¶ms;
- 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 */

On 10 December 2015 at 23:03, Bin Meng bmeng.cn@gmail.com wrote:
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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org
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: Tested-by: Simon Glass sjg@chromium.org

On Sat, Dec 19, 2015 at 10:51 AM, Simon Glass sjg@chromium.org wrote:
On 10 December 2015 at 23:03, Bin Meng bmeng.cn@gmail.com wrote:
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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org
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: Tested-by: Simon Glass sjg@chromium.org
applied to u-boot-x86/next, thanks!

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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
---
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(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 7e7cb61..f07567c 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -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 diff --git a/arch/x86/lib/fsp/fsp_support.c b/arch/x86/lib/fsp/fsp_support.c index 9257745..d86a511 100644 --- a/arch/x86/lib/fsp/fsp_support.c +++ b/arch/x86/lib/fsp/fsp_support.c @@ -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);

On 10 December 2015 at 23:03, Bin Meng bmeng.cn@gmail.com wrote:
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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
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(-)
Acked-by: Simon Glass sjg@chromium.org Tested on Minnowmax: Tested-by: Simon Glass sjg@chromium.org

On Sat, Dec 19, 2015 at 10:51 AM, Simon Glass sjg@chromium.org wrote:
On 10 December 2015 at 23:03, Bin Meng bmeng.cn@gmail.com wrote:
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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
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(-)
Acked-by: Simon Glass sjg@chromium.org Tested on Minnowmax: Tested-by: Simon Glass sjg@chromium.org
applied to u-boot-x86/next, thanks!

Those comments in update_fsp_configs() are not correct. Remove them.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org
---
Changes in v2: None
arch/x86/cpu/queensbay/fsp_configs.c | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/arch/x86/cpu/queensbay/fsp_configs.c b/arch/x86/cpu/queensbay/fsp_configs.c index f84ae30..25a92f7 100644 --- a/arch/x86/cpu/queensbay/fsp_configs.c +++ b/arch/x86/cpu/queensbay/fsp_configs.c @@ -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; */ }

On 10 December 2015 at 23:03, Bin Meng bmeng.cn@gmail.com wrote:
Those comments in update_fsp_configs() are not correct. Remove them.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org
Changes in v2: None
arch/x86/cpu/queensbay/fsp_configs.c | 6 ------ 1 file changed, 6 deletions(-)
Tested on Minnowmax: Tested-by: Simon Glass sjg@chromium.org

On Sat, Dec 19, 2015 at 10:51 AM, Simon Glass sjg@chromium.org wrote:
On 10 December 2015 at 23:03, Bin Meng bmeng.cn@gmail.com wrote:
Those comments in update_fsp_configs() are not correct. Remove them.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org
Changes in v2: None
arch/x86/cpu/queensbay/fsp_configs.c | 6 ------ 1 file changed, 6 deletions(-)
Tested on Minnowmax: Tested-by: Simon Glass sjg@chromium.org
applied to u-boot-x86/next, thanks!

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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org ---
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
diff --git a/arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h b/arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h index 87c7d35..e539890 100644 --- a/arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h +++ b/arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h @@ -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__ */ diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h index 87c7d35..e539890 100644 --- a/arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h +++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_configs.h @@ -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__ */ diff --git a/arch/x86/include/asm/fsp/fsp_platform.h b/arch/x86/include/asm/fsp/fsp_platform.h deleted file mode 100644 index 61286ce..0000000 --- a/arch/x86/include/asm/fsp/fsp_platform.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (C) 2013, Intel Corporation - * Copyright (C) 2014, Bin Meng bmeng.cn@gmail.com - * - * 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 diff --git a/arch/x86/include/asm/fsp/fsp_support.h b/arch/x86/include/asm/fsp/fsp_support.h index 67741cc..e65a130 100644 --- a/arch/x86/include/asm/fsp/fsp_support.h +++ b/arch/x86/include/asm/fsp/fsp_support.h @@ -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>

On 10 December 2015 at 23:03, Bin Meng bmeng.cn@gmail.com wrote:
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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org
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: Tested-by: Simon Glass sjg@chromium.org

On Sat, Dec 19, 2015 at 10:51 AM, Simon Glass sjg@chromium.org wrote:
On 10 December 2015 at 23:03, Bin Meng bmeng.cn@gmail.com wrote:
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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Acked-by: Simon Glass sjg@chromium.org
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: Tested-by: Simon Glass sjg@chromium.org
applied to u-boot-x86/next, thanks!

fsp_init() runtime buffer parameter might be different across different platforms. Move this to update_fsp_configs().
Signed-off-by: Bin Meng bmeng.cn@gmail.com
---
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(-)
diff --git a/arch/x86/cpu/baytrail/fsp_configs.c b/arch/x86/cpu/baytrail/fsp_configs.c index 9810921..d49b8d2 100644 --- a/arch/x86/cpu/baytrail/fsp_configs.c +++ b/arch/x86/cpu/baytrail/fsp_configs.c @@ -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); diff --git a/arch/x86/cpu/queensbay/fsp_configs.c b/arch/x86/cpu/queensbay/fsp_configs.c index 25a92f7..f83bb5f 100644 --- a/arch/x86/cpu/queensbay/fsp_configs.c +++ b/arch/x86/cpu/queensbay/fsp_configs.c @@ -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 */ } diff --git a/arch/x86/include/asm/fsp/fsp_support.h b/arch/x86/include/asm/fsp/fsp_support.h index e65a130..61d811f 100644 --- a/arch/x86/include/asm/fsp/fsp_support.h +++ b/arch/x86/include/asm/fsp/fsp_support.h @@ -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 diff --git a/arch/x86/lib/fsp/fsp_support.c b/arch/x86/lib/fsp/fsp_support.c index d86a511..875c96a 100644 --- a/arch/x86/lib/fsp/fsp_support.c +++ b/arch/x86/lib/fsp/fsp_support.c @@ -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(¶ms, 0, sizeof(struct fsp_init_params)); params.nvs_buf = nvs_buf;

On 10 December 2015 at 23:03, Bin Meng bmeng.cn@gmail.com wrote:
fsp_init() runtime buffer parameter might be different across different platforms. Move this to update_fsp_configs().
Signed-off-by: Bin Meng bmeng.cn@gmail.com
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(-)
Acked-by: Simon Glass sjg@chromium.org Tested on Minnowmax: Tested-by: Simon Glass sjg@chromium.org

On Sat, Dec 19, 2015 at 10:51 AM, Simon Glass sjg@chromium.org wrote:
On 10 December 2015 at 23:03, Bin Meng bmeng.cn@gmail.com wrote:
fsp_init() runtime buffer parameter might be different across different platforms. Move this to update_fsp_configs().
Signed-off-by: Bin Meng bmeng.cn@gmail.com
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(-)
Acked-by: Simon Glass sjg@chromium.org Tested on Minnowmax: Tested-by: Simon Glass sjg@chromium.org
applied to u-boot-x86/next, thanks!
participants (2)
-
Bin Meng
-
Simon Glass