gma ddi: Don't try to disable non-existent DDI D

Didn't hurt on Haswell-/Broadwell-U, but did lock up Broxton.

Change-Id: I6a47d0fba8cb6e59d8ace1ab64eed6182769a37b
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/18420
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/common/haswell_shared/hw-gfx-gma-connectors.adb b/common/haswell_shared/hw-gfx-gma-connectors.adb
index 15b3c12..734b11a 100644
--- a/common/haswell_shared/hw-gfx-gma-connectors.adb
+++ b/common/haswell_shared/hw-gfx-gma-connectors.adb
@@ -83,7 +83,7 @@
    procedure Post_All_Off
    is
    begin
-      for Port in Digital_Port range DIGI_A .. DIGI_D loop
+      for Port in Digital_Port range DIGI_A .. Config.Last_Digital_Port loop
          DDI.Off (Port);
       end loop;
       if Config.Is_FDI_Port (Analog) then
diff --git a/common/haswell_shared/hw-gfx-gma-port_detect.adb b/common/haswell_shared/hw-gfx-gma-port_detect.adb
index bf9fba5..b8ba37d 100644
--- a/common/haswell_shared/hw-gfx-gma-port_detect.adb
+++ b/common/haswell_shared/hw-gfx-gma-port_detect.adb
@@ -59,9 +59,6 @@
       Internal_Detected,
       DDI_Detected : Boolean;
 
-      Last_Digital_Port : constant Digital_Port :=
-        (if Config.Has_DDI_D then DIGI_D else DIGI_C);
-
       subtype Ext_Digital_Port is
          Digital_Port range DIGI_B .. DIGI_D;
       type Digital_Port_To_GMA_Port is array (Ext_Digital_Port) of Port_Type;
@@ -116,7 +113,7 @@
       Config.Valid_Port (Internal) := Internal_Detected;
 
       -- DDI_[BCD]
-      for Port in Ext_Digital_Port range DIGI_B .. Last_Digital_Port loop
+      for Port in Ext_Digital_Port range DIGI_B .. Config.Last_Digital_Port loop
          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 b3492f4..5ad6593 100644
--- a/common/hw-gfx-gma-config.ads.template
+++ b/common/hw-gfx-gma-config.ads.template
@@ -156,6 +156,9 @@
       Part_Of => GMA.Config_State;
    Valid_Port : Valid_Per_Port renames Valid_Port_GPU (CPU);
 
+   Last_Digital_Port : constant Digital_Port :=
+     (if Has_DDI_D then DIGI_D else DIGI_C);
+
    ----------------------------------------------------------------------------
 
    type FDI_Per_Port is array (Port_Type) of Boolean;