gma config: Fix framebuffer alignment check

The framebuffer stride has to be aligned to one cacheline (i.e.
64 bytes) and not to 64 pixels.

Change-Id: I8016b6c03b7908aff3ae72601d8d68cba065c7a0
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/17957
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
diff --git a/common/hw-gfx-gma-config_helpers.adb b/common/hw-gfx-gma-config_helpers.adb
index 31406cf..3a41baf 100644
--- a/common/hw-gfx-gma-config_helpers.adb
+++ b/common/hw-gfx-gma-config_helpers.adb
@@ -188,12 +188,16 @@
       Pipe        : Pipe_Index)
       return Boolean
    is
+      function To_Bytes (Pixels : Width_Type) return Pos32 is
+      begin
+         return Pos32 (Pixels) * 4 * Pos32 (Framebuffer.BPC) / 8;
+      end To_Bytes;
    begin
       -- No downscaling
       -- Respect maximum scalable width
       -- VGA plane is only allowed on the primary pipe
       -- Only 32bpp RGB (ignored for VGA plane)
-      -- Stride must be a multiple of 64 (ignored for VGA plane)
+      -- Stride must be a multiple of 64 bytes (ignored for VGA plane)
       return
          ((Framebuffer.Width = Pos32 (Port_Cfg.Mode.H_Visible) and
            Framebuffer.Height = Pos32 (Port_Cfg.Mode.V_Visible)) or
@@ -204,7 +208,7 @@
          and
          (Framebuffer.Offset = VGA_PLANE_FRAMEBUFFER_OFFSET or
           (Framebuffer.BPC = 8 and
-           Framebuffer.Stride mod 64 = 0));
+           To_Bytes (Framebuffer.Stride) mod 64 = 0));
    end Validate_Config;
 
 end HW.GFX.GMA.Config_Helpers;