summaryrefslogtreecommitdiff
path: root/src/soc/intel/xeon_sp/uncore.c
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2024-02-14 13:53:28 +0100
committerPatrick Rudolph <patrick.rudolph@9elements.com>2024-02-23 07:45:08 +0000
commit89cacb9050a9d2de91f0770dc1521ca1be7160be (patch)
tree4a7d31b46353edd189a2a00ca65850edea0b8bc3 /src/soc/intel/xeon_sp/uncore.c
parent1d3838b6237fefccc3a4c4b0848025dfd32918f5 (diff)
soc/intel/xeon_sp/uncore: Read VtdBar
Read the VtdBar and add it to the resources of the host bridge PCI device. The BAR is already marked as PciResourceMem32 in the parent PCI domain. This allows easy probing for VTD devices with enabled VtdBars in the next commit, without the need to look up the stack HOB. Change-Id: Id579a94e653473f3dd0dccea6e33dc64f792d028 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/80550 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/soc/intel/xeon_sp/uncore.c')
-rw-r--r--src/soc/intel/xeon_sp/uncore.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/soc/intel/xeon_sp/uncore.c b/src/soc/intel/xeon_sp/uncore.c
index d43b209591..952ca4db70 100644
--- a/src/soc/intel/xeon_sp/uncore.c
+++ b/src/soc/intel/xeon_sp/uncore.c
@@ -45,6 +45,7 @@ enum {
ME_LIMIT_REG,
TSEG_BASE_REG,
TSEG_LIMIT_REG,
+ VTDBAR_REG,
/* Must be last. */
NUM_MAP_ENTRIES
};
@@ -64,6 +65,7 @@ static struct map_entry memory_map[NUM_MAP_ENTRIES] = {
#endif
[TSEG_BASE_REG] = MAP_ENTRY_BASE_32(VTD_TSEG_BASE_CSR, "TSEGMB_BASE"),
[TSEG_LIMIT_REG] = MAP_ENTRY_LIMIT_32(VTD_TSEG_LIMIT_CSR, 20, "TSEGMB_LIMIT"),
+ [VTDBAR_REG] = MAP_ENTRY_BASE_32(VTD_BAR_CSR, "VTD_BAR"),
};
static void read_map_entry(struct device *dev, struct map_entry *entry,
@@ -76,6 +78,11 @@ static void read_map_entry(struct device *dev, struct map_entry *entry,
*result = 0;
return;
}
+ if (entry->reg == VTD_BAR_CSR && !(pci_read_config32(dev, entry->reg) & 1)) {
+ /* VTDBAR is not enabled */
+ *result = 0;
+ return;
+ }
mask = ((1ULL << entry->mask_bits) - 1);
mask = ~mask;
@@ -198,14 +205,19 @@ static void mc_add_dram_resources(struct device *dev, int *res_count)
int index = *res_count;
struct range_entry fsp_mem;
- /* Only add dram resources once. */
- if (dev->upstream->secondary != 0 || dev->upstream->segment_group != 0)
- return;
-
/* Read in the MAP registers and report their values. */
mc_read_map_entries(dev, &mc_values[0]);
mc_report_map_entries(dev, &mc_values[0]);
+ if (mc_values[VTDBAR_REG]) {
+ res = mmio_range(dev, VTD_BAR_CSR, mc_values[VTDBAR_REG], 8 * KiB);
+ LOG_RESOURCE("vtd_bar", dev, res);
+ }
+
+ /* Only add dram resources once. */
+ if (dev->upstream->secondary != 0 || dev->upstream->segment_group != 0)
+ return;
+
/* Conventional Memory (DOS region, 0x0 to 0x9FFFF) */
res = ram_from_to(dev, index++, 0, 0xa0000);
LOG_RESOURCE("legacy_ram", dev, res);