summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPratik Prajapati <pratikkumar.v.prajapati@intel.com>2017-08-28 15:11:49 -0700
committerAaron Durbin <adurbin@chromium.org>2017-09-14 14:58:33 +0000
commit738414586d1b6eb0339e1e70534c68e0c2d36027 (patch)
treeaeeb01f0705ec0ef697786aea7c0ad24fd899b2c /src
parent82cdfa73d5fbe8ded890f5bb4079a67f57449db1 (diff)
soc/intel/apollolake: Implement UNCORE PRMRR get base and mask API
Implement soc_get_uncore_prmmr_base_and_mask() API for APL/GLK Change-Id: I57df1f0e8ff984f32de4efdc6ebd68be501b4799 Signed-off-by: Pratik Prajapati <pratikkumar.v.prajapati@intel.com> Reviewed-on: https://review.coreboot.org/21244 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/soc/intel/apollolake/systemagent.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/soc/intel/apollolake/systemagent.c b/src/soc/intel/apollolake/systemagent.c
index 22d801e018..57de4b82fb 100644
--- a/src/soc/intel/apollolake/systemagent.c
+++ b/src/soc/intel/apollolake/systemagent.c
@@ -16,7 +16,10 @@
* GNU General Public License for more details.
*/
+#include <cpu/cpu.h>
+#include <console/console.h>
#include <device/device.h>
+#include <fsp/util.h>
#include <intelblocks/systemagent.h>
#include <soc/iomap.h>
#include <soc/systemagent.h>
@@ -38,3 +41,47 @@ void soc_add_fixed_mmio_resources(struct device *dev, int *index)
sa_add_fixed_mmio_resources(dev, index, soc_fixed_resources,
ARRAY_SIZE(soc_fixed_resources));
}
+
+int soc_get_uncore_prmmr_base_and_mask(uint64_t *prmrr_base,
+ uint64_t *prmrr_mask)
+{
+ const void *hob;
+ size_t hob_size, prmrr_size;
+ uint64_t phys_address_mask;
+ const uint8_t prmrr_phys_base_guid[16] = {
+ 0x38, 0x3a, 0x81, 0x9f, 0xb0, 0x6f, 0xa7, 0x4f,
+ 0xaf, 0x79, 0x8a, 0x4e, 0x74, 0xdd, 0x48, 0x33
+ };
+ const uint8_t prmrr_size_guid[16] = {
+ 0x44, 0xed, 0x0b, 0x99, 0x4e, 0x9b, 0x26, 0x42,
+ 0xa5, 0x97, 0x28, 0x36, 0x76, 0x6b, 0x5c, 0x41
+ };
+
+ hob = fsp_find_extension_hob_by_guid(prmrr_phys_base_guid,
+ &hob_size);
+ if (!hob) {
+ printk(BIOS_ERR, "Failed to locate PRMRR base hob\n");
+ return -1;
+ }
+ if (hob_size != sizeof(uint64_t)) {
+ printk(BIOS_ERR, "Incorrect PRMRR base hob size\n");
+ return -1;
+ }
+ *prmrr_base = *(uint64_t *) hob;
+
+ hob = fsp_find_extension_hob_by_guid(prmrr_size_guid,
+ &hob_size);
+ if (!hob) {
+ printk(BIOS_ERR, "Failed to locate PRMRR size hob\n");
+ return -1;
+ }
+ if (hob_size != sizeof(uint64_t)) {
+ printk(BIOS_ERR, "Incorrect PRMRR base hob size\n");
+ return -1;
+ }
+ prmrr_size = *(uint64_t *) hob;
+ phys_address_mask = (1ULL << cpu_phys_address_size()) - 1;
+ *prmrr_mask = phys_address_mask & ~(uint64_t)(prmrr_size - 1);
+
+ return 0;
+}