<p>Nico Huber has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/27138">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gma: Implement automatic CPU detection<br><br>In dynamic CPU configurations, Config.Detect_CPU() sets the CPU<br>variables according to the given PCI device id. In static confi-<br>gurations it does nothing.<br><br>Change-Id: I8ce31c867f97c8d6ef99ca096cb45f7719e78a19<br>Signed-off-by: Nico Huber <nico.h@gmx.de><br>---<br>M common/Makefile.inc<br>A common/dyncpu/hw-gfx-gma-config.adb<br>M common/hw-gfx-gma-config.ads.template<br>M common/hw-gfx-gma.adb<br>4 files changed, 39 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/38/27138/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/common/Makefile.inc b/common/Makefile.inc</span><br><span>index 815de90..50834fd 100644</span><br><span>--- a/common/Makefile.inc</span><br><span>+++ b/common/Makefile.inc</span><br><span>@@ -79,6 +79,7 @@</span><br><span>       -e's/<\(ilk\|hsw\|skl\)\(...\)\?var>/$(_GEN_CONST_TARGET)/' \</span><br><span>          -e's/\(.*: *<cpufunc>.*:=\) *\(.*\);/\1\n     (\2);/' \</span><br><span>        -e's/\([^ ]\+\) *: *<cpufunc> \+\([^ ]*\) *:=/function \1 return \2 is/' \</span><br><span style="color: hsl(120, 100%, 40%);">+      -e's/<cpunull>//' \</span><br><span>            $< >$@</span><br><span> else</span><br><span> $(hw-gfx-gma-config-ads): $(dir)/hw-gfx-gma-config.ads.template $(cnf)</span><br><span>@@ -92,9 +93,11 @@</span><br><span>          -e'/Dyn_CPU\(_Var\)\?/d' \</span><br><span>           -e's/<\(gen\|\(ilk\|hsw\|skl\)\(...\)\?\)bool>/constant Boolean/' \</span><br><span>            -e's/<\(\(ilk\|hsw\|skl\)\(...\)\?\)var>/constant/' \</span><br><span style="color: hsl(120, 100%, 40%);">+           -e's/<cpunull>/ is null/' \</span><br><span>            $< >$@</span><br><span> endif</span><br><span> gfxinit-gen-y += $(hw-gfx-gma-config-ads)</span><br><span style="color: hsl(120, 100%, 40%);">+gfxinit-$(CONFIG_GFX_GMA_DYN_CPU) += dyncpu/hw-gfx-gma-config.adb</span><br><span> </span><br><span> ifneq ($(filter G45,$(CONFIG_GFX_GMA_CPU)),)</span><br><span> subdirs-y += g45</span><br><span>diff --git a/common/dyncpu/hw-gfx-gma-config.adb b/common/dyncpu/hw-gfx-gma-config.adb</span><br><span>new file mode 100644</span><br><span>index 0000000..762ff6f</span><br><span>--- /dev/null</span><br><span>+++ b/common/dyncpu/hw-gfx-gma-config.adb</span><br><span>@@ -0,0 +1,31 @@</span><br><span style="color: hsl(120, 100%, 40%);">+--</span><br><span style="color: hsl(120, 100%, 40%);">+-- Copyright (C) 2018 Nico Huber <nico.h@gmx.de></span><br><span style="color: hsl(120, 100%, 40%);">+--</span><br><span style="color: hsl(120, 100%, 40%);">+-- This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+-- it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(120, 100%, 40%);">+-- the Free Software Foundation; either version 2 of the License, or</span><br><span style="color: hsl(120, 100%, 40%);">+-- (at your option) any later version.</span><br><span style="color: hsl(120, 100%, 40%);">+--</span><br><span style="color: hsl(120, 100%, 40%);">+-- This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+-- but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+-- GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+--</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+package body HW.GFX.GMA.Config</span><br><span style="color: hsl(120, 100%, 40%);">+is</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   procedure Detect_CPU (Device : Word16) is</span><br><span style="color: hsl(120, 100%, 40%);">+   begin</span><br><span style="color: hsl(120, 100%, 40%);">+      for CPU in Gen_CPU_Type loop</span><br><span style="color: hsl(120, 100%, 40%);">+         for CPU_Var in Gen_CPU_Variant loop</span><br><span style="color: hsl(120, 100%, 40%);">+            if Is_GPU (Device, CPU, CPU_Var) then</span><br><span style="color: hsl(120, 100%, 40%);">+               Config.CPU := CPU;</span><br><span style="color: hsl(120, 100%, 40%);">+               Config.CPU_Var := CPU_Var;</span><br><span style="color: hsl(120, 100%, 40%);">+               exit;</span><br><span style="color: hsl(120, 100%, 40%);">+            end if;</span><br><span style="color: hsl(120, 100%, 40%);">+         end loop;</span><br><span style="color: hsl(120, 100%, 40%);">+      end loop;</span><br><span style="color: hsl(120, 100%, 40%);">+   end Detect_CPU;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+end HW.GFX.GMA.Config;</span><br><span>diff --git a/common/hw-gfx-gma-config.ads.template b/common/hw-gfx-gma-config.ads.template</span><br><span>index 0cd1f89..c92f420 100644</span><br><span>--- a/common/hw-gfx-gma-config.ads.template</span><br><span>+++ b/common/hw-gfx-gma-config.ads.template</span><br><span>@@ -363,4 +363,8 @@</span><br><span>    function Compatible_GPU (Device_Id : Word16) return Boolean is</span><br><span>      (Is_GPU (Device_Id, CPU, CPU_Var));</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+   pragma Warnings (GNATprove, Off, "subprogram ""Detect_CPU"" has no effect",</span><br><span style="color: hsl(120, 100%, 40%);">+                    Reason => "only effective in dynamic cpu config");</span><br><span style="color: hsl(120, 100%, 40%);">+   procedure Detect_CPU (Device : Word16)<cpunull>;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> end HW.GFX.GMA.Config;</span><br><span>diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb</span><br><span>index 885072c..19eb42b 100644</span><br><span>--- a/common/hw-gfx-gma.adb</span><br><span>+++ b/common/hw-gfx-gma.adb</span><br><span>@@ -425,6 +425,7 @@</span><br><span>          Dev.Read16 (Vendor, PCI.Vendor_Id);</span><br><span>          Dev.Read16 (Device, PCI.Device_Id);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+         Config.Detect_CPU (Device);</span><br><span>          Success := Vendor = 16#8086# and Config.Compatible_GPU (Device);</span><br><span>       end Check_Platform_PCI;</span><br><span>    begin</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/27138">change 27138</a>. To unsubscribe, or for help writing mail filters, 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/27138"/><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: I8ce31c867f97c8d6ef99ca096cb45f7719e78a19 </div>
<div style="display:none"> Gerrit-Change-Number: 27138 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Nico Huber <nico.h@gmx.de> </div>