From 544369ebf3223eda11279614b93b9e05f7f27170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Tue, 6 Aug 2019 22:14:34 +0300 Subject: [PATCH] amd/stoneyridge,picasso: Open TSEG earlier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't make assumptions about which subregion will be accessed first. Change-Id: I558fa4acc5068014b3748be6fc1bc34999054c0a Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/34775 Reviewed-by: Paul Menzel Reviewed-by: Furquan Shaikh Reviewed-by: Marshall Dawson Reviewed-by: Richard Spiegel Tested-by: build bot (Jenkins) --- src/soc/amd/picasso/ramtop.c | 7 ++++++- src/soc/amd/stoneyridge/ramtop.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/soc/amd/picasso/ramtop.c b/src/soc/amd/picasso/ramtop.c index 6b28ec7dd6..672fdd8194 100644 --- a/src/soc/amd/picasso/ramtop.c +++ b/src/soc/amd/picasso/ramtop.c @@ -111,6 +111,7 @@ static void clear_tvalid(void) int smm_subregion(int sub, uintptr_t *start, size_t *size) { + static int once; uintptr_t sub_base; size_t sub_size; const size_t cache_size = CONFIG_SMM_RESERVED_SIZE; @@ -118,6 +119,11 @@ int smm_subregion(int sub, uintptr_t *start, size_t *size) smm_region(&sub_base, &sub_size); assert(sub_size > CONFIG_SMM_RESERVED_SIZE); + if (!once) { + clear_tvalid(); + once = 1; + } + switch (sub) { case SMM_SUBREGION_HANDLER: /* Handler starts at the base of TSEG. */ @@ -127,7 +133,6 @@ int smm_subregion(int sub, uintptr_t *start, size_t *size) /* External cache is in the middle of TSEG. */ sub_base += sub_size - cache_size; sub_size = cache_size; - clear_tvalid(); break; default: *start = 0; diff --git a/src/soc/amd/stoneyridge/ramtop.c b/src/soc/amd/stoneyridge/ramtop.c index 26d84cef12..e2b0f7d6bc 100644 --- a/src/soc/amd/stoneyridge/ramtop.c +++ b/src/soc/amd/stoneyridge/ramtop.c @@ -111,6 +111,7 @@ static void clear_tvalid(void) int smm_subregion(int sub, uintptr_t *start, size_t *size) { + static int once; uintptr_t sub_base; size_t sub_size; const size_t cache_size = CONFIG_SMM_RESERVED_SIZE; @@ -118,6 +119,11 @@ int smm_subregion(int sub, uintptr_t *start, size_t *size) smm_region(&sub_base, &sub_size); assert(sub_size > CONFIG_SMM_RESERVED_SIZE); + if (!once) { + clear_tvalid(); + once = 1; + } + switch (sub) { case SMM_SUBREGION_HANDLER: /* Handler starts at the base of TSEG. */ @@ -127,7 +133,6 @@ int smm_subregion(int sub, uintptr_t *start, size_t *size) /* External cache is in the middle of TSEG. */ sub_base += sub_size - cache_size; sub_size = cache_size; - clear_tvalid(); break; default: *start = 0;