summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Rhodes <sean@starlabs.systems>2021-07-13 07:23:22 +0100
committerFelix Held <felix-coreboot@felixheld.de>2021-10-18 12:32:43 +0000
commit66c8062a0072e9b162bf132fc5f279db158ab708 (patch)
tree31461bf5d1e53442f192118d6ace3fac6034f1e1
parentbc89bc6680c186c3a7969e93f48b90bc6d6e9eb6 (diff)
soc/skylake: Make VT-d controllable from CMOS option
Make VT-d enable or disable based on CMOS value "vtd" 1 = Enable 0 = Disable Signed-off-by: Sean Rhodes <sean@starlabs.systems> Change-Id: I1aea14968e08ee6af822bd259ca1d462f8926994 Reviewed-on: https://review.coreboot.org/c/coreboot/+/56252 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de>
-rw-r--r--src/soc/intel/skylake/acpi.c2
-rw-r--r--src/soc/intel/skylake/chip.c2
-rw-r--r--src/soc/intel/skylake/include/soc/systemagent.h2
-rw-r--r--src/soc/intel/skylake/systemagent.c9
4 files changed, 10 insertions, 5 deletions
diff --git a/src/soc/intel/skylake/acpi.c b/src/soc/intel/skylake/acpi.c
index cac72532ea..9bbfec3cd5 100644
--- a/src/soc/intel/skylake/acpi.c
+++ b/src/soc/intel/skylake/acpi.c
@@ -245,7 +245,7 @@ unsigned long sa_write_acpi_tables(const struct device *const dev,
acpi_dmar_t *const dmar = (acpi_dmar_t *)current;
/* Create DMAR table only if we have VT-d capability. */
- if (!soc_is_vtd_capable())
+ if (!soc_vtd_enabled())
return current;
printk(BIOS_DEBUG, "ACPI: * DMAR\n");
diff --git a/src/soc/intel/skylake/chip.c b/src/soc/intel/skylake/chip.c
index dd42f31961..a04869990d 100644
--- a/src/soc/intel/skylake/chip.c
+++ b/src/soc/intel/skylake/chip.c
@@ -509,7 +509,7 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
params->PchIoApicBdfValid = 0;
/* Enable VT-d and X2APIC */
- if (soc_is_vtd_capable()) {
+ if (soc_vtd_enabled()) {
params->VtdBaseAddress[0] = GFXVT_BASE_ADDRESS;
params->VtdBaseAddress[1] = VTVC0_BASE_ADDRESS;
params->X2ApicOptOut = 0;
diff --git a/src/soc/intel/skylake/include/soc/systemagent.h b/src/soc/intel/skylake/include/soc/systemagent.h
index da9ba553fe..9d917769ea 100644
--- a/src/soc/intel/skylake/include/soc/systemagent.h
+++ b/src/soc/intel/skylake/include/soc/systemagent.h
@@ -31,7 +31,7 @@
#define MCH_DDR_POWER_LIMIT_LO 0x58e0
#define MCH_DDR_POWER_LIMIT_HI 0x58e4
-bool soc_is_vtd_capable(void);
+bool soc_vtd_enabled(void);
static const struct sa_mmio_descriptor soc_gfxvt_mmio_descriptor = {
GFXVTBAR,
diff --git a/src/soc/intel/skylake/systemagent.c b/src/soc/intel/skylake/systemagent.c
index 2b297670b1..f11208720d 100644
--- a/src/soc/intel/skylake/systemagent.c
+++ b/src/soc/intel/skylake/systemagent.c
@@ -6,15 +6,20 @@
#include <device/pci_ops.h>
#include <intelblocks/power_limit.h>
#include <intelblocks/systemagent.h>
+#include <option.h>
#include <soc/cpu.h>
#include <soc/iomap.h>
#include <soc/msr.h>
#include <soc/pci_devs.h>
#include <soc/systemagent.h>
+#include <types.h>
#include "chip.h"
-bool soc_is_vtd_capable(void)
+bool soc_vtd_enabled(void)
{
+ const unsigned int vtd = get_uint_option("vtd", 1);
+ if (!vtd)
+ return false;
struct device *const root_dev = pcidev_path_on_root(SA_DEVFN_ROOT);
return root_dev &&
!(pci_read_config32(root_dev, CAPID0_A) & VTD_DISABLE);
@@ -41,7 +46,7 @@ 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));
- if (soc_is_vtd_capable()) {
+ if (soc_vtd_enabled()) {
if (is_devfn_enabled(SA_DEVFN_IGD))
sa_add_fixed_mmio_resources(dev, index,
&soc_gfxvt_mmio_descriptor, 1);