Nico Huber has uploaded this change for review. ( https://review.coreboot.org/27065
Change subject: gma config: Group mutable state into a record ......................................................................
gma config: Group mutable state into a record
Put all state into a record, `Settings`, so it can be referenced at once in other packages. This is required to add stateful variables without changing the rest of the codebase.
Change-Id: Iffc7984b61e57cda7bdaf3b915a4fc51b396423a Signed-off-by: Nico Huber nico.h@gmx.de --- M common/hw-gfx-gma-config.ads.template M common/hw-gfx-gma-display_probing.adb M common/hw-gfx-gma-dp_aux_request.adb M common/hw-gfx-gma.adb 4 files changed, 24 insertions(+), 18 deletions(-)
git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/65/27065/1
diff --git a/common/hw-gfx-gma-config.ads.template b/common/hw-gfx-gma-config.ads.template index 5715e3b..a35c81e 100644 --- a/common/hw-gfx-gma-config.ads.template +++ b/common/hw-gfx-gma-config.ads.template @@ -14,7 +14,7 @@
private package HW.GFX.GMA.Config with - Initializes => (Valid_Port, Raw_Clock) + Initializes => Settings is
Gen : constant Generation := <<GEN>>; @@ -58,6 +58,23 @@
----------------------------------------------------------------------------
+ type Valid_Port_Array is array (Port_Type) of Boolean; + type Settings_T is record + Valid_Port : Valid_Port_Array; + Raw_Clock : Frequency_Type; + end record; + + Settings : Settings_T := + (Valid_Port => (others => False), + Raw_Clock => Frequency_Type'First) + with + Part_Of => GMA.Config_State; + + Valid_Port : Valid_Port_Array renames Settings.Valid_Port; + Raw_Clock : Frequency_Type renames Settings.Raw_Clock; + + ---------------------------------------------------------------------------- + Gen_G45 : constant Boolean := Gen = G45; Gen_Ironlake : constant Boolean := Gen = Ironlake; Gen_Haswell : constant Boolean := Gen = Haswell; @@ -186,10 +203,6 @@ Max_Pipe : constant Pipe_Index := (if Has_Tertiary_Pipe then Tertiary else Secondary);
- Valid_Port : array (Port_Type) of Boolean := (others => False) - with - Part_Of => GMA.Config_State; - Last_Digital_Port : constant Digital_Port := (if Has_DDI_E then DIGI_E else DIGI_C);
@@ -238,9 +251,6 @@ elsif Gen_Skylake then 24_000_000 else Frequency_Type'First);
- Raw_Clock : Frequency_Type := Default_RawClk_Freq - with Part_Of => GMA.Config_State; - ----------------------------------------------------------------------------
-- Maximum source width with enabled scaler. This only accounts diff --git a/common/hw-gfx-gma-display_probing.adb b/common/hw-gfx-gma-display_probing.adb index 50f9322..ed3ed45 100644 --- a/common/hw-gfx-gma-display_probing.adb +++ b/common/hw-gfx-gma-display_probing.adb @@ -164,10 +164,7 @@ Keep_Power : in Boolean := False) with Refined_Global => - (Input => - (GMA.Cur_Configs, - Config.Raw_Clock, Config.Valid_Port, - Time.State), + (Input => (GMA.Cur_Configs, Config.Settings, Time.State), In_Out => (Panel.Panel_State, Registers.Register_State), Proof_In => (Init_State)) is diff --git a/common/hw-gfx-gma-dp_aux_request.adb b/common/hw-gfx-gma-dp_aux_request.adb index 75a2cca..73662bd 100644 --- a/common/hw-gfx-gma-dp_aux_request.adb +++ b/common/hw-gfx-gma-dp_aux_request.adb @@ -163,7 +163,7 @@ Success : out Boolean) with Global => (In_Out => Registers.Register_State, - Input => (Time.State, Config.Raw_Clock)), + Input => (Time.State, Config.Settings)), Depends => ((Registers.Register_State, Response, @@ -171,7 +171,7 @@ Success) => (Registers.Register_State, - Config.Raw_Clock, + Config.Settings, Time.State, Port, Request, diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb index c1eaa51..cba75d6 100644 --- a/common/hw-gfx-gma.adb +++ b/common/hw-gfx-gma.adb @@ -44,7 +44,7 @@ HPD_Delay, Wait_For_HPD, Linear_FB_Base), Init_State => Initialized, - Config_State => (Config.Valid_Port, Config.Raw_Clock), + Config_State => (Config.Settings), Device_State => (Dev.PCI_State, Registers.Register_State, Registers.GTT_State)) is @@ -371,9 +371,8 @@ with Refined_Global => (In_Out => - (Config.Valid_Port, Dev.PCI_State, - Registers.Register_State, Port_IO.State, - Config.Raw_Clock), + (Config.Settings, Dev.PCI_State, + Registers.Register_State, Port_IO.State), Input => (Time.State), Output =>