blob: 47316ecdc82c24ed0522ff30541d93e13087fc7a [file] [log] [blame]
Nico Huber83693c82016-10-08 22:17:55 +02001--
Nico Huber25fdb152019-02-17 15:54:39 +01002-- Copyright (C) 2015-2019 secunet Security Networks AG
Nico Huber83693c82016-10-08 22:17:55 +02003--
4-- This program is free software; you can redistribute it and/or modify
5-- it under the terms of the GNU General Public License as published by
Nico Huber125a29e2016-10-18 00:23:54 +02006-- the Free Software Foundation; either version 2 of the License, or
7-- (at your option) any later version.
Nico Huber83693c82016-10-08 22:17:55 +02008--
9-- This program is distributed in the hope that it will be useful,
10-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-- GNU General Public License for more details.
13--
14
Nico Huber4cafa4a2020-06-10 16:14:36 +020015with HW.PCI;
16
Nico Huber27088aa2018-06-10 13:28:05 +020017private package HW.GFX.GMA.Config is
Nico Huber83693c82016-10-08 22:17:55 +020018
Nico Huber6621a142018-06-07 23:56:54 +020019 Gen : constant Generation := <<GEN>>;
20
Nico Huberd7809ab2018-06-10 15:44:23 +020021 CPU_First : constant CPU_Type :=
22 (case Gen is
Nico Huberc505ae72024-07-21 20:03:38 +020023 when I945 => I945G,
24 when G45 => GM965,
25 when Ironlake => Ironlake,
26 when Haswell => Haswell,
27 when Broxton => Broxton,
28 when Skylake => Skylake,
29 when Tigerlake => Tigerlake,
30 when AlderlakeP => AlderlakeP);
Nico Huberd7809ab2018-06-10 15:44:23 +020031 CPU_Last : constant CPU_Type :=
32 (case Gen is
Nico Huberc505ae72024-07-21 20:03:38 +020033 when I945 => Pineview_M,
34 when G45 => GM45,
35 when Ironlake => Ivybridge,
36 when Haswell => Broadwell,
37 when Broxton => Broxton,
38 when Skylake => Kabylake,
39 when Tigerlake => Tigerlake,
40 when AlderlakeP => AlderlakeP);
41 CPU_Var_First : constant CPU_Variant :=
42 (case Gen is
43 when AlderlakeP => ULT,
44 when others => Normal);
Nico Huberd7809ab2018-06-10 15:44:23 +020045 CPU_Var_Last : constant CPU_Variant :=
46 (case Gen is
Nico Huberc505ae72024-07-21 20:03:38 +020047 when Haswell | Skylake => ULX,
48 when Tigerlake | AlderlakeP => ULT,
49 when others => Normal);
Nico Huberd7809ab2018-06-10 15:44:23 +020050 subtype Gen_CPU_Type is CPU_Type range CPU_First .. CPU_Last;
Nico Huberc505ae72024-07-21 20:03:38 +020051 subtype Gen_CPU_Variant is CPU_Variant range CPU_Var_First .. CPU_Var_Last;
Nico Huber83693c82016-10-08 22:17:55 +020052
Nico Huberd7809ab2018-06-10 15:44:23 +020053 CPU : constant Gen_CPU_Type := <<CPU>>;
54
55 CPU_Var : constant Gen_CPU_Variant := <<CPU_VARIANT>>;
Nico Huber83693c82016-10-08 22:17:55 +020056
Nico Hubere79babd2020-12-20 01:33:26 +010057 PCH_First : constant PCH_Type :=
58 (case Gen is
Nico Huberc505ae72024-07-21 20:03:38 +020059 when I945 => No_PCH,
60 when G45 => No_PCH,
61 when Ironlake => Ibex_Peak,
62 when Haswell => Lynx_Point,
63 when Broxton => No_PCH,
64 when Skylake => Sunrise_Point,
65 when Tigerlake => Tiger_Point,
66 when AlderlakeP => Alder_Point);
Nico Hubere79babd2020-12-20 01:33:26 +010067 PCH_Last : constant PCH_Type :=
68 (case Gen is
Nico Huberc505ae72024-07-21 20:03:38 +020069 when I945 => No_PCH,
70 when G45 => No_PCH,
71 when Ironlake => Cougar_Point,
72 when Haswell => Lynx_Point,
73 when Broxton => No_PCH,
74 when Skylake => Cannon_Point,
75 when Tigerlake => Tiger_Point,
76 when AlderlakeP => Alder_Point);
Nico Hubere79babd2020-12-20 01:33:26 +010077 subtype Gen_PCH_Type is PCH_Type range PCH_First .. PCH_Last;
78
79 PCH : constant Gen_PCH_Type := <<PCH>>;
80
Nico Huber2bbd6e72020-01-07 18:22:59 +010081 Panel_Ports : constant array (Valid_Panels) of Port_Type :=
Nico Huber5dbaf4b2020-01-08 17:24:58 +010082 (Panel_1 => <<PANEL_1_PORT>>,
83 Panel_2 => <<PANEL_2_PORT>>);
Nico Huber83693c82016-10-08 22:17:55 +020084
Nico Huberd55afeb2016-10-21 14:31:10 +020085 Analog_I2C_Port : constant PCH_Port := <<ANALOG_I2C_PORT>>;
86
Nico Huber83693c82016-10-08 22:17:55 +020087 EDP_Low_Voltage_Swing : constant Boolean := False;
88
Nico Huber247adf32017-06-12 14:39:11 +020089 DDI_HDMI_Buffer_Translation : constant Integer := -1;
90
Nico Huber4cafa4a2020-06-10 16:14:36 +020091 PCI_Dev : constant PCI.Address := <<PCI_DEV_ADDRESS>>;
92 Override_MMConf_Base : constant := <<OVERRIDE_MMCONF_BASE>>;
93 Default_MMIO_Base : constant := <<DEFAULT_MMIO_BASE>>;
Nico Huber83693c82016-10-08 22:17:55 +020094
95 LVDS_Dual_Threshold : constant := 95_000_000;
96
Matt DeVillier2a3dbba2020-05-14 17:34:13 -050097 Ignore_Presence_Straps : constant Boolean := <<IGNORE_STRAPS>>;
98
Nico Huber83693c82016-10-08 22:17:55 +020099 ----------------------------------------------------------------------------
100
Nico Huber07ff1b92019-09-29 00:03:17 +0200101 -- On older generations dot clocks are limited to 90% of
102 -- the CDClk rate. To ease proofs, we limit CDClk's range.
103 CDClk_Min : constant Frequency_Type :=
104 (case Gen is
Arthur Heymans960e2392026-03-03 19:45:24 +0100105 when I945 .. Ironlake => Frequency_Type'First * 100 / 90 + 1,
106 when others => Frequency_Type'First);
Nico Huber07ff1b92019-09-29 00:03:17 +0200107 subtype CDClk_Range is Frequency_Type range CDClk_Min .. Frequency_Type'Last;
108
109 ----------------------------------------------------------------------------
110
Nico Huber30e84082018-06-10 13:28:05 +0200111 type Valid_Port_Array is array (Port_Type) of Boolean;
112 type Variable_Config is record
113 Valid_Port : Valid_Port_Array;
Nico Huber07ff1b92019-09-29 00:03:17 +0200114 CDClk : CDClk_Range;
115 Max_CDClk : CDClk_Range;
Nico Huber30e84082018-06-10 13:28:05 +0200116 Raw_Clock : Frequency_Type;
Nico Huberadfe11f2018-06-10 14:59:04 +0200117 Dyn_CPU : Gen_CPU_Type;
118 Dyn_CPU_Var : Gen_CPU_Variant;
Nico Huber30e84082018-06-10 13:28:05 +0200119 end record;
120
Nico Huber27088aa2018-06-10 13:28:05 +0200121 Initial_Settings : constant Variable_Config :=
Nico Huber30e84082018-06-10 13:28:05 +0200122 (Valid_Port => (others => False),
Nico Huber07ff1b92019-09-29 00:03:17 +0200123 CDClk => CDClk_Range'First,
124 Max_CDClk => CDClk_Range'First,
Nico Huberadfe11f2018-06-10 14:59:04 +0200125 Raw_Clock => Frequency_Type'First,
126 Dyn_CPU => Gen_CPU_Type'First,
127 Dyn_CPU_Var => Gen_CPU_Variant'First);
Nico Huber27088aa2018-06-10 13:28:05 +0200128
Nico Hubere317e9c2019-09-29 03:03:18 +0200129 Variable : Variable_Config with Part_Of => GMA.State;
Nico Huber30e84082018-06-10 13:28:05 +0200130
131 Valid_Port : Valid_Port_Array renames Variable.Valid_Port;
Nico Huber07ff1b92019-09-29 00:03:17 +0200132 CDClk : CDClk_Range renames Variable.CDClk;
133 Max_CDClk : CDClk_Range renames Variable.Max_CDClk;
Nico Huber30e84082018-06-10 13:28:05 +0200134 Raw_Clock : Frequency_Type renames Variable.Raw_Clock;
Nico Huberadfe11f2018-06-10 14:59:04 +0200135 CPU : Gen_CPU_Type renames Variable.Dyn_CPU;
136 CPU_Var : Gen_CPU_Variant renames Variable.Dyn_CPU_Var;
Nico Huber30e84082018-06-10 13:28:05 +0200137
138 ----------------------------------------------------------------------------
139
Nico Huberd9365612018-06-10 14:59:04 +0200140 -- To support both static configurations, that are compiled for a
141 -- fixed CPU, and dynamic configurations, where the CPU and its
142 -- variant are detected at runtime, all derived config values are
143 -- tagged based on their dependencies.
144 --
145 -- Booleans that only depend on the generation should be tagged
146 -- <genbool>. Those that may depend on the CPU are tagged with the
147 -- generations where that is the case. For instance `CPU_Ivybridge`
148 -- can be decided purely based on the generation unless the gene-
149 -- ration is Ironlake, thus, it is tagged <ilkbool>.
150 --
151 -- For non-boolean constants, per generation tags <...var> are
152 -- used (e.g. <ilkvar>).
153 --
154 -- To ease parsing, all multiline expressions of tagged config
155 -- values start after a line break.
Nico Huber6621a142018-06-07 23:56:54 +0200156
Arthur Heymans960e2392026-03-03 19:45:24 +0100157 Gen_I945 : <genbool> := Gen = I945;
Nico Huberd9365612018-06-10 14:59:04 +0200158 Gen_G45 : <genbool> := Gen = G45;
159 Gen_Ironlake : <genbool> := Gen = Ironlake;
160 Gen_Haswell : <genbool> := Gen = Haswell;
161 Gen_Broxton : <genbool> := Gen = Broxton;
162 Gen_Skylake : <genbool> := Gen = Skylake;
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600163 Gen_Tigerlake : <genbool> := Gen = Tigerlake;
Nico Huberc505ae72024-07-21 20:03:38 +0200164 Gen_AlderlakeP : <genbool> := Gen = AlderlakeP;
Nico Huber6621a142018-06-07 23:56:54 +0200165
Arthur Heymans960e2392026-03-03 19:45:24 +0100166 Up_To_G45 : <genbool> := Gen <= G45;
Nico Huberd9365612018-06-10 14:59:04 +0200167 Up_To_Ironlake : <genbool> := Gen <= Ironlake;
Arthur Heymans960e2392026-03-03 19:45:24 +0100168 G45_On : <genbool> := Gen >= G45;
Nico Huberd9365612018-06-10 14:59:04 +0200169 Ironlake_On : <genbool> := Gen >= Ironlake;
170 Haswell_On : <genbool> := Gen >= Haswell;
171 Broxton_On : <genbool> := Gen >= Broxton;
172 Skylake_On : <genbool> := Gen >= Skylake;
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600173 Tigerlake_On : <genbool> := Gen >= Tigerlake;
Nico Huberc505ae72024-07-21 20:03:38 +0200174 AlderlakeP_On : <genbool> := Gen >= AlderlakeP;
Nico Huber998ee2b2018-06-12 23:02:17 +0200175
Arthur Heymans960e2392026-03-03 19:45:24 +0100176 GMCH_I945GM : <i945bool> := Gen_I945 and then CPU = I945GM;
Arthur Heymans3f37cce2026-03-03 18:52:12 +0100177 GMCH_GM965 : <g45bool> := Gen_G45 and then CPU = GM965;
Arthur Heymans6dc78432026-06-18 09:34:50 +0200178 CPU_Pineview : <i945bool> := Gen_I945 and then CPU = Pineview;
179 CPU_Pineview_M : <i945bool> := Gen_I945 and then CPU = Pineview_M;
180 CPU_Any_Pineview : <i945bool> := CPU_Pineview or CPU_Pineview_M;
181 GMCH_Gen3_Mobile : <i945bool> := GMCH_I945GM or CPU_Pineview_M;
Nico Huberb47a5c42019-09-29 00:07:21 +0200182 GMCH_GM45 : <g45bool> := Gen_G45 and then CPU = GM45;
Nico Huberd9365612018-06-10 14:59:04 +0200183 CPU_Ironlake : <ilkbool> := Gen_Ironlake and then CPU = Ironlake;
184 CPU_Sandybridge : <ilkbool> := Gen_Ironlake and then CPU = Sandybridge;
185 CPU_Ivybridge : <ilkbool> := Gen_Ironlake and then CPU = Ivybridge;
186 CPU_Haswell : <hswbool> := Gen_Haswell and then CPU = Haswell;
187 CPU_Broadwell : <hswbool> := Gen_Haswell and then CPU = Broadwell;
Nico Huber88badbe2018-09-27 16:36:47 +0200188 CPU_Skylake : <sklbool> := Gen_Skylake and then CPU = Skylake;
189 CPU_Kabylake : <sklbool> := Gen_Skylake and then CPU = Kabylake;
Nico Huberc505ae72024-07-21 20:03:38 +0200190 CPU_Tigerlake : <genbool> := Gen_Tigerlake;
191 CPU_AlderlakeP : <genbool> := Gen_AlderlakeP;
Nico Huberd9365612018-06-10 14:59:04 +0200192
193 Sandybridge_On : <ilkbool> :=
Nico Huber998ee2b2018-06-12 23:02:17 +0200194 ((Gen_Ironlake and then CPU >= Sandybridge) or Haswell_On);
Nico Huberd9365612018-06-10 14:59:04 +0200195 Ivybridge_On : <ilkbool> :=
Nico Huber998ee2b2018-06-12 23:02:17 +0200196 ((Gen_Ironlake and then CPU >= Ivybridge) or Haswell_On);
Nico Huberd9365612018-06-10 14:59:04 +0200197 Broadwell_On : <hswbool> :=
Nico Huber998ee2b2018-06-12 23:02:17 +0200198 ((Gen_Haswell and then CPU >= Broadwell) or Broxton_On);
199
Nico Hubere79babd2020-12-20 01:33:26 +0100200 PCH_Cougar_Point : <genbool> := Gen_Ironlake and then PCH = Cougar_Point;
201
202 Cougar_Point_On : <genbool> :=
203 ((Gen_Ironlake and then PCH >= Cougar_Point) or Haswell_On);
Nico Huberdde06302020-12-20 02:18:30 +0100204 Cannon_Point_On : <genbool> := Skylake_On and then PCH >= Cannon_Point;
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600205 Tiger_Point_On : <genbool> := Tigerlake_On and then PCH >= Tiger_Point;
Nico Hubere79babd2020-12-20 01:33:26 +0100206
Nico Huberc505ae72024-07-21 20:03:38 +0200207 pragma Warnings (GNAT, Off, "condition can only be * if invalid values present");
208 Is_ULT : <hswskltglbool> := CPU_Var = ULT;
209 Is_ULX : <hswsklbool> := CPU_Var = ULX;
210 Is_LP : <hswskltglbool> := Is_ULT or Is_ULX;
211 pragma Warnings (GNAT, On, "condition can only be * if invalid values present");
212
Nico Huber6621a142018-06-07 23:56:54 +0200213 ----------------------------------------------------------------------------
214
Nico Huber117db372018-06-09 17:56:05 +0200215 Have_HDMI_Buf_Override : constant Boolean := DDI_HDMI_Buffer_Translation >= 0;
Nico Huber2b6f6992017-07-09 18:11:34 +0200216 Default_MMIO_Base_Set : constant Boolean := Default_MMIO_Base /= 0;
217
Nico Huber1bc496f2017-06-09 22:23:28 +0200218 Have_DVI_I : constant Boolean := Analog_I2C_Port /= PCH_DAC;
Nico Huberd9365612018-06-10 14:59:04 +0200219
Arthur Heymans960e2392026-03-03 19:45:24 +0100220 Has_Presence_Straps : <genbool> := not Gen_Broxton and not Gen_I945;
Nico Huber83693c82016-10-08 22:17:55 +0200221
Nico Huberd9365612018-06-10 14:59:04 +0200222 ---------- CPU pipe: ---------
223 Has_Tertiary_Pipe : <ilkbool> := Ivybridge_On;
Arthur Heymans960e2392026-03-03 19:45:24 +0100224 Disable_Trickle_Feed : <genbool> := not Gen_Haswell and not Gen_I945;
Nico Huberd9365612018-06-10 14:59:04 +0200225 Pipe_Enabled_Workaround : <hswbool> := CPU_Broadwell;
Tim Wawrzynczak4be2e752022-09-09 10:37:06 -0600226 Has_EDP_Transcoder : <genbool> := Haswell_On and not Tigerlake_On;
Nico Huberd9365612018-06-10 14:59:04 +0200227 Use_PDW_For_EDP_Scaling : <hswbool> := CPU_Haswell;
228 Has_Pipe_DDI_Func : <genbool> := Haswell_On;
229 Has_Trans_Clk_Sel : <genbool> := Haswell_On;
230 Has_Pipe_MSA_Misc : <genbool> := Haswell_On;
231 Has_Pipeconf_Misc : <hswbool> := Broadwell_On;
232 Has_Pipeconf_BPC : <hswbool> := not CPU_Haswell;
233 Has_Plane_Control : <genbool> := Broxton_On;
Nico Huberfb6dbad2026-04-10 16:23:39 +0000234 Needs_Even_Source_Width : <genbool> := Tigerlake_On;
235 Has_Skylake_Scaler_Limits : <genbool> := Gen_Broxton or Gen_Skylake;
Nico Huberd9365612018-06-10 14:59:04 +0200236 Has_DSP_Linoff : <genbool> := Up_To_Ironlake;
Arthur Heymans960e2392026-03-03 19:45:24 +0100237 Has_DSPSURF : <genbool> := G45_On;
Nico Huberd9365612018-06-10 14:59:04 +0200238 Has_PF_Pipe_Select : <ilkhswbool> := CPU_Ivybridge or CPU_Haswell;
Nico Huber75a707f2018-06-18 16:28:33 +0200239 Has_Ivybridge_Cursors : <ilkbool> := Ivybridge_On;
Nico Huberd9365612018-06-10 14:59:04 +0200240 VGA_Plane_Workaround : <ilkbool> := CPU_Ivybridge;
241 Has_GMCH_DP_Transcoder : <genbool> := Gen_G45;
Arthur Heymans960e2392026-03-03 19:45:24 +0100242 Has_GMCH_VGACNTRL : <genbool> := Up_To_G45;
243 Has_GMCH_PFIT_CONTROL : <genbool> := Up_To_G45;
Nico Huber83693c82016-10-08 22:17:55 +0200244
Tim Wawrzynczak4be2e752022-09-09 10:37:06 -0600245 ----------- Transcoder -------
246 Need_Early_Transcoder_Setup : <genbool> := Tigerlake_On;
Nico Huber09472732026-04-20 22:33:33 +0200247 Continuous_Port_Select : <genbool> := AlderlakeP_On;
Nico Huberc505ae72024-07-21 20:03:38 +0200248 Need_Pipe_Arb_Slots : <genbool> := AlderlakeP_On;
Tim Wawrzynczak0da761a2022-09-09 10:42:36 -0600249
250 ----------- Planes -----------
Nico Huber7edb1a72026-05-27 21:10:10 +0200251 Has_Mbus_Abox_Credits : <genbool> := Gen_Tigerlake;
Tim Wawrzynczak0da761a2022-09-09 10:42:36 -0600252 Has_Mbus_Dbox_Credits : <genbool> := Tigerlake_On;
Nico Huberc505ae72024-07-21 20:03:38 +0200253 Has_New_Mbus_Dbox_Credits : <genbool> := AlderlakeP_On;
Nico Huber7edb1a72026-05-27 21:10:10 +0200254 Has_Mbus_Joining : <genbool> := AlderlakeP_On;
Tim Wawrzynczak0da761a2022-09-09 10:42:36 -0600255 Has_Wide_Watermarks : <genbool> := Tigerlake_On;
256 Has_Plane_Color_Control : <genbool> := Tigerlake_On;
Tim Wawrzynczak0da761a2022-09-09 10:42:36 -0600257
258 ----------- Pipe -------------
Nico Huberc505ae72024-07-21 20:03:38 +0200259 Need_Underrun_Rec_Disable : <genbool> := AlderlakeP_On;
Tim Wawrzynczak4be2e752022-09-09 10:37:06 -0600260
Nico Huberd9365612018-06-10 14:59:04 +0200261 --------- Panel power: -------
262 Has_PP_Write_Protection : <genbool> := Up_To_Ironlake;
263 Has_PP_Port_Select : <genbool> := Up_To_Ironlake;
264 Use_PP_VDD_Override : <genbool> := Up_To_Ironlake;
265 Has_PCH_Panel_Power : <genbool> := Ironlake_On;
Nico Huberdde06302020-12-20 02:18:30 +0100266 Has_PP_Divisor_Reg : <genbool> :=
267 (not Gen_Broxton and not Cannon_Point_On);
268 Has_New_Backlight_Control : <genbool> := Gen_Broxton or Cannon_Point_On;
Nico Huber83693c82016-10-08 22:17:55 +0200269
Nico Huberd9365612018-06-10 14:59:04 +0200270 ----------- PCH/FDI: ---------
Nico Hubere79babd2020-12-20 01:33:26 +0100271 Has_PCH : <genbool> := PCH /= No_PCH;
Nico Huberd9365612018-06-10 14:59:04 +0200272 Has_PCH_DAC : <hswbool> :=
Nico Huber25fdb152019-02-17 15:54:39 +0100273 (Gen_Ironlake or (Gen_Haswell and then not Is_LP));
Nico Huber83693c82016-10-08 22:17:55 +0200274
Nico Huberd9365612018-06-10 14:59:04 +0200275 Has_PCH_Aux_Channels : <genbool> := Gen_Ironlake or Gen_Haswell;
Nico Huber83693c82016-10-08 22:17:55 +0200276
Nico Huberd9365612018-06-10 14:59:04 +0200277 VGA_Has_Sync_Disable : <genbool> := Up_To_Ironlake;
Nico Huber83693c82016-10-08 22:17:55 +0200278
Nico Huberd9365612018-06-10 14:59:04 +0200279 Has_Trans_Timing_Ovrrde : <ilkbool> := Sandybridge_On;
Nico Huber83693c82016-10-08 22:17:55 +0200280
Nico Huberd9365612018-06-10 14:59:04 +0200281 Has_DPLL_SEL : <genbool> := Gen_Ironlake;
282 Has_FDI_BPC : <genbool> := Gen_Ironlake;
283 Has_FDI_Composite_Sel : <ilkbool> := CPU_Ivybridge;
Nico Hubere79babd2020-12-20 01:33:26 +0100284 Has_New_FDI_Sink : <genbool> := Cougar_Point_On;
Nico Huberd9365612018-06-10 14:59:04 +0200285 Has_New_FDI_Source : <ilkbool> := Ivybridge_On;
Nico Hubere79babd2020-12-20 01:33:26 +0100286 Has_Trans_DP_Ctl : <genbool> := PCH_Cougar_Point;
Nico Huberd9365612018-06-10 14:59:04 +0200287 Has_FDI_C : <ilkbool> := CPU_Ivybridge;
Nico Huber83693c82016-10-08 22:17:55 +0200288
Nico Huberd9365612018-06-10 14:59:04 +0200289 Has_FDI_RX_Power_Down : <genbool> := Gen_Haswell;
Nico Huber83693c82016-10-08 22:17:55 +0200290
Nico Huberd0f84b92019-09-22 21:31:52 +0200291 ---------- Clocks: -----------
Arthur Heymans960e2392026-03-03 19:45:24 +0100292 Has_GMCH_RawClk : <genbool> := Up_To_G45;
Arthur Heymans3f37cce2026-03-03 18:52:12 +0100293 Has_GMCH_Mobile_VCO : <g45bool> := GMCH_GM45 or GMCH_GM965;
Arthur Heymans960e2392026-03-03 19:45:24 +0100294
Arthur Heymans6dc78432026-06-18 09:34:50 +0200295 ---------- Gen3/i945-specific: ----
Arthur Heymans960e2392026-03-03 19:45:24 +0100296 Has_I945_GTT_BAR : <genbool> := Gen_I945;
Arthur Heymans6dc78432026-06-18 09:34:50 +0200297 Has_I945_Simple_GTT_PTE : <i945bool> := Gen_I945 and then not CPU_Any_Pineview;
Arthur Heymans960e2392026-03-03 19:45:24 +0100298 Has_Gen3_Fences : <genbool> := Gen_I945;
299 -- Pre-i965: LVDS encoder can only source from Pipe B (Secondary)
300 LVDS_Needs_Pipe_B : <genbool> := Gen_I945;
301 -- Pre-Gen5: DSPCNTR has a pipe select field (bits 25:24)
302 Has_DSPCNTR_Pipe_Select : <genbool> := Up_To_G45;
303 -- Gen3: Plane A feeds Pipe B, Plane B feeds Pipe A (for FBC + LVDS)
304 Planes_Pipes_Swapped : <genbool> := Gen_I945;
Nico Huberd0f84b92019-09-22 21:31:52 +0200305 Has_Broadwell_CDClk : <hswbool> := CPU_Broadwell;
306 Can_Switch_CDClk : <hswbool> := Broadwell_On;
Nico Huberdde06302020-12-20 02:18:30 +0100307 Has_Fractional_RawClk : <genbool> := Cannon_Point_On;
Nico Huberc505ae72024-07-21 20:03:38 +0200308 Has_New_Type_C_PLL_Enable : <genbool> := AlderlakeP_On;
Arthur Heymans73ea0322018-03-28 17:17:07 +0200309
Nico Huberd9365612018-06-10 14:59:04 +0200310 ----------- DDI: -------------
311 End_EDP_Training_Late : <genbool> := Gen_Haswell;
312 Has_Per_DDI_Clock_Sel : <genbool> := Gen_Haswell;
313 Has_HOTPLUG_CTL : <genbool> := Gen_Haswell;
314 Has_SHOTPLUG_CTL_A : <hswbool> :=
Nico Huber25fdb152019-02-17 15:54:39 +0100315 ((Gen_Haswell and then Is_LP) or Skylake_On);
Nico Huberd920d252023-02-09 13:23:27 +0000316 Has_Hotplug_Invert : <genbool> := Gen_Broxton;
Nico Huber83693c82016-10-08 22:17:55 +0200317
Nico Huberd9365612018-06-10 14:59:04 +0200318 Has_DDI_PHYs : <genbool> := Gen_Broxton;
Nico Huber19729a72017-07-30 01:05:05 +0200319
Nico Huberd9365612018-06-10 14:59:04 +0200320 Has_DDI_D : <hswsklbool> :=
Nico Huber25fdb152019-02-17 15:54:39 +0100321 ((Gen_Haswell or Gen_Skylake) and then not Is_LP);
Nico Huberd9365612018-06-10 14:59:04 +0200322 -- might be disabled by x4 eDP:
323 Has_DDI_E : <hswsklbool> := Has_DDI_D;
Nico Huber83693c82016-10-08 22:17:55 +0200324
Tim Wawrzynczak4be2e752022-09-09 10:37:06 -0600325 Has_TGL_DDI_Select : <genbool> := Tigerlake_On;
326
Nico Huberd9365612018-06-10 14:59:04 +0200327 Has_DDI_Buffer_Trans : <genbool> := Haswell_On and not Has_DDI_PHYs;
328 Has_Low_Voltage_Swing : <genbool> := Broxton_On;
329 Has_Iboost_Config : <genbool> := Skylake_On;
Nico Huber88badbe2018-09-27 16:36:47 +0200330 Use_KBL_DDI_Buf_Trans : <sklbool> := CPU_Kabylake;
Nico Huber83693c82016-10-08 22:17:55 +0200331
Nico Huberd9365612018-06-10 14:59:04 +0200332 Need_DP_Aux_Mutex : <genbool> := False; -- Skylake & (PSR | GTC)
Nico Huber83693c82016-10-08 22:17:55 +0200333
Nico Huber25fdb152019-02-17 15:54:39 +0100334 ----- DP: --------------------
335 DP_Max_2_7_GHz : <hswbool> :=
336 (not Haswell_On or else (CPU_Haswell and Is_ULX));
337
Nico Huberd9365612018-06-10 14:59:04 +0200338 ----------- GMBUS: -----------
Tim Wawrzynczak732feb42022-09-09 10:32:37 -0600339 Ungate_GMBUS_Unit_Level : <genbool> := Skylake_On and not Tigerlake_On;
Nico Huberdde06302020-12-20 02:18:30 +0100340 GMBUS_Alternative_Pins : <genbool> := Gen_Broxton or Cannon_Point_On;
Nico Huberd9365612018-06-10 14:59:04 +0200341 Has_PCH_GMBUS : <genbool> := Ironlake_On;
Arthur Heymans960e2392026-03-03 19:45:24 +0100342 Has_GMCH_GMBUS : <genbool> := Up_To_G45;
Nico Huber83693c82016-10-08 22:17:55 +0200343
Nico Huberd9365612018-06-10 14:59:04 +0200344 ----------- Power: -----------
345 Has_IPS : <hswbool> :=
Nico Huber998ee2b2018-06-12 23:02:17 +0200346 (Gen_Haswell and then
Nico Huber25fdb152019-02-17 15:54:39 +0100347 ((CPU_Haswell and Is_LP) or CPU_Broadwell));
Nico Huberd9365612018-06-10 14:59:04 +0200348 Has_IPS_CTL_Mailbox : <hswbool> := CPU_Broadwell;
Nico Huber83693c82016-10-08 22:17:55 +0200349
Nico Huberd9365612018-06-10 14:59:04 +0200350 Has_Per_Pipe_SRD : <hswbool> := Broadwell_On;
Nico Huber83693c82016-10-08 22:17:55 +0200351
Nico Huberd9365612018-06-10 14:59:04 +0200352 ----------- GTT: -------------
353 Has_64bit_GTT : <hswbool> := Broadwell_On;
Nico Huber83693c82016-10-08 22:17:55 +0200354
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600355 ----------- Type-C: ----------
356 Has_Type_C_Ports : <genbool> := Tigerlake_On;
Nico Huber80b25df2024-08-28 00:03:29 +0200357 Need_TC_PHY_Ownership : <genbool> := AlderlakeP_On;
358 Need_TC_Loadgen_Select : <genbool> := AlderlakeP_On;
359 Need_TBT_DP_Alt_Switch_Wa : <genbool> := AlderlakeP_On;
360 Block_TC_Cold : <genbool> := Gen_Tigerlake;
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600361
Tim Wawrzynczakfc49b602022-09-09 10:29:24 -0600362 ----------- Rawclk -----------
363 Need_Rawclk_Numerator : <genbool> := Tigerlake_On;
364
Tim Wawrzynczak5473d292023-02-06 16:46:33 -0700365 ----------- Combo Phy --------
Nico Huberc505ae72024-07-21 20:03:38 +0200366 Has_TGL_Buffer_Translations : <genbool> := CPU_Tigerlake;
Tim Wawrzynczak5473d292023-02-06 16:46:33 -0700367
Nico Huber83693c82016-10-08 22:17:55 +0200368 ----------------------------------------------------------------------------
369
Nico Huberd9365612018-06-10 14:59:04 +0200370 Max_Pipe : <ilkvar> Pipe_Index :=
Nico Huberd58de7d2018-06-07 23:06:55 +0200371 (if Has_Tertiary_Pipe then Tertiary else Secondary);
Nico Huber83693c82016-10-08 22:17:55 +0200372
Nico Huberd9365612018-06-10 14:59:04 +0200373 Last_Digital_Port : <hswsklvar> Digital_Port :=
Nico Huber208857d2017-07-29 21:30:24 +0200374 (if Has_DDI_E then DIGI_E else DIGI_C);
Nico Huberac455ad2017-02-14 14:41:19 +0100375
Tim Wawrzynczak5473d292023-02-06 16:46:33 -0700376 Last_TC_Port : constant GPU_Port :=
Nico Huber6ff49532024-06-24 16:22:48 +0000377 (if not Tigerlake_On then DIGI_E -- Makes 'First..Last_TC_Port empty.
378 else DDI_TC4);
379
Nico Huber83693c82016-10-08 22:17:55 +0200380 ----------------------------------------------------------------------------
381
Nico Huber3c544ee2016-11-20 04:56:58 +0100382 type FDI_Per_Port is array (Port_Type) of Boolean;
Nico Huberd9365612018-06-10 14:59:04 +0200383 Is_FDI_Port : <hswvar> FDI_Per_Port :=
Nico Huber6621a142018-06-07 23:56:54 +0200384 (Disabled => False,
Nico Huber8beafd72020-01-07 14:59:44 +0100385 eDP => False,
386 LVDS => Gen_Ironlake,
Nico Huberad096092024-07-02 18:45:44 +0200387 DP1 .. DP3 => Gen_Ironlake,
388 HDMI1 .. HDMI3 => Gen_Ironlake,
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600389 Analog => Has_PCH_DAC,
390 others => False);
Nico Huber83693c82016-10-08 22:17:55 +0200391
392 type FDI_Lanes_Per_Port is array (GPU_Port) of DP_Lane_Count;
393 FDI_Lane_Count : constant FDI_Lanes_Per_Port :=
394 (DIGI_D => DP_Lane_Count_2,
Nico Huber6621a142018-06-07 23:56:54 +0200395 others => (if Gen_Ironlake then DP_Lane_Count_4 else DP_Lane_Count_2));
Nico Huber83693c82016-10-08 22:17:55 +0200396
Nico Huberd9365612018-06-10 14:59:04 +0200397 FDI_Training : <ilkvar> FDI_Training_Type :=
Nico Huber998ee2b2018-06-12 23:02:17 +0200398 (if CPU_Ironlake then Simple_Training
399 elsif CPU_Sandybridge then Full_Training
400 else Auto_Training);
Nico Huber83693c82016-10-08 22:17:55 +0200401
Nico Huberf54d0962016-10-20 14:17:18 +0200402 ----------------------------------------------------------------------------
403
Nico Huber88badbe2018-09-27 16:36:47 +0200404 DDI_Buffer_Iboost : <hswsklvar> Natural :=
405 (if Is_ULX or (CPU_Kabylake and Is_ULT) then 3 else 1);
Nico Huber25fdb152019-02-17 15:54:39 +0100406
Nico Huberd9365612018-06-10 14:59:04 +0200407 Default_DDI_HDMI_Buffer_Translation : <hswvar> DDI_HDMI_Buf_Trans_Range :=
Nico Huber998ee2b2018-06-12 23:02:17 +0200408 (if CPU_Haswell then 6
409 elsif CPU_Broadwell then 7
410 elsif Broxton_On then 8
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600411 elsif Tigerlake_On then 6
Nico Huber998ee2b2018-06-12 23:02:17 +0200412 else 0);
Nico Huber247adf32017-06-12 14:39:11 +0200413
414 ----------------------------------------------------------------------------
415
Arthur Heymans960e2392026-03-03 19:45:24 +0100416 Default_CDClk_Freq : <i945ilkhswvar> CDClk_Range :=
417 (if Gen_I945 then 200_000_000 -- unused, depends on GCFGC
418 elsif Gen_G45 then 320_000_000 -- unused
Nico Huber25fdb152019-02-17 15:54:39 +0100419 elsif CPU_Ironlake then 450_000_000
Nico Huber998ee2b2018-06-12 23:02:17 +0200420 elsif CPU_Sandybridge or CPU_Ivybridge then 400_000_000
Nico Huber25fdb152019-02-17 15:54:39 +0100421 elsif Gen_Haswell and then Is_ULX then 337_500_000
422 elsif Gen_Haswell then 450_000_000
Nico Huber998ee2b2018-06-12 23:02:17 +0200423 elsif Gen_Broxton then 288_000_000
424 elsif Gen_Skylake then 337_500_000
Tim Wawrzynczak6db27c42022-09-09 10:49:55 -0600425 elsif Gen_Tigerlake then 172_800_000 -- depends on ref clk
Nico Huber07ff1b92019-09-29 00:03:17 +0200426 else CDClk_Range'First);
Nico Huberabe3de22016-10-20 15:03:46 +0200427
Nico Huberd9365612018-06-10 14:59:04 +0200428 Default_RawClk_Freq : <hswvar> Frequency_Type :=
Arthur Heymans960e2392026-03-03 19:45:24 +0100429 (if Gen_I945 then 100_000_000 -- unused, depends on FSB
430 elsif Gen_G45 then 100_000_000 -- unused, depends on FSB
Nico Huber998ee2b2018-06-12 23:02:17 +0200431 elsif Gen_Ironlake then 125_000_000
Nico Huber25fdb152019-02-17 15:54:39 +0100432 elsif Gen_Haswell then (if Is_LP then 24_000_000 else 125_000_000)
Nico Huber998ee2b2018-06-12 23:02:17 +0200433 elsif Gen_Broxton then Frequency_Type'First -- none needed
434 elsif Gen_Skylake then 24_000_000
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600435 elsif Gen_Tigerlake then 24_000_000
Nico Huber998ee2b2018-06-12 23:02:17 +0200436 else Frequency_Type'First);
Nico Huberf54d0962016-10-20 14:17:18 +0200437
Nico Huberdcd274b2016-11-03 20:15:39 +0100438 ----------------------------------------------------------------------------
439
440 -- Maximum source width with enabled scaler. This only accounts
441 -- for simple 1:1 pipe:scaler mappings.
442
Nico Huberc5c767a2018-06-03 01:09:04 +0200443 type Width_Per_Pipe is array (Pipe_Index) of Width_Type;
Nico Huberdcd274b2016-11-03 20:15:39 +0100444
Nico Huberd9365612018-06-10 14:59:04 +0200445 Maximum_Scalable_Width : <hswvar> Width_Per_Pipe :=
Arthur Heymans960e2392026-03-03 19:45:24 +0100446 (if Gen_I945 or Gen_G45 then
Nico Huber998ee2b2018-06-12 23:02:17 +0200447 (Primary => 4096,
448 Secondary => 2048,
449 Tertiary => Pos32'First)
450 elsif Gen_Ironlake or CPU_Haswell then
451 (Primary => 4096,
452 Secondary => 2048,
453 Tertiary => 2048)
454 else
455 (Primary => 4096,
456 Secondary => 4096,
457 Tertiary => 4096));
Nico Huberdcd274b2016-11-03 20:15:39 +0100458
Nico Hubera02b2c62018-01-09 15:58:34 +0100459 -- Maximum X position of hardware cursors
Nico Huberd9365612018-06-10 14:59:04 +0200460 Maximum_Cursor_X : constant :=
461 (case Gen is
Arthur Heymans960e2392026-03-03 19:45:24 +0100462 when I945 .. Ironlake => 4095,
Nico Huberc505ae72024-07-21 20:03:38 +0200463 when Haswell .. AlderlakeP => 8191);
Nico Hubera02b2c62018-01-09 15:58:34 +0100464
465 Maximum_Cursor_Y : constant := 4095;
466
Nico Huber74ec9622016-11-19 03:00:43 +0100467 ----------------------------------------------------------------------------
468
Nico Huber21da5742017-01-20 14:00:53 +0100469 -- FIXME: Unknown for Broxton, Linux' i915 contains a fixme too :-D
Nico Huber74ec9622016-11-19 03:00:43 +0100470 HDMI_Max_Clock_24bpp : constant Frequency_Type :=
Nico Huber530651b2019-10-03 14:59:38 +0200471 (case Gen is
Nico Huberc505ae72024-07-21 20:03:38 +0200472 when Generation'First .. G45 => 165_000_000, -- i945: no HDMI, moot
473 when Ironlake => 225_000_000,
474 when Haswell .. Skylake => 300_000_000,
475 when Tigerlake .. AlderlakeP => 600_000_000);
Nico Huber74ec9622016-11-19 03:00:43 +0100476
Nico Huberb8ae6182017-07-15 20:03:56 +0200477 ----------------------------------------------------------------------------
478
Tim Wawrzynczak1b65b842022-09-09 10:23:06 -0600479 GMA_Phys_Base_Index : constant PCI.Index :=
480 (if Config.Tigerlake_On then 16#c0# else 16#5c#);
481
482 GMA_Base_Is_64bit : constant Boolean := Config.Tigerlake_On;
483
Arthur Heymans3f37cce2026-03-03 18:52:12 +0100484 AUD_VID_DID_Offset : <ilkhswvar> Natural :=
485 (if Gen_G45 then 16#06_2020#
486 elsif Gen_Ironlake then 16#0e_5020#
487 else 16#06_5020#);
488
489 -- Default 32-bit GTT offset for static MMIO instantiation.
490 Default_MMIO_GTT_32_Offset : constant Natural :=
491 (if Has_I945_GTT_BAR then 16#00_0000# else 16#20_0000#);
492 MMIO_GTT_32_Offset : <g45var> Natural :=
493 (if GMCH_GM965 then 16#0008_0000# else Default_MMIO_GTT_32_Offset);
494 MMIO_GTT_64_Offset : constant Natural := 16#80_0000#;
495 MMIO_GTT_Offset : <g45hswvar> Natural :=
496 (if Has_64bit_GTT then MMIO_GTT_64_Offset else MMIO_GTT_32_Offset);
Nico Huberadfe11f2018-06-10 14:59:04 +0200497 GTT_PTE_Size : <hswvar> Natural := (if Has_64bit_GTT then 8 else 4);
Nico Huberb8ae6182017-07-15 20:03:56 +0200498
Arthur Heymans960e2392026-03-03 19:45:24 +0100499 Fence_Base : <i945ilkvar> Natural :=
500 (if Gen_I945 then 16#0000_2000#
501 elsif not Sandybridge_On then 16#0000_3000#
502 else 16#0010_0000#);
Nico Huberb03c8f12017-08-25 13:29:08 +0200503
Nico Huberadfe11f2018-06-10 14:59:04 +0200504 Fence_Count : <ilkvar> Natural :=
Nico Huber998ee2b2018-06-12 23:02:17 +0200505 (if not Ivybridge_On then 16 else 32);
Nico Huberb03c8f12017-08-25 13:29:08 +0200506
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200507 ----------------------------------------------------------------------------
508
509 use type HW.Word16;
510
Nico Huber25fdb152019-02-17 15:54:39 +0100511 -- GMA PCI IDs:
512 --
513 -- Rather catch too much here than too little, it's
514 -- mostly used to distinguish generations. Best public
515 -- reference for these IDs is Linux' i915.
516 --
517 -- Since Sandybridge, bits 4 and 5 encode the compu-
518 -- tational capabilities and can mostly be ignored.
519 -- From Haswell on, we have to distinguish between
520 -- Normal, ULT (U CPU lines) and ULX (Y CPU lines).
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200521
Nico Huber25fdb152019-02-17 15:54:39 +0100522 function Is_Haswell_Y (Device_Id : Word16) return Boolean is
523 ((Device_Id and 16#ffef#) = 16#0a0e#);
524 function Is_Haswell_U (Device_Id : Word16) return Boolean is
525 (((Device_Id and 16#ffc3#) = 16#0a02# or
526 (Device_Id and 16#ffcf#) = 16#0a0b#) and
527 not Is_Haswell_Y (Device_Id));
528 function Is_Haswell (Device_Id : Word16) return Boolean is
529 ((Device_Id and 16#ffc3#) = 16#0402# or
530 (Device_Id and 16#ffcf#) = 16#040b# or
531 (Device_Id and 16#ffc3#) = 16#0c02# or
532 (Device_Id and 16#ffcf#) = 16#0c0b# or
533 (Device_Id and 16#ffc3#) = 16#0d02# or
534 (Device_Id and 16#ffcf#) = 16#0d0b#);
535
536 function Is_Broadwell_Y (Device_Id : Word16) return Boolean is
537 ((Device_Id and 16#ffcf#) = 16#160e#);
538 function Is_Broadwell_U (Device_Id : Word16) return Boolean is
539 ((Device_Id and 16#ffcf#) = 16#1606# or
540 (Device_Id and 16#ffcf#) = 16#160b#);
541 function Is_Broadwell (Device_Id : Word16) return Boolean is
542 ((Device_Id and 16#ffc7#) = 16#1602# or
543 (Device_Id and 16#ffcf#) = 16#160d#);
544
545 function Is_Skylake_Y (Device_Id : Word16) return Boolean is
546 ((Device_Id and 16#ffcf#) = 16#190e#);
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200547 function Is_Skylake_U (Device_Id : Word16) return Boolean is
Nico Huber25fdb152019-02-17 15:54:39 +0100548 ((Device_Id and 16#ffc9#) = 16#1901# or
549 (Device_Id and 16#ffcf#) = 16#1906#);
550 function Is_Skylake (Device_Id : Word16) return Boolean is
551 ((Device_Id and 16#ffc7#) = 16#1902# or
552 (Device_Id and 16#ffcf#) = 16#190b# or
553 (Device_Id and 16#ffcf#) = 16#190d#);
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200554
Nico Huber88badbe2018-09-27 16:36:47 +0200555 function Is_Kaby_Lake_Y (Device_Id : Word16) return Boolean is
556 ((Device_Id and 16#ffcf#) = 16#5905# or
557 (Device_Id and 16#ffcf#) = 16#590e#);
558 function Is_Kaby_Lake_Y_AML (Device_Id : Word16) return Boolean is
559 (Device_Id = 16#591c# or Device_Id = 16#87c0#);
560 function Is_Kaby_Lake_U (Device_Id : Word16) return Boolean is
561 ((Device_Id and 16#ffcd#) = 16#5901# or
562 (Device_Id and 16#ffce#) = 16#5906#);
563 function Is_Kaby_Lake (Device_Id : Word16) return Boolean is
564 ((Device_Id and 16#ffc7#) = 16#5902# or
565 (Device_Id and 16#ffcf#) = 16#5908# or
566 (Device_Id and 16#ffcf#) = 16#590b# or
567 (Device_Id and 16#ffcf#) = 16#590d#);
568
Nico Huber2c927942019-02-17 19:07:31 +0100569 function Is_Coffee_Lake_Y_AML (Device_Id : Word16) return Boolean is
570 (Device_Id = 16#87ca#);
571 -- Including Whiskey Lake:
572 function Is_Coffee_Lake_U (Device_Id : Word16) return Boolean is
573 ((Device_Id and 16#fff0#) = 16#3ea0#);
574 function Is_Coffee_Lake (Device_Id : Word16) return Boolean is
575 ((Device_Id and 16#fff0#) = 16#3e90#);
576
Nico Hubercdbfce22019-10-29 20:00:43 +0100577 function Is_Comet_Lake_U (Device_Id : Word16) return Boolean is
578 ((Device_Id and 16#ff9f#) = 16#9b01# or
579 (Device_Id and 16#ff9f#) = 16#9b8a# or
580 (Device_Id and 16#ff9f#) = 16#9b8c#);
581 function Is_Comet_Lake (Device_Id : Word16) return Boolean is
582 ((Device_Id and 16#ff8f#) = 16#9b82# or
583 (Device_Id and 16#ff8f#) = 16#9b84# or
584 (Device_Id and 16#ff8f#) = 16#9b85# or
585 (Device_Id and 16#ff8f#) = 16#9b86# or
586 (Device_Id and 16#ff8f#) = 16#9b88#);
587
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600588 -- For TGL, the distinction is UP4 (formerly Y), UP3 (U), or H (Normal),
589 -- however, the PRMs state "The Intel UHD Graphics Device ID SKUs are
590 -- unified for both UP3 and UP4, e.g. there is no unique device ID
591 -- between UP3 and UP4"
592 function Is_Tiger_Lake_U (Device_Id : Word16) return Boolean is
593 (Device_Id = 16#9a40# or
594 Device_Id = 16#9a49# or
595 Device_Id = 16#9a59# or
596 Device_Id = 16#9a78# or
597 Device_Id = 16#9ac0# or
598 Device_Id = 16#9ac9# or
599 Device_Id = 16#9ad9# or
600 Device_Id = 16#9af8#);
601
602 function Is_Tiger_Lake_H (Device_Id : Word16) return Boolean is
603 (Device_Id = 16#9a60# or
604 Device_Id = 16#9a68# or
605 Device_Id = 16#9a70#);
606
Nico Huberac2a1412026-07-02 10:41:59 +0200607 function Is_Alder_Lake_P (Device_Id : Word16) return Boolean is
Tim Wawrzynczake9631d82022-09-09 12:26:32 -0600608 (Device_Id = 16#46a0# or
609 Device_Id = 16#46a1# or
610 Device_Id = 16#46a2# or
611 Device_Id = 16#46a3# or
612 Device_Id = 16#46a6# or
613 Device_Id = 16#46a8# or
614 Device_Id = 16#46aa# or
615 Device_Id = 16#462a# or
616 Device_Id = 16#4626# or
617 Device_Id = 16#4628# or
618 Device_Id = 16#46b0# or
619 Device_Id = 16#46b1# or
620 Device_Id = 16#46b2# or
621 Device_Id = 16#46b3# or
622 Device_Id = 16#46c0# or
623 Device_Id = 16#46c1# or
624 Device_Id = 16#46c2# or
625 Device_Id = 16#46c3#);
Nico Huberac2a1412026-07-02 10:41:59 +0200626 function Is_Alder_Lake_N (Device_Id : Word16) return Boolean is
Tim Wawrzynczake9631d82022-09-09 12:26:32 -0600627 (Device_Id = 16#46d0# or
628 Device_Id = 16#46d1# or
629 Device_Id = 16#46d2#);
Nico Huberac2a1412026-07-02 10:41:59 +0200630 function Is_Raptor_Lake_P (Device_Id : Word16) return Boolean is
Tim Wawrzynczake9631d82022-09-09 12:26:32 -0600631 (Device_Id = 16#a720# or
632 Device_Id = 16#a721# or
633 Device_Id = 16#a7a0# or
634 Device_Id = 16#a7a1# or
635 Device_Id = 16#a7a8# or
Anil Kumar87469f22023-09-15 11:14:47 -0700636 Device_Id = 16#a7a9# or
637 Device_Id = 16#a7aa# or
638 Device_Id = 16#a7ab# or
639 Device_Id = 16#a7ac# or
640 Device_Id = 16#a7ad#);
Nico Huberc505ae72024-07-21 20:03:38 +0200641 function Is_Alder_Lake_P_Gen (Device_Id : Word16) return Boolean is
Tim Wawrzynczake9631d82022-09-09 12:26:32 -0600642 (Is_Alder_Lake_P (Device_Id) or
643 Is_Alder_Lake_N (Device_Id) or
644 Is_Raptor_Lake_P (Device_Id));
645
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200646 function Is_GPU (Device_Id : Word16; CPU : CPU_Type; CPU_Var : CPU_Variant)
647 return Boolean is
648 (case CPU is
Arthur Heymans960e2392026-03-03 19:45:24 +0100649 when I945G => Device_Id = 16#2772#,
Arthur Heymans3f37cce2026-03-03 18:52:12 +0100650 when GM965 => (Device_Id and 16#ffef#) = 16#2a02#,
Arthur Heymans960e2392026-03-03 19:45:24 +0100651 when I945GM => Device_Id = 16#27a2# or Device_Id = 16#27ae#,
Arthur Heymans6dc78432026-06-18 09:34:50 +0200652 when Pineview => Device_Id = 16#a001#,
653 when Pineview_M => Device_Id = 16#a011#,
Nico Huber7f3e2802019-09-28 20:40:55 +0200654 when G45 => (Device_Id and 16#ff02#) = 16#2e02#,
655 when GM45 => (Device_Id and 16#fffe#) = 16#2a42#,
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200656 when Ironlake => (Device_Id and 16#fff3#) = 16#0042#,
657 when Sandybridge => (Device_Id and 16#ffc2#) = 16#0102#,
658 when Ivybridge => (Device_Id and 16#ffc3#) = 16#0142#,
Nico Huber25fdb152019-02-17 15:54:39 +0100659 when Haswell => (case CPU_Var is
660 when Normal => Is_Haswell (Device_Id),
661 when ULT => Is_Haswell_U (Device_Id),
662 when ULX => Is_Haswell_Y (Device_Id)),
663 when Broadwell => (case CPU_Var is
664 when Normal => Is_Broadwell (Device_Id),
665 when ULT => Is_Broadwell_U (Device_Id),
666 when ULX => Is_Broadwell_Y (Device_Id)),
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200667 when Broxton => (Device_Id and 16#fffe#) = 16#5a84#,
Nico Huber25fdb152019-02-17 15:54:39 +0100668 when Skylake => (case CPU_Var is
669 when Normal => Is_Skylake (Device_Id),
670 when ULT => Is_Skylake_U (Device_Id),
Nico Huber88badbe2018-09-27 16:36:47 +0200671 when ULX => Is_Skylake_Y (Device_Id)),
672 when Kabylake => (case CPU_Var is
Nico Huber2c927942019-02-17 19:07:31 +0100673 when Normal =>
674 Is_Kaby_Lake (Device_Id) or
Nico Hubercdbfce22019-10-29 20:00:43 +0100675 Is_Coffee_Lake (Device_Id) or
676 Is_Comet_Lake (Device_Id),
Nico Huber2c927942019-02-17 19:07:31 +0100677 when ULT =>
678 Is_Kaby_Lake_U (Device_Id) or
Nico Hubercdbfce22019-10-29 20:00:43 +0100679 Is_Coffee_Lake_U (Device_Id) or
680 Is_Comet_Lake_U (Device_Id),
Nico Huber2c927942019-02-17 19:07:31 +0100681 when ULX =>
682 Is_Kaby_Lake_Y (Device_Id) or
683 Is_Kaby_Lake_Y_AML (Device_Id) or
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600684 Is_Coffee_Lake_Y_AML (Device_Id)),
685 when Tigerlake => (case CPU_Var is
Nico Huber333d1892024-07-21 19:46:26 +0200686 when Normal =>
687 Is_Tiger_Lake_H (Device_Id),
688 when ULT =>
689 Is_Tiger_Lake_U (Device_Id),
690 when ULX =>
691 False),
Nico Huberc505ae72024-07-21 20:03:38 +0200692 when AlderlakeP => (case CPU_Var is
Nico Huber333d1892024-07-21 19:46:26 +0200693 when ULT =>
Nico Huberc505ae72024-07-21 20:03:38 +0200694 Is_Alder_Lake_P_Gen (Device_Id),
Nico Huber333d1892024-07-21 19:46:26 +0200695 when others =>
696 False));
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200697
698 function Compatible_GPU (Device_Id : Word16) return Boolean is
699 (Is_GPU (Device_Id, CPU, CPU_Var));
700
Nico Huber6a996dc2018-06-17 16:30:33 +0200701 pragma Warnings (GNATprove, Off, "subprogram ""Detect_CPU"" has no effect",
702 Reason => "only effective in dynamic cpu config");
703 procedure Detect_CPU (Device : Word16)<cpunull>;
704
Nico Huber83693c82016-10-08 22:17:55 +0200705end HW.GFX.GMA.Config;