Nico Huber has uploaded this change for review. ( https://review.coreboot.org/27138
Change subject: gma: Implement automatic CPU detection
......................................................................
gma: Implement automatic CPU detection
In dynamic CPU configurations, Config.Detect_CPU() sets the CPU
variables according to the given PCI device id. In static confi-
gurations it does nothing.
Change-Id: I8ce31c867f97c8d6ef99ca096cb45f7719e78a19
Signed-off-by: Nico Huber <nico.h(a)gmx.de>
---
M common/Makefile.inc
A common/dyncpu/hw-gfx-gma-config.adb
M common/hw-gfx-gma-config.ads.template
M common/hw-gfx-gma.adb
4 files changed, 39 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/38/27138/1
diff --git a/common/Makefile.inc b/common/Makefile.inc
index 815de90..50834fd 100644
--- a/common/Makefile.inc
+++ b/common/Makefile.inc
@@ -79,6 +79,7 @@
-e's/<\(ilk\|hsw\|skl\)\(...\)\?var>/$(_GEN_CONST_TARGET)/' \
-e's/\(.*: *<cpufunc>.*:=\) *\(.*\);/\1\n (\2);/' \
-e's/\([^ ]\+\) *: *<cpufunc> \+\([^ ]*\) *:=/function \1 return \2 is/' \
+ -e's/<cpunull>//' \
$< >$@
else
$(hw-gfx-gma-config-ads): $(dir)/hw-gfx-gma-config.ads.template $(cnf)
@@ -92,9 +93,11 @@
-e'/Dyn_CPU\(_Var\)\?/d' \
-e's/<\(gen\|\(ilk\|hsw\|skl\)\(...\)\?\)bool>/constant Boolean/' \
-e's/<\(\(ilk\|hsw\|skl\)\(...\)\?\)var>/constant/' \
+ -e's/<cpunull>/ is null/' \
$< >$@
endif
gfxinit-gen-y += $(hw-gfx-gma-config-ads)
+gfxinit-$(CONFIG_GFX_GMA_DYN_CPU) += dyncpu/hw-gfx-gma-config.adb
ifneq ($(filter G45,$(CONFIG_GFX_GMA_CPU)),)
subdirs-y += g45
diff --git a/common/dyncpu/hw-gfx-gma-config.adb b/common/dyncpu/hw-gfx-gma-config.adb
new file mode 100644
index 0000000..762ff6f
--- /dev/null
+++ b/common/dyncpu/hw-gfx-gma-config.adb
@@ -0,0 +1,31 @@
+--
+-- Copyright (C) 2018 Nico Huber <nico.h(a)gmx.de>
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+
+package body HW.GFX.GMA.Config
+is
+
+ procedure Detect_CPU (Device : Word16) is
+ begin
+ for CPU in Gen_CPU_Type loop
+ for CPU_Var in Gen_CPU_Variant loop
+ if Is_GPU (Device, CPU, CPU_Var) then
+ Config.CPU := CPU;
+ Config.CPU_Var := CPU_Var;
+ exit;
+ end if;
+ end loop;
+ end loop;
+ end Detect_CPU;
+
+end HW.GFX.GMA.Config;
diff --git a/common/hw-gfx-gma-config.ads.template b/common/hw-gfx-gma-config.ads.template
index 0cd1f89..c92f420 100644
--- a/common/hw-gfx-gma-config.ads.template
+++ b/common/hw-gfx-gma-config.ads.template
@@ -363,4 +363,8 @@
function Compatible_GPU (Device_Id : Word16) return Boolean is
(Is_GPU (Device_Id, CPU, CPU_Var));
+ pragma Warnings (GNATprove, Off, "subprogram ""Detect_CPU"" has no effect",
+ Reason => "only effective in dynamic cpu config");
+ procedure Detect_CPU (Device : Word16)<cpunull>;
+
end HW.GFX.GMA.Config;
diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb
index 885072c..19eb42b 100644
--- a/common/hw-gfx-gma.adb
+++ b/common/hw-gfx-gma.adb
@@ -425,6 +425,7 @@
Dev.Read16 (Vendor, PCI.Vendor_Id);
Dev.Read16 (Device, PCI.Device_Id);
+ Config.Detect_CPU (Device);
Success := Vendor = 16#8086# and Config.Compatible_GPU (Device);
end Check_Platform_PCI;
begin
--
To view, visit https://review.coreboot.org/27138
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: libgfxinit
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8ce31c867f97c8d6ef99ca096cb45f7719e78a19
Gerrit-Change-Number: 27138
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/27135 )
Change subject: google/lars,lili: Add SPD mapping for Hynix 8GB config
......................................................................
Patch Set 2:
Build Successful
https://qa.coreboot.org/job/coreboot-gerrit/75024/ : SUCCESS
--
To view, visit https://review.coreboot.org/27135
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Icf6588582da3b4a7861bced539d51a914b011dc4
Gerrit-Change-Number: 27135
Gerrit-PatchSet: 2
Gerrit-Owner: Matt DeVillier <matt.devillier(a)gmail.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Ren Kuo <ren.kuo(a)quantatw.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Sun, 17 Jun 2018 13:23:47 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: No