[coreboot-gerrit] Change in coreboot[master]: soc/intel/common: Add function to get soc reserved memory size

Subrata Banik (Code Review) gerrit at coreboot.org
Thu Sep 14 14:32:09 CEST 2017


Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/21539


Change subject: soc/intel/common: Add function to get soc reserved memory size
......................................................................

soc/intel/common: Add function to get soc reserved memory size

This patch ensures to consider soc reserved memory size while
allocating DRAM based resources.

Change-Id: I587a9c1ea44f2dbf67099fef03d0ff92bc44f242
Signed-off-by: Subrata Banik <subrata.banik at intel.com>
---
M src/soc/intel/common/block/include/intelblocks/systemagent.h
M src/soc/intel/common/block/systemagent/systemagent.c
2 files changed, 16 insertions(+), 4 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/39/21539/1

diff --git a/src/soc/intel/common/block/include/intelblocks/systemagent.h b/src/soc/intel/common/block/include/intelblocks/systemagent.h
index 4ca19e6..f6b9a0b 100644
--- a/src/soc/intel/common/block/include/intelblocks/systemagent.h
+++ b/src/soc/intel/common/block/include/intelblocks/systemagent.h
@@ -99,5 +99,7 @@
  * struct sa_mmio_descriptor along with resource count.
  */
 void soc_add_fixed_mmio_resources(struct device *dev, int *resource_cnt);
+/* SoC call to summarize all Intel Reserve MMIO size and report to SA */
+size_t soc_reversed_mmio_size(void);
 
 #endif	/* SOC_INTEL_COMMON_BLOCK_SA_H */
diff --git a/src/soc/intel/common/block/systemagent/systemagent.c b/src/soc/intel/common/block/systemagent/systemagent.c
index cb7af41..23e7984 100644
--- a/src/soc/intel/common/block/systemagent/systemagent.c
+++ b/src/soc/intel/common/block/systemagent/systemagent.c
@@ -36,6 +36,11 @@
 	/* no-op */
 }
 
+__attribute__((weak)) size_t soc_reversed_mmio_size(void)
+{
+	return 0;
+}
+
 /*
  * Add all known fixed MMIO ranges that hang off the host bridge/memory
  * controller device.
@@ -134,12 +139,16 @@
 {
 	uintptr_t base_k, touud_k;
 	size_t dpr_size = 0, size_k;
+	size_t reserved_mmio_size;
 	uint64_t sa_map_values[MAX_MAP_ENTRIES];
 	uintptr_t top_of_ram;
 	int index = *resource_count;
 
 	if (IS_ENABLED(CONFIG_SA_ENABLE_DPR))
 		dpr_size = sa_get_dpr_size();
+
+	/* Get SoC reserve memory size as per user selection */
+	reserved_mmio_size = soc_reversed_mmio_size();
 
 	top_of_ram = (uintptr_t)cbmem_top();
 
@@ -155,13 +164,14 @@
 
 	sa_get_mem_map(dev, &sa_map_values[0]);
 
-	/* top_of_ram -> TSEG - DPR */
+	/* top_of_ram -> TSEG - DPR - Intel Reserve Memory SIze*/
 	base_k = top_of_ram;
-	size_k = sa_map_values[SA_TSEG_REG] - dpr_size - base_k;
+	size_k = sa_map_values[SA_TSEG_REG] - dpr_size - base_k
+				- reserved_mmio_size;
 	mmio_resource(dev, index++, base_k / KiB, size_k / KiB);
 
-	/* TSEG - DPR -> BGSM */
-	base_k = sa_map_values[SA_TSEG_REG] - dpr_size;
+	/* TSEG - DPR - Intel Reserve Memory SIze -> BGSM */
+	base_k = sa_map_values[SA_TSEG_REG] - dpr_size - reserved_mmio_size;
 	size_k = sa_map_values[SA_BGSM_REG] - base_k;
 	reserved_ram_resource(dev, index++, base_k / KiB, size_k / KiB);
 

-- 
To view, visit https://review.coreboot.org/21539
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I587a9c1ea44f2dbf67099fef03d0ff92bc44f242
Gerrit-Change-Number: 21539
Gerrit-PatchSet: 1
Gerrit-Owner: Subrata Banik <subrata.banik at intel.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170914/ce292b9a/attachment.html>


More information about the coreboot-gerrit mailing list