blob: e495526c92cfd62a686e381c7a9db20af8646ece [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
Arthur Heymans960e2392026-03-03 19:45:24 +010023 when I945 => I945G,
Arthur Heymans3f37cce2026-03-03 18:52:12 +010024 when G45 => GM965,
Nico Huberd7809ab2018-06-10 15:44:23 +020025 when Ironlake => Ironlake,
26 when Haswell => Haswell,
27 when Broxton => Broxton,
Tim Wawrzynczak605660b2022-06-08 12:48:19 -060028 when Skylake => Skylake,
29 when Tigerlake => Tigerlake);
Nico Huberd7809ab2018-06-10 15:44:23 +020030 CPU_Last : constant CPU_Type :=
31 (case Gen is
Arthur Heymans960e2392026-03-03 19:45:24 +010032 when I945 => I945GM,
Nico Huber7f3e2802019-09-28 20:40:55 +020033 when G45 => GM45,
Nico Huberd7809ab2018-06-10 15:44:23 +020034 when Ironlake => Ivybridge,
35 when Haswell => Broadwell,
36 when Broxton => Broxton,
Tim Wawrzynczak605660b2022-06-08 12:48:19 -060037 when Skylake => Kabylake,
Tim Wawrzynczake9631d82022-09-09 12:26:32 -060038 when Tigerlake => Alderlake);
Nico Huberd7809ab2018-06-10 15:44:23 +020039 CPU_Var_Last : constant CPU_Variant :=
40 (case Gen is
Tim Wawrzynczak605660b2022-06-08 12:48:19 -060041 when Haswell | Skylake | Tigerlake => ULX,
42 when others => Normal);
Nico Huberd7809ab2018-06-10 15:44:23 +020043 subtype Gen_CPU_Type is CPU_Type range CPU_First .. CPU_Last;
44 subtype Gen_CPU_Variant is CPU_Variant range Normal .. CPU_Var_Last;
Nico Huber83693c82016-10-08 22:17:55 +020045
Nico Huberd7809ab2018-06-10 15:44:23 +020046 CPU : constant Gen_CPU_Type := <<CPU>>;
47
48 CPU_Var : constant Gen_CPU_Variant := <<CPU_VARIANT>>;
Nico Huber83693c82016-10-08 22:17:55 +020049
Nico Hubere79babd2020-12-20 01:33:26 +010050 PCH_First : constant PCH_Type :=
51 (case Gen is
Arthur Heymans960e2392026-03-03 19:45:24 +010052 when I945 => No_PCH,
Nico Hubere79babd2020-12-20 01:33:26 +010053 when G45 => No_PCH,
54 when Ironlake => Ibex_Peak,
55 when Haswell => Lynx_Point,
56 when Broxton => No_PCH,
Tim Wawrzynczak605660b2022-06-08 12:48:19 -060057 when Skylake => Sunrise_Point,
58 when Tigerlake => Tiger_Point);
Nico Hubere79babd2020-12-20 01:33:26 +010059 PCH_Last : constant PCH_Type :=
60 (case Gen is
Arthur Heymans960e2392026-03-03 19:45:24 +010061 when I945 => No_PCH,
Nico Hubere79babd2020-12-20 01:33:26 +010062 when G45 => No_PCH,
63 when Ironlake => Cougar_Point,
64 when Haswell => Lynx_Point,
65 when Broxton => No_PCH,
Tim Wawrzynczak605660b2022-06-08 12:48:19 -060066 when Skylake => Cannon_Point,
Tim Wawrzynczake9631d82022-09-09 12:26:32 -060067 when Tigerlake => Alder_Point);
Nico Hubere79babd2020-12-20 01:33:26 +010068 subtype Gen_PCH_Type is PCH_Type range PCH_First .. PCH_Last;
69
70 PCH : constant Gen_PCH_Type := <<PCH>>;
71
Nico Huber2bbd6e72020-01-07 18:22:59 +010072 Panel_Ports : constant array (Valid_Panels) of Port_Type :=
Nico Huber5dbaf4b2020-01-08 17:24:58 +010073 (Panel_1 => <<PANEL_1_PORT>>,
74 Panel_2 => <<PANEL_2_PORT>>);
Nico Huber83693c82016-10-08 22:17:55 +020075
Nico Huberd55afeb2016-10-21 14:31:10 +020076 Analog_I2C_Port : constant PCH_Port := <<ANALOG_I2C_PORT>>;
77
Nico Huber83693c82016-10-08 22:17:55 +020078 EDP_Low_Voltage_Swing : constant Boolean := False;
79
Nico Huber247adf32017-06-12 14:39:11 +020080 DDI_HDMI_Buffer_Translation : constant Integer := -1;
81
Nico Huber4cafa4a2020-06-10 16:14:36 +020082 PCI_Dev : constant PCI.Address := <<PCI_DEV_ADDRESS>>;
83 Override_MMConf_Base : constant := <<OVERRIDE_MMCONF_BASE>>;
84 Default_MMIO_Base : constant := <<DEFAULT_MMIO_BASE>>;
Nico Huber83693c82016-10-08 22:17:55 +020085
86 LVDS_Dual_Threshold : constant := 95_000_000;
87
Matt DeVillier2a3dbba2020-05-14 17:34:13 -050088 Ignore_Presence_Straps : constant Boolean := <<IGNORE_STRAPS>>;
89
Nico Huber83693c82016-10-08 22:17:55 +020090 ----------------------------------------------------------------------------
91
Nico Huber07ff1b92019-09-29 00:03:17 +020092 -- On older generations dot clocks are limited to 90% of
93 -- the CDClk rate. To ease proofs, we limit CDClk's range.
94 CDClk_Min : constant Frequency_Type :=
95 (case Gen is
Arthur Heymans960e2392026-03-03 19:45:24 +010096 when I945 .. Ironlake => Frequency_Type'First * 100 / 90 + 1,
97 when others => Frequency_Type'First);
Nico Huber07ff1b92019-09-29 00:03:17 +020098 subtype CDClk_Range is Frequency_Type range CDClk_Min .. Frequency_Type'Last;
99
100 ----------------------------------------------------------------------------
101
Nico Huber30e84082018-06-10 13:28:05 +0200102 type Valid_Port_Array is array (Port_Type) of Boolean;
103 type Variable_Config is record
104 Valid_Port : Valid_Port_Array;
Nico Huber07ff1b92019-09-29 00:03:17 +0200105 CDClk : CDClk_Range;
106 Max_CDClk : CDClk_Range;
Nico Huber30e84082018-06-10 13:28:05 +0200107 Raw_Clock : Frequency_Type;
Nico Huberadfe11f2018-06-10 14:59:04 +0200108 Dyn_CPU : Gen_CPU_Type;
109 Dyn_CPU_Var : Gen_CPU_Variant;
Nico Huber30e84082018-06-10 13:28:05 +0200110 end record;
111
Nico Huber27088aa2018-06-10 13:28:05 +0200112 Initial_Settings : constant Variable_Config :=
Nico Huber30e84082018-06-10 13:28:05 +0200113 (Valid_Port => (others => False),
Nico Huber07ff1b92019-09-29 00:03:17 +0200114 CDClk => CDClk_Range'First,
115 Max_CDClk => CDClk_Range'First,
Nico Huberadfe11f2018-06-10 14:59:04 +0200116 Raw_Clock => Frequency_Type'First,
117 Dyn_CPU => Gen_CPU_Type'First,
118 Dyn_CPU_Var => Gen_CPU_Variant'First);
Nico Huber27088aa2018-06-10 13:28:05 +0200119
Nico Hubere317e9c2019-09-29 03:03:18 +0200120 Variable : Variable_Config with Part_Of => GMA.State;
Nico Huber30e84082018-06-10 13:28:05 +0200121
122 Valid_Port : Valid_Port_Array renames Variable.Valid_Port;
Nico Huber07ff1b92019-09-29 00:03:17 +0200123 CDClk : CDClk_Range renames Variable.CDClk;
124 Max_CDClk : CDClk_Range renames Variable.Max_CDClk;
Nico Huber30e84082018-06-10 13:28:05 +0200125 Raw_Clock : Frequency_Type renames Variable.Raw_Clock;
Nico Huberadfe11f2018-06-10 14:59:04 +0200126 CPU : Gen_CPU_Type renames Variable.Dyn_CPU;
127 CPU_Var : Gen_CPU_Variant renames Variable.Dyn_CPU_Var;
Nico Huber30e84082018-06-10 13:28:05 +0200128
129 ----------------------------------------------------------------------------
130
Nico Huberd9365612018-06-10 14:59:04 +0200131 -- To support both static configurations, that are compiled for a
132 -- fixed CPU, and dynamic configurations, where the CPU and its
133 -- variant are detected at runtime, all derived config values are
134 -- tagged based on their dependencies.
135 --
136 -- Booleans that only depend on the generation should be tagged
137 -- <genbool>. Those that may depend on the CPU are tagged with the
138 -- generations where that is the case. For instance `CPU_Ivybridge`
139 -- can be decided purely based on the generation unless the gene-
140 -- ration is Ironlake, thus, it is tagged <ilkbool>.
141 --
142 -- For non-boolean constants, per generation tags <...var> are
143 -- used (e.g. <ilkvar>).
144 --
145 -- To ease parsing, all multiline expressions of tagged config
146 -- values start after a line break.
Nico Huber6621a142018-06-07 23:56:54 +0200147
Arthur Heymans960e2392026-03-03 19:45:24 +0100148 Gen_I945 : <genbool> := Gen = I945;
Nico Huberd9365612018-06-10 14:59:04 +0200149 Gen_G45 : <genbool> := Gen = G45;
150 Gen_Ironlake : <genbool> := Gen = Ironlake;
151 Gen_Haswell : <genbool> := Gen = Haswell;
152 Gen_Broxton : <genbool> := Gen = Broxton;
153 Gen_Skylake : <genbool> := Gen = Skylake;
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600154 Gen_Tigerlake : <genbool> := Gen = Tigerlake;
Nico Huber6621a142018-06-07 23:56:54 +0200155
Arthur Heymans960e2392026-03-03 19:45:24 +0100156 Up_To_G45 : <genbool> := Gen <= G45;
Nico Huberd9365612018-06-10 14:59:04 +0200157 Up_To_Ironlake : <genbool> := Gen <= Ironlake;
Arthur Heymans960e2392026-03-03 19:45:24 +0100158 G45_On : <genbool> := Gen >= G45;
Nico Huberd9365612018-06-10 14:59:04 +0200159 Ironlake_On : <genbool> := Gen >= Ironlake;
160 Haswell_On : <genbool> := Gen >= Haswell;
161 Broxton_On : <genbool> := Gen >= Broxton;
162 Skylake_On : <genbool> := Gen >= Skylake;
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600163 Tigerlake_On : <genbool> := Gen >= Tigerlake;
Nico Huber998ee2b2018-06-12 23:02:17 +0200164
Arthur Heymans960e2392026-03-03 19:45:24 +0100165 GMCH_I945GM : <i945bool> := Gen_I945 and then CPU = I945GM;
Arthur Heymans3f37cce2026-03-03 18:52:12 +0100166 GMCH_GM965 : <g45bool> := Gen_G45 and then CPU = GM965;
Nico Huberb47a5c42019-09-29 00:07:21 +0200167 GMCH_GM45 : <g45bool> := Gen_G45 and then CPU = GM45;
Nico Huberd9365612018-06-10 14:59:04 +0200168 CPU_Ironlake : <ilkbool> := Gen_Ironlake and then CPU = Ironlake;
169 CPU_Sandybridge : <ilkbool> := Gen_Ironlake and then CPU = Sandybridge;
170 CPU_Ivybridge : <ilkbool> := Gen_Ironlake and then CPU = Ivybridge;
171 CPU_Haswell : <hswbool> := Gen_Haswell and then CPU = Haswell;
172 CPU_Broadwell : <hswbool> := Gen_Haswell and then CPU = Broadwell;
Nico Huber88badbe2018-09-27 16:36:47 +0200173 CPU_Skylake : <sklbool> := Gen_Skylake and then CPU = Skylake;
174 CPU_Kabylake : <sklbool> := Gen_Skylake and then CPU = Kabylake;
Tim Wawrzynczake9631d82022-09-09 12:26:32 -0600175 CPU_Tigerlake : <tglbool> := Gen_Tigerlake and then CPU = Tigerlake;
176 CPU_Alderlake : <tglbool> := Gen_Tigerlake and then CPU = Alderlake;
Nico Huberd9365612018-06-10 14:59:04 +0200177
178 Sandybridge_On : <ilkbool> :=
Nico Huber998ee2b2018-06-12 23:02:17 +0200179 ((Gen_Ironlake and then CPU >= Sandybridge) or Haswell_On);
Nico Huberd9365612018-06-10 14:59:04 +0200180 Ivybridge_On : <ilkbool> :=
Nico Huber998ee2b2018-06-12 23:02:17 +0200181 ((Gen_Ironlake and then CPU >= Ivybridge) or Haswell_On);
Nico Huberd9365612018-06-10 14:59:04 +0200182 Broadwell_On : <hswbool> :=
Nico Huber998ee2b2018-06-12 23:02:17 +0200183 ((Gen_Haswell and then CPU >= Broadwell) or Broxton_On);
Tim Wawrzynczake9631d82022-09-09 12:26:32 -0600184 Alderlake_On : <tglbool> :=
185 (Gen_Tigerlake and then CPU >= Alderlake);
Nico Huber998ee2b2018-06-12 23:02:17 +0200186
Nico Hubere79babd2020-12-20 01:33:26 +0100187 PCH_Cougar_Point : <genbool> := Gen_Ironlake and then PCH = Cougar_Point;
188
189 Cougar_Point_On : <genbool> :=
190 ((Gen_Ironlake and then PCH >= Cougar_Point) or Haswell_On);
Nico Huberdde06302020-12-20 02:18:30 +0100191 Cannon_Point_On : <genbool> := Skylake_On and then PCH >= Cannon_Point;
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600192 Tiger_Point_On : <genbool> := Tigerlake_On and then PCH >= Tiger_Point;
Nico Hubere79babd2020-12-20 01:33:26 +0100193
Nico Huber6621a142018-06-07 23:56:54 +0200194 ----------------------------------------------------------------------------
195
Nico Huber117db372018-06-09 17:56:05 +0200196 Have_HDMI_Buf_Override : constant Boolean := DDI_HDMI_Buffer_Translation >= 0;
Nico Huber2b6f6992017-07-09 18:11:34 +0200197 Default_MMIO_Base_Set : constant Boolean := Default_MMIO_Base /= 0;
198
Nico Huber1bc496f2017-06-09 22:23:28 +0200199 Have_DVI_I : constant Boolean := Analog_I2C_Port /= PCH_DAC;
Nico Huberd9365612018-06-10 14:59:04 +0200200
Arthur Heymans960e2392026-03-03 19:45:24 +0100201 Has_Presence_Straps : <genbool> := not Gen_Broxton and not Gen_I945;
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600202 Is_ULT : <hswskltglbool> :=
203 ((Gen_Haswell or Gen_Skylake or Gen_Tigerlake) and then CPU_Var = ULT);
204 Is_ULX : <hswskltglbool> :=
205 ((Gen_Haswell or Gen_Skylake or Gen_Tigerlake) and then CPU_Var = ULX);
206 Is_LP : <hswskltglbool> := Is_ULT or Is_ULX;
Nico Huber83693c82016-10-08 22:17:55 +0200207
Nico Huberd9365612018-06-10 14:59:04 +0200208 ---------- CPU pipe: ---------
209 Has_Tertiary_Pipe : <ilkbool> := Ivybridge_On;
Arthur Heymans960e2392026-03-03 19:45:24 +0100210 Disable_Trickle_Feed : <genbool> := not Gen_Haswell and not Gen_I945;
Nico Huberd9365612018-06-10 14:59:04 +0200211 Pipe_Enabled_Workaround : <hswbool> := CPU_Broadwell;
Tim Wawrzynczak4be2e752022-09-09 10:37:06 -0600212 Has_EDP_Transcoder : <genbool> := Haswell_On and not Tigerlake_On;
Nico Huberd9365612018-06-10 14:59:04 +0200213 Use_PDW_For_EDP_Scaling : <hswbool> := CPU_Haswell;
214 Has_Pipe_DDI_Func : <genbool> := Haswell_On;
215 Has_Trans_Clk_Sel : <genbool> := Haswell_On;
216 Has_Pipe_MSA_Misc : <genbool> := Haswell_On;
217 Has_Pipeconf_Misc : <hswbool> := Broadwell_On;
218 Has_Pipeconf_BPC : <hswbool> := not CPU_Haswell;
219 Has_Plane_Control : <genbool> := Broxton_On;
Nico Huberfb6dbad2026-04-10 16:23:39 +0000220 Needs_Even_Source_Width : <genbool> := Tigerlake_On;
221 Has_Skylake_Scaler_Limits : <genbool> := Gen_Broxton or Gen_Skylake;
Nico Huberd9365612018-06-10 14:59:04 +0200222 Has_DSP_Linoff : <genbool> := Up_To_Ironlake;
Arthur Heymans960e2392026-03-03 19:45:24 +0100223 Has_DSPSURF : <genbool> := G45_On;
Nico Huberd9365612018-06-10 14:59:04 +0200224 Has_PF_Pipe_Select : <ilkhswbool> := CPU_Ivybridge or CPU_Haswell;
Nico Huber75a707f2018-06-18 16:28:33 +0200225 Has_Ivybridge_Cursors : <ilkbool> := Ivybridge_On;
Nico Huberd9365612018-06-10 14:59:04 +0200226 VGA_Plane_Workaround : <ilkbool> := CPU_Ivybridge;
227 Has_GMCH_DP_Transcoder : <genbool> := Gen_G45;
Arthur Heymans960e2392026-03-03 19:45:24 +0100228 Has_GMCH_VGACNTRL : <genbool> := Up_To_G45;
229 Has_GMCH_PFIT_CONTROL : <genbool> := Up_To_G45;
Nico Huber83693c82016-10-08 22:17:55 +0200230
Tim Wawrzynczak4be2e752022-09-09 10:37:06 -0600231 ----------- Transcoder -------
232 Need_Early_Transcoder_Setup : <genbool> := Tigerlake_On;
Tim Wawrzynczak0da761a2022-09-09 10:42:36 -0600233 Need_Pipe_Arb_Slots : <tglbool> := Alderlake_On;
234
235 ----------- Planes -----------
236 Has_Mbus_Dbox_Credits : <genbool> := Tigerlake_On;
237 Has_Wide_Watermarks : <genbool> := Tigerlake_On;
238 Has_Plane_Color_Control : <genbool> := Tigerlake_On;
239 Has_New_Mbus_Dbox_Credits : <tglbool> := (Alderlake_On and Is_LP);
240
241 ----------- Pipe -------------
242 Need_Underrun_Rec_Disable : <tglbool> := Alderlake_On;
Tim Wawrzynczak4be2e752022-09-09 10:37:06 -0600243
Nico Huberd9365612018-06-10 14:59:04 +0200244 --------- Panel power: -------
245 Has_PP_Write_Protection : <genbool> := Up_To_Ironlake;
246 Has_PP_Port_Select : <genbool> := Up_To_Ironlake;
247 Use_PP_VDD_Override : <genbool> := Up_To_Ironlake;
248 Has_PCH_Panel_Power : <genbool> := Ironlake_On;
Nico Huberdde06302020-12-20 02:18:30 +0100249 Has_PP_Divisor_Reg : <genbool> :=
250 (not Gen_Broxton and not Cannon_Point_On);
251 Has_New_Backlight_Control : <genbool> := Gen_Broxton or Cannon_Point_On;
Nico Huber83693c82016-10-08 22:17:55 +0200252
Nico Huberd9365612018-06-10 14:59:04 +0200253 ----------- PCH/FDI: ---------
Nico Hubere79babd2020-12-20 01:33:26 +0100254 Has_PCH : <genbool> := PCH /= No_PCH;
Nico Huberd9365612018-06-10 14:59:04 +0200255 Has_PCH_DAC : <hswbool> :=
Nico Huber25fdb152019-02-17 15:54:39 +0100256 (Gen_Ironlake or (Gen_Haswell and then not Is_LP));
Nico Huber83693c82016-10-08 22:17:55 +0200257
Nico Huberd9365612018-06-10 14:59:04 +0200258 Has_PCH_Aux_Channels : <genbool> := Gen_Ironlake or Gen_Haswell;
Nico Huber83693c82016-10-08 22:17:55 +0200259
Nico Huberd9365612018-06-10 14:59:04 +0200260 VGA_Has_Sync_Disable : <genbool> := Up_To_Ironlake;
Nico Huber83693c82016-10-08 22:17:55 +0200261
Nico Huberd9365612018-06-10 14:59:04 +0200262 Has_Trans_Timing_Ovrrde : <ilkbool> := Sandybridge_On;
Nico Huber83693c82016-10-08 22:17:55 +0200263
Nico Huberd9365612018-06-10 14:59:04 +0200264 Has_DPLL_SEL : <genbool> := Gen_Ironlake;
265 Has_FDI_BPC : <genbool> := Gen_Ironlake;
266 Has_FDI_Composite_Sel : <ilkbool> := CPU_Ivybridge;
Nico Hubere79babd2020-12-20 01:33:26 +0100267 Has_New_FDI_Sink : <genbool> := Cougar_Point_On;
Nico Huberd9365612018-06-10 14:59:04 +0200268 Has_New_FDI_Source : <ilkbool> := Ivybridge_On;
Nico Hubere79babd2020-12-20 01:33:26 +0100269 Has_Trans_DP_Ctl : <genbool> := PCH_Cougar_Point;
Nico Huberd9365612018-06-10 14:59:04 +0200270 Has_FDI_C : <ilkbool> := CPU_Ivybridge;
Nico Huber83693c82016-10-08 22:17:55 +0200271
Nico Huberd9365612018-06-10 14:59:04 +0200272 Has_FDI_RX_Power_Down : <genbool> := Gen_Haswell;
Nico Huber83693c82016-10-08 22:17:55 +0200273
Nico Huberd0f84b92019-09-22 21:31:52 +0200274 ---------- Clocks: -----------
Arthur Heymans960e2392026-03-03 19:45:24 +0100275 Has_GMCH_RawClk : <genbool> := Up_To_G45;
Arthur Heymans3f37cce2026-03-03 18:52:12 +0100276 Has_GMCH_Mobile_VCO : <g45bool> := GMCH_GM45 or GMCH_GM965;
Arthur Heymans960e2392026-03-03 19:45:24 +0100277
278 ---------- I945-specific: ----
279 Has_I945_GTT_BAR : <genbool> := Gen_I945;
280 Has_I945_Simple_GTT_PTE : <genbool> := Gen_I945;
281 Has_Gen3_Fences : <genbool> := Gen_I945;
282 -- Pre-i965: LVDS encoder can only source from Pipe B (Secondary)
283 LVDS_Needs_Pipe_B : <genbool> := Gen_I945;
284 -- Pre-Gen5: DSPCNTR has a pipe select field (bits 25:24)
285 Has_DSPCNTR_Pipe_Select : <genbool> := Up_To_G45;
286 -- Gen3: Plane A feeds Pipe B, Plane B feeds Pipe A (for FBC + LVDS)
287 Planes_Pipes_Swapped : <genbool> := Gen_I945;
Nico Huberd0f84b92019-09-22 21:31:52 +0200288 Has_Broadwell_CDClk : <hswbool> := CPU_Broadwell;
289 Can_Switch_CDClk : <hswbool> := Broadwell_On;
Nico Huberdde06302020-12-20 02:18:30 +0100290 Has_Fractional_RawClk : <genbool> := Cannon_Point_On;
Tim Wawrzynczak68deeb42022-09-09 10:59:08 -0600291 Has_New_Type_C_PLL_Enable : <tglbool> := Alderlake_On;
Arthur Heymans73ea0322018-03-28 17:17:07 +0200292
Nico Huberd9365612018-06-10 14:59:04 +0200293 ----------- DDI: -------------
294 End_EDP_Training_Late : <genbool> := Gen_Haswell;
295 Has_Per_DDI_Clock_Sel : <genbool> := Gen_Haswell;
296 Has_HOTPLUG_CTL : <genbool> := Gen_Haswell;
297 Has_SHOTPLUG_CTL_A : <hswbool> :=
Nico Huber25fdb152019-02-17 15:54:39 +0100298 ((Gen_Haswell and then Is_LP) or Skylake_On);
Nico Huber83693c82016-10-08 22:17:55 +0200299
Nico Huberd9365612018-06-10 14:59:04 +0200300 Has_DDI_PHYs : <genbool> := Gen_Broxton;
Nico Huber19729a72017-07-30 01:05:05 +0200301
Nico Huberd9365612018-06-10 14:59:04 +0200302 Has_DDI_D : <hswsklbool> :=
Nico Huber25fdb152019-02-17 15:54:39 +0100303 ((Gen_Haswell or Gen_Skylake) and then not Is_LP);
Nico Huberd9365612018-06-10 14:59:04 +0200304 -- might be disabled by x4 eDP:
305 Has_DDI_E : <hswsklbool> := Has_DDI_D;
Nico Huber83693c82016-10-08 22:17:55 +0200306
Tim Wawrzynczak4be2e752022-09-09 10:37:06 -0600307 Has_TGL_DDI_Select : <genbool> := Tigerlake_On;
308
Nico Huberd9365612018-06-10 14:59:04 +0200309 Has_DDI_Buffer_Trans : <genbool> := Haswell_On and not Has_DDI_PHYs;
310 Has_Low_Voltage_Swing : <genbool> := Broxton_On;
311 Has_Iboost_Config : <genbool> := Skylake_On;
Nico Huber88badbe2018-09-27 16:36:47 +0200312 Use_KBL_DDI_Buf_Trans : <sklbool> := CPU_Kabylake;
Nico Huber83693c82016-10-08 22:17:55 +0200313
Nico Huberd9365612018-06-10 14:59:04 +0200314 Need_DP_Aux_Mutex : <genbool> := False; -- Skylake & (PSR | GTC)
Nico Huber83693c82016-10-08 22:17:55 +0200315
Nico Huber25fdb152019-02-17 15:54:39 +0100316 ----- DP: --------------------
317 DP_Max_2_7_GHz : <hswbool> :=
318 (not Haswell_On or else (CPU_Haswell and Is_ULX));
319
Nico Huberd9365612018-06-10 14:59:04 +0200320 ----------- GMBUS: -----------
Tim Wawrzynczak732feb42022-09-09 10:32:37 -0600321 Ungate_GMBUS_Unit_Level : <genbool> := Skylake_On and not Tigerlake_On;
Nico Huberdde06302020-12-20 02:18:30 +0100322 GMBUS_Alternative_Pins : <genbool> := Gen_Broxton or Cannon_Point_On;
Nico Huberd9365612018-06-10 14:59:04 +0200323 Has_PCH_GMBUS : <genbool> := Ironlake_On;
Arthur Heymans960e2392026-03-03 19:45:24 +0100324 Has_GMCH_GMBUS : <genbool> := Up_To_G45;
Nico Huber83693c82016-10-08 22:17:55 +0200325
Nico Huberd9365612018-06-10 14:59:04 +0200326 ----------- Power: -----------
327 Has_IPS : <hswbool> :=
Nico Huber998ee2b2018-06-12 23:02:17 +0200328 (Gen_Haswell and then
Nico Huber25fdb152019-02-17 15:54:39 +0100329 ((CPU_Haswell and Is_LP) or CPU_Broadwell));
Nico Huberd9365612018-06-10 14:59:04 +0200330 Has_IPS_CTL_Mailbox : <hswbool> := CPU_Broadwell;
Nico Huber83693c82016-10-08 22:17:55 +0200331
Nico Huberd9365612018-06-10 14:59:04 +0200332 Has_Per_Pipe_SRD : <hswbool> := Broadwell_On;
Nico Huber83693c82016-10-08 22:17:55 +0200333
Nico Huberd9365612018-06-10 14:59:04 +0200334 ----------- GTT: -------------
335 Has_64bit_GTT : <hswbool> := Broadwell_On;
Nico Huber83693c82016-10-08 22:17:55 +0200336
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600337 ----------- Type-C: ----------
338 Has_Type_C_Ports : <genbool> := Tigerlake_On;
339
Tim Wawrzynczakfc49b602022-09-09 10:29:24 -0600340 ----------- Rawclk -----------
341 Need_Rawclk_Numerator : <genbool> := Tigerlake_On;
342
Tim Wawrzynczak5473d292023-02-06 16:46:33 -0700343 ----------- Combo Phy --------
344 Has_TGL_Buffer_Translations : <tglbool> := CPU_Tigerlake;
345
Nico Huber83693c82016-10-08 22:17:55 +0200346 ----------------------------------------------------------------------------
347
Nico Huberd9365612018-06-10 14:59:04 +0200348 Max_Pipe : <ilkvar> Pipe_Index :=
Nico Huberd58de7d2018-06-07 23:06:55 +0200349 (if Has_Tertiary_Pipe then Tertiary else Secondary);
Nico Huber83693c82016-10-08 22:17:55 +0200350
Nico Huberd9365612018-06-10 14:59:04 +0200351 Last_Digital_Port : <hswsklvar> Digital_Port :=
Nico Huber208857d2017-07-29 21:30:24 +0200352 (if Has_DDI_E then DIGI_E else DIGI_C);
Nico Huberac455ad2017-02-14 14:41:19 +0100353
Tim Wawrzynczak5473d292023-02-06 16:46:33 -0700354 Last_TC_Port : constant GPU_Port :=
Nico Huber6ff49532024-06-24 16:22:48 +0000355 (if not Tigerlake_On then DIGI_E -- Makes 'First..Last_TC_Port empty.
356 else DDI_TC4);
357
Nico Huber83693c82016-10-08 22:17:55 +0200358 ----------------------------------------------------------------------------
359
Nico Huber3c544ee2016-11-20 04:56:58 +0100360 type FDI_Per_Port is array (Port_Type) of Boolean;
Nico Huberd9365612018-06-10 14:59:04 +0200361 Is_FDI_Port : <hswvar> FDI_Per_Port :=
Nico Huber6621a142018-06-07 23:56:54 +0200362 (Disabled => False,
Nico Huber8beafd72020-01-07 14:59:44 +0100363 eDP => False,
364 LVDS => Gen_Ironlake,
Nico Huberad096092024-07-02 18:45:44 +0200365 DP1 .. DP3 => Gen_Ironlake,
366 HDMI1 .. HDMI3 => Gen_Ironlake,
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600367 Analog => Has_PCH_DAC,
368 others => False);
Nico Huber83693c82016-10-08 22:17:55 +0200369
370 type FDI_Lanes_Per_Port is array (GPU_Port) of DP_Lane_Count;
371 FDI_Lane_Count : constant FDI_Lanes_Per_Port :=
372 (DIGI_D => DP_Lane_Count_2,
Nico Huber6621a142018-06-07 23:56:54 +0200373 others => (if Gen_Ironlake then DP_Lane_Count_4 else DP_Lane_Count_2));
Nico Huber83693c82016-10-08 22:17:55 +0200374
Nico Huberd9365612018-06-10 14:59:04 +0200375 FDI_Training : <ilkvar> FDI_Training_Type :=
Nico Huber998ee2b2018-06-12 23:02:17 +0200376 (if CPU_Ironlake then Simple_Training
377 elsif CPU_Sandybridge then Full_Training
378 else Auto_Training);
Nico Huber83693c82016-10-08 22:17:55 +0200379
Nico Huberf54d0962016-10-20 14:17:18 +0200380 ----------------------------------------------------------------------------
381
Nico Huber88badbe2018-09-27 16:36:47 +0200382 DDI_Buffer_Iboost : <hswsklvar> Natural :=
383 (if Is_ULX or (CPU_Kabylake and Is_ULT) then 3 else 1);
Nico Huber25fdb152019-02-17 15:54:39 +0100384
Nico Huberd9365612018-06-10 14:59:04 +0200385 Default_DDI_HDMI_Buffer_Translation : <hswvar> DDI_HDMI_Buf_Trans_Range :=
Nico Huber998ee2b2018-06-12 23:02:17 +0200386 (if CPU_Haswell then 6
387 elsif CPU_Broadwell then 7
388 elsif Broxton_On then 8
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600389 elsif Tigerlake_On then 6
Nico Huber998ee2b2018-06-12 23:02:17 +0200390 else 0);
Nico Huber247adf32017-06-12 14:39:11 +0200391
392 ----------------------------------------------------------------------------
393
Arthur Heymans960e2392026-03-03 19:45:24 +0100394 Default_CDClk_Freq : <i945ilkhswvar> CDClk_Range :=
395 (if Gen_I945 then 200_000_000 -- unused, depends on GCFGC
396 elsif Gen_G45 then 320_000_000 -- unused
Nico Huber25fdb152019-02-17 15:54:39 +0100397 elsif CPU_Ironlake then 450_000_000
Nico Huber998ee2b2018-06-12 23:02:17 +0200398 elsif CPU_Sandybridge or CPU_Ivybridge then 400_000_000
Nico Huber25fdb152019-02-17 15:54:39 +0100399 elsif Gen_Haswell and then Is_ULX then 337_500_000
400 elsif Gen_Haswell then 450_000_000
Nico Huber998ee2b2018-06-12 23:02:17 +0200401 elsif Gen_Broxton then 288_000_000
402 elsif Gen_Skylake then 337_500_000
Tim Wawrzynczak6db27c42022-09-09 10:49:55 -0600403 elsif Gen_Tigerlake then 172_800_000 -- depends on ref clk
Nico Huber07ff1b92019-09-29 00:03:17 +0200404 else CDClk_Range'First);
Nico Huberabe3de22016-10-20 15:03:46 +0200405
Nico Huberd9365612018-06-10 14:59:04 +0200406 Default_RawClk_Freq : <hswvar> Frequency_Type :=
Arthur Heymans960e2392026-03-03 19:45:24 +0100407 (if Gen_I945 then 100_000_000 -- unused, depends on FSB
408 elsif Gen_G45 then 100_000_000 -- unused, depends on FSB
Nico Huber998ee2b2018-06-12 23:02:17 +0200409 elsif Gen_Ironlake then 125_000_000
Nico Huber25fdb152019-02-17 15:54:39 +0100410 elsif Gen_Haswell then (if Is_LP then 24_000_000 else 125_000_000)
Nico Huber998ee2b2018-06-12 23:02:17 +0200411 elsif Gen_Broxton then Frequency_Type'First -- none needed
412 elsif Gen_Skylake then 24_000_000
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600413 elsif Gen_Tigerlake then 24_000_000
Nico Huber998ee2b2018-06-12 23:02:17 +0200414 else Frequency_Type'First);
Nico Huberf54d0962016-10-20 14:17:18 +0200415
Nico Huberdcd274b2016-11-03 20:15:39 +0100416 ----------------------------------------------------------------------------
417
418 -- Maximum source width with enabled scaler. This only accounts
419 -- for simple 1:1 pipe:scaler mappings.
420
Nico Huberc5c767a2018-06-03 01:09:04 +0200421 type Width_Per_Pipe is array (Pipe_Index) of Width_Type;
Nico Huberdcd274b2016-11-03 20:15:39 +0100422
Nico Huberd9365612018-06-10 14:59:04 +0200423 Maximum_Scalable_Width : <hswvar> Width_Per_Pipe :=
Arthur Heymans960e2392026-03-03 19:45:24 +0100424 (if Gen_I945 or Gen_G45 then
Nico Huber998ee2b2018-06-12 23:02:17 +0200425 (Primary => 4096,
426 Secondary => 2048,
427 Tertiary => Pos32'First)
428 elsif Gen_Ironlake or CPU_Haswell then
429 (Primary => 4096,
430 Secondary => 2048,
431 Tertiary => 2048)
432 else
433 (Primary => 4096,
434 Secondary => 4096,
435 Tertiary => 4096));
Nico Huberdcd274b2016-11-03 20:15:39 +0100436
Nico Hubera02b2c62018-01-09 15:58:34 +0100437 -- Maximum X position of hardware cursors
Nico Huberd9365612018-06-10 14:59:04 +0200438 Maximum_Cursor_X : constant :=
439 (case Gen is
Arthur Heymans960e2392026-03-03 19:45:24 +0100440 when I945 .. Ironlake => 4095,
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600441 when Haswell .. Tigerlake => 8191);
Nico Hubera02b2c62018-01-09 15:58:34 +0100442
443 Maximum_Cursor_Y : constant := 4095;
444
Nico Huber74ec9622016-11-19 03:00:43 +0100445 ----------------------------------------------------------------------------
446
Nico Huber21da5742017-01-20 14:00:53 +0100447 -- FIXME: Unknown for Broxton, Linux' i915 contains a fixme too :-D
Nico Huber74ec9622016-11-19 03:00:43 +0100448 HDMI_Max_Clock_24bpp : constant Frequency_Type :=
Nico Huber530651b2019-10-03 14:59:38 +0200449 (case Gen is
Arthur Heymans960e2392026-03-03 19:45:24 +0100450 when Generation'First .. G45 => 165_000_000, -- i945: no HDMI, moot
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600451 when Ironlake => 225_000_000,
452 when Haswell .. Skylake => 300_000_000,
Nico Huberac2a1412026-07-02 10:41:59 +0200453 when Tigerlake .. Generation'Last => 600_000_000);
Nico Huber74ec9622016-11-19 03:00:43 +0100454
Nico Huberb8ae6182017-07-15 20:03:56 +0200455 ----------------------------------------------------------------------------
456
Tim Wawrzynczak1b65b842022-09-09 10:23:06 -0600457 GMA_Phys_Base_Index : constant PCI.Index :=
458 (if Config.Tigerlake_On then 16#c0# else 16#5c#);
459
460 GMA_Base_Is_64bit : constant Boolean := Config.Tigerlake_On;
461
Arthur Heymans3f37cce2026-03-03 18:52:12 +0100462 AUD_VID_DID_Offset : <ilkhswvar> Natural :=
463 (if Gen_G45 then 16#06_2020#
464 elsif Gen_Ironlake then 16#0e_5020#
465 else 16#06_5020#);
466
467 -- Default 32-bit GTT offset for static MMIO instantiation.
468 Default_MMIO_GTT_32_Offset : constant Natural :=
469 (if Has_I945_GTT_BAR then 16#00_0000# else 16#20_0000#);
470 MMIO_GTT_32_Offset : <g45var> Natural :=
471 (if GMCH_GM965 then 16#0008_0000# else Default_MMIO_GTT_32_Offset);
472 MMIO_GTT_64_Offset : constant Natural := 16#80_0000#;
473 MMIO_GTT_Offset : <g45hswvar> Natural :=
474 (if Has_64bit_GTT then MMIO_GTT_64_Offset else MMIO_GTT_32_Offset);
Nico Huberadfe11f2018-06-10 14:59:04 +0200475 GTT_PTE_Size : <hswvar> Natural := (if Has_64bit_GTT then 8 else 4);
Nico Huberb8ae6182017-07-15 20:03:56 +0200476
Arthur Heymans960e2392026-03-03 19:45:24 +0100477 Fence_Base : <i945ilkvar> Natural :=
478 (if Gen_I945 then 16#0000_2000#
479 elsif not Sandybridge_On then 16#0000_3000#
480 else 16#0010_0000#);
Nico Huberb03c8f12017-08-25 13:29:08 +0200481
Nico Huberadfe11f2018-06-10 14:59:04 +0200482 Fence_Count : <ilkvar> Natural :=
Nico Huber998ee2b2018-06-12 23:02:17 +0200483 (if not Ivybridge_On then 16 else 32);
Nico Huberb03c8f12017-08-25 13:29:08 +0200484
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200485 ----------------------------------------------------------------------------
486
487 use type HW.Word16;
488
Nico Huber25fdb152019-02-17 15:54:39 +0100489 -- GMA PCI IDs:
490 --
491 -- Rather catch too much here than too little, it's
492 -- mostly used to distinguish generations. Best public
493 -- reference for these IDs is Linux' i915.
494 --
495 -- Since Sandybridge, bits 4 and 5 encode the compu-
496 -- tational capabilities and can mostly be ignored.
497 -- From Haswell on, we have to distinguish between
498 -- Normal, ULT (U CPU lines) and ULX (Y CPU lines).
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200499
Nico Huber25fdb152019-02-17 15:54:39 +0100500 function Is_Haswell_Y (Device_Id : Word16) return Boolean is
501 ((Device_Id and 16#ffef#) = 16#0a0e#);
502 function Is_Haswell_U (Device_Id : Word16) return Boolean is
503 (((Device_Id and 16#ffc3#) = 16#0a02# or
504 (Device_Id and 16#ffcf#) = 16#0a0b#) and
505 not Is_Haswell_Y (Device_Id));
506 function Is_Haswell (Device_Id : Word16) return Boolean is
507 ((Device_Id and 16#ffc3#) = 16#0402# or
508 (Device_Id and 16#ffcf#) = 16#040b# or
509 (Device_Id and 16#ffc3#) = 16#0c02# or
510 (Device_Id and 16#ffcf#) = 16#0c0b# or
511 (Device_Id and 16#ffc3#) = 16#0d02# or
512 (Device_Id and 16#ffcf#) = 16#0d0b#);
513
514 function Is_Broadwell_Y (Device_Id : Word16) return Boolean is
515 ((Device_Id and 16#ffcf#) = 16#160e#);
516 function Is_Broadwell_U (Device_Id : Word16) return Boolean is
517 ((Device_Id and 16#ffcf#) = 16#1606# or
518 (Device_Id and 16#ffcf#) = 16#160b#);
519 function Is_Broadwell (Device_Id : Word16) return Boolean is
520 ((Device_Id and 16#ffc7#) = 16#1602# or
521 (Device_Id and 16#ffcf#) = 16#160d#);
522
523 function Is_Skylake_Y (Device_Id : Word16) return Boolean is
524 ((Device_Id and 16#ffcf#) = 16#190e#);
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200525 function Is_Skylake_U (Device_Id : Word16) return Boolean is
Nico Huber25fdb152019-02-17 15:54:39 +0100526 ((Device_Id and 16#ffc9#) = 16#1901# or
527 (Device_Id and 16#ffcf#) = 16#1906#);
528 function Is_Skylake (Device_Id : Word16) return Boolean is
529 ((Device_Id and 16#ffc7#) = 16#1902# or
530 (Device_Id and 16#ffcf#) = 16#190b# or
531 (Device_Id and 16#ffcf#) = 16#190d#);
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200532
Nico Huber88badbe2018-09-27 16:36:47 +0200533 function Is_Kaby_Lake_Y (Device_Id : Word16) return Boolean is
534 ((Device_Id and 16#ffcf#) = 16#5905# or
535 (Device_Id and 16#ffcf#) = 16#590e#);
536 function Is_Kaby_Lake_Y_AML (Device_Id : Word16) return Boolean is
537 (Device_Id = 16#591c# or Device_Id = 16#87c0#);
538 function Is_Kaby_Lake_U (Device_Id : Word16) return Boolean is
539 ((Device_Id and 16#ffcd#) = 16#5901# or
540 (Device_Id and 16#ffce#) = 16#5906#);
541 function Is_Kaby_Lake (Device_Id : Word16) return Boolean is
542 ((Device_Id and 16#ffc7#) = 16#5902# or
543 (Device_Id and 16#ffcf#) = 16#5908# or
544 (Device_Id and 16#ffcf#) = 16#590b# or
545 (Device_Id and 16#ffcf#) = 16#590d#);
546
Nico Huber2c927942019-02-17 19:07:31 +0100547 function Is_Coffee_Lake_Y_AML (Device_Id : Word16) return Boolean is
548 (Device_Id = 16#87ca#);
549 -- Including Whiskey Lake:
550 function Is_Coffee_Lake_U (Device_Id : Word16) return Boolean is
551 ((Device_Id and 16#fff0#) = 16#3ea0#);
552 function Is_Coffee_Lake (Device_Id : Word16) return Boolean is
553 ((Device_Id and 16#fff0#) = 16#3e90#);
554
Nico Hubercdbfce22019-10-29 20:00:43 +0100555 function Is_Comet_Lake_U (Device_Id : Word16) return Boolean is
556 ((Device_Id and 16#ff9f#) = 16#9b01# or
557 (Device_Id and 16#ff9f#) = 16#9b8a# or
558 (Device_Id and 16#ff9f#) = 16#9b8c#);
559 function Is_Comet_Lake (Device_Id : Word16) return Boolean is
560 ((Device_Id and 16#ff8f#) = 16#9b82# or
561 (Device_Id and 16#ff8f#) = 16#9b84# or
562 (Device_Id and 16#ff8f#) = 16#9b85# or
563 (Device_Id and 16#ff8f#) = 16#9b86# or
564 (Device_Id and 16#ff8f#) = 16#9b88#);
565
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600566 -- For TGL, the distinction is UP4 (formerly Y), UP3 (U), or H (Normal),
567 -- however, the PRMs state "The Intel UHD Graphics Device ID SKUs are
568 -- unified for both UP3 and UP4, e.g. there is no unique device ID
569 -- between UP3 and UP4"
570 function Is_Tiger_Lake_U (Device_Id : Word16) return Boolean is
571 (Device_Id = 16#9a40# or
572 Device_Id = 16#9a49# or
573 Device_Id = 16#9a59# or
574 Device_Id = 16#9a78# or
575 Device_Id = 16#9ac0# or
576 Device_Id = 16#9ac9# or
577 Device_Id = 16#9ad9# or
578 Device_Id = 16#9af8#);
579
580 function Is_Tiger_Lake_H (Device_Id : Word16) return Boolean is
581 (Device_Id = 16#9a60# or
582 Device_Id = 16#9a68# or
583 Device_Id = 16#9a70#);
584
Nico Huberac2a1412026-07-02 10:41:59 +0200585 function Is_Alder_Lake_P (Device_Id : Word16) return Boolean is
Tim Wawrzynczake9631d82022-09-09 12:26:32 -0600586 (Device_Id = 16#46a0# or
587 Device_Id = 16#46a1# or
588 Device_Id = 16#46a2# or
589 Device_Id = 16#46a3# or
590 Device_Id = 16#46a6# or
591 Device_Id = 16#46a8# or
592 Device_Id = 16#46aa# or
593 Device_Id = 16#462a# or
594 Device_Id = 16#4626# or
595 Device_Id = 16#4628# or
596 Device_Id = 16#46b0# or
597 Device_Id = 16#46b1# or
598 Device_Id = 16#46b2# or
599 Device_Id = 16#46b3# or
600 Device_Id = 16#46c0# or
601 Device_Id = 16#46c1# or
602 Device_Id = 16#46c2# or
603 Device_Id = 16#46c3#);
Nico Huberac2a1412026-07-02 10:41:59 +0200604 function Is_Alder_Lake_N (Device_Id : Word16) return Boolean is
Tim Wawrzynczake9631d82022-09-09 12:26:32 -0600605 (Device_Id = 16#46d0# or
606 Device_Id = 16#46d1# or
607 Device_Id = 16#46d2#);
Nico Huberac2a1412026-07-02 10:41:59 +0200608 function Is_Raptor_Lake_P (Device_Id : Word16) return Boolean is
Tim Wawrzynczake9631d82022-09-09 12:26:32 -0600609 (Device_Id = 16#a720# or
610 Device_Id = 16#a721# or
611 Device_Id = 16#a7a0# or
612 Device_Id = 16#a7a1# or
613 Device_Id = 16#a7a8# or
Anil Kumar87469f22023-09-15 11:14:47 -0700614 Device_Id = 16#a7a9# or
615 Device_Id = 16#a7aa# or
616 Device_Id = 16#a7ab# or
617 Device_Id = 16#a7ac# or
618 Device_Id = 16#a7ad#);
Tim Wawrzynczake9631d82022-09-09 12:26:32 -0600619 function Is_Alder_Lake (Device_Id : Word16) return Boolean is
620 (Is_Alder_Lake_P (Device_Id) or
621 Is_Alder_Lake_N (Device_Id) or
622 Is_Raptor_Lake_P (Device_Id));
623
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200624 function Is_GPU (Device_Id : Word16; CPU : CPU_Type; CPU_Var : CPU_Variant)
625 return Boolean is
626 (case CPU is
Arthur Heymans960e2392026-03-03 19:45:24 +0100627 when I945G => Device_Id = 16#2772#,
Arthur Heymans3f37cce2026-03-03 18:52:12 +0100628 when GM965 => (Device_Id and 16#ffef#) = 16#2a02#,
Arthur Heymans960e2392026-03-03 19:45:24 +0100629 when I945GM => Device_Id = 16#27a2# or Device_Id = 16#27ae#,
Nico Huber7f3e2802019-09-28 20:40:55 +0200630 when G45 => (Device_Id and 16#ff02#) = 16#2e02#,
631 when GM45 => (Device_Id and 16#fffe#) = 16#2a42#,
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200632 when Ironlake => (Device_Id and 16#fff3#) = 16#0042#,
633 when Sandybridge => (Device_Id and 16#ffc2#) = 16#0102#,
634 when Ivybridge => (Device_Id and 16#ffc3#) = 16#0142#,
Nico Huber25fdb152019-02-17 15:54:39 +0100635 when Haswell => (case CPU_Var is
636 when Normal => Is_Haswell (Device_Id),
637 when ULT => Is_Haswell_U (Device_Id),
638 when ULX => Is_Haswell_Y (Device_Id)),
639 when Broadwell => (case CPU_Var is
640 when Normal => Is_Broadwell (Device_Id),
641 when ULT => Is_Broadwell_U (Device_Id),
642 when ULX => Is_Broadwell_Y (Device_Id)),
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200643 when Broxton => (Device_Id and 16#fffe#) = 16#5a84#,
Nico Huber25fdb152019-02-17 15:54:39 +0100644 when Skylake => (case CPU_Var is
645 when Normal => Is_Skylake (Device_Id),
646 when ULT => Is_Skylake_U (Device_Id),
Nico Huber88badbe2018-09-27 16:36:47 +0200647 when ULX => Is_Skylake_Y (Device_Id)),
648 when Kabylake => (case CPU_Var is
Nico Huber2c927942019-02-17 19:07:31 +0100649 when Normal =>
650 Is_Kaby_Lake (Device_Id) or
Nico Hubercdbfce22019-10-29 20:00:43 +0100651 Is_Coffee_Lake (Device_Id) or
652 Is_Comet_Lake (Device_Id),
Nico Huber2c927942019-02-17 19:07:31 +0100653 when ULT =>
654 Is_Kaby_Lake_U (Device_Id) or
Nico Hubercdbfce22019-10-29 20:00:43 +0100655 Is_Coffee_Lake_U (Device_Id) or
656 Is_Comet_Lake_U (Device_Id),
Nico Huber2c927942019-02-17 19:07:31 +0100657 when ULX =>
658 Is_Kaby_Lake_Y (Device_Id) or
659 Is_Kaby_Lake_Y_AML (Device_Id) or
Tim Wawrzynczak605660b2022-06-08 12:48:19 -0600660 Is_Coffee_Lake_Y_AML (Device_Id)),
661 when Tigerlake => (case CPU_Var is
662 when Normal =>
663 Is_Tiger_Lake_H (Device_Id),
664 when ULT | ULX =>
Tim Wawrzynczake9631d82022-09-09 12:26:32 -0600665 Is_Tiger_Lake_U (Device_Id)),
666 when Alderlake => (case CPU_Var is
667 when Normal =>
668 False,
669 when ULT | ULX =>
Nico Huberac2a1412026-07-02 10:41:59 +0200670 Is_Alder_Lake (Device_Id)));
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200671
672 function Compatible_GPU (Device_Id : Word16) return Boolean is
673 (Is_GPU (Device_Id, CPU, CPU_Var));
674
Nico Huber6a996dc2018-06-17 16:30:33 +0200675 pragma Warnings (GNATprove, Off, "subprogram ""Detect_CPU"" has no effect",
676 Reason => "only effective in dynamic cpu config");
677 procedure Detect_CPU (Device : Word16)<cpunull>;
678
Nico Huber83693c82016-10-08 22:17:55 +0200679end HW.GFX.GMA.Config;