Nico Huber has uploaded this change for review. ( https://review.coreboot.org/c/libgfxinit/+/83602?usp=email )
Change subject: gma connectors: Add Claim() and Prepare() steps ......................................................................
gma connectors: Add Claim() and Prepare() steps
Claim() ensures that we have a working connection, e.g. when things need to be mu'xed for Type-C ports. This is necessary in particular, before we probe an EDID.
Prepare() will be used to adapt a `Port_Config' to platform quirks. For instance the FDI usage on Ironlake, USB-C usage on Tiger Lake.
Change-Id: I2fb3ed026077f0371112682b90bea751a28bf994 Signed-off-by: Nico Huber nico.huber@secunet.com --- M common/g45/hw-gfx-gma-connectors.adb M common/haswell_shared/hw-gfx-gma-connectors.adb M common/hw-gfx-gma-connectors.ads M common/hw-gfx-gma-display_probing.adb M common/hw-gfx-gma.adb M common/ironlake/hw-gfx-gma-connectors.adb M common/tigerlake/hw-gfx-gma-connectors.adb 7 files changed, 98 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/02/83602/1
diff --git a/common/g45/hw-gfx-gma-connectors.adb b/common/g45/hw-gfx-gma-connectors.adb index ff689bb..3f1a80b 100644 --- a/common/g45/hw-gfx-gma-connectors.adb +++ b/common/g45/hw-gfx-gma-connectors.adb @@ -31,6 +31,22 @@
----------------------------------------------------------------------------
+ procedure Claim (Port : in Active_Port_Type; Success : out Boolean) is + begin + Success := True; + end Claim; + + procedure Prepare + (Port : in Active_Port_Type; + Port_Cfg : in out Port_Config; + Success : out Boolean) + is + begin + Success := True; + end Prepare; + + ---------------------------------------------------------------------------- + procedure Pre_On (Pipe : in Pipe_Index; Port_Cfg : in Port_Config; diff --git a/common/haswell_shared/hw-gfx-gma-connectors.adb b/common/haswell_shared/hw-gfx-gma-connectors.adb index e81322e..aff510e 100644 --- a/common/haswell_shared/hw-gfx-gma-connectors.adb +++ b/common/haswell_shared/hw-gfx-gma-connectors.adb @@ -33,6 +33,24 @@ DDI.Initialize; end Initialize;
+ ---------------------------------------------------------------------------- + + procedure Claim (Port : in Active_Port_Type; Success : out Boolean) is + begin + Success := True; + end Claim; + + procedure Prepare + (Port : in Active_Port_Type; + Port_Cfg : in out Port_Config; + Success : out Boolean) + is + begin + Success := True; + end Prepare; + + ---------------------------------------------------------------------------- + procedure Pre_On (Pipe : in Pipe_Index; Port_Cfg : in Port_Config; diff --git a/common/hw-gfx-gma-connectors.ads b/common/hw-gfx-gma-connectors.ads index a1d0d1e..c0a24a2 100644 --- a/common/hw-gfx-gma-connectors.ads +++ b/common/hw-gfx-gma-connectors.ads @@ -14,14 +14,25 @@
private package HW.GFX.GMA.Connectors is
+ pragma Warnings (GNATprove, Off, "unused variable ""P*""", + Reason => "Needed for a common interface"); + pragma Warnings (GNATprove, Off, """P*"" is not modified, could be IN", + Reason => "Needed for a common interface"); pragma Warnings (GNATprove, Off, "subprogram ""*"" has no effect", Reason => "Only effects some platforms"); procedure Post_Reset_Off; procedure Initialize; + procedure Claim (Port : in Active_Port_Type; Success : out Boolean); + procedure Prepare + (Port : in Active_Port_Type; + Port_Cfg : in out Port_Config; + Success : out Boolean) + with + Post => Port_Cfg.Mode = Port_Cfg'Old.Mode; + + pragma Warnings (GNATprove, On, """P*"" is not modified, could be IN"); pragma Warnings (GNATprove, On, "subprogram ""*"" has no effect");
- pragma Warnings (GNATprove, Off, "unused variable ""P*""", - Reason => "Needed for a common interface"); procedure Pre_On (Pipe : in Pipe_Index; Port_Cfg : in Port_Config; diff --git a/common/hw-gfx-gma-display_probing.adb b/common/hw-gfx-gma-display_probing.adb index 4625322..b66650b 100644 --- a/common/hw-gfx-gma-display_probing.adb +++ b/common/hw-gfx-gma-display_probing.adb @@ -19,6 +19,7 @@ with HW.GFX.GMA.I2C; with HW.GFX.GMA.DP_Aux_Ch; with HW.GFX.GMA.Panel; +with HW.GFX.GMA.Connectors; with HW.GFX.GMA.Port_Detect; with HW.GFX.GMA.Power_And_Clocks;
@@ -62,6 +63,12 @@ begin pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
+ Connectors.Claim (Port, Success); + if not Success then + Raw_EDID := (others => 16#00#); + return; + end if; + for I in 1 .. 2 loop if Config_Helpers.To_Display_Type (Port) = DP then -- May need power and CDClk to read EDID diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb index 46fb44b..c6fd909 100644 --- a/common/hw-gfx-gma.adb +++ b/common/hw-gfx-gma.adb @@ -155,6 +155,10 @@ (Port_Cfg, Pipe, Pipe_Cfg.Port, Pipe_Cfg.Mode, Success);
if Success then + Connectors.Prepare (Pipe_Cfg.Port, Port_Cfg, Success); + end if; + + if Success then Connector_Info.Preferred_Link_Setting (Port_Cfg, Success); end if;
@@ -308,6 +312,10 @@ Config_Helpers.Validate_Config (New_Config.Framebuffer, New_Config.Mode, Pipe);
+ if Success then + Connectors.Claim (New_Config.Port, Success); + end if; + if Success and then Requires_Scaling (New_Config) then Display_Controller.Reserve_Scaler (Success, Scaler_Reservation, Pipe); diff --git a/common/ironlake/hw-gfx-gma-connectors.adb b/common/ironlake/hw-gfx-gma-connectors.adb index 1c3a243..c1bec22 100644 --- a/common/ironlake/hw-gfx-gma-connectors.adb +++ b/common/ironlake/hw-gfx-gma-connectors.adb @@ -32,6 +32,24 @@ procedure Post_Reset_Off is null; procedure Initialize is null;
+ ---------------------------------------------------------------------------- + + procedure Claim (Port : in Active_Port_Type; Success : out Boolean) is + begin + Success := True; + end Claim; + + procedure Prepare + (Port : in Active_Port_Type; + Port_Cfg : in out Port_Config; + Success : out Boolean) + is + begin + Success := True; + end Prepare; + + ---------------------------------------------------------------------------- + function Is_Internal (Port_Cfg : Port_Config) return Boolean is begin diff --git a/common/tigerlake/hw-gfx-gma-connectors.adb b/common/tigerlake/hw-gfx-gma-connectors.adb index 5e66b96..e084b5c 100644 --- a/common/tigerlake/hw-gfx-gma-connectors.adb +++ b/common/tigerlake/hw-gfx-gma-connectors.adb @@ -30,6 +30,24 @@ pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); end Initialize;
+ --------------------------------------------------------------------- + + procedure Claim (Port : in Active_Port_Type; Success : out Boolean) is + begin + Success := True; + end Claim; + + procedure Prepare + (Port : in Active_Port_Type; + Port_Cfg : in out Port_Config; + Success : out Boolean) + is + begin + Success := False; + end; + + --------------------------------------------------------------------- + procedure Pre_On (Pipe : in Pipe_Index; Port_Cfg : in Port_Config;