gma: Allow to configure PCI device, override MMConf
In virtualized environments (e.g. PCI pass-through), it's possible
that the guest-visible PCI address differs from the actual hardware
address. Similarly, the MMConf/ECAM space might not be fully mapped
into the guest, so allow to override that as well.
Change-Id: Icc286b5db8c2d9098fa99307d449b46fccdec4dc
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.sourcearcade.org/c/libgfxinit/+/536
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Thomas Heijligen <src@posteo.de>
diff --git a/common/Makefile.inc b/common/Makefile.inc
index 47ef35b..175c152 100644
--- a/common/Makefile.inc
+++ b/common/Makefile.inc
@@ -52,6 +52,8 @@
CONFIG_GFX_GMA_PCH ?= No_PCH
CONFIG_GFX_GMA_PANEL_2_PORT ?= Disabled
+CONFIG_GFX_GMA_PCI_DEV ?= (0, 2, 0)
+CONFIG_GFX_GMA_OVERRIDE_MMCONF ?= 0
CONFIG_GFX_GMA_GENERATION := $(call strip_quotes,$(CONFIG_GFX_GMA_GENERATION))
CONFIG_GFX_GMA_CPU := $(call strip_quotes,$(CONFIG_GFX_GMA_CPU))
@@ -87,6 +89,8 @@
-e's/<<PANEL_1_PORT>>/$(CONFIG_GFX_GMA_PANEL_1_PORT)/' \
-e's/<<PANEL_2_PORT>>/$(CONFIG_GFX_GMA_PANEL_2_PORT)/' \
-e's/<<ANALOG_I2C_PORT>>/$(CONFIG_GFX_GMA_ANALOG_I2C_PORT)/' \
+ -e's/<<PCI_DEV_ADDRESS>>/$(CONFIG_GFX_GMA_PCI_DEV)/' \
+ -e's/<<OVERRIDE_MMCONF_BASE>>/$(CONFIG_GFX_GMA_OVERRIDE_MMCONF)/' \
-e's/<<DEFAULT_MMIO_BASE>>/$(CONFIG_GFX_GMA_DEFAULT_MMIO)/' \
-e's/<<IGNORE_STRAPS>>/$(CONFIG_GFX_GMA_IGNORE_PRESENCE_STRAPS)/' \
diff --git a/common/hw-gfx-gma-config.ads.template b/common/hw-gfx-gma-config.ads.template
index 763a22d..e495526 100644
--- a/common/hw-gfx-gma-config.ads.template
+++ b/common/hw-gfx-gma-config.ads.template
@@ -12,6 +12,8 @@
-- GNU General Public License for more details.
--
+with HW.PCI;
+
private package HW.GFX.GMA.Config is
Gen : constant Generation := <<GEN>>;
@@ -77,7 +79,9 @@
DDI_HDMI_Buffer_Translation : constant Integer := -1;
- Default_MMIO_Base : constant := <<DEFAULT_MMIO_BASE>>;
+ PCI_Dev : constant PCI.Address := <<PCI_DEV_ADDRESS>>;
+ Override_MMConf_Base : constant := <<OVERRIDE_MMCONF_BASE>>;
+ Default_MMIO_Base : constant := <<DEFAULT_MMIO_BASE>>;
LVDS_Dual_Threshold : constant := 95_000_000;
diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb
index 3ad37e6..fc8005f 100644
--- a/common/hw-gfx-gma.adb
+++ b/common/hw-gfx-gma.adb
@@ -78,7 +78,9 @@
USBC3 => "USBC3 ",
USBC4 => "USBC4 ");
- package Dev is new HW.PCI.Dev (PCI.Address'(0, 2, 0));
+ package Dev is new HW.PCI.Dev
+ (Dev => Config.PCI_Dev,
+ MMConf_Base => Config.Override_MMConf_Base);
package Display_Controller renames Pipe_Setup;