mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-17 02:21:15 +00:00
gma: Implement PCI Id based generation check
We were used to sanity check the GPU generation by the audio id because that was easily accessible in MMIO space and only one number per gene- ration. It doesn't work on Skylake, though, so we read PCI ids instead. Change-Id: Id6c9cfdb00664dc2c36b2cbd13136568829297d5 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/21394 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
@@ -286,4 +286,46 @@ is
|
||||
when Ironlake .. Haswell => 4,
|
||||
when Broadwell .. Skylake => 8);
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
use type HW.Word16;
|
||||
|
||||
function Is_Broadwell_H (Device_Id : Word16) return Boolean is
|
||||
(Device_Id = 16#1612# or Device_Id = 16#1622# or Device_Id = 16#162a#);
|
||||
|
||||
function Is_Skylake_U (Device_Id : Word16) return Boolean is
|
||||
(Device_Id = 16#1906# or Device_Id = 16#1916# or Device_Id = 16#1923# or
|
||||
Device_Id = 16#1926# or Device_Id = 16#1927#);
|
||||
|
||||
-- Rather catch too much here than too little,
|
||||
-- it's only used to distinguish generations.
|
||||
function Is_GPU (Device_Id : Word16; CPU : CPU_Type; CPU_Var : CPU_Variant)
|
||||
return Boolean is
|
||||
(case CPU is
|
||||
when Ironlake => (Device_Id and 16#fff3#) = 16#0042#,
|
||||
when Sandybridge => (Device_Id and 16#ffc2#) = 16#0102#,
|
||||
when Ivybridge => (Device_Id and 16#ffc3#) = 16#0142#,
|
||||
when Haswell =>
|
||||
(case CPU_Var is
|
||||
when Normal => (Device_Id and 16#ffc3#) = 16#0402# or
|
||||
(Device_Id and 16#ffc3#) = 16#0d02#,
|
||||
when ULT => (Device_Id and 16#ffc3#) = 16#0a02#),
|
||||
when Broadwell => ((Device_Id and 16#ffc3#) = 16#1602# or
|
||||
(Device_Id and 16#ffcf#) = 16#160b# or
|
||||
(Device_Id and 16#ffcf#) = 16#160d#) and
|
||||
(case CPU_Var is
|
||||
when Normal => Is_Broadwell_H (Device_Id),
|
||||
when ULT => not Is_Broadwell_H (Device_Id)),
|
||||
when Broxton => (Device_Id and 16#fffe#) = 16#5a84#,
|
||||
when Skylake => ((Device_Id and 16#ffc3#) = 16#1902# or
|
||||
(Device_Id and 16#ffcf#) = 16#190b# or
|
||||
(Device_Id and 16#ffcf#) = 16#190d# or
|
||||
(Device_Id and 16#fff9#) = 16#1921#) and
|
||||
(case CPU_Var is
|
||||
when Normal => not Is_Skylake_U (Device_Id),
|
||||
when ULT => Is_Skylake_U (Device_Id)));
|
||||
|
||||
function Compatible_GPU (Device_Id : Word16) return Boolean is
|
||||
(Is_GPU (Device_Id, CPU, CPU_Var));
|
||||
|
||||
end HW.GFX.GMA.Config;
|
||||
|
||||
@@ -345,6 +345,17 @@ is
|
||||
Audio_VID_DID = 16#8086_2805#,
|
||||
when Ironlake => Audio_VID_DID = 16#0000_0000#);
|
||||
end Check_Platform;
|
||||
|
||||
procedure Check_Platform_PCI (Success : out Boolean)
|
||||
is
|
||||
use type HW.Word16;
|
||||
Vendor, Device : Word16;
|
||||
begin
|
||||
Dev.Read16 (Vendor, PCI.Vendor_Id);
|
||||
Dev.Read16 (Device, PCI.Device_Id);
|
||||
|
||||
Success := Vendor = 16#8086# and Config.Compatible_GPU (Device);
|
||||
end Check_Platform_PCI;
|
||||
begin
|
||||
pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
|
||||
|
||||
@@ -374,15 +385,19 @@ is
|
||||
Registers.Set_Register_Base (Config.Default_MMIO_Base);
|
||||
Success := Config.Default_MMIO_Base_Set;
|
||||
end if;
|
||||
|
||||
if Success then
|
||||
Check_Platform_PCI (Success);
|
||||
end if;
|
||||
else
|
||||
pragma Debug (Debug.Put_Line
|
||||
("WARNING: Couldn't initialize PCI dev."));
|
||||
Registers.Set_Register_Base (Config.Default_MMIO_Base);
|
||||
Success := Config.Default_MMIO_Base_Set;
|
||||
end if;
|
||||
|
||||
if Success then
|
||||
Check_Platform (Success);
|
||||
if Success then
|
||||
Check_Platform (Success);
|
||||
end if;
|
||||
end if;
|
||||
|
||||
if not Success then
|
||||
|
||||
Reference in New Issue
Block a user