Hello Arthur Heymans, Matt DeVillier, Thomas Heijligen,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/libgfxinit/+/35714
to review the following change.
Change subject: gma config: Allow to cache CDClk in variable config state ......................................................................
gma config: Allow to cache CDClk in variable config state
Add `CDClk` and `Max_CDClk` fields to the variable config state. They will be used to cache the current hardware state, so that we don't have to poke registers in every call to Update_Outputs().
Also introduce `CDClk_Range`, which is chosen such that common dot-clock limits (90% of CDClk) are in range of `Frequency_Type`.
Change-Id: I3d9c956eabcedb2f8299a1642ff0172cd7f54e45 Signed-off-by: Nico Huber nico.h@gmx.de --- M common/hw-gfx-gma-config.ads.template M common/hw-gfx-gma.ads 2 files changed, 15 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/14/35714/1
diff --git a/common/hw-gfx-gma-config.ads.template b/common/hw-gfx-gma-config.ads.template index d5bd2ba..bbfdc05 100644 --- a/common/hw-gfx-gma-config.ads.template +++ b/common/hw-gfx-gma-config.ads.template @@ -60,6 +60,8 @@ type Valid_Port_Array is array (Port_Type) of Boolean; type Variable_Config is record Valid_Port : Valid_Port_Array; + CDClk : CDClk_Range; + Max_CDClk : CDClk_Range; Raw_Clock : Frequency_Type; Dyn_CPU : Gen_CPU_Type; Dyn_CPU_Var : Gen_CPU_Variant; @@ -67,6 +69,8 @@
Initial_Settings : constant Variable_Config := (Valid_Port => (others => False), + CDClk => CDClk_Range'First, + Max_CDClk => CDClk_Range'First, Raw_Clock => Frequency_Type'First, Dyn_CPU => Gen_CPU_Type'First, Dyn_CPU_Var => Gen_CPU_Variant'First); @@ -74,6 +78,8 @@ Variable : Variable_Config with Part_Of => GMA.State;
Valid_Port : Valid_Port_Array renames Variable.Valid_Port; + CDClk : CDClk_Range renames Variable.CDClk; + Max_CDClk : CDClk_Range renames Variable.Max_CDClk; Raw_Clock : Frequency_Type renames Variable.Raw_Clock; CPU : Gen_CPU_Type renames Variable.Dyn_CPU; CPU_Var : Gen_CPU_Variant renames Variable.Dyn_CPU_Var; @@ -271,7 +277,7 @@
----------------------------------------------------------------------------
- Default_CDClk_Freq : <ilkhswvar> Frequency_Type := + Default_CDClk_Freq : <ilkhswvar> CDClk_Range := (if Gen_G45 then 320_000_000 -- unused elsif CPU_Ironlake then 450_000_000 elsif CPU_Sandybridge or CPU_Ivybridge then 400_000_000 @@ -279,7 +285,7 @@ elsif Gen_Haswell then 450_000_000 elsif Gen_Broxton then 288_000_000 elsif Gen_Skylake then 337_500_000 - else Frequency_Type'First); + else CDClk_Range'First);
Default_RawClk_Freq : <hswvar> Frequency_Type := (if Gen_G45 then 100_000_000 -- unused, depends on FSB diff --git a/common/hw-gfx-gma.ads b/common/hw-gfx-gma.ads index bdc4704..69df07d 100644 --- a/common/hw-gfx-gma.ads +++ b/common/hw-gfx-gma.ads @@ -206,6 +206,13 @@
private
+ -- Older Generations only allow dot clocks <= 90% of the CDClk. + -- Hence, to calculate the limit, CDClk must start higher. + subtype CDClk_Range is Frequency_Type + range Frequency_Type'First * 10 / 9 + 1 .. Frequency_Type'Last; + + ---------------------------------------------------------------------------- + PCI_Usable : Boolean with Part_Of => State; use type HW.PCI.Index; procedure PCI_Read16 (Value : out Word16; Offset : HW.PCI.Index)