From c31ba0ef529ef571ea839572f2c701a871cb33d7 Mon Sep 17 00:00:00 2001 From: Brandon Breitenstein Date: Wed, 27 Jul 2016 17:34:45 -0700 Subject: drivers/intel/fsp2_0: Make FSP Headers Consumable out of Box The following patch is based off of the UEFI 2.6 patch. The FSP header files are temporarily staying in soc/intel/apollolake and FspUpd.h has been relocated since the other headers expect it to be in the root of an includable directory. Any struct defines were removed since they are defined in the headers and no longer need to be explicity declared as struct with the UEFI 2.6 includes. BUG=chrome-os-partner:54100 BRANCH=none TEST=confirmed coreboot builds successfully Change-Id: I10739dca1b6da3f15bd850adf06238f7c51508f7 Signed-off-by: Brandon Breitenstein # Signed-off-by: Andrey Petrov Reviewed-on: https://review.coreboot.org/16308 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/drivers/intel/fsp2_0/Kconfig | 2 +- src/drivers/intel/fsp2_0/debug.c | 14 +++++----- src/drivers/intel/fsp2_0/include/fsp/api.h | 32 +++------------------- src/drivers/intel/fsp2_0/include/fsp/debug.h | 26 +++++++++--------- src/drivers/intel/fsp2_0/include/fsp/soc_binding.h | 30 ++++++++++++++++++++ src/drivers/intel/fsp2_0/include/fsp/util.h | 10 +++---- src/drivers/intel/fsp2_0/memory_init.c | 12 ++++---- src/drivers/intel/fsp2_0/notify.c | 3 +- src/drivers/intel/fsp2_0/silicon_init.c | 6 ++-- src/drivers/intel/fsp2_0/upd_display.c | 12 ++++---- src/drivers/intel/fsp2_0/util.c | 4 +-- 11 files changed, 78 insertions(+), 73 deletions(-) create mode 100644 src/drivers/intel/fsp2_0/include/fsp/soc_binding.h (limited to 'src/drivers/intel') diff --git a/src/drivers/intel/fsp2_0/Kconfig b/src/drivers/intel/fsp2_0/Kconfig index af0706ad96..3ffb402965 100644 --- a/src/drivers/intel/fsp2_0/Kconfig +++ b/src/drivers/intel/fsp2_0/Kconfig @@ -15,7 +15,7 @@ config PLATFORM_USES_FSP2_0 bool - select UEFI_2_4_BINDING + select UDK_2015_BINDING help Include FSP 2.0 wrappers and functionality diff --git a/src/drivers/intel/fsp2_0/debug.c b/src/drivers/intel/fsp2_0/debug.c index a0035694f1..f36f6de475 100644 --- a/src/drivers/intel/fsp2_0/debug.c +++ b/src/drivers/intel/fsp2_0/debug.c @@ -25,8 +25,8 @@ asmlinkage size_t fsp_write_line(uint8_t *buffer, size_t number_of_bytes) *----------- */ void fsp_debug_before_memory_init(fsp_memory_init_fn memory_init, - const struct FSPM_UPD *fspm_old_upd, - const struct FSPM_UPD *fspm_new_upd) + const FSPM_UPD *fspm_old_upd, + const FSPM_UPD *fspm_new_upd) { /* Display the MTRRs */ if (IS_ENABLED(CONFIG_DISPLAY_MTRRS)) @@ -44,7 +44,7 @@ void fsp_debug_before_memory_init(fsp_memory_init_fn memory_init, printk(BIOS_SPEW, "\t0x%p: &hob_list_ptr\n", fsp_get_hob_list_ptr()); } -void fsp_debug_after_memory_init(enum fsp_status status) +void fsp_debug_after_memory_init(uint32_t status) { if (IS_ENABLED(CONFIG_DISPLAY_FSP_CALLS_AND_STATUS)) printk(BIOS_SPEW, "FspMemoryInit returned 0x%08x\n", status); @@ -72,8 +72,8 @@ void fsp_debug_after_memory_init(enum fsp_status status) *----------- */ void fsp_debug_before_silicon_init(fsp_silicon_init_fn silicon_init, - const struct FSPS_UPD *fsps_old_upd, - const struct FSPS_UPD *fsps_new_upd) + const FSPS_UPD *fsps_old_upd, + const FSPS_UPD *fsps_new_upd) { /* Display the MTRRs */ if (IS_ENABLED(CONFIG_DISPLAY_MTRRS)) @@ -90,7 +90,7 @@ void fsp_debug_before_silicon_init(fsp_silicon_init_fn silicon_init, printk(BIOS_SPEW, "\t0x%p: upd\n", fsps_new_upd); } -void fsp_debug_after_silicon_init(enum fsp_status status) +void fsp_debug_after_silicon_init(uint32_t status) { if (IS_ENABLED(CONFIG_DISPLAY_FSP_CALLS_AND_STATUS)) printk(BIOS_SPEW, "FspSiliconInit returned 0x%08x\n", status); @@ -120,7 +120,7 @@ void fsp_before_debug_notify(fsp_notify_fn notify, printk(BIOS_SPEW, "\t0x%p: notify_params\n", notify_params); } -void fsp_debug_after_notify(enum fsp_status status) +void fsp_debug_after_notify(uint32_t status) { if (IS_ENABLED(CONFIG_DISPLAY_FSP_CALLS_AND_STATUS)) printk(BIOS_SPEW, "FspNotify returned 0x%08x\n", status); diff --git a/src/drivers/intel/fsp2_0/include/fsp/api.h b/src/drivers/intel/fsp2_0/include/fsp/api.h index a6228f2264..b0436e8290 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/api.h +++ b/src/drivers/intel/fsp2_0/include/fsp/api.h @@ -14,33 +14,9 @@ #define _FSP2_0_API_H_ #include -#include -#include -#include +#include -enum fsp_status { - FSP_SUCCESS = 0x00000000, - FSP_STATUS_RESET_REQUIRED_COLD = 0x40000001, - FSP_STATUS_RESET_REQUIRED_WARM = 0x40000002, - FSP_STATUS_RESET_REQUIRED_3 = 0x40000003, - FSP_STATUS_RESET_REQUIRED_4 = 0x40000004, - FSP_STATUS_RESET_REQUIRED_5 = 0x40000005, - FSP_STATUS_RESET_REQUIRED_6 = 0x40000006, - FSP_STATUS_RESET_REQUIRED_7 = 0x40000007, - FSP_STATUS_RESET_REQUIRED_8 = 0x40000008, - FSP_INVALID_PARAMETER = 0x80000002, - FSP_UNSUPPORTED = 0x80000003, - FSP_NOT_READY = 0x80000006, - FSP_DEVICE_ERROR = 0x80000007, - FSP_OUT_OF_RESOURCES = 0x80000009, - FSP_VOLUME_CORRUPTED = 0x8000000a, - FSP_NOT_FOUND = 0x8000000a, - FSP_TIMEOUT = 0x80000012, - FSP_ABORTED = 0x80000015, - FSP_INCOMPATIBLE_VERSION = 0x80000010, - FSP_SECURITY_VIOLATION = 0x8000001a, - FSP_CRC_ERROR = 0x8000001b, -}; +#define FSP_SUCCESS EFI_SUCCESS enum fsp_boot_mode { FSP_BOOT_WITH_FULL_CONFIGURATION = 0x00, @@ -64,8 +40,8 @@ void fsp_memory_init(bool s3wake); void fsp_silicon_init(void); /* Callbacks for updating stage-specific parameters */ -void platform_fsp_memory_init_params_cb(struct FSPM_UPD *mupd); -void platform_fsp_silicon_init_params_cb(struct FSPS_UPD *supd); +void platform_fsp_memory_init_params_cb(FSPM_UPD *mupd); +void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd); /* Callback after processing FSP notify */ void platform_fsp_notify_status(enum fsp_notify_phase phase); diff --git a/src/drivers/intel/fsp2_0/include/fsp/debug.h b/src/drivers/intel/fsp2_0/include/fsp/debug.h index 2f1d806b25..ef7131e1c2 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/debug.h +++ b/src/drivers/intel/fsp2_0/include/fsp/debug.h @@ -16,18 +16,18 @@ /* FSP debug API */ void fsp_debug_before_memory_init(fsp_memory_init_fn memory_init, - const struct FSPM_UPD *fspm_old_upd, - const struct FSPM_UPD *fspm_new_upd); -void fsp_debug_after_memory_init(enum fsp_status status); + const FSPM_UPD *fspm_old_upd, + const FSPM_UPD *fspm_new_upd); +void fsp_debug_after_memory_init(uint32_t status); void fsp_debug_before_silicon_init(fsp_silicon_init_fn silicon_init, - const struct FSPS_UPD *fsps_old_upd, - const struct FSPS_UPD *fsps_new_upd); -void fsp_debug_after_silicon_init(enum fsp_status status); + const FSPS_UPD *fsps_old_upd, + const FSPS_UPD *fsps_new_upd); +void fsp_debug_after_silicon_init(uint32_t status); void fsp_before_debug_notify(fsp_notify_fn notify, const struct fsp_notify_params *notify_params); -void fsp_debug_after_notify(enum fsp_status status); -void fspm_display_upd_values(const struct FSPM_UPD *old, - const struct FSPM_UPD *new); +void fsp_debug_after_notify(uint32_t status); +void fspm_display_upd_values(const FSPM_UPD *old, + const FSPM_UPD *new); void fsp_display_hobs(void); void fsp_verify_memory_init_hobs(void); void fsp_print_header_info(const struct fsp_header *hdr); @@ -35,10 +35,10 @@ void fsp_print_header_info(const struct fsp_header *hdr); /* Callbacks for displaying UPD parameters - place in a separate file * that is conditionally build with CONFIG_DISPLAY_UPD_DATA. */ -void soc_display_fspm_upd_params(const struct FSPM_UPD *fspm_old_upd, - const struct FSPM_UPD *fspm_new_upd); -void soc_display_fsps_upd_params(const struct FSPS_UPD *fsps_old_upd, - const struct FSPS_UPD *fsps_new_upd); +void soc_display_fspm_upd_params(const FSPM_UPD *fspm_old_upd, + const FSPM_UPD *fspm_new_upd); +void soc_display_fsps_upd_params(const FSPS_UPD *fsps_old_upd, + const FSPS_UPD *fsps_new_upd); /* Callbacks for displaying HOBs - place in a separate file that is * conditionally build with CONFIG_DISPLAY_HOBS. diff --git a/src/drivers/intel/fsp2_0/include/fsp/soc_binding.h b/src/drivers/intel/fsp2_0/include/fsp/soc_binding.h new file mode 100644 index 0000000000..6369986d2a --- /dev/null +++ b/src/drivers/intel/fsp2_0/include/fsp/soc_binding.h @@ -0,0 +1,30 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2015 Google Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _FSP2_0_SOC_BINDING_H_ +#define _FSP2_0_SOC_BINDING_H_ + +#pragma pack(push) +/* + * This file is a implementation specific header. i.e. different + * FSP implementations for different chipsets. + */ +#include +#include +#include + +#pragma pack(pop) + +#endif diff --git a/src/drivers/intel/fsp2_0/include/fsp/util.h b/src/drivers/intel/fsp2_0/include/fsp/util.h index 269bb02953..1c8dbba024 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/util.h +++ b/src/drivers/intel/fsp2_0/include/fsp/util.h @@ -83,15 +83,15 @@ uintptr_t fsp_load_vbt(void); * SoC. If the requested status is not a reboot status or unhandled, this * function does nothing. */ -void fsp_handle_reset(enum fsp_status status); +void fsp_handle_reset(uint32_t status); /* SoC/chipset must provide this to handle platform-specific reset codes */ -void chipset_handle_reset(enum fsp_status status); +void chipset_handle_reset(uint32_t status); -typedef asmlinkage enum fsp_status (*fsp_memory_init_fn) +typedef asmlinkage uint32_t (*fsp_memory_init_fn) (void *raminit_upd, void **hob_list); -typedef asmlinkage enum fsp_status (*fsp_silicon_init_fn)(void *silicon_upd); -typedef asmlinkage enum fsp_status (*fsp_notify_fn)(struct fsp_notify_params *); +typedef asmlinkage uint32_t (*fsp_silicon_init_fn)(void *silicon_upd); +typedef asmlinkage uint32_t (*fsp_notify_fn)(struct fsp_notify_params *); #include #endif /* _FSP2_0_UTIL_H_ */ diff --git a/src/drivers/intel/fsp2_0/memory_init.c b/src/drivers/intel/fsp2_0/memory_init.c index 1957cdb952..d0a22ce297 100644 --- a/src/drivers/intel/fsp2_0/memory_init.c +++ b/src/drivers/intel/fsp2_0/memory_init.c @@ -103,7 +103,7 @@ static void do_fsp_post_memory_init(bool s3wake, uint32_t fsp_version) printk(BIOS_SPEW, "Romstage handoff structure not added!\n"); } -static void fsp_fill_mrc_cache(struct FSPM_ARCH_UPD *arch_upd, bool s3wake, +static void fsp_fill_mrc_cache(FSPM_ARCH_UPD *arch_upd, bool s3wake, uint32_t fsp_version) { const struct mrc_saved_data *mrc_cache; @@ -152,7 +152,7 @@ static enum cb_err check_region_overlap(const struct memranges *ranges, return CB_SUCCESS; } -static enum cb_err fsp_fill_common_arch_params(struct FSPM_ARCH_UPD *arch_upd, +static enum cb_err fsp_fill_common_arch_params(FSPM_ARCH_UPD *arch_upd, bool s3wake, uint32_t fsp_version, const struct memranges *memmap) { @@ -183,14 +183,14 @@ static enum cb_err fsp_fill_common_arch_params(struct FSPM_ARCH_UPD *arch_upd, static void do_fsp_memory_init(struct fsp_header *hdr, bool s3wake, const struct memranges *memmap) { - enum fsp_status status; + uint32_t status; fsp_memory_init_fn fsp_raminit; - struct FSPM_UPD fspm_upd, *upd; - struct FSPM_ARCH_UPD *arch_upd; + FSPM_UPD fspm_upd, *upd; + FSPM_ARCH_UPD *arch_upd; post_code(0x34); - upd = (struct FSPM_UPD *)(hdr->cfg_region_offset + hdr->image_base); + upd = (FSPM_UPD *)(hdr->cfg_region_offset + hdr->image_base); if (upd->FspUpdHeader.Signature != FSPM_UPD_SIGNATURE) { die("Invalid FSPM signature!\n"); diff --git a/src/drivers/intel/fsp2_0/notify.c b/src/drivers/intel/fsp2_0/notify.c index 9879de024d..840165375c 100644 --- a/src/drivers/intel/fsp2_0/notify.c +++ b/src/drivers/intel/fsp2_0/notify.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -21,7 +20,7 @@ static void fsp_notify(enum fsp_notify_phase phase) { - enum fsp_status ret; + uint32_t ret; fsp_notify_fn fspnotify; struct fsp_notify_params notify_params = { .phase = phase }; diff --git a/src/drivers/intel/fsp2_0/silicon_init.c b/src/drivers/intel/fsp2_0/silicon_init.c index 562fec5844..b911553c2f 100644 --- a/src/drivers/intel/fsp2_0/silicon_init.c +++ b/src/drivers/intel/fsp2_0/silicon_init.c @@ -25,11 +25,11 @@ struct fsp_header fsps_hdr; static void do_silicon_init(struct fsp_header *hdr) { - struct FSPS_UPD upd, *supd; + FSPS_UPD upd, *supd; fsp_silicon_init_fn silicon_init; - enum fsp_status status; + uint32_t status; - supd = (struct FSPS_UPD *) (hdr->cfg_region_offset + hdr->image_base); + supd = (FSPS_UPD *) (hdr->cfg_region_offset + hdr->image_base); if (supd->FspUpdHeader.Signature != FSPS_UPD_SIGNATURE) { die("Invalid FSPS signature\n"); diff --git a/src/drivers/intel/fsp2_0/upd_display.c b/src/drivers/intel/fsp2_0/upd_display.c index 694a66e080..a588358ec1 100644 --- a/src/drivers/intel/fsp2_0/upd_display.c +++ b/src/drivers/intel/fsp2_0/upd_display.c @@ -51,15 +51,15 @@ static void fspm_display_arch_params(const struct FSPM_ARCH_UPD *old, /* Display the UPD parameters for MemoryInit */ __attribute__((weak)) void soc_display_fspm_upd_params( - const struct FSPM_UPD *fspm_old_upd, - const struct FSPM_UPD *fspm_new_upd) + const FSPM_UPD *fspm_old_upd, + const FSPM_UPD *fspm_new_upd) { printk(BIOS_SPEW, "UPD values for MemoryInit:\n"); hexdump(fspm_new_upd, sizeof(*fspm_new_upd)); } -void fspm_display_upd_values(const struct FSPM_UPD *old, - const struct FSPM_UPD *new) +void fspm_display_upd_values(const FSPM_UPD *old, + const FSPM_UPD *new) { /* Display the UPD data */ fspm_display_arch_params(&old->FspmArchUpd, &new->FspmArchUpd); @@ -68,8 +68,8 @@ void fspm_display_upd_values(const struct FSPM_UPD *old, /* Display the UPD parameters for SiliconInit */ __attribute__((weak)) void soc_display_fsps_upd_params( - const struct FSPS_UPD *fsps_old_upd, - const struct FSPS_UPD *fsps_new_upd) + const FSPS_UPD *fsps_old_upd, + const FSPS_UPD *fsps_new_upd) { printk(BIOS_SPEW, "UPD values for SiliconInit:\n"); hexdump(fsps_new_upd, sizeof(*fsps_new_upd)); diff --git a/src/drivers/intel/fsp2_0/util.c b/src/drivers/intel/fsp2_0/util.c index aaa239eec1..e7e4f1688e 100644 --- a/src/drivers/intel/fsp2_0/util.c +++ b/src/drivers/intel/fsp2_0/util.c @@ -92,13 +92,13 @@ enum cb_err fsp_validate_component(struct fsp_header *hdr, return CB_SUCCESS; } -static bool fsp_reset_requested(enum fsp_status status) +static bool fsp_reset_requested(uint32_t status) { return (status >= FSP_STATUS_RESET_REQUIRED_COLD && status <= FSP_STATUS_RESET_REQUIRED_8); } -void fsp_handle_reset(enum fsp_status status) +void fsp_handle_reset(uint32_t status) { if (!fsp_reset_requested(status)) return; -- cgit v1.2.3