<p>Nico Huber has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/21394">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">[WIP] gma: Implement PCI Id based generation check<br><br>We were used to sanity check the GPU generation by the audio id because<br>that was easily accessible in MMIO space and only one number per gene-<br>ration. It doesn't work on Skylake, though, so we read PCI ids instead.<br><br>Change-Id: Id6c9cfdb00664dc2c36b2cbd13136568829297d5<br>Signed-off-by: Nico Huber <nico.h@gmx.de><br>---<br>M common/hw-gfx-gma-config.ads.template<br>M common/hw-gfx-gma.adb<br>2 files changed, 57 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/94/21394/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/common/hw-gfx-gma-config.ads.template b/common/hw-gfx-gma-config.ads.template<br>index e82b133..ba08664 100644<br>--- a/common/hw-gfx-gma-config.ads.template<br>+++ b/common/hw-gfx-gma-config.ads.template<br>@@ -287,4 +287,46 @@<br> when Ironlake .. Haswell => 4,<br> when Broadwell .. Skylake => 8);<br> <br>+ ----------------------------------------------------------------------------<br>+<br>+ use type HW.Word16;<br>+<br>+ function Is_Broadwell_H (Device_Id : Word16) return Boolean is<br>+ (Device_Id = 16#1612# or Device_Id = 16#1622# or Device_Id = 16#162a#);<br>+<br>+ function Is_Skylake_U (Device_Id : Word16) return Boolean is<br>+ (Device_Id = 16#1906# or Device_Id = 16#1916# or Device_Id = 16#1923# or<br>+ Device_Id = 16#1926# or Device_Id = 16#1927#);<br>+<br>+ -- Rather catch too much here than too little,<br>+ -- it's only used to distinguish generations.<br>+ function Is_GPU (Device_Id : Word16; CPU : CPU_Type; CPU_Var : CPU_Variant)<br>+ return Boolean is<br>+ (case CPU is<br>+ when Ironlake => (Device_Id and 16#fff3#) = 16#0042#,<br>+ when Sandybridge => (Device_Id and 16#ffc2#) = 16#0102#,<br>+ when Ivybridge => (Device_Id and 16#ffc3#) = 16#0142#,<br>+ when Haswell =><br>+ (case CPU_Var is<br>+ when Normal => (Device_Id and 16#ffc3#) = 16#0402# or<br>+ (Device_Id and 16#ffc3#) = 16#0d02#,<br>+ when ULT => (Device_Id and 16#ffc3#) = 16#0a02#),<br>+ when Broadwell => ((Device_Id and 16#ffc3#) = 16#1602# or<br>+ (Device_Id and 16#ffcf#) = 16#160b# or<br>+ (Device_Id and 16#ffcf#) = 16#160d#) and<br>+ (case CPU_Var is<br>+ when Normal => Is_Broadwell_H (Device_Id),<br>+ when ULT => not Is_Broadwell_H (Device_Id)),<br>+ when Broxton => (Device_Id and 16#fffe#) = 16#5a84#,<br>+ when Skylake => ((Device_Id and 16#ffc3#) = 16#1902# or<br>+ (Device_Id and 16#ffcf#) = 16#190b# or<br>+ (Device_Id and 16#ffcf#) = 16#190d# or<br>+ (Device_Id and 16#fff9#) = 16#1921#) and<br>+ (case CPU_Var is<br>+ when Normal => not Is_Skylake_U (Device_Id),<br>+ when ULT => Is_Skylake_U (Device_Id)));<br>+<br>+ function Compatible_GPU (Device_Id : Word16) return Boolean is<br>+ (Is_GPU (Device_Id, CPU, CPU_Var));<br>+<br> end HW.GFX.GMA.Config;<br>diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb<br>index 6bc6fea..5198272 100644<br>--- a/common/hw-gfx-gma.adb<br>+++ b/common/hw-gfx-gma.adb<br>@@ -345,6 +345,17 @@<br> Audio_VID_DID = 16#8086_2805#,<br> when Ironlake => Audio_VID_DID = 16#0000_0000#);<br> end Check_Platform;<br>+<br>+ procedure Check_Platform_PCI (Success : out Boolean)<br>+ is<br>+ use type HW.Word16;<br>+ Vendor, Device : Word16;<br>+ begin<br>+ Dev.Read16 (Vendor, PCI.Vendor_Id);<br>+ Dev.Read16 (Device, PCI.Device_Id);<br>+<br>+ Success := Vendor = 16#8086# and Config.Compatible_GPU (Device);<br>+ end Check_Platform_PCI;<br> begin<br> pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));<br> <br>@@ -374,15 +385,16 @@<br> Registers.Set_Register_Base (Config.Default_MMIO_Base);<br> Success := Config.Default_MMIO_Base_Set;<br> end if;<br>+ Check_Platform_PCI (Success);<br> else<br> pragma Debug (Debug.Put_Line<br> ("WARNING: Couldn't initialize PCI dev."));<br> Registers.Set_Register_Base (Config.Default_MMIO_Base);<br> Success := Config.Default_MMIO_Base_Set;<br>- end if;<br> <br>- if Success then<br>- Check_Platform (Success);<br>+ if Success then<br>+ Check_Platform (Success);<br>+ end if;<br> end if;<br> <br> if not Success then<br></pre><p>To view, visit <a href="https://review.coreboot.org/21394">change 21394</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/21394"/><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: Id6c9cfdb00664dc2c36b2cbd13136568829297d5 </div>
<div style="display:none"> Gerrit-Change-Number: 21394 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Nico Huber <nico.h@gmx.de> </div>