diff options
author | Subrata Banik <subrata.banik@intel.com> | 2018-05-24 10:51:29 +0530 |
---|---|---|
committer | Subrata Banik <subrata.banik@intel.com> | 2018-05-25 02:00:00 +0000 |
commit | 44ffb5dedfcf7aea473f34e43073ffedaec55261 (patch) | |
tree | 1303efcc599f401ee0407a038bda3fd419b53316 /src/drivers/intel | |
parent | 659f40bb348dd2ca02f9483ed2668465177b6a40 (diff) | |
download | coreboot-44ffb5dedfcf7aea473f34e43073ffedaec55261.tar.xz |
drivers/intel/fsp2_0: Make use of xmalloc for FSP-S UPD
Don't allocate FSP-S UPD over stack. This patch reduces stack
usage for Cannonlake platform.
TEST=On CNL platform stack usage reduces from ~3.6KiB to ~1KiB.
Change-Id: I07ef0db6720d7e6865ac1641ce2661009332907c
Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-on: https://review.coreboot.org/26501
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/drivers/intel')
-rw-r--r-- | src/drivers/intel/fsp2_0/silicon_init.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/drivers/intel/fsp2_0/silicon_init.c b/src/drivers/intel/fsp2_0/silicon_init.c index bda88d11ca..0461b68078 100644 --- a/src/drivers/intel/fsp2_0/silicon_init.c +++ b/src/drivers/intel/fsp2_0/silicon_init.c @@ -14,6 +14,7 @@ #include <cbfs.h> #include <cbmem.h> #include <commonlib/fsp.h> +#include <commonlib/stdlib.h> #include <console/console.h> #include <fsp/api.h> #include <fsp/util.h> @@ -26,7 +27,7 @@ struct fsp_header fsps_hdr; static void do_silicon_init(struct fsp_header *hdr) { - FSPS_UPD upd, *supd; + FSPS_UPD *upd, *supd; fsp_silicon_init_fn silicon_init; uint32_t status; @@ -35,19 +36,21 @@ static void do_silicon_init(struct fsp_header *hdr) if (supd->FspUpdHeader.Signature != FSPS_UPD_SIGNATURE) die("Invalid FSPS signature\n"); - memcpy(&upd, supd, sizeof(upd)); + upd = xmalloc(sizeof(FSPS_UPD)); + + memcpy(upd, supd, sizeof(FSPS_UPD)); /* Give SoC/mainboard a chance to populate entries */ - platform_fsp_silicon_init_params_cb(&upd); + platform_fsp_silicon_init_params_cb(upd); /* Call SiliconInit */ silicon_init = (void *) (hdr->image_base + hdr->silicon_init_entry_offset); - fsp_debug_before_silicon_init(silicon_init, supd, &upd); + fsp_debug_before_silicon_init(silicon_init, supd, upd); timestamp_add_now(TS_FSP_SILICON_INIT_START); post_code(POST_FSP_SILICON_INIT); - status = silicon_init(&upd); + status = silicon_init(upd); timestamp_add_now(TS_FSP_SILICON_INIT_END); post_code(POST_FSP_SILICON_EXIT); |