From 31218a4259708233c17fa8b09fa9d9c06ea1f2ad Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Mon, 30 Nov 2020 15:50:06 +0100 Subject: drivers/intel/fsp2_0: Fix running on x86_64 Add new Kconfig symbols to mark FSP binary as x86_32. Fix the FSP headers and replace void pointers by fixed sized integers depending on the used mode to compile the FSP. This issue has been reported here: https://github.com/intel/FSP/issues/59 This is necessary to run on x86_64, as pointers have different size. Add preprocessor error to warn that x86_64 FSP isn't supported by the current code. Tested on Intel Skylake. FSP-M no longer returns the error "Invalid Parameter". Change-Id: I6015005c4ee3fc2f361985cf8cff896bcefd04fb Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/48174 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- src/vendorcode/amd/fsp/cezanne/fsp_h_c99.h | 11 +++++++++-- src/vendorcode/amd/fsp/picasso/fsp_h_c99.h | 10 ++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'src/vendorcode/amd/fsp') diff --git a/src/vendorcode/amd/fsp/cezanne/fsp_h_c99.h b/src/vendorcode/amd/fsp/cezanne/fsp_h_c99.h index c477a4ff1f..1a295f591a 100644 --- a/src/vendorcode/amd/fsp/cezanne/fsp_h_c99.h +++ b/src/vendorcode/amd/fsp/cezanne/fsp_h_c99.h @@ -35,11 +35,15 @@ typedef struct __packed { _Static_assert(sizeof(FSP_UPD_HEADER) == 32, "FSP_UPD_HEADER not packed"); + +#if CONFIG(PLATFORM_USES_FSP2_X86_32) typedef struct __packed { uint8_t Revision; uint8_t Reserved[3]; - void *NvsBufferPtr; - void *StackBase; + /* Note: This ought to be void*, but that won't allow calling this binary on x86_64. */ + uint32_t NvsBufferPtr; + /* Note: This ought to be void*, but that won't allow calling this binary on x86_64. */ + uint32_t StackBase; uint32_t StackSize; uint32_t BootLoaderTolumSize; uint32_t BootMode; @@ -47,5 +51,8 @@ typedef struct __packed { } FSPM_ARCH_UPD; _Static_assert(sizeof(FSPM_ARCH_UPD) == 32, "FSPM_ARCH_UPD not packed"); +#else +#error You need to implement this struct for x86_64 FSP +#endif #endif /* FSP_H_C99_H */ diff --git a/src/vendorcode/amd/fsp/picasso/fsp_h_c99.h b/src/vendorcode/amd/fsp/picasso/fsp_h_c99.h index c477a4ff1f..79ef9253f8 100644 --- a/src/vendorcode/amd/fsp/picasso/fsp_h_c99.h +++ b/src/vendorcode/amd/fsp/picasso/fsp_h_c99.h @@ -35,11 +35,14 @@ typedef struct __packed { _Static_assert(sizeof(FSP_UPD_HEADER) == 32, "FSP_UPD_HEADER not packed"); +#if CONFIG(PLATFORM_USES_FSP2_X86_32) typedef struct __packed { uint8_t Revision; uint8_t Reserved[3]; - void *NvsBufferPtr; - void *StackBase; + /* Note: This ought to be void*, but that won't allow calling this binary on x86_64. */ + uint32_t NvsBufferPtr; + /* Note: This ought to be void*, but that won't allow calling this binary on x86_64. */ + uint32_t StackBase; uint32_t StackSize; uint32_t BootLoaderTolumSize; uint32_t BootMode; @@ -47,5 +50,8 @@ typedef struct __packed { } FSPM_ARCH_UPD; _Static_assert(sizeof(FSPM_ARCH_UPD) == 32, "FSPM_ARCH_UPD not packed"); +#else +#error You need to implement this struct for x86_64 FSP +#endif #endif /* FSP_H_C99_H */ -- cgit v1.2.3