[coreboot-gerrit] Change in libgfxinit[master]: gma registers: Draw usage of Config.Fence_Count into the code

Nico Huber (Code Review) gerrit at coreboot.org
Wed Jun 13 01:27:36 CEST 2018


Nico Huber has uploaded this change for review. ( https://review.coreboot.org/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 at gmx.de>
---
M common/hw-gfx-gma-registers.adb
1 file changed, 8 insertions(+), 5 deletions(-)



  git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/55/27055/1

diff --git a/common/hw-gfx-gma-registers.adb b/common/hw-gfx-gma-registers.adb
index 94965d5..fa53ebf 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 Registers_Range range 0 .. 31;
 
    FENCE_PAGE_SHIFT                    : constant := 12;
    FENCE_PAGE_MASK                     : constant := 16#ffff_f000#;
@@ -69,14 +69,15 @@
    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 .. Fence_Range (Config.Fence_Count - 1)
+      loop
          Regs.Write (Fence_Lower_Idx (Fence), 0);
       end loop;
    end Clear_Fences;
@@ -101,7 +102,8 @@
       pragma Debug (Debug.Put_Line (" tiles per row."));
 
       Success := False;
-      for Fence in Fence_Range loop
+      for Fence in Fence_Range range 0 .. Fence_Range (Config.Fence_Count - 1)
+      loop
          Regs.Read (Reg32, Fence_Lower_Idx (Fence));
          if (Reg32 and FENCE_VALID) = 0 then
             Regs.Write
@@ -127,7 +129,8 @@
          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 .. Fence_Range (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

-- 
To view, visit https://review.coreboot.org/27055
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: libgfxinit
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ab37f4cd9e6b4d37353ae4fd11d7e5a686d166f
Gerrit-Change-Number: 27055
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h at gmx.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180612/34252ae4/attachment-0001.html>


More information about the coreboot-gerrit mailing list