Nico Huber has submitted this change and it was merged. ( https://review.coreboot.org/c/libgfxinit/+/27055 )
Change subject: gma registers: Draw usage of Config.Fence_Count into the code ......................................................................
gma registers: Draw usage of Config.Fence_Count into the code
In case `Config.Fence_Count` is not a constant, we can't use it to declare `Fence_Range`. Instead, limit the range throughout the code.
Change-Id: I2ab37f4cd9e6b4d37353ae4fd11d7e5a686d166f Signed-off-by: Nico Huber nico.h@gmx.de Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/27055 Reviewed-by: Arthur Heymans arthur@aheymans.xyz --- M common/hw-gfx-gma-registers.adb 1 file changed, 5 insertions(+), 5 deletions(-)
Approvals: Nico Huber: Verified Arthur Heymans: Looks good to me, approved
diff --git a/common/hw-gfx-gma-registers.adb b/common/hw-gfx-gma-registers.adb index 94965d5..d7e02d9 100644 --- a/common/hw-gfx-gma-registers.adb +++ b/common/hw-gfx-gma-registers.adb @@ -61,7 +61,7 @@
----------------------------------------------------------------------------
- subtype Fence_Range is Registers_Range range 0 .. Config.Fence_Count - 1; + subtype Fence_Range is Natural range 0 .. 31;
FENCE_PAGE_SHIFT : constant := 12; FENCE_PAGE_MASK : constant := 16#ffff_f000#; @@ -69,14 +69,14 @@ FENCE_VALID : constant := 1 * 2 ** 0;
function Fence_Lower_Idx (Fence : Fence_Range) return Registers_Range is - (Config.Fence_Base / Register_Width + 2 * Fence); + (Registers_Range (Config.Fence_Base / Register_Width + 2 * Fence)); function Fence_Upper_Idx (Fence : Fence_Range) return Registers_Range is (Fence_Lower_Idx (Fence) + 1);
procedure Clear_Fences is begin - for Fence in Fence_Range loop + for Fence in Fence_Range range 0 .. Config.Fence_Count - 1 loop Regs.Write (Fence_Lower_Idx (Fence), 0); end loop; end Clear_Fences; @@ -101,7 +101,7 @@ pragma Debug (Debug.Put_Line (" tiles per row."));
Success := False; - for Fence in Fence_Range loop + for Fence in Fence_Range range 0 .. Config.Fence_Count - 1 loop Regs.Read (Reg32, Fence_Lower_Idx (Fence)); if (Reg32 and FENCE_VALID) = 0 then Regs.Write @@ -127,7 +127,7 @@ Shift_Left (Word32 (Last_Page), FENCE_PAGE_SHIFT); Fence_Upper, Fence_Lower : Word32; begin - for Fence in Fence_Range loop + for Fence in Fence_Range range 0 .. Config.Fence_Count - 1 loop Regs.Read (Fence_Lower, Fence_Lower_Idx (Fence)); Regs.Read (Fence_Upper, Fence_Upper_Idx (Fence)); if (Fence_Lower and FENCE_PAGE_MASK) = Page_Lower and