gma: Add Map_Linear_FB()
Change-Id: Ia8850256b3a679e3b76567a6e3146e4c3dc38960
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/20609
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb
index 2dcaf1c..b3818a3 100644
--- a/common/hw-gfx-gma.adb
+++ b/common/hw-gfx-gma.adb
@@ -43,7 +43,8 @@
Registers.Address_State,
PLLs.State, Panel.Panel_State,
Cur_Configs, Allocated_PLLs,
- HPD_Delay, Wait_For_HPD),
+ HPD_Delay, Wait_For_HPD,
+ Linear_FB_Base),
Init_State => Initialized,
Config_State => Config.Valid_Port_GPU,
Device_State =>
@@ -78,6 +79,8 @@
Wait_For_HPD : HPD_Type;
Initialized : Boolean := False;
+ Linear_FB_Base : Word64;
+
----------------------------------------------------------------------------
PCH_RAWCLK_FREQ_MASK : constant := 16#3ff# * 2 ** 0;
@@ -312,7 +315,8 @@
Registers.Address_State,
PLLs.State, Panel.Panel_State,
Cur_Configs, Allocated_PLLs,
- HPD_Delay, Wait_For_HPD, Initialized))
+ HPD_Delay, Wait_For_HPD,
+ Linear_FB_Base, Initialized))
is
use type HW.Word64;
@@ -346,6 +350,7 @@
pragma Debug (Debug.Set_Register_Write_Delay (Write_Delay));
+ Linear_FB_Base := 0;
Wait_For_HPD := HPD_Type'(others => False);
HPD_Delay := HPD_Delay_Type'(others => Now);
Allocated_PLLs := (others => PLLs.Invalid);
@@ -597,16 +602,36 @@
use type HW.Word64;
Linear_FB : Word64;
begin
- Dev.Map (Linear_FB, PCI.Res2);
+ Map_Linear_FB (Linear_FB, FB);
if Linear_FB /= 0 then
- Framebuffer_Filler.Fill (Linear_FB + Word64 (FB.Offset), FB);
+ Framebuffer_Filler.Fill (Linear_FB, FB);
end if;
- pragma Debug
- (Linear_FB = 0, Debug.Put_Line ("Failed to map resource2."));
end;
end if;
end Setup_Default_FB;
+ procedure Map_Linear_FB (Linear_FB : out Word64; FB : in Framebuffer_Type)
+ is
+ use type HW.Word64;
+
+ Valid : Boolean;
+ begin
+ Linear_FB := 0;
+
+ if Linear_FB_Base = 0 then
+ Dev.Map (Linear_FB_Base, PCI.Res2);
+ pragma Debug
+ (Linear_FB_Base = 0, Debug.Put_Line ("Failed to map resource2."));
+ end if;
+
+ if Linear_FB_Base /= 0 then
+ Validate_FB (FB, Valid);
+ if Valid then
+ Linear_FB := Linear_FB_Base + Word64 (FB.Offset);
+ end if;
+ end if;
+ end Map_Linear_FB;
+
----------------------------------------------------------------------------
procedure Dump_Configs (Configs : Pipe_Configs)
diff --git a/common/hw-gfx-gma.ads b/common/hw-gfx-gma.ads
index 5b66803..3771804 100644
--- a/common/hw-gfx-gma.ads
+++ b/common/hw-gfx-gma.ads
@@ -101,6 +101,10 @@
with
Pre => Is_Initialized and HW.Config.Dynamic_MMIO;
+ procedure Map_Linear_FB (Linear_FB : out Word64; FB : in Framebuffer_Type)
+ with
+ Pre => Is_Initialized and HW.Config.Dynamic_MMIO;
+
private
----------------------------------------------------------------------------