| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 1 | -- |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 2 | -- Copyright (C) 2015-2019 secunet Security Networks AG |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 3 | -- |
| 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 Huber | 125a29e | 2016-10-18 00:23:54 +0200 | [diff] [blame] | 6 | -- the Free Software Foundation; either version 2 of the License, or |
| 7 | -- (at your option) any later version. |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 8 | -- |
| 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 Huber | 27088aa | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 15 | private package HW.GFX.GMA.Config is |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 16 | |
| Nico Huber | 6621a14 | 2018-06-07 23:56:54 +0200 | [diff] [blame] | 17 | Gen : constant Generation := <<GEN>>; |
| 18 | |
| Nico Huber | d7809ab | 2018-06-10 15:44:23 +0200 | [diff] [blame] | 19 | CPU_First : constant CPU_Type := |
| 20 | (case Gen is |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 21 | when I945 => I945G, |
| Nico Huber | d7809ab | 2018-06-10 15:44:23 +0200 | [diff] [blame] | 22 | when G45 => G45, |
| 23 | when Ironlake => Ironlake, |
| 24 | when Haswell => Haswell, |
| 25 | when Broxton => Broxton, |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 26 | when Skylake => Skylake, |
| 27 | when Tigerlake => Tigerlake); |
| Nico Huber | d7809ab | 2018-06-10 15:44:23 +0200 | [diff] [blame] | 28 | CPU_Last : constant CPU_Type := |
| 29 | (case Gen is |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 30 | when I945 => I945GM, |
| Nico Huber | 7f3e280 | 2019-09-28 20:40:55 +0200 | [diff] [blame] | 31 | when G45 => GM45, |
| Nico Huber | d7809ab | 2018-06-10 15:44:23 +0200 | [diff] [blame] | 32 | when Ironlake => Ivybridge, |
| 33 | when Haswell => Broadwell, |
| 34 | when Broxton => Broxton, |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 35 | when Skylake => Kabylake, |
| Tim Wawrzynczak | e9631d8 | 2022-09-09 12:26:32 -0600 | [diff] [blame] | 36 | when Tigerlake => Alderlake); |
| Nico Huber | d7809ab | 2018-06-10 15:44:23 +0200 | [diff] [blame] | 37 | CPU_Var_Last : constant CPU_Variant := |
| 38 | (case Gen is |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 39 | when Haswell | Skylake | Tigerlake => ULX, |
| 40 | when others => Normal); |
| Nico Huber | d7809ab | 2018-06-10 15:44:23 +0200 | [diff] [blame] | 41 | subtype Gen_CPU_Type is CPU_Type range CPU_First .. CPU_Last; |
| 42 | subtype Gen_CPU_Variant is CPU_Variant range Normal .. CPU_Var_Last; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 43 | |
| Nico Huber | d7809ab | 2018-06-10 15:44:23 +0200 | [diff] [blame] | 44 | CPU : constant Gen_CPU_Type := <<CPU>>; |
| 45 | |
| 46 | CPU_Var : constant Gen_CPU_Variant := <<CPU_VARIANT>>; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 47 | |
| Nico Huber | e79babd | 2020-12-20 01:33:26 +0100 | [diff] [blame] | 48 | PCH_First : constant PCH_Type := |
| 49 | (case Gen is |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 50 | when I945 => No_PCH, |
| Nico Huber | e79babd | 2020-12-20 01:33:26 +0100 | [diff] [blame] | 51 | when G45 => No_PCH, |
| 52 | when Ironlake => Ibex_Peak, |
| 53 | when Haswell => Lynx_Point, |
| 54 | when Broxton => No_PCH, |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 55 | when Skylake => Sunrise_Point, |
| 56 | when Tigerlake => Tiger_Point); |
| Nico Huber | e79babd | 2020-12-20 01:33:26 +0100 | [diff] [blame] | 57 | PCH_Last : constant PCH_Type := |
| 58 | (case Gen is |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 59 | when I945 => No_PCH, |
| Nico Huber | e79babd | 2020-12-20 01:33:26 +0100 | [diff] [blame] | 60 | when G45 => No_PCH, |
| 61 | when Ironlake => Cougar_Point, |
| 62 | when Haswell => Lynx_Point, |
| 63 | when Broxton => No_PCH, |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 64 | when Skylake => Cannon_Point, |
| Tim Wawrzynczak | e9631d8 | 2022-09-09 12:26:32 -0600 | [diff] [blame] | 65 | when Tigerlake => Alder_Point); |
| Nico Huber | e79babd | 2020-12-20 01:33:26 +0100 | [diff] [blame] | 66 | subtype Gen_PCH_Type is PCH_Type range PCH_First .. PCH_Last; |
| 67 | |
| 68 | PCH : constant Gen_PCH_Type := <<PCH>>; |
| 69 | |
| Nico Huber | 2bbd6e7 | 2020-01-07 18:22:59 +0100 | [diff] [blame] | 70 | Panel_Ports : constant array (Valid_Panels) of Port_Type := |
| Nico Huber | 5dbaf4b | 2020-01-08 17:24:58 +0100 | [diff] [blame] | 71 | (Panel_1 => <<PANEL_1_PORT>>, |
| 72 | Panel_2 => <<PANEL_2_PORT>>); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 73 | |
| Nico Huber | d55afeb | 2016-10-21 14:31:10 +0200 | [diff] [blame] | 74 | Analog_I2C_Port : constant PCH_Port := <<ANALOG_I2C_PORT>>; |
| 75 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 76 | EDP_Low_Voltage_Swing : constant Boolean := False; |
| 77 | |
| Nico Huber | 247adf3 | 2017-06-12 14:39:11 +0200 | [diff] [blame] | 78 | DDI_HDMI_Buffer_Translation : constant Integer := -1; |
| 79 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 80 | Default_MMIO_Base : constant := <<DEFAULT_MMIO_BASE>>; |
| 81 | |
| 82 | LVDS_Dual_Threshold : constant := 95_000_000; |
| 83 | |
| Matt DeVillier | 2a3dbba | 2020-05-14 17:34:13 -0500 | [diff] [blame] | 84 | Ignore_Presence_Straps : constant Boolean := <<IGNORE_STRAPS>>; |
| 85 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 86 | ---------------------------------------------------------------------------- |
| 87 | |
| Nico Huber | 07ff1b9 | 2019-09-29 00:03:17 +0200 | [diff] [blame] | 88 | -- On older generations dot clocks are limited to 90% of |
| 89 | -- the CDClk rate. To ease proofs, we limit CDClk's range. |
| 90 | CDClk_Min : constant Frequency_Type := |
| 91 | (case Gen is |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 92 | when I945 .. Ironlake => Frequency_Type'First * 100 / 90 + 1, |
| 93 | when others => Frequency_Type'First); |
| Nico Huber | 07ff1b9 | 2019-09-29 00:03:17 +0200 | [diff] [blame] | 94 | subtype CDClk_Range is Frequency_Type range CDClk_Min .. Frequency_Type'Last; |
| 95 | |
| 96 | ---------------------------------------------------------------------------- |
| 97 | |
| Nico Huber | 30e8408 | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 98 | type Valid_Port_Array is array (Port_Type) of Boolean; |
| 99 | type Variable_Config is record |
| 100 | Valid_Port : Valid_Port_Array; |
| Nico Huber | 07ff1b9 | 2019-09-29 00:03:17 +0200 | [diff] [blame] | 101 | CDClk : CDClk_Range; |
| 102 | Max_CDClk : CDClk_Range; |
| Nico Huber | 30e8408 | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 103 | Raw_Clock : Frequency_Type; |
| Nico Huber | adfe11f | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 104 | Dyn_CPU : Gen_CPU_Type; |
| 105 | Dyn_CPU_Var : Gen_CPU_Variant; |
| Nico Huber | 30e8408 | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 106 | end record; |
| 107 | |
| Nico Huber | 27088aa | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 108 | Initial_Settings : constant Variable_Config := |
| Nico Huber | 30e8408 | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 109 | (Valid_Port => (others => False), |
| Nico Huber | 07ff1b9 | 2019-09-29 00:03:17 +0200 | [diff] [blame] | 110 | CDClk => CDClk_Range'First, |
| 111 | Max_CDClk => CDClk_Range'First, |
| Nico Huber | adfe11f | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 112 | Raw_Clock => Frequency_Type'First, |
| 113 | Dyn_CPU => Gen_CPU_Type'First, |
| 114 | Dyn_CPU_Var => Gen_CPU_Variant'First); |
| Nico Huber | 27088aa | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 115 | |
| Nico Huber | e317e9c | 2019-09-29 03:03:18 +0200 | [diff] [blame] | 116 | Variable : Variable_Config with Part_Of => GMA.State; |
| Nico Huber | 30e8408 | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 117 | |
| 118 | Valid_Port : Valid_Port_Array renames Variable.Valid_Port; |
| Nico Huber | 07ff1b9 | 2019-09-29 00:03:17 +0200 | [diff] [blame] | 119 | CDClk : CDClk_Range renames Variable.CDClk; |
| 120 | Max_CDClk : CDClk_Range renames Variable.Max_CDClk; |
| Nico Huber | 30e8408 | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 121 | Raw_Clock : Frequency_Type renames Variable.Raw_Clock; |
| Nico Huber | adfe11f | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 122 | CPU : Gen_CPU_Type renames Variable.Dyn_CPU; |
| 123 | CPU_Var : Gen_CPU_Variant renames Variable.Dyn_CPU_Var; |
| Nico Huber | 30e8408 | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 124 | |
| 125 | ---------------------------------------------------------------------------- |
| 126 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 127 | -- To support both static configurations, that are compiled for a |
| 128 | -- fixed CPU, and dynamic configurations, where the CPU and its |
| 129 | -- variant are detected at runtime, all derived config values are |
| 130 | -- tagged based on their dependencies. |
| 131 | -- |
| 132 | -- Booleans that only depend on the generation should be tagged |
| 133 | -- <genbool>. Those that may depend on the CPU are tagged with the |
| 134 | -- generations where that is the case. For instance `CPU_Ivybridge` |
| 135 | -- can be decided purely based on the generation unless the gene- |
| 136 | -- ration is Ironlake, thus, it is tagged <ilkbool>. |
| 137 | -- |
| 138 | -- For non-boolean constants, per generation tags <...var> are |
| 139 | -- used (e.g. <ilkvar>). |
| 140 | -- |
| 141 | -- To ease parsing, all multiline expressions of tagged config |
| 142 | -- values start after a line break. |
| Nico Huber | 6621a14 | 2018-06-07 23:56:54 +0200 | [diff] [blame] | 143 | |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 144 | Gen_I945 : <genbool> := Gen = I945; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 145 | Gen_G45 : <genbool> := Gen = G45; |
| 146 | Gen_Ironlake : <genbool> := Gen = Ironlake; |
| 147 | Gen_Haswell : <genbool> := Gen = Haswell; |
| 148 | Gen_Broxton : <genbool> := Gen = Broxton; |
| 149 | Gen_Skylake : <genbool> := Gen = Skylake; |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 150 | Gen_Tigerlake : <genbool> := Gen = Tigerlake; |
| Nico Huber | 6621a14 | 2018-06-07 23:56:54 +0200 | [diff] [blame] | 151 | |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 152 | Up_To_G45 : <genbool> := Gen <= G45; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 153 | Up_To_Ironlake : <genbool> := Gen <= Ironlake; |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 154 | G45_On : <genbool> := Gen >= G45; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 155 | Ironlake_On : <genbool> := Gen >= Ironlake; |
| 156 | Haswell_On : <genbool> := Gen >= Haswell; |
| 157 | Broxton_On : <genbool> := Gen >= Broxton; |
| 158 | Skylake_On : <genbool> := Gen >= Skylake; |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 159 | Tigerlake_On : <genbool> := Gen >= Tigerlake; |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 160 | |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 161 | GMCH_I945GM : <i945bool> := Gen_I945 and then CPU = I945GM; |
| Nico Huber | b47a5c4 | 2019-09-29 00:07:21 +0200 | [diff] [blame] | 162 | GMCH_GM45 : <g45bool> := Gen_G45 and then CPU = GM45; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 163 | CPU_Ironlake : <ilkbool> := Gen_Ironlake and then CPU = Ironlake; |
| 164 | CPU_Sandybridge : <ilkbool> := Gen_Ironlake and then CPU = Sandybridge; |
| 165 | CPU_Ivybridge : <ilkbool> := Gen_Ironlake and then CPU = Ivybridge; |
| 166 | CPU_Haswell : <hswbool> := Gen_Haswell and then CPU = Haswell; |
| 167 | CPU_Broadwell : <hswbool> := Gen_Haswell and then CPU = Broadwell; |
| Nico Huber | 88badbe | 2018-09-27 16:36:47 +0200 | [diff] [blame] | 168 | CPU_Skylake : <sklbool> := Gen_Skylake and then CPU = Skylake; |
| 169 | CPU_Kabylake : <sklbool> := Gen_Skylake and then CPU = Kabylake; |
| Tim Wawrzynczak | e9631d8 | 2022-09-09 12:26:32 -0600 | [diff] [blame] | 170 | CPU_Tigerlake : <tglbool> := Gen_Tigerlake and then CPU = Tigerlake; |
| 171 | CPU_Alderlake : <tglbool> := Gen_Tigerlake and then CPU = Alderlake; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 172 | |
| 173 | Sandybridge_On : <ilkbool> := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 174 | ((Gen_Ironlake and then CPU >= Sandybridge) or Haswell_On); |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 175 | Ivybridge_On : <ilkbool> := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 176 | ((Gen_Ironlake and then CPU >= Ivybridge) or Haswell_On); |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 177 | Broadwell_On : <hswbool> := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 178 | ((Gen_Haswell and then CPU >= Broadwell) or Broxton_On); |
| Tim Wawrzynczak | e9631d8 | 2022-09-09 12:26:32 -0600 | [diff] [blame] | 179 | Alderlake_On : <tglbool> := |
| 180 | (Gen_Tigerlake and then CPU >= Alderlake); |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 181 | |
| Nico Huber | e79babd | 2020-12-20 01:33:26 +0100 | [diff] [blame] | 182 | PCH_Cougar_Point : <genbool> := Gen_Ironlake and then PCH = Cougar_Point; |
| 183 | |
| 184 | Cougar_Point_On : <genbool> := |
| 185 | ((Gen_Ironlake and then PCH >= Cougar_Point) or Haswell_On); |
| Nico Huber | dde0630 | 2020-12-20 02:18:30 +0100 | [diff] [blame] | 186 | Cannon_Point_On : <genbool> := Skylake_On and then PCH >= Cannon_Point; |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 187 | Tiger_Point_On : <genbool> := Tigerlake_On and then PCH >= Tiger_Point; |
| Nico Huber | e79babd | 2020-12-20 01:33:26 +0100 | [diff] [blame] | 188 | |
| Nico Huber | 6621a14 | 2018-06-07 23:56:54 +0200 | [diff] [blame] | 189 | ---------------------------------------------------------------------------- |
| 190 | |
| Nico Huber | 117db37 | 2018-06-09 17:56:05 +0200 | [diff] [blame] | 191 | Have_HDMI_Buf_Override : constant Boolean := DDI_HDMI_Buffer_Translation >= 0; |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 192 | Default_MMIO_Base_Set : constant Boolean := Default_MMIO_Base /= 0; |
| 193 | |
| Nico Huber | 1bc496f | 2017-06-09 22:23:28 +0200 | [diff] [blame] | 194 | Have_DVI_I : constant Boolean := Analog_I2C_Port /= PCH_DAC; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 195 | |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 196 | Has_Presence_Straps : <genbool> := not Gen_Broxton and not Gen_I945; |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 197 | Is_ULT : <hswskltglbool> := |
| 198 | ((Gen_Haswell or Gen_Skylake or Gen_Tigerlake) and then CPU_Var = ULT); |
| 199 | Is_ULX : <hswskltglbool> := |
| 200 | ((Gen_Haswell or Gen_Skylake or Gen_Tigerlake) and then CPU_Var = ULX); |
| 201 | Is_LP : <hswskltglbool> := Is_ULT or Is_ULX; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 202 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 203 | ---------- CPU pipe: --------- |
| 204 | Has_Tertiary_Pipe : <ilkbool> := Ivybridge_On; |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 205 | Disable_Trickle_Feed : <genbool> := not Gen_Haswell and not Gen_I945; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 206 | Pipe_Enabled_Workaround : <hswbool> := CPU_Broadwell; |
| Tim Wawrzynczak | 4be2e75 | 2022-09-09 10:37:06 -0600 | [diff] [blame] | 207 | Has_EDP_Transcoder : <genbool> := Haswell_On and not Tigerlake_On; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 208 | Use_PDW_For_EDP_Scaling : <hswbool> := CPU_Haswell; |
| 209 | Has_Pipe_DDI_Func : <genbool> := Haswell_On; |
| 210 | Has_Trans_Clk_Sel : <genbool> := Haswell_On; |
| 211 | Has_Pipe_MSA_Misc : <genbool> := Haswell_On; |
| 212 | Has_Pipeconf_Misc : <hswbool> := Broadwell_On; |
| 213 | Has_Pipeconf_BPC : <hswbool> := not CPU_Haswell; |
| 214 | Has_Plane_Control : <genbool> := Broxton_On; |
| 215 | Has_DSP_Linoff : <genbool> := Up_To_Ironlake; |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 216 | Has_DSPSURF : <genbool> := G45_On; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 217 | Has_PF_Pipe_Select : <ilkhswbool> := CPU_Ivybridge or CPU_Haswell; |
| Nico Huber | 75a707f | 2018-06-18 16:28:33 +0200 | [diff] [blame] | 218 | Has_Ivybridge_Cursors : <ilkbool> := Ivybridge_On; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 219 | VGA_Plane_Workaround : <ilkbool> := CPU_Ivybridge; |
| 220 | Has_GMCH_DP_Transcoder : <genbool> := Gen_G45; |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 221 | Has_GMCH_VGACNTRL : <genbool> := Up_To_G45; |
| 222 | Has_GMCH_PFIT_CONTROL : <genbool> := Up_To_G45; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 223 | |
| Tim Wawrzynczak | 4be2e75 | 2022-09-09 10:37:06 -0600 | [diff] [blame] | 224 | ----------- Transcoder ------- |
| 225 | Need_Early_Transcoder_Setup : <genbool> := Tigerlake_On; |
| 226 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 227 | --------- Panel power: ------- |
| 228 | Has_PP_Write_Protection : <genbool> := Up_To_Ironlake; |
| 229 | Has_PP_Port_Select : <genbool> := Up_To_Ironlake; |
| 230 | Use_PP_VDD_Override : <genbool> := Up_To_Ironlake; |
| 231 | Has_PCH_Panel_Power : <genbool> := Ironlake_On; |
| Nico Huber | dde0630 | 2020-12-20 02:18:30 +0100 | [diff] [blame] | 232 | Has_PP_Divisor_Reg : <genbool> := |
| 233 | (not Gen_Broxton and not Cannon_Point_On); |
| 234 | Has_New_Backlight_Control : <genbool> := Gen_Broxton or Cannon_Point_On; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 235 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 236 | ----------- PCH/FDI: --------- |
| Nico Huber | e79babd | 2020-12-20 01:33:26 +0100 | [diff] [blame] | 237 | Has_PCH : <genbool> := PCH /= No_PCH; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 238 | Has_PCH_DAC : <hswbool> := |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 239 | (Gen_Ironlake or (Gen_Haswell and then not Is_LP)); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 240 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 241 | Has_PCH_Aux_Channels : <genbool> := Gen_Ironlake or Gen_Haswell; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 242 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 243 | VGA_Has_Sync_Disable : <genbool> := Up_To_Ironlake; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 244 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 245 | Has_Trans_Timing_Ovrrde : <ilkbool> := Sandybridge_On; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 246 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 247 | Has_DPLL_SEL : <genbool> := Gen_Ironlake; |
| 248 | Has_FDI_BPC : <genbool> := Gen_Ironlake; |
| 249 | Has_FDI_Composite_Sel : <ilkbool> := CPU_Ivybridge; |
| Nico Huber | e79babd | 2020-12-20 01:33:26 +0100 | [diff] [blame] | 250 | Has_New_FDI_Sink : <genbool> := Cougar_Point_On; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 251 | Has_New_FDI_Source : <ilkbool> := Ivybridge_On; |
| Nico Huber | e79babd | 2020-12-20 01:33:26 +0100 | [diff] [blame] | 252 | Has_Trans_DP_Ctl : <genbool> := PCH_Cougar_Point; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 253 | Has_FDI_C : <ilkbool> := CPU_Ivybridge; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 254 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 255 | Has_FDI_RX_Power_Down : <genbool> := Gen_Haswell; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 256 | |
| Nico Huber | d0f84b9 | 2019-09-22 21:31:52 +0200 | [diff] [blame] | 257 | ---------- Clocks: ----------- |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 258 | Has_GMCH_RawClk : <genbool> := Up_To_G45; |
| Nico Huber | b47a5c4 | 2019-09-29 00:07:21 +0200 | [diff] [blame] | 259 | Has_GMCH_Mobile_VCO : <g45bool> := GMCH_GM45; |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 260 | |
| 261 | ---------- I945-specific: ---- |
| 262 | Has_I945_GTT_BAR : <genbool> := Gen_I945; |
| 263 | Has_I945_Simple_GTT_PTE : <genbool> := Gen_I945; |
| 264 | Has_Gen3_Fences : <genbool> := Gen_I945; |
| 265 | -- Pre-i965: LVDS encoder can only source from Pipe B (Secondary) |
| 266 | LVDS_Needs_Pipe_B : <genbool> := Gen_I945; |
| 267 | -- Pre-Gen5: DSPCNTR has a pipe select field (bits 25:24) |
| 268 | Has_DSPCNTR_Pipe_Select : <genbool> := Up_To_G45; |
| 269 | -- Gen3: Plane A feeds Pipe B, Plane B feeds Pipe A (for FBC + LVDS) |
| 270 | Planes_Pipes_Swapped : <genbool> := Gen_I945; |
| Nico Huber | d0f84b9 | 2019-09-22 21:31:52 +0200 | [diff] [blame] | 271 | Has_Broadwell_CDClk : <hswbool> := CPU_Broadwell; |
| 272 | Can_Switch_CDClk : <hswbool> := Broadwell_On; |
| Nico Huber | dde0630 | 2020-12-20 02:18:30 +0100 | [diff] [blame] | 273 | Has_Fractional_RawClk : <genbool> := Cannon_Point_On; |
| Arthur Heymans | 73ea032 | 2018-03-28 17:17:07 +0200 | [diff] [blame] | 274 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 275 | ----------- DDI: ------------- |
| 276 | End_EDP_Training_Late : <genbool> := Gen_Haswell; |
| 277 | Has_Per_DDI_Clock_Sel : <genbool> := Gen_Haswell; |
| 278 | Has_HOTPLUG_CTL : <genbool> := Gen_Haswell; |
| 279 | Has_SHOTPLUG_CTL_A : <hswbool> := |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 280 | ((Gen_Haswell and then Is_LP) or Skylake_On); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 281 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 282 | Has_DDI_PHYs : <genbool> := Gen_Broxton; |
| Nico Huber | 19729a7 | 2017-07-30 01:05:05 +0200 | [diff] [blame] | 283 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 284 | Has_DDI_D : <hswsklbool> := |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 285 | ((Gen_Haswell or Gen_Skylake) and then not Is_LP); |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 286 | -- might be disabled by x4 eDP: |
| 287 | Has_DDI_E : <hswsklbool> := Has_DDI_D; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 288 | |
| Tim Wawrzynczak | 4be2e75 | 2022-09-09 10:37:06 -0600 | [diff] [blame] | 289 | Has_TGL_DDI_Select : <genbool> := Tigerlake_On; |
| 290 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 291 | Has_DDI_Buffer_Trans : <genbool> := Haswell_On and not Has_DDI_PHYs; |
| 292 | Has_Low_Voltage_Swing : <genbool> := Broxton_On; |
| 293 | Has_Iboost_Config : <genbool> := Skylake_On; |
| Nico Huber | 88badbe | 2018-09-27 16:36:47 +0200 | [diff] [blame] | 294 | Use_KBL_DDI_Buf_Trans : <sklbool> := CPU_Kabylake; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 295 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 296 | Need_DP_Aux_Mutex : <genbool> := False; -- Skylake & (PSR | GTC) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 297 | |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 298 | ----- DP: -------------------- |
| 299 | DP_Max_2_7_GHz : <hswbool> := |
| 300 | (not Haswell_On or else (CPU_Haswell and Is_ULX)); |
| 301 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 302 | ----------- GMBUS: ----------- |
| Tim Wawrzynczak | 732feb4 | 2022-09-09 10:32:37 -0600 | [diff] [blame] | 303 | Ungate_GMBUS_Unit_Level : <genbool> := Skylake_On and not Tigerlake_On; |
| Nico Huber | dde0630 | 2020-12-20 02:18:30 +0100 | [diff] [blame] | 304 | GMBUS_Alternative_Pins : <genbool> := Gen_Broxton or Cannon_Point_On; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 305 | Has_PCH_GMBUS : <genbool> := Ironlake_On; |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 306 | Has_GMCH_GMBUS : <genbool> := Up_To_G45; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 307 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 308 | ----------- Power: ----------- |
| 309 | Has_IPS : <hswbool> := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 310 | (Gen_Haswell and then |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 311 | ((CPU_Haswell and Is_LP) or CPU_Broadwell)); |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 312 | Has_IPS_CTL_Mailbox : <hswbool> := CPU_Broadwell; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 313 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 314 | Has_Per_Pipe_SRD : <hswbool> := Broadwell_On; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 315 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 316 | ----------- GTT: ------------- |
| 317 | Has_64bit_GTT : <hswbool> := Broadwell_On; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 318 | |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 319 | ----------- Type-C: ---------- |
| 320 | Has_Type_C_Ports : <genbool> := Tigerlake_On; |
| 321 | |
| Tim Wawrzynczak | fc49b60 | 2022-09-09 10:29:24 -0600 | [diff] [blame] | 322 | ----------- Rawclk ----------- |
| 323 | Need_Rawclk_Numerator : <genbool> := Tigerlake_On; |
| 324 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 325 | ---------------------------------------------------------------------------- |
| 326 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 327 | Max_Pipe : <ilkvar> Pipe_Index := |
| Nico Huber | d58de7d | 2018-06-07 23:06:55 +0200 | [diff] [blame] | 328 | (if Has_Tertiary_Pipe then Tertiary else Secondary); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 329 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 330 | Last_Digital_Port : <hswsklvar> Digital_Port := |
| Nico Huber | 208857d | 2017-07-29 21:30:24 +0200 | [diff] [blame] | 331 | (if Has_DDI_E then DIGI_E else DIGI_C); |
| Nico Huber | ac455ad | 2017-02-14 14:41:19 +0100 | [diff] [blame] | 332 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 333 | ---------------------------------------------------------------------------- |
| 334 | |
| Nico Huber | 3c544ee | 2016-11-20 04:56:58 +0100 | [diff] [blame] | 335 | type FDI_Per_Port is array (Port_Type) of Boolean; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 336 | Is_FDI_Port : <hswvar> FDI_Per_Port := |
| Nico Huber | 6621a14 | 2018-06-07 23:56:54 +0200 | [diff] [blame] | 337 | (Disabled => False, |
| Nico Huber | 8beafd7 | 2020-01-07 14:59:44 +0100 | [diff] [blame] | 338 | eDP => False, |
| 339 | LVDS => Gen_Ironlake, |
| Nico Huber | 6621a14 | 2018-06-07 23:56:54 +0200 | [diff] [blame] | 340 | DP1 .. HDMI3 => Gen_Ironlake, |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 341 | Analog => Has_PCH_DAC, |
| 342 | others => False); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 343 | |
| 344 | type FDI_Lanes_Per_Port is array (GPU_Port) of DP_Lane_Count; |
| 345 | FDI_Lane_Count : constant FDI_Lanes_Per_Port := |
| 346 | (DIGI_D => DP_Lane_Count_2, |
| Nico Huber | 6621a14 | 2018-06-07 23:56:54 +0200 | [diff] [blame] | 347 | others => (if Gen_Ironlake then DP_Lane_Count_4 else DP_Lane_Count_2)); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 348 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 349 | FDI_Training : <ilkvar> FDI_Training_Type := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 350 | (if CPU_Ironlake then Simple_Training |
| 351 | elsif CPU_Sandybridge then Full_Training |
| 352 | else Auto_Training); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 353 | |
| Nico Huber | f54d096 | 2016-10-20 14:17:18 +0200 | [diff] [blame] | 354 | ---------------------------------------------------------------------------- |
| 355 | |
| Nico Huber | 88badbe | 2018-09-27 16:36:47 +0200 | [diff] [blame] | 356 | DDI_Buffer_Iboost : <hswsklvar> Natural := |
| 357 | (if Is_ULX or (CPU_Kabylake and Is_ULT) then 3 else 1); |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 358 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 359 | Default_DDI_HDMI_Buffer_Translation : <hswvar> DDI_HDMI_Buf_Trans_Range := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 360 | (if CPU_Haswell then 6 |
| 361 | elsif CPU_Broadwell then 7 |
| 362 | elsif Broxton_On then 8 |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 363 | elsif Tigerlake_On then 6 |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 364 | else 0); |
| Nico Huber | 247adf3 | 2017-06-12 14:39:11 +0200 | [diff] [blame] | 365 | |
| 366 | ---------------------------------------------------------------------------- |
| 367 | |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 368 | Default_CDClk_Freq : <i945ilkhswvar> CDClk_Range := |
| 369 | (if Gen_I945 then 200_000_000 -- unused, depends on GCFGC |
| 370 | elsif Gen_G45 then 320_000_000 -- unused |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 371 | elsif CPU_Ironlake then 450_000_000 |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 372 | elsif CPU_Sandybridge or CPU_Ivybridge then 400_000_000 |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 373 | elsif Gen_Haswell and then Is_ULX then 337_500_000 |
| 374 | elsif Gen_Haswell then 450_000_000 |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 375 | elsif Gen_Broxton then 288_000_000 |
| 376 | elsif Gen_Skylake then 337_500_000 |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 377 | elsif Gen_Tigerlake then CDClk_Range'First -- depends on ref clk |
| Nico Huber | 07ff1b9 | 2019-09-29 00:03:17 +0200 | [diff] [blame] | 378 | else CDClk_Range'First); |
| Nico Huber | abe3de2 | 2016-10-20 15:03:46 +0200 | [diff] [blame] | 379 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 380 | Default_RawClk_Freq : <hswvar> Frequency_Type := |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 381 | (if Gen_I945 then 100_000_000 -- unused, depends on FSB |
| 382 | elsif Gen_G45 then 100_000_000 -- unused, depends on FSB |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 383 | elsif Gen_Ironlake then 125_000_000 |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 384 | elsif Gen_Haswell then (if Is_LP then 24_000_000 else 125_000_000) |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 385 | elsif Gen_Broxton then Frequency_Type'First -- none needed |
| 386 | elsif Gen_Skylake then 24_000_000 |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 387 | elsif Gen_Tigerlake then 24_000_000 |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 388 | else Frequency_Type'First); |
| Nico Huber | f54d096 | 2016-10-20 14:17:18 +0200 | [diff] [blame] | 389 | |
| Nico Huber | dcd274b | 2016-11-03 20:15:39 +0100 | [diff] [blame] | 390 | ---------------------------------------------------------------------------- |
| 391 | |
| 392 | -- Maximum source width with enabled scaler. This only accounts |
| 393 | -- for simple 1:1 pipe:scaler mappings. |
| 394 | |
| Nico Huber | c5c767a | 2018-06-03 01:09:04 +0200 | [diff] [blame] | 395 | type Width_Per_Pipe is array (Pipe_Index) of Width_Type; |
| Nico Huber | dcd274b | 2016-11-03 20:15:39 +0100 | [diff] [blame] | 396 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 397 | Maximum_Scalable_Width : <hswvar> Width_Per_Pipe := |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 398 | (if Gen_I945 or Gen_G45 then |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 399 | (Primary => 4096, |
| 400 | Secondary => 2048, |
| 401 | Tertiary => Pos32'First) |
| 402 | elsif Gen_Ironlake or CPU_Haswell then |
| 403 | (Primary => 4096, |
| 404 | Secondary => 2048, |
| 405 | Tertiary => 2048) |
| 406 | else |
| 407 | (Primary => 4096, |
| 408 | Secondary => 4096, |
| 409 | Tertiary => 4096)); |
| Nico Huber | dcd274b | 2016-11-03 20:15:39 +0100 | [diff] [blame] | 410 | |
| Nico Huber | a02b2c6 | 2018-01-09 15:58:34 +0100 | [diff] [blame] | 411 | -- Maximum X position of hardware cursors |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 412 | Maximum_Cursor_X : constant := |
| 413 | (case Gen is |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 414 | when I945 .. Ironlake => 4095, |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 415 | when Haswell .. Tigerlake => 8191); |
| Nico Huber | a02b2c6 | 2018-01-09 15:58:34 +0100 | [diff] [blame] | 416 | |
| 417 | Maximum_Cursor_Y : constant := 4095; |
| 418 | |
| Nico Huber | 74ec962 | 2016-11-19 03:00:43 +0100 | [diff] [blame] | 419 | ---------------------------------------------------------------------------- |
| 420 | |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 421 | -- FIXME: Unknown for Broxton, Linux' i915 contains a fixme too :-D |
| Nico Huber | 74ec962 | 2016-11-19 03:00:43 +0100 | [diff] [blame] | 422 | HDMI_Max_Clock_24bpp : constant Frequency_Type := |
| Nico Huber | 530651b | 2019-10-03 14:59:38 +0200 | [diff] [blame] | 423 | (case Gen is |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 424 | when Generation'First .. G45 => 165_000_000, -- i945: no HDMI, moot |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 425 | when Ironlake => 225_000_000, |
| 426 | when Haswell .. Skylake => 300_000_000, |
| 427 | when Tigerlake .. Generation'Last => 600_000_000); |
| Nico Huber | 74ec962 | 2016-11-19 03:00:43 +0100 | [diff] [blame] | 428 | |
| Nico Huber | b8ae618 | 2017-07-15 20:03:56 +0200 | [diff] [blame] | 429 | ---------------------------------------------------------------------------- |
| 430 | |
| Tim Wawrzynczak | 1b65b84 | 2022-09-09 10:23:06 -0600 | [diff] [blame] | 431 | GMA_Phys_Base_Index : constant PCI.Index := |
| 432 | (if Config.Tigerlake_On then 16#c0# else 16#5c#); |
| 433 | |
| 434 | GMA_Base_Is_64bit : constant Boolean := Config.Tigerlake_On; |
| 435 | |
| Nico Huber | adfe11f | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 436 | GTT_PTE_Size : <hswvar> Natural := (if Has_64bit_GTT then 8 else 4); |
| Nico Huber | b8ae618 | 2017-07-15 20:03:56 +0200 | [diff] [blame] | 437 | |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 438 | Fence_Base : <i945ilkvar> Natural := |
| 439 | (if Gen_I945 then 16#0000_2000# |
| 440 | elsif not Sandybridge_On then 16#0000_3000# |
| 441 | else 16#0010_0000#); |
| Nico Huber | b03c8f1 | 2017-08-25 13:29:08 +0200 | [diff] [blame] | 442 | |
| Nico Huber | adfe11f | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 443 | Fence_Count : <ilkvar> Natural := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 444 | (if not Ivybridge_On then 16 else 32); |
| Nico Huber | b03c8f1 | 2017-08-25 13:29:08 +0200 | [diff] [blame] | 445 | |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame] | 446 | ---------------------------------------------------------------------------- |
| 447 | |
| 448 | use type HW.Word16; |
| 449 | |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 450 | -- GMA PCI IDs: |
| 451 | -- |
| 452 | -- Rather catch too much here than too little, it's |
| 453 | -- mostly used to distinguish generations. Best public |
| 454 | -- reference for these IDs is Linux' i915. |
| 455 | -- |
| 456 | -- Since Sandybridge, bits 4 and 5 encode the compu- |
| 457 | -- tational capabilities and can mostly be ignored. |
| 458 | -- From Haswell on, we have to distinguish between |
| 459 | -- Normal, ULT (U CPU lines) and ULX (Y CPU lines). |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame] | 460 | |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 461 | function Is_Haswell_Y (Device_Id : Word16) return Boolean is |
| 462 | ((Device_Id and 16#ffef#) = 16#0a0e#); |
| 463 | function Is_Haswell_U (Device_Id : Word16) return Boolean is |
| 464 | (((Device_Id and 16#ffc3#) = 16#0a02# or |
| 465 | (Device_Id and 16#ffcf#) = 16#0a0b#) and |
| 466 | not Is_Haswell_Y (Device_Id)); |
| 467 | function Is_Haswell (Device_Id : Word16) return Boolean is |
| 468 | ((Device_Id and 16#ffc3#) = 16#0402# or |
| 469 | (Device_Id and 16#ffcf#) = 16#040b# or |
| 470 | (Device_Id and 16#ffc3#) = 16#0c02# or |
| 471 | (Device_Id and 16#ffcf#) = 16#0c0b# or |
| 472 | (Device_Id and 16#ffc3#) = 16#0d02# or |
| 473 | (Device_Id and 16#ffcf#) = 16#0d0b#); |
| 474 | |
| 475 | function Is_Broadwell_Y (Device_Id : Word16) return Boolean is |
| 476 | ((Device_Id and 16#ffcf#) = 16#160e#); |
| 477 | function Is_Broadwell_U (Device_Id : Word16) return Boolean is |
| 478 | ((Device_Id and 16#ffcf#) = 16#1606# or |
| 479 | (Device_Id and 16#ffcf#) = 16#160b#); |
| 480 | function Is_Broadwell (Device_Id : Word16) return Boolean is |
| 481 | ((Device_Id and 16#ffc7#) = 16#1602# or |
| 482 | (Device_Id and 16#ffcf#) = 16#160d#); |
| 483 | |
| 484 | function Is_Skylake_Y (Device_Id : Word16) return Boolean is |
| 485 | ((Device_Id and 16#ffcf#) = 16#190e#); |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame] | 486 | function Is_Skylake_U (Device_Id : Word16) return Boolean is |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 487 | ((Device_Id and 16#ffc9#) = 16#1901# or |
| 488 | (Device_Id and 16#ffcf#) = 16#1906#); |
| 489 | function Is_Skylake (Device_Id : Word16) return Boolean is |
| 490 | ((Device_Id and 16#ffc7#) = 16#1902# or |
| 491 | (Device_Id and 16#ffcf#) = 16#190b# or |
| 492 | (Device_Id and 16#ffcf#) = 16#190d#); |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame] | 493 | |
| Nico Huber | 88badbe | 2018-09-27 16:36:47 +0200 | [diff] [blame] | 494 | function Is_Kaby_Lake_Y (Device_Id : Word16) return Boolean is |
| 495 | ((Device_Id and 16#ffcf#) = 16#5905# or |
| 496 | (Device_Id and 16#ffcf#) = 16#590e#); |
| 497 | function Is_Kaby_Lake_Y_AML (Device_Id : Word16) return Boolean is |
| 498 | (Device_Id = 16#591c# or Device_Id = 16#87c0#); |
| 499 | function Is_Kaby_Lake_U (Device_Id : Word16) return Boolean is |
| 500 | ((Device_Id and 16#ffcd#) = 16#5901# or |
| 501 | (Device_Id and 16#ffce#) = 16#5906#); |
| 502 | function Is_Kaby_Lake (Device_Id : Word16) return Boolean is |
| 503 | ((Device_Id and 16#ffc7#) = 16#5902# or |
| 504 | (Device_Id and 16#ffcf#) = 16#5908# or |
| 505 | (Device_Id and 16#ffcf#) = 16#590b# or |
| 506 | (Device_Id and 16#ffcf#) = 16#590d#); |
| 507 | |
| Nico Huber | 2c92794 | 2019-02-17 19:07:31 +0100 | [diff] [blame] | 508 | function Is_Coffee_Lake_Y_AML (Device_Id : Word16) return Boolean is |
| 509 | (Device_Id = 16#87ca#); |
| 510 | -- Including Whiskey Lake: |
| 511 | function Is_Coffee_Lake_U (Device_Id : Word16) return Boolean is |
| 512 | ((Device_Id and 16#fff0#) = 16#3ea0#); |
| 513 | function Is_Coffee_Lake (Device_Id : Word16) return Boolean is |
| 514 | ((Device_Id and 16#fff0#) = 16#3e90#); |
| 515 | |
| Nico Huber | cdbfce2 | 2019-10-29 20:00:43 +0100 | [diff] [blame] | 516 | function Is_Comet_Lake_U (Device_Id : Word16) return Boolean is |
| 517 | ((Device_Id and 16#ff9f#) = 16#9b01# or |
| 518 | (Device_Id and 16#ff9f#) = 16#9b8a# or |
| 519 | (Device_Id and 16#ff9f#) = 16#9b8c#); |
| 520 | function Is_Comet_Lake (Device_Id : Word16) return Boolean is |
| 521 | ((Device_Id and 16#ff8f#) = 16#9b82# or |
| 522 | (Device_Id and 16#ff8f#) = 16#9b84# or |
| 523 | (Device_Id and 16#ff8f#) = 16#9b85# or |
| 524 | (Device_Id and 16#ff8f#) = 16#9b86# or |
| 525 | (Device_Id and 16#ff8f#) = 16#9b88#); |
| 526 | |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 527 | -- For TGL, the distinction is UP4 (formerly Y), UP3 (U), or H (Normal), |
| 528 | -- however, the PRMs state "The Intel UHD Graphics Device ID SKUs are |
| 529 | -- unified for both UP3 and UP4, e.g. there is no unique device ID |
| 530 | -- between UP3 and UP4" |
| 531 | function Is_Tiger_Lake_U (Device_Id : Word16) return Boolean is |
| 532 | (Device_Id = 16#9a40# or |
| 533 | Device_Id = 16#9a49# or |
| 534 | Device_Id = 16#9a59# or |
| 535 | Device_Id = 16#9a78# or |
| 536 | Device_Id = 16#9ac0# or |
| 537 | Device_Id = 16#9ac9# or |
| 538 | Device_Id = 16#9ad9# or |
| 539 | Device_Id = 16#9af8#); |
| 540 | |
| 541 | function Is_Tiger_Lake_H (Device_Id : Word16) return Boolean is |
| 542 | (Device_Id = 16#9a60# or |
| 543 | Device_Id = 16#9a68# or |
| 544 | Device_Id = 16#9a70#); |
| 545 | |
| Tim Wawrzynczak | e9631d8 | 2022-09-09 12:26:32 -0600 | [diff] [blame] | 546 | function Is_Alder_Lake_P (Device_ID : Word16) return Boolean is |
| 547 | (Device_Id = 16#46a0# or |
| 548 | Device_Id = 16#46a1# or |
| 549 | Device_Id = 16#46a2# or |
| 550 | Device_Id = 16#46a3# or |
| 551 | Device_Id = 16#46a6# or |
| 552 | Device_Id = 16#46a8# or |
| 553 | Device_Id = 16#46aa# or |
| 554 | Device_Id = 16#462a# or |
| 555 | Device_Id = 16#4626# or |
| 556 | Device_Id = 16#4628# or |
| 557 | Device_Id = 16#46b0# or |
| 558 | Device_Id = 16#46b1# or |
| 559 | Device_Id = 16#46b2# or |
| 560 | Device_Id = 16#46b3# or |
| 561 | Device_Id = 16#46c0# or |
| 562 | Device_Id = 16#46c1# or |
| 563 | Device_Id = 16#46c2# or |
| 564 | Device_Id = 16#46c3#); |
| 565 | function Is_Alder_Lake_N (Device_ID : Word16) return Boolean is |
| 566 | (Device_Id = 16#46d0# or |
| 567 | Device_Id = 16#46d1# or |
| 568 | Device_Id = 16#46d2#); |
| 569 | function Is_Raptor_Lake_P (Device_ID : Word16) return Boolean is |
| 570 | (Device_Id = 16#a720# or |
| 571 | Device_Id = 16#a721# or |
| 572 | Device_Id = 16#a7a0# or |
| 573 | Device_Id = 16#a7a1# or |
| 574 | Device_Id = 16#a7a8# or |
| Anil Kumar | 87469f2 | 2023-09-15 11:14:47 -0700 | [diff] [blame] | 575 | Device_Id = 16#a7a9# or |
| 576 | Device_Id = 16#a7aa# or |
| 577 | Device_Id = 16#a7ab# or |
| 578 | Device_Id = 16#a7ac# or |
| 579 | Device_Id = 16#a7ad#); |
| Tim Wawrzynczak | e9631d8 | 2022-09-09 12:26:32 -0600 | [diff] [blame] | 580 | function Is_Alder_Lake (Device_Id : Word16) return Boolean is |
| 581 | (Is_Alder_Lake_P (Device_Id) or |
| 582 | Is_Alder_Lake_N (Device_Id) or |
| 583 | Is_Raptor_Lake_P (Device_Id)); |
| 584 | |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame] | 585 | function Is_GPU (Device_Id : Word16; CPU : CPU_Type; CPU_Var : CPU_Variant) |
| 586 | return Boolean is |
| 587 | (case CPU is |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame^] | 588 | when I945G => Device_Id = 16#2772#, |
| 589 | when I945GM => Device_Id = 16#27a2# or Device_Id = 16#27ae#, |
| Nico Huber | 7f3e280 | 2019-09-28 20:40:55 +0200 | [diff] [blame] | 590 | when G45 => (Device_Id and 16#ff02#) = 16#2e02#, |
| 591 | when GM45 => (Device_Id and 16#fffe#) = 16#2a42#, |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame] | 592 | when Ironlake => (Device_Id and 16#fff3#) = 16#0042#, |
| 593 | when Sandybridge => (Device_Id and 16#ffc2#) = 16#0102#, |
| 594 | when Ivybridge => (Device_Id and 16#ffc3#) = 16#0142#, |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 595 | when Haswell => (case CPU_Var is |
| 596 | when Normal => Is_Haswell (Device_Id), |
| 597 | when ULT => Is_Haswell_U (Device_Id), |
| 598 | when ULX => Is_Haswell_Y (Device_Id)), |
| 599 | when Broadwell => (case CPU_Var is |
| 600 | when Normal => Is_Broadwell (Device_Id), |
| 601 | when ULT => Is_Broadwell_U (Device_Id), |
| 602 | when ULX => Is_Broadwell_Y (Device_Id)), |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame] | 603 | when Broxton => (Device_Id and 16#fffe#) = 16#5a84#, |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 604 | when Skylake => (case CPU_Var is |
| 605 | when Normal => Is_Skylake (Device_Id), |
| 606 | when ULT => Is_Skylake_U (Device_Id), |
| Nico Huber | 88badbe | 2018-09-27 16:36:47 +0200 | [diff] [blame] | 607 | when ULX => Is_Skylake_Y (Device_Id)), |
| 608 | when Kabylake => (case CPU_Var is |
| Nico Huber | 2c92794 | 2019-02-17 19:07:31 +0100 | [diff] [blame] | 609 | when Normal => |
| 610 | Is_Kaby_Lake (Device_Id) or |
| Nico Huber | cdbfce2 | 2019-10-29 20:00:43 +0100 | [diff] [blame] | 611 | Is_Coffee_Lake (Device_Id) or |
| 612 | Is_Comet_Lake (Device_Id), |
| Nico Huber | 2c92794 | 2019-02-17 19:07:31 +0100 | [diff] [blame] | 613 | when ULT => |
| 614 | Is_Kaby_Lake_U (Device_Id) or |
| Nico Huber | cdbfce2 | 2019-10-29 20:00:43 +0100 | [diff] [blame] | 615 | Is_Coffee_Lake_U (Device_Id) or |
| 616 | Is_Comet_Lake_U (Device_Id), |
| Nico Huber | 2c92794 | 2019-02-17 19:07:31 +0100 | [diff] [blame] | 617 | when ULX => |
| 618 | Is_Kaby_Lake_Y (Device_Id) or |
| 619 | Is_Kaby_Lake_Y_AML (Device_Id) or |
| Tim Wawrzynczak | 605660b | 2022-06-08 12:48:19 -0600 | [diff] [blame] | 620 | Is_Coffee_Lake_Y_AML (Device_Id)), |
| 621 | when Tigerlake => (case CPU_Var is |
| 622 | when Normal => |
| 623 | Is_Tiger_Lake_H (Device_Id), |
| 624 | when ULT | ULX => |
| Tim Wawrzynczak | e9631d8 | 2022-09-09 12:26:32 -0600 | [diff] [blame] | 625 | Is_Tiger_Lake_U (Device_Id)), |
| 626 | when Alderlake => (case CPU_Var is |
| 627 | when Normal => |
| 628 | False, |
| 629 | when ULT | ULX => |
| 630 | Is_Alder_Lake (Device_ID))); |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame] | 631 | |
| 632 | function Compatible_GPU (Device_Id : Word16) return Boolean is |
| 633 | (Is_GPU (Device_Id, CPU, CPU_Var)); |
| 634 | |
| Nico Huber | 6a996dc | 2018-06-17 16:30:33 +0200 | [diff] [blame] | 635 | pragma Warnings (GNATprove, Off, "subprogram ""Detect_CPU"" has no effect", |
| 636 | Reason => "only effective in dynamic cpu config"); |
| 637 | procedure Detect_CPU (Device : Word16)<cpunull>; |
| 638 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 639 | end HW.GFX.GMA.Config; |