Nico Huber has submitted this change. ( https://review.coreboot.org/c/libgfxinit/+/35712 )
Change subject: gma: Allow private sub-packages to access PCI config ......................................................................
gma: Allow private sub-packages to access PCI config
Only export Read16() for now, which we need in a follow-up.
Change-Id: I2ca17cab0566d50000369263ab56e122ac6cbb8b Signed-off-by: Nico Huber nico.h@gmx.de Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/35712 Reviewed-by: Arthur Heymans arthur@aheymans.xyz --- M common/hw-gfx-gma.adb M common/hw-gfx-gma.ads 2 files changed, 22 insertions(+), 2 deletions(-)
Approvals: Nico Huber: Verified Arthur Heymans: Looks good to me, approved
diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb index 269feec..8352e1c 100644 --- a/common/hw-gfx-gma.adb +++ b/common/hw-gfx-gma.adb @@ -38,7 +38,8 @@ package body HW.GFX.GMA with Refined_State => (State => - (Dev.Address_State, + (PCI_Usable, + Dev.Address_State, Registers.Address_State, PCode.Mailbox_Ready, PLLs.State, Panel.Panel_State, @@ -384,7 +385,8 @@ (Input => (Time.State), In_Out => (Dev.PCI_State, Registers.Register_State, Port_IO.State), Output => - (Config.Variable, + (PCI_Usable, + Config.Variable, Dev.Address_State, Registers.Address_State, PCode.Mailbox_Ready, @@ -446,6 +448,7 @@
pragma Debug (Debug.Set_Register_Write_Delay (Write_Delay));
+ PCI_Usable := False; Linear_FB_Base := 0; PCode.Mailbox_Ready := False; Wait_For_HPD := HPD_Type'(others => False); @@ -470,6 +473,7 @@ Dev.Map (PCI_GTT_Base, PCI.Res0, Offset => MMIO_GTT_Offset); if PCI_MMIO_Base /= 0 and PCI_GTT_Base /= 0 then Registers.Set_Register_Base (PCI_MMIO_Base, PCI_GTT_Base); + PCI_Usable := True; else pragma Debug (Debug.Put_Line ("ERROR: Couldn't map resoure0.")); @@ -934,4 +938,11 @@ end loop; end Dump_Configs;
+ ---------------------------------------------------------------------------- + + procedure PCI_Read16 (Value : out Word16; Offset : HW.PCI.Index) is + begin + Dev.Read16 (Value, Offset); + end PCI_Read16; + end HW.GFX.GMA; diff --git a/common/hw-gfx-gma.ads b/common/hw-gfx-gma.ads index 353ec4b..3a4580e 100644 --- a/common/hw-gfx-gma.ads +++ b/common/hw-gfx-gma.ads @@ -15,6 +15,7 @@
with HW.Config; with HW.Time; +with HW.PCI; with HW.Port_IO; with HW.GFX.Framebuffer_Filler;
@@ -230,6 +231,14 @@
private
+ PCI_Usable : Boolean with Part_Of => State; + use type HW.PCI.Index; + procedure PCI_Read16 (Value : out Word16; Offset : HW.PCI.Index) + with + Pre => PCI_Usable and Offset mod 2 = 0; + + ---------------------------------------------------------------------------- + -- For the default framebuffer setup (see below) with 90 degree rotations, -- we expect the offset which is used for the final scanout to be above -- `GTT_Rotation_Offset`. So we can use `Offset - GTT_Rotation_Offset` for