gma config: Introduce Have_HDMI_Buf_Override

Change-Id: Id00ae200cc8d08ce245d57b2886a40f0fea10167
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/27049
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/common/haswell/hw-gfx-gma-connectors-ddi-buffers.adb b/common/haswell/hw-gfx-gma-connectors-ddi-buffers.adb
index 57066b9..baceb10 100644
--- a/common/haswell/hw-gfx-gma-connectors-ddi-buffers.adb
+++ b/common/haswell/hw-gfx-gma-connectors-ddi-buffers.adb
@@ -120,11 +120,7 @@
    procedure Translations (Trans : out Buf_Trans_Array; Port : Digital_Port)
    is
       HDMI_Trans : constant DDI_HDMI_Buf_Trans_Range :=
-        (if (Config.CPU = Broadwell and
-             Config.DDI_HDMI_Buffer_Translation in Broadwell_HDMI_Range)
-            or
-            (Config.CPU /= Broadwell and
-             Config.DDI_HDMI_Buffer_Translation in Haswell_HDMI_Range)
+        (if Config.Have_HDMI_Buf_Override
          then Config.DDI_HDMI_Buffer_Translation
          else Config.Default_DDI_HDMI_Buffer_Translation);
    begin
diff --git a/common/haswell_shared/hw-gfx-gma-connectors-ddi.adb b/common/haswell_shared/hw-gfx-gma-connectors-ddi.adb
index 88f2b22..7f179ff 100644
--- a/common/haswell_shared/hw-gfx-gma-connectors-ddi.adb
+++ b/common/haswell_shared/hw-gfx-gma-connectors-ddi.adb
@@ -679,8 +679,7 @@
          then
             declare
                HDMI_Level : constant DDI_Phy.HDMI_Buf_Trans_Range :=
-                 (if Config.DDI_HDMI_Buffer_Translation
-                     in DDI_Phy.HDMI_Buf_Trans_Range
+                 (if Config.Have_HDMI_Buf_Override
                   then Config.DDI_HDMI_Buffer_Translation
                   else Config.Default_DDI_HDMI_Buffer_Translation);
             begin
diff --git a/common/hw-gfx-gma-config.ads.template b/common/hw-gfx-gma-config.ads.template
index 150937d..398b340 100644
--- a/common/hw-gfx-gma-config.ads.template
+++ b/common/hw-gfx-gma-config.ads.template
@@ -35,6 +35,7 @@
 
    ----------------------------------------------------------------------------
 
+   Have_HDMI_Buf_Override  : constant Boolean := DDI_HDMI_Buffer_Translation >= 0;
    Default_MMIO_Base_Set   : constant Boolean := Default_MMIO_Base /= 0;
 
    Has_Internal_Display    : constant Boolean := Internal_Display /= None;