summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/soc/intel/xeon_sp/cpx/soc_util.c5
-rw-r--r--src/soc/intel/xeon_sp/gnr/soc_util.c5
-rw-r--r--src/soc/intel/xeon_sp/include/soc/util.h2
-rw-r--r--src/soc/intel/xeon_sp/skx/soc_util.c5
-rw-r--r--src/soc/intel/xeon_sp/spr/soc_util.c9
-rw-r--r--src/soc/intel/xeon_sp/uncore.c27
6 files changed, 51 insertions, 2 deletions
diff --git a/src/soc/intel/xeon_sp/cpx/soc_util.c b/src/soc/intel/xeon_sp/cpx/soc_util.c
index 3472d589a8..aac5589073 100644
--- a/src/soc/intel/xeon_sp/cpx/soc_util.c
+++ b/src/soc/intel/xeon_sp/cpx/soc_util.c
@@ -141,3 +141,8 @@ uint8_t get_cxl_node_count(void)
{
return 0;
}
+
+bool get_mmio_high_base_size(resource_t *base, resource_t *size)
+{
+ return false;
+}
diff --git a/src/soc/intel/xeon_sp/gnr/soc_util.c b/src/soc/intel/xeon_sp/gnr/soc_util.c
index a65e5fcc52..7ea65c213c 100644
--- a/src/soc/intel/xeon_sp/gnr/soc_util.c
+++ b/src/soc/intel/xeon_sp/gnr/soc_util.c
@@ -148,3 +148,8 @@ bool is_memtype_processor_attached(uint16_t mem_type)
{
return true;
}
+
+bool get_mmio_high_base_size(resource_t *base, resource_t *size)
+{
+ return false;
+}
diff --git a/src/soc/intel/xeon_sp/include/soc/util.h b/src/soc/intel/xeon_sp/include/soc/util.h
index e694af3e3c..a7b98f3ae6 100644
--- a/src/soc/intel/xeon_sp/include/soc/util.h
+++ b/src/soc/intel/xeon_sp/include/soc/util.h
@@ -31,4 +31,6 @@ void bios_done_msr(void *unused);
union p2sb_bdf soc_get_hpet_bdf(void);
union p2sb_bdf soc_get_ioapic_bdf(void);
+bool get_mmio_high_base_size(resource_t *base, resource_t *size);
+
#endif
diff --git a/src/soc/intel/xeon_sp/skx/soc_util.c b/src/soc/intel/xeon_sp/skx/soc_util.c
index 0ccacfb73c..0938260b0a 100644
--- a/src/soc/intel/xeon_sp/skx/soc_util.c
+++ b/src/soc/intel/xeon_sp/skx/soc_util.c
@@ -214,3 +214,8 @@ uint8_t get_cxl_node_count(void)
{
return 0;
}
+
+bool get_mmio_high_base_size(resource_t *base, resource_t *size)
+{
+ return false;
+}
diff --git a/src/soc/intel/xeon_sp/spr/soc_util.c b/src/soc/intel/xeon_sp/spr/soc_util.c
index 584532785e..6dd06acd50 100644
--- a/src/soc/intel/xeon_sp/spr/soc_util.c
+++ b/src/soc/intel/xeon_sp/spr/soc_util.c
@@ -188,3 +188,12 @@ bool is_memtype_processor_attached(uint16_t mem_type)
*/
return (mem_type < MemTypeCxlAccVolatileMem);
}
+
+bool get_mmio_high_base_size(resource_t *base, resource_t *size)
+{
+ const IIO_UDS *hob = get_iio_uds();
+ *base = hob->PlatformData.PlatGlobalMmio64Base;
+ *size = hob->PlatformData.PlatGlobalMmio64Limit - (*base) + 1;
+
+ return true;
+}
diff --git a/src/soc/intel/xeon_sp/uncore.c b/src/soc/intel/xeon_sp/uncore.c
index 2e5023d04e..be5b38f9c3 100644
--- a/src/soc/intel/xeon_sp/uncore.c
+++ b/src/soc/intel/xeon_sp/uncore.c
@@ -151,6 +151,9 @@ static void configure_dpr(struct device *dev)
pci_write_config32(dev, VTD_LTDPR, dpr.raw);
}
+#define MC_DRAM_RESOURCE_MMIO_HIGH 0x1000
+#define MC_DRAM_RESOURCE_ANON_START 0x1001
+
/*
* Host Memory Map:
*
@@ -350,7 +353,7 @@ static void mc_add_dram_resources(struct device *dev, int *res_count)
static void mmapvtd_read_resources(struct device *dev)
{
- int index = 0;
+ int index = MC_DRAM_RESOURCE_ANON_START;
/* Read standard PCI resources. */
pci_dev_read_resources(dev);
@@ -362,13 +365,33 @@ static void mmapvtd_read_resources(struct device *dev)
mc_add_dram_resources(dev, &index);
}
+static void mmapvtd_set_resources(struct device *dev)
+{
+ /*
+ * The MMIO high window has to be added in set_resources() instead of
+ * read_resources(). Because adding in read_resources() would cause the
+ * whole window to be reserved, and it couldn't be used for resource
+ * allocation.
+ */
+ if (is_domain0(dev->upstream->dev)) {
+ resource_t mmio64_base, mmio64_size;
+ if (get_mmio_high_base_size(&mmio64_base, &mmio64_size)) {
+ assert(!probe_resource(dev, MC_DRAM_RESOURCE_MMIO_HIGH));
+ fixed_mem_range_flags(dev, MC_DRAM_RESOURCE_MMIO_HIGH,
+ mmio64_base, mmio64_size, IORESOURCE_STORED);
+ }
+ }
+
+ pci_dev_set_resources(dev);
+}
+
static void mmapvtd_init(struct device *dev)
{
}
static struct device_operations mmapvtd_ops = {
.read_resources = mmapvtd_read_resources,
- .set_resources = pci_dev_set_resources,
+ .set_resources = mmapvtd_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = mmapvtd_init,
.ops_pci = &soc_pci_ops,