<p>Nico Huber has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/20609">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gma: Add Map_Linear_FB()<br><br>Change-Id: Ia8850256b3a679e3b76567a6e3146e4c3dc38960<br>Signed-off-by: Nico Huber <nico.h@gmx.de><br>---<br>M common/hw-gfx-gma.adb<br>M common/hw-gfx-gma.ads<br>2 files changed, 55 insertions(+), 18 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/09/20609/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb<br>index 5f7cafe..f6ddb84 100644<br>--- a/common/hw-gfx-gma.adb<br>+++ b/common/hw-gfx-gma.adb<br>@@ -43,7 +43,8 @@<br> Registers.Address_State,<br> PLLs.State, Panel.Panel_State,<br> Cur_Configs, Allocated_PLLs,<br>- HPD_Delay, Wait_For_HPD),<br>+ HPD_Delay, Wait_For_HPD,<br>+ Linear_FB_Addr),<br> Init_State => Initialized,<br> Config_State => Config.Valid_Port_GPU,<br> Device_State =><br>@@ -77,6 +78,8 @@<br> HPD_Delay : HPD_Delay_Type;<br> Wait_For_HPD : HPD_Type;<br> Initialized : Boolean := False;<br>+<br>+ Linear_FB_Addr : Word64;<br> <br> ----------------------------------------------------------------------------<br> <br>@@ -312,7 +315,8 @@<br> Registers.Address_State,<br> PLLs.State, Panel.Panel_State,<br> Cur_Configs, Allocated_PLLs,<br>- HPD_Delay, Wait_For_HPD, Initialized))<br>+ HPD_Delay, Wait_For_HPD,<br>+ Linear_FB_Addr, Initialized))<br> is<br> use type HW.Word64;<br> <br>@@ -346,6 +350,7 @@<br> <br> pragma Debug (Debug.Set_Register_Write_Delay (Write_Delay));<br> <br>+ Linear_FB_Addr := 0;<br> Wait_For_HPD := HPD_Type'(others => False);<br> HPD_Delay := HPD_Delay_Type'(others => Now);<br> Allocated_PLLs := (others => PLLs.Invalid);<br>@@ -545,6 +550,25 @@<br> end case;<br> end Decode_Stolen;<br> <br>+ procedure Validate_FB (FB : Framebuffer_Type; Valid : out Boolean)<br>+ with<br>+ Post => (if Valid then Valid_Phys_FB (FB))<br>+ is<br>+ GTT_Size : Natural;<br>+ Stolen_Size : Stolen_Size_Range;<br>+ begin<br>+ Valid := Valid_FB (FB);<br>+<br>+ if Valid then<br>+ Decode_Stolen (GTT_Size, Stolen_Size);<br>+ Valid :=<br>+ FB_Last_Page (FB) < GTT_Size / Config.GTT_PTE_Size and<br>+ FB_Last_Page (FB) < Natural (Stolen_Size / GTT_Page_Size);<br>+ pragma Debug (not Valid, Debug.Put<br>+ ("Stolen memory too small to hold framebuffer."));<br>+ end if;<br>+ end Validate_FB;<br>+<br> procedure Setup_Default_FB<br> (FB : in Framebuffer_Type;<br> Clear : in Boolean := True;<br>@@ -554,19 +578,8 @@<br> GMA_Phys_Base_Mask : constant := 16#fff0_0000#;<br> <br> Phys_Base : Word32;<br>- GTT_Size : Natural;<br>- Stolen_Size : Stolen_Size_Range;<br> begin<br>- Success := Valid_FB (FB);<br>-<br>- if Success then<br>- Decode_Stolen (GTT_Size, Stolen_Size);<br>- Success :=<br>- FB_Last_Page (FB) < GTT_Size / Config.GTT_PTE_Size and<br>- FB_Last_Page (FB) < Natural (Stolen_Size / GTT_Page_Size);<br>- pragma Debug (not Success, Debug.Put<br>- ("Stolen memory too small to hold framebuffer."));<br>- end if;<br>+ Validate_FB (FB, Success);<br> <br> if Success then<br> Dev.Read32 (Phys_Base, GMA_Phys_Base);<br>@@ -584,16 +597,36 @@<br> use type HW.Word64;<br> Linear_FB : Word64;<br> begin<br>- Dev.Map (Linear_FB, PCI.Res2);<br>+ Map_Linear_FB (Linear_FB, FB);<br> if Linear_FB /= 0 then<br>- Framebuffer_Filler.Fill (Linear_FB + Word64 (FB.Offset), FB);<br>+ Framebuffer_Filler.Fill (Linear_FB, FB);<br> end if;<br>- pragma Debug<br>- (Linear_FB = 0, Debug.Put_Line ("Failed to map resource2."));<br> end;<br> end if;<br> end Setup_Default_FB;<br> <br>+ procedure Map_Linear_FB (Linear_FB : out Word64; FB : in Framebuffer_Type)<br>+ is<br>+ use type HW.Word64;<br>+<br>+ Valid : Boolean;<br>+ begin<br>+ Linear_FB := 0;<br>+<br>+ if Linear_FB_Addr = 0 then<br>+ Dev.Map (Linear_FB_Addr, PCI.Res2);<br>+ pragma Debug<br>+ (Linear_FB_Addr = 0, Debug.Put_Line ("Failed to map resource2."));<br>+ end if;<br>+<br>+ if Linear_FB_Addr /= 0 then<br>+ Validate_FB (FB, Valid);<br>+ if Valid then<br>+ Linear_FB := Linear_FB_Addr + Word64 (FB.Offset);<br>+ end if;<br>+ end if;<br>+ end Map_Linear_FB;<br>+<br> ----------------------------------------------------------------------------<br> <br> procedure Dump_Configs (Configs : Pipe_Configs)<br>diff --git a/common/hw-gfx-gma.ads b/common/hw-gfx-gma.ads<br>index b693ff4..30dc45e 100644<br>--- a/common/hw-gfx-gma.ads<br>+++ b/common/hw-gfx-gma.ads<br>@@ -101,6 +101,10 @@<br> with<br> Pre => Is_Initialized and HW.Config.Dynamic_MMIO;<br> <br>+ procedure Map_Linear_FB (Linear_FB : out Word64; FB : in Framebuffer_Type)<br>+ with<br>+ Pre => Is_Initialized and HW.Config.Dynamic_MMIO;<br>+<br> private<br> <br> ----------------------------------------------------------------------------<br></pre><p>To view, visit <a href="https://review.coreboot.org/20609">change 20609</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/20609"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: libgfxinit </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ia8850256b3a679e3b76567a6e3146e4c3dc38960 </div>
<div style="display:none"> Gerrit-Change-Number: 20609 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Nico Huber <nico.h@gmx.de> </div>