gma: Allow offsets /= 0 in Setup_Default_GTT()
Honor the `Offset` field of the given framebuffer and add preconditions
that ensure we won't overflow the GTT or its target address space.
Change-Id: I6577e98e154610228734baee7674ee54b9a922e8
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/20602
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
diff --git a/common/hw-gfx.ads b/common/hw-gfx.ads
index 051b326..daf648d 100644
--- a/common/hw-gfx.ads
+++ b/common/hw-gfx.ads
@@ -1,5 +1,6 @@
--
-- Copyright (C) 2015-2016 secunet Security Networks AG
+-- Copyright (C) 2017 Nico Huber <nico.h@gmx.de>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@@ -35,6 +36,9 @@
Offset : Word32;
end record;
+ function FB_Size (FB : Framebuffer_Type) return Pos32 is
+ (FB.Stride * FB.Height * Pos32 (FB.BPC) / (8 / 4));
+
Default_FB : constant Framebuffer_Type := Framebuffer_Type'
(Width => 1,
Height => 1,