xref: /aosp_15_r20/external/coreboot/src/soc/amd/common/fsp/fsp_memmap.c (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <amdblocks/memmap.h>
4 #include <console/console.h>
5 #include <fsp/util.h>
6 #include <FspGuids.h>
7 #include <memrange.h>
8 #include <types.h>
9 
fsp_get_smm_region(uintptr_t * start,size_t * size)10 void fsp_get_smm_region(uintptr_t *start, size_t *size)
11 {
12 	static uintptr_t smm_start;
13 	static size_t smm_size;
14 
15 	*start = smm_start;
16 	*size = smm_size;
17 	if (*size && *start)
18 		return;
19 
20 	struct range_entry tseg;
21 
22 	if (fsp_find_range_hob(&tseg, AMD_FSP_TSEG_HOB_GUID.b) != CB_SUCCESS) {
23 		printk(BIOS_ERR, "unable to find TSEG HOB\n");
24 		return;
25 	}
26 
27 	smm_start = (uintptr_t)range_entry_base(&tseg);
28 	smm_size =  range_entry_size(&tseg);
29 	*start = smm_start;
30 	*size = smm_size;
31 }
32