aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2022-07-12 12:12:19 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-07-14 12:48:46 +0000
commit7f611018d4bc7b5eda2ecfa3d8bff4dedf832d52 (patch)
treea15241788b074a69f7c5e178f87ee69a0db597df /src
parent50a27072d07defb434391e21741a74a111489302 (diff)
soc/amd/fsp: Cache smm_region() results
This avoids searching the HOB output multiple times when calling smm_region(). Change-Id: Iad09c3aa3298745ba3ba7012e6bb8cfb8785d525 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/65787 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src')
-rw-r--r--src/soc/amd/common/block/cpu/noncar/memmap.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/soc/amd/common/block/cpu/noncar/memmap.c b/src/soc/amd/common/block/cpu/noncar/memmap.c
index dd057c05fa..8cd9ec8998 100644
--- a/src/soc/amd/common/block/cpu/noncar/memmap.c
+++ b/src/soc/amd/common/block/cpu/noncar/memmap.c
@@ -37,12 +37,16 @@ const struct memmap_early_dram *memmap_get_early_dram_usage(void)
void smm_region(uintptr_t *start, size_t *size)
{
static int once;
- struct range_entry tseg;
+ static uintptr_t smm_start;
+ static size_t smm_size;
int status;
- *start = 0;
- *size = 0;
+ *start = smm_start;
+ *size = smm_size;
+ if (*size && *start)
+ return;
+ struct range_entry tseg;
status = fsp_find_range_hob(&tseg, AMD_FSP_TSEG_HOB_GUID.b);
if (status < 0) {
@@ -50,8 +54,10 @@ void smm_region(uintptr_t *start, size_t *size)
return;
}
- *start = (uintptr_t)range_entry_base(&tseg);
- *size = range_entry_size(&tseg);
+ smm_start = (uintptr_t)range_entry_base(&tseg);
+ smm_size = range_entry_size(&tseg);
+ *start = smm_start;
+ *size = smm_size;
if (!once) {
clear_tvalid();