gma broxton power/clocks: Turn pre-condition into code
In case `Config.Default_CDClk_Freq` is not constant, we have
to filter it.
Change-Id: I3ccafdc91a6e11fdc565e154f1394598a4572449
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/27054
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/common/broxton/hw-gfx-gma-power_and_clocks.adb b/common/broxton/hw-gfx-gma-power_and_clocks.adb
index 8aa9a21..f6576d9 100644
--- a/common/broxton/hw-gfx-gma-power_and_clocks.adb
+++ b/common/broxton/hw-gfx-gma-power_and_clocks.adb
@@ -216,12 +216,15 @@
CDClk_Ref : constant := 19_200_000;
- procedure Set_CDClk (Freq : Frequency_Type)
- with
- Pre =>
- Freq = CDClk_Ref or Freq = 144_000_000 or Freq = 288_000_000 or
- Freq = 384_000_000 or Freq = 576_000_000 or Freq = 624_000_000
+ procedure Set_CDClk (Freq_In : Frequency_Type)
is
+ Freq : constant Frequency_Type :=
+ (if Freq_In = CDClk_Ref then CDClk_Ref
+ elsif Freq_In <= 144_000_000 then 144_000_000
+ elsif Freq_In <= 288_000_000 then 288_000_000
+ elsif Freq_In <= 384_000_000 then 384_000_000
+ elsif Freq_In <= 576_000_000 then 576_000_000
+ else 624_000_000);
VCO : constant Int64 :=
CDClk_Ref *
(if Freq = CDClk_Ref then