soc/intel/skylake: Use SA library to get smm region information

This patch uses system agent common library to
know tseg region start and size. Unable to remove smm_region()
function from soc code as SMM common library
is not yet available for skylake use.

BRANCH=none
BUG=b:63974384
TEST=Build and boot eve successfully.

Change-Id: If98b65805753db2c30d6fea29e401a17cef39799
Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-on: https://review.coreboot.org/21290
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Subrata Banik 2017-08-30 16:33:17 +05:30
parent a0618201d4
commit ce9653fe78
1 changed files with 7 additions and 23 deletions

View File

@ -38,27 +38,10 @@ size_t mmap_region_granularity(void)
return 8*MiB;
}
/* Returns base of requested region encoded in the system agent. */
static inline uintptr_t system_agent_region_base(size_t reg)
{
/* All regions concerned for have 1 MiB alignment. */
return ALIGN_DOWN(pci_read_config32(SA_DEV_ROOT, reg), 1*MiB);
}
static inline uintptr_t smm_region_start(void)
{
return system_agent_region_base(TSEG);
}
static inline size_t smm_region_size(void)
{
return system_agent_region_base(BGSM) - smm_region_start();
}
void smm_region(void **start, size_t *size)
{
*start = (void *)smm_region_start();
*size = smm_region_size();
*start = (void *)sa_get_tseg_base();
*size = sa_get_tseg_size();
}
/*
@ -76,11 +59,12 @@ int smm_subregion(int sub, void **start, size_t *size)
{
uintptr_t sub_base;
size_t sub_size;
void *smm_base;
const size_t ied_size = CONFIG_IED_REGION_SIZE;
const size_t cache_size = CONFIG_SMM_RESERVED_SIZE;
sub_base = smm_region_start();
sub_size = smm_region_size();
smm_region(&smm_base, &sub_size);
sub_base = (uintptr_t)smm_base;
switch (sub) {
case SMM_SUBREGION_HANDLER:
@ -170,7 +154,7 @@ static u32 calculate_dram_base(void)
dram_base -= sa_get_gsm_size();
}
/* Get TSEG size */
dram_base -= smm_region_size();
dram_base -= sa_get_tseg_size();
/* Get DPR size */
if (IS_ENABLED(CONFIG_SA_ENABLE_DPR))
@ -224,7 +208,7 @@ static u32 top_of_32bit_ram(void)
* PRMMR_BASE MSR. The system hangs if PRMRR_BASE MSR is read before
* PRMRR_MASK MSR lock bit is set.
*/
if (smm_region_start() == 0)
if (sa_get_tseg_base() == 0)
return 0;
return calculate_dram_base();