gma config: allow override of presence straps
A handful of boards do not properly implement the presence straps,
leading libgfxinit to fail to detect an attached internal display.
Add an override which can be set by coreboot for affected boards.
Change-Id: Iabf0fac3a8431ffceb81cd583bb05f9c28e8ad64
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/41415
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/common/Makefile.inc b/common/Makefile.inc
index af6dc11..f5d2c76 100644
--- a/common/Makefile.inc
+++ b/common/Makefile.inc
@@ -55,6 +55,7 @@
CONFIG_GFX_GMA_PANEL_1_PORT := $(call strip_quotes,$(CONFIG_GFX_GMA_PANEL_1_PORT))
CONFIG_GFX_GMA_PANEL_2_PORT := $(call strip_quotes,$(CONFIG_GFX_GMA_PANEL_2_PORT))
CONFIG_GFX_GMA_ANALOG_I2C_PORT := $(call strip_quotes,$(CONFIG_GFX_GMA_ANALOG_I2C_PORT))
+CONFIG_GFX_GMA_IGNORE_PRESENCE_STRAPS := $(if $(filter y,$(CONFIG_GFX_GMA_IGNORE_PRESENCE_STRAPS)),True,False)
_GEN_NONCONST := $(strip \
$(if $(filter G45,$(CONFIG_GFX_GMA_GENERATION)),g45, \
@@ -79,6 +80,7 @@
-e's/<<PANEL_2_PORT>>/$(CONFIG_GFX_GMA_PANEL_2_PORT)/' \
-e's/<<ANALOG_I2C_PORT>>/$(CONFIG_GFX_GMA_ANALOG_I2C_PORT)/' \
-e's/<<DEFAULT_MMIO_BASE>>/$(CONFIG_GFX_GMA_DEFAULT_MMIO)/' \
+ -e's/<<IGNORE_STRAPS>>/$(CONFIG_GFX_GMA_IGNORE_PRESENCE_STRAPS)/' \
-e'/constant Gen_CPU\(_Var\)\?/d' \
-e's/<genbool>/constant Boolean/' \
-e's/<\(\(g45\|ilk\|hsw\|skl\)\(...\)\?\)bool>/<\1var> Boolean/' \
@@ -98,6 +100,7 @@
-e's/<<PANEL_2_PORT>>/$(CONFIG_GFX_GMA_PANEL_2_PORT)/' \
-e's/<<ANALOG_I2C_PORT>>/$(CONFIG_GFX_GMA_ANALOG_I2C_PORT)/' \
-e's/<<DEFAULT_MMIO_BASE>>/$(CONFIG_GFX_GMA_DEFAULT_MMIO)/' \
+ -e's/<<IGNORE_STRAPS>>/$(CONFIG_GFX_GMA_IGNORE_PRESENCE_STRAPS)/' \
-e":s$$(printf '\n ')/,$$/{N;s/,\n.*Dyn_CPU\(_Var\)\?[^,)]*//;ts$$(printf '\n ')P;D;}" \
-e'/Dyn_CPU\(_Var\)\?/d' \
-e's/<\(gen\|\(g45\|ilk\|hsw\|skl\)\(...\)\?\)bool>/constant Boolean/' \
diff --git a/common/haswell_shared/hw-gfx-gma-port_detect.adb b/common/haswell_shared/hw-gfx-gma-port_detect.adb
index 09136ff..5765941 100644
--- a/common/haswell_shared/hw-gfx-gma-port_detect.adb
+++ b/common/haswell_shared/hw-gfx-gma-port_detect.adb
@@ -88,7 +88,7 @@
end if;
-- DDI_A
- if Config.Has_Presence_Straps then
+ if Config.Has_Presence_Straps and not Config.Ignore_Presence_Straps then
Registers.Is_Set_Mask
(Register => Registers.DDI_BUF_CTL_A,
Mask => DDI_PORT_DETECTED (DIGI_A),
@@ -123,7 +123,7 @@
for Port in Ext_Digital_Port range
DIGI_B .. Ext_Digital_Port'Min (DIGI_D, Config.Last_Digital_Port)
loop
- if Config.Has_Presence_Straps then
+ if Config.Has_Presence_Straps and not Config.Ignore_Presence_Straps then
Registers.Is_Set_Mask
(Register => Registers.SFUSE_STRAP,
Mask => DDI_PORT_DETECTED (Port),
diff --git a/common/hw-gfx-gma-config.ads.template b/common/hw-gfx-gma-config.ads.template
index b9ba9f8..241fe8e 100644
--- a/common/hw-gfx-gma-config.ads.template
+++ b/common/hw-gfx-gma-config.ads.template
@@ -57,6 +57,8 @@
LVDS_Dual_Threshold : constant := 95_000_000;
+ Ignore_Presence_Straps : constant Boolean := <<IGNORE_STRAPS>>;
+
----------------------------------------------------------------------------
-- On older generations dot clocks are limited to 90% of