Pratikkumar V Prajapati has uploaded this change for review. ( https://review.coreboot.org/21244
Change subject: soc/intel/apollolake: Implement PRMRR get base and mask APIs ......................................................................
soc/intel/apollolake: Implement PRMRR get base and mask APIs
Implement following APIs for APL/GLK - soc_get_uncore_prmmr_base() - soc_get_uncore_prmmr_mask()
Change-Id: I57df1f0e8ff984f32de4efdc6ebd68be501b4799 Signed-off-by: Pratik Prajapati pratikkumar.v.prajapati@intel.com --- M src/soc/intel/apollolake/systemagent.c 1 file changed, 54 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/44/21244/1
diff --git a/src/soc/intel/apollolake/systemagent.c b/src/soc/intel/apollolake/systemagent.c index 22d801e..88fc8ad 100644 --- a/src/soc/intel/apollolake/systemagent.c +++ b/src/soc/intel/apollolake/systemagent.c @@ -38,3 +38,57 @@ sa_add_fixed_mmio_resources(dev, index, soc_fixed_resources, ARRAY_SIZE(soc_fixed_resources)); } + +int soc_get_uncore_prmmr_base(msr_t *prmrr_base) +{ + const void *prmrr_base_hob; + size_t prmrr_base_hob_size = 0; + uint64_t temp = 0; + + const uint8_t prmrr_phys_base_guid[16] = { + 0x38, 0x3a, 0x81, 0x9f, 0xb0, 0x6f, 0xa7, 0x4f, + 0xaf, 0x79, 0x8a, 0x4e, 0x74, 0xdd, 0x48, 0x33 + }; + + prmrr_base_hob = fsp_find_extension_hob_by_guid(prmrr_phys_base_guid, + &prmrr_base_hob_size); + + if (!prmrr_base_hob) { + printk(BIOS_ERR, "Failed to locate PRMRR base hob\n"); + return -1; + } + + temp = *(uint64_t *) prmrr_base_hob; + prmrr_base->lo = (uint32_t) temp; + prmrr_base->hi = temp >> 32; + + return 0; +} + +int soc_get_uncore_prmmr_mask(msr_t *prmrr_mask) +{ + const void *prmrr_size_hob; + size_t prmrr_size_hob_size = 0; + uint64_t prmrr_size = 0; + const uint64_t PRMRR_HOB_MASK = 0x07FFFFFFFFF; + uint64_t temp; + const uint8_t prmrr_size_guid[16] = { + 0x44, 0xed, 0x0b, 0x99, 0x4e, 0x9b, 0x26, 0x42, + 0xa5, 0x97, 0x28, 0x36, 0x76, 0x6b, 0x5c, 0x41 + }; + + prmrr_size_hob = fsp_find_extension_hob_by_guid(prmrr_size_guid, + &prmrr_size_hob_size); + + if (!prmrr_size_hob) { + printk(BIOS_ERR, "Failed to locate PRMRR size hob\n"); + return -1; + } + + prmrr_size = *(uint64_t *) prmrr_size_hob; + temp = PRMRR_HOB_MASK & (~((uint64_t) (prmrr_size - 1))); + prmrr_mask->lo = (uint32_t) temp; + prmrr_mask->hi = temp >> 32; + + return 0; +}