gma config: Group mutable state into a record
Put all state into a record, `Config.Variable`, so it can be referenced
at once from other packages. This is required to add stateful variables
to `Config` without changing the rest of the codebase.
Change-Id: Iffc7984b61e57cda7bdaf3b915a4fc51b396423a
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/27065
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/common/hw-gfx-gma-config.ads.template b/common/hw-gfx-gma-config.ads.template
index 6033dc0..ea42443 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 => Variable
is
Gen : constant Generation := <<GEN>>;
@@ -58,6 +58,23 @@
----------------------------------------------------------------------------
+ type Valid_Port_Array is array (Port_Type) of Boolean;
+ type Variable_Config is record
+ Valid_Port : Valid_Port_Array;
+ Raw_Clock : Frequency_Type;
+ end record;
+
+ Variable : Variable_Config :=
+ (Valid_Port => (others => False),
+ Raw_Clock => Frequency_Type'First)
+ with
+ Part_Of => GMA.Config_State;
+
+ Valid_Port : Valid_Port_Array renames Variable.Valid_Port;
+ Raw_Clock : Frequency_Type renames Variable.Raw_Clock;
+
+ ----------------------------------------------------------------------------
+
Gen_G45 : constant Boolean := Gen = G45;
Gen_Ironlake : constant Boolean := Gen = Ironlake;
Gen_Haswell : constant Boolean := Gen = Haswell;
@@ -187,10 +204,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);
@@ -239,9 +252,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