| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 1 | -- |
| Nico Huber | 3d06de8 | 2018-05-29 01:35:04 +0200 | [diff] [blame] | 2 | -- Copyright (C) 2015-2018 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 |
| 21 | when G45 => G45, |
| 22 | when Ironlake => Ironlake, |
| 23 | when Haswell => Haswell, |
| 24 | when Broxton => Broxton, |
| 25 | when Skylake => Skylake); |
| 26 | CPU_Last : constant CPU_Type := |
| 27 | (case Gen is |
| 28 | when G45 => G45, |
| 29 | when Ironlake => Ivybridge, |
| 30 | when Haswell => Broadwell, |
| 31 | when Broxton => Broxton, |
| 32 | when Skylake => Skylake); |
| 33 | CPU_Var_Last : constant CPU_Variant := |
| 34 | (case Gen is |
| 35 | when Haswell | Skylake => ULT, |
| 36 | when others => Normal); |
| 37 | subtype Gen_CPU_Type is CPU_Type range CPU_First .. CPU_Last; |
| 38 | subtype Gen_CPU_Variant is CPU_Variant range Normal .. CPU_Var_Last; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 39 | |
| Nico Huber | d7809ab | 2018-06-10 15:44:23 +0200 | [diff] [blame] | 40 | CPU : constant Gen_CPU_Type := <<CPU>>; |
| 41 | |
| 42 | CPU_Var : constant Gen_CPU_Variant := <<CPU_VARIANT>>; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 43 | |
| 44 | Internal_Display : constant Internal_Type := <<INTERNAL_PORT>>; |
| 45 | |
| Nico Huber | d55afeb | 2016-10-21 14:31:10 +0200 | [diff] [blame] | 46 | Analog_I2C_Port : constant PCH_Port := <<ANALOG_I2C_PORT>>; |
| 47 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 48 | EDP_Low_Voltage_Swing : constant Boolean := False; |
| 49 | |
| Nico Huber | 247adf3 | 2017-06-12 14:39:11 +0200 | [diff] [blame] | 50 | DDI_HDMI_Buffer_Translation : constant Integer := -1; |
| 51 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 52 | Default_MMIO_Base : constant := <<DEFAULT_MMIO_BASE>>; |
| 53 | |
| 54 | LVDS_Dual_Threshold : constant := 95_000_000; |
| 55 | |
| 56 | ---------------------------------------------------------------------------- |
| 57 | |
| Nico Huber | 30e8408 | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 58 | type Valid_Port_Array is array (Port_Type) of Boolean; |
| 59 | type Variable_Config is record |
| 60 | Valid_Port : Valid_Port_Array; |
| 61 | Raw_Clock : Frequency_Type; |
| 62 | end record; |
| 63 | |
| Nico Huber | 27088aa | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 64 | Initial_Settings : constant Variable_Config := |
| Nico Huber | 30e8408 | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 65 | (Valid_Port => (others => False), |
| Nico Huber | 27088aa | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 66 | Raw_Clock => Frequency_Type'First); |
| 67 | |
| 68 | Variable : Variable_Config with Part_Of => GMA.Config_State; |
| Nico Huber | 30e8408 | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 69 | |
| 70 | Valid_Port : Valid_Port_Array renames Variable.Valid_Port; |
| 71 | Raw_Clock : Frequency_Type renames Variable.Raw_Clock; |
| 72 | |
| 73 | ---------------------------------------------------------------------------- |
| 74 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 75 | -- To support both static configurations, that are compiled for a |
| 76 | -- fixed CPU, and dynamic configurations, where the CPU and its |
| 77 | -- variant are detected at runtime, all derived config values are |
| 78 | -- tagged based on their dependencies. |
| 79 | -- |
| 80 | -- Booleans that only depend on the generation should be tagged |
| 81 | -- <genbool>. Those that may depend on the CPU are tagged with the |
| 82 | -- generations where that is the case. For instance `CPU_Ivybridge` |
| 83 | -- can be decided purely based on the generation unless the gene- |
| 84 | -- ration is Ironlake, thus, it is tagged <ilkbool>. |
| 85 | -- |
| 86 | -- For non-boolean constants, per generation tags <...var> are |
| 87 | -- used (e.g. <ilkvar>). |
| 88 | -- |
| 89 | -- To ease parsing, all multiline expressions of tagged config |
| 90 | -- values start after a line break. |
| Nico Huber | 6621a14 | 2018-06-07 23:56:54 +0200 | [diff] [blame] | 91 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 92 | Gen_G45 : <genbool> := Gen = G45; |
| 93 | Gen_Ironlake : <genbool> := Gen = Ironlake; |
| 94 | Gen_Haswell : <genbool> := Gen = Haswell; |
| 95 | Gen_Broxton : <genbool> := Gen = Broxton; |
| 96 | Gen_Skylake : <genbool> := Gen = Skylake; |
| Nico Huber | 6621a14 | 2018-06-07 23:56:54 +0200 | [diff] [blame] | 97 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 98 | Up_To_Ironlake : <genbool> := Gen <= Ironlake; |
| 99 | Ironlake_On : <genbool> := Gen >= Ironlake; |
| 100 | Haswell_On : <genbool> := Gen >= Haswell; |
| 101 | Broxton_On : <genbool> := Gen >= Broxton; |
| 102 | Skylake_On : <genbool> := Gen >= Skylake; |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 103 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 104 | CPU_Ironlake : <ilkbool> := Gen_Ironlake and then CPU = Ironlake; |
| 105 | CPU_Sandybridge : <ilkbool> := Gen_Ironlake and then CPU = Sandybridge; |
| 106 | CPU_Ivybridge : <ilkbool> := Gen_Ironlake and then CPU = Ivybridge; |
| 107 | CPU_Haswell : <hswbool> := Gen_Haswell and then CPU = Haswell; |
| 108 | CPU_Broadwell : <hswbool> := Gen_Haswell and then CPU = Broadwell; |
| 109 | |
| 110 | Sandybridge_On : <ilkbool> := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 111 | ((Gen_Ironlake and then CPU >= Sandybridge) or Haswell_On); |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 112 | Ivybridge_On : <ilkbool> := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 113 | ((Gen_Ironlake and then CPU >= Ivybridge) or Haswell_On); |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 114 | Broadwell_On : <hswbool> := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 115 | ((Gen_Haswell and then CPU >= Broadwell) or Broxton_On); |
| 116 | |
| Nico Huber | 6621a14 | 2018-06-07 23:56:54 +0200 | [diff] [blame] | 117 | ---------------------------------------------------------------------------- |
| 118 | |
| Nico Huber | 117db37 | 2018-06-09 17:56:05 +0200 | [diff] [blame] | 119 | Have_HDMI_Buf_Override : constant Boolean := DDI_HDMI_Buffer_Translation >= 0; |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 120 | Default_MMIO_Base_Set : constant Boolean := Default_MMIO_Base /= 0; |
| 121 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 122 | Has_Internal_Display : constant Boolean := Internal_Display /= None; |
| Nico Huber | 318bca1 | 2018-06-09 19:22:52 +0200 | [diff] [blame] | 123 | Internal_Is_LVDS : constant Boolean := Internal_Display = LVDS; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 124 | Internal_Is_EDP : constant Boolean := Internal_Display = DP; |
| Nico Huber | 1bc496f | 2017-06-09 22:23:28 +0200 | [diff] [blame] | 125 | Have_DVI_I : constant Boolean := Analog_I2C_Port /= PCH_DAC; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 126 | |
| 127 | Has_Presence_Straps : <genbool> := not Gen_Broxton; |
| 128 | Is_ULT : <hswsklbool> := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 129 | ((Gen_Haswell or Gen_Skylake) and then CPU_Var = ULT); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 130 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 131 | ---------- CPU pipe: --------- |
| 132 | Has_Tertiary_Pipe : <ilkbool> := Ivybridge_On; |
| 133 | Disable_Trickle_Feed : <genbool> := not Gen_Haswell; |
| 134 | Pipe_Enabled_Workaround : <hswbool> := CPU_Broadwell; |
| 135 | Has_EDP_Transcoder : <genbool> := Haswell_On; |
| 136 | Use_PDW_For_EDP_Scaling : <hswbool> := CPU_Haswell; |
| 137 | Has_Pipe_DDI_Func : <genbool> := Haswell_On; |
| 138 | Has_Trans_Clk_Sel : <genbool> := Haswell_On; |
| 139 | Has_Pipe_MSA_Misc : <genbool> := Haswell_On; |
| 140 | Has_Pipeconf_Misc : <hswbool> := Broadwell_On; |
| 141 | Has_Pipeconf_BPC : <hswbool> := not CPU_Haswell; |
| 142 | Has_Plane_Control : <genbool> := Broxton_On; |
| 143 | Has_DSP_Linoff : <genbool> := Up_To_Ironlake; |
| 144 | Has_PF_Pipe_Select : <ilkhswbool> := CPU_Ivybridge or CPU_Haswell; |
| 145 | Has_Cursor_FBC_Control : <ilkbool> := Ivybridge_On; |
| 146 | VGA_Plane_Workaround : <ilkbool> := CPU_Ivybridge; |
| 147 | Has_GMCH_DP_Transcoder : <genbool> := Gen_G45; |
| 148 | Has_GMCH_VGACNTRL : <genbool> := Gen_G45; |
| 149 | Has_GMCH_PFIT_CONTROL : <genbool> := Gen_G45; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 150 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 151 | --------- Panel power: ------- |
| 152 | Has_PP_Write_Protection : <genbool> := Up_To_Ironlake; |
| 153 | Has_PP_Port_Select : <genbool> := Up_To_Ironlake; |
| 154 | Use_PP_VDD_Override : <genbool> := Up_To_Ironlake; |
| 155 | Has_PCH_Panel_Power : <genbool> := Ironlake_On; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 156 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 157 | ----------- PCH/FDI: --------- |
| 158 | Has_PCH : <genbool> := not Gen_Broxton and not Gen_G45; |
| 159 | Has_PCH_DAC : <hswbool> := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 160 | (Gen_Ironlake or (Gen_Haswell and then not Is_ULT)); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 161 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 162 | Has_PCH_Aux_Channels : <genbool> := Gen_Ironlake or Gen_Haswell; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 163 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 164 | VGA_Has_Sync_Disable : <genbool> := Up_To_Ironlake; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 165 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 166 | Has_Trans_Timing_Ovrrde : <ilkbool> := Sandybridge_On; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 167 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 168 | Has_DPLL_SEL : <genbool> := Gen_Ironlake; |
| 169 | Has_FDI_BPC : <genbool> := Gen_Ironlake; |
| 170 | Has_FDI_Composite_Sel : <ilkbool> := CPU_Ivybridge; |
| 171 | Has_New_FDI_Sink : <ilkbool> := Sandybridge_On; |
| 172 | Has_New_FDI_Source : <ilkbool> := Ivybridge_On; |
| 173 | Has_Trans_DP_Ctl : <ilkbool> := CPU_Sandybridge or CPU_Ivybridge; |
| 174 | Has_FDI_C : <ilkbool> := CPU_Ivybridge; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 175 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 176 | Has_FDI_RX_Power_Down : <genbool> := Gen_Haswell; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 177 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 178 | Has_GMCH_RawClk : <genbool> := Gen_G45; |
| Arthur Heymans | 73ea032 | 2018-03-28 17:17:07 +0200 | [diff] [blame] | 179 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 180 | ----------- DDI: ------------- |
| 181 | End_EDP_Training_Late : <genbool> := Gen_Haswell; |
| 182 | Has_Per_DDI_Clock_Sel : <genbool> := Gen_Haswell; |
| 183 | Has_HOTPLUG_CTL : <genbool> := Gen_Haswell; |
| 184 | Has_SHOTPLUG_CTL_A : <hswbool> := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 185 | ((Gen_Haswell and then Is_ULT) or Skylake_On); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 186 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 187 | Has_DDI_PHYs : <genbool> := Gen_Broxton; |
| Nico Huber | 19729a7 | 2017-07-30 01:05:05 +0200 | [diff] [blame] | 188 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 189 | Has_DDI_D : <hswsklbool> := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 190 | ((Gen_Haswell or Gen_Skylake) and then not Is_ULT); |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 191 | -- might be disabled by x4 eDP: |
| 192 | Has_DDI_E : <hswsklbool> := Has_DDI_D; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 193 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 194 | Has_DDI_Buffer_Trans : <genbool> := Haswell_On and not Has_DDI_PHYs; |
| 195 | Has_Low_Voltage_Swing : <genbool> := Broxton_On; |
| 196 | Has_Iboost_Config : <genbool> := Skylake_On; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 197 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 198 | Need_DP_Aux_Mutex : <genbool> := False; -- Skylake & (PSR | GTC) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 199 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 200 | ----------- GMBUS: ----------- |
| 201 | Ungate_GMBUS_Unit_Level : <genbool> := Skylake_On; |
| 202 | GMBUS_Alternative_Pins : <genbool> := Gen_Broxton; |
| 203 | Has_PCH_GMBUS : <genbool> := Ironlake_On; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 204 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 205 | ----------- Power: ----------- |
| 206 | Has_IPS : <hswbool> := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 207 | (Gen_Haswell and then |
| 208 | ((CPU_Haswell and Is_ULT) or CPU_Broadwell)); |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 209 | Has_IPS_CTL_Mailbox : <hswbool> := CPU_Broadwell; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 210 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 211 | Has_Per_Pipe_SRD : <hswbool> := Broadwell_On; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 212 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 213 | ----------- GTT: ------------- |
| 214 | Has_64bit_GTT : <hswbool> := Broadwell_On; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 215 | |
| 216 | ---------------------------------------------------------------------------- |
| 217 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 218 | Max_Pipe : <ilkvar> Pipe_Index := |
| Nico Huber | d58de7d | 2018-06-07 23:06:55 +0200 | [diff] [blame] | 219 | (if Has_Tertiary_Pipe then Tertiary else Secondary); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 220 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 221 | Last_Digital_Port : <hswsklvar> Digital_Port := |
| Nico Huber | 208857d | 2017-07-29 21:30:24 +0200 | [diff] [blame] | 222 | (if Has_DDI_E then DIGI_E else DIGI_C); |
| Nico Huber | ac455ad | 2017-02-14 14:41:19 +0100 | [diff] [blame] | 223 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 224 | ---------------------------------------------------------------------------- |
| 225 | |
| Nico Huber | 3c544ee | 2016-11-20 04:56:58 +0100 | [diff] [blame] | 226 | type FDI_Per_Port is array (Port_Type) of Boolean; |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 227 | Is_FDI_Port : <hswvar> FDI_Per_Port := |
| Nico Huber | 6621a14 | 2018-06-07 23:56:54 +0200 | [diff] [blame] | 228 | (Disabled => False, |
| 229 | Internal => Gen_Ironlake and Internal_Is_LVDS, |
| 230 | DP1 .. HDMI3 => Gen_Ironlake, |
| 231 | Analog => Has_PCH_DAC); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 232 | |
| 233 | type FDI_Lanes_Per_Port is array (GPU_Port) of DP_Lane_Count; |
| 234 | FDI_Lane_Count : constant FDI_Lanes_Per_Port := |
| 235 | (DIGI_D => DP_Lane_Count_2, |
| Nico Huber | 6621a14 | 2018-06-07 23:56:54 +0200 | [diff] [blame] | 236 | 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] | 237 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 238 | FDI_Training : <ilkvar> FDI_Training_Type := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 239 | (if CPU_Ironlake then Simple_Training |
| 240 | elsif CPU_Sandybridge then Full_Training |
| 241 | else Auto_Training); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 242 | |
| Nico Huber | f54d096 | 2016-10-20 14:17:18 +0200 | [diff] [blame] | 243 | ---------------------------------------------------------------------------- |
| 244 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 245 | Default_DDI_HDMI_Buffer_Translation : <hswvar> DDI_HDMI_Buf_Trans_Range := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 246 | (if CPU_Haswell then 6 |
| 247 | elsif CPU_Broadwell then 7 |
| 248 | elsif Broxton_On then 8 |
| 249 | else 0); |
| Nico Huber | 247adf3 | 2017-06-12 14:39:11 +0200 | [diff] [blame] | 250 | |
| 251 | ---------------------------------------------------------------------------- |
| 252 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 253 | Default_CDClk_Freq : <ilkvar> Frequency_Type := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 254 | (if Gen_G45 then 320_000_000 -- unused |
| 255 | elsif CPU_Ironlake or Gen_Haswell then 450_000_000 |
| 256 | elsif CPU_Sandybridge or CPU_Ivybridge then 400_000_000 |
| 257 | elsif Gen_Broxton then 288_000_000 |
| 258 | elsif Gen_Skylake then 337_500_000 |
| 259 | else Frequency_Type'First); |
| Nico Huber | abe3de2 | 2016-10-20 15:03:46 +0200 | [diff] [blame] | 260 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 261 | Default_RawClk_Freq : <hswvar> Frequency_Type := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 262 | (if Gen_G45 then 100_000_000 -- unused, depends on FSB |
| 263 | elsif Gen_Ironlake then 125_000_000 |
| 264 | elsif Gen_Haswell then (if Is_ULT then 24_000_000 else 125_000_000) |
| 265 | elsif Gen_Broxton then Frequency_Type'First -- none needed |
| 266 | elsif Gen_Skylake then 24_000_000 |
| 267 | else Frequency_Type'First); |
| Nico Huber | f54d096 | 2016-10-20 14:17:18 +0200 | [diff] [blame] | 268 | |
| Nico Huber | dcd274b | 2016-11-03 20:15:39 +0100 | [diff] [blame] | 269 | ---------------------------------------------------------------------------- |
| 270 | |
| 271 | -- Maximum source width with enabled scaler. This only accounts |
| 272 | -- for simple 1:1 pipe:scaler mappings. |
| 273 | |
| Nico Huber | c5c767a | 2018-06-03 01:09:04 +0200 | [diff] [blame] | 274 | type Width_Per_Pipe is array (Pipe_Index) of Width_Type; |
| Nico Huber | dcd274b | 2016-11-03 20:15:39 +0100 | [diff] [blame] | 275 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 276 | Maximum_Scalable_Width : <hswvar> Width_Per_Pipe := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 277 | (if Gen_G45 then -- TODO: Is this true? |
| 278 | (Primary => 4096, |
| 279 | Secondary => 2048, |
| 280 | Tertiary => Pos32'First) |
| 281 | elsif Gen_Ironlake or CPU_Haswell then |
| 282 | (Primary => 4096, |
| 283 | Secondary => 2048, |
| 284 | Tertiary => 2048) |
| 285 | else |
| 286 | (Primary => 4096, |
| 287 | Secondary => 4096, |
| 288 | Tertiary => 4096)); |
| Nico Huber | dcd274b | 2016-11-03 20:15:39 +0100 | [diff] [blame] | 289 | |
| Nico Huber | a02b2c6 | 2018-01-09 15:58:34 +0100 | [diff] [blame] | 290 | -- Maximum X position of hardware cursors |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 291 | Maximum_Cursor_X : constant := |
| 292 | (case Gen is |
| 293 | when G45 .. Ironlake => 4095, |
| 294 | when Haswell .. Skylake => 8191); |
| Nico Huber | a02b2c6 | 2018-01-09 15:58:34 +0100 | [diff] [blame] | 295 | |
| 296 | Maximum_Cursor_Y : constant := 4095; |
| 297 | |
| Nico Huber | 74ec962 | 2016-11-19 03:00:43 +0100 | [diff] [blame] | 298 | ---------------------------------------------------------------------------- |
| 299 | |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 300 | -- FIXME: Unknown for Broxton, Linux' i915 contains a fixme too :-D |
| Nico Huber | 74ec962 | 2016-11-19 03:00:43 +0100 | [diff] [blame] | 301 | HDMI_Max_Clock_24bpp : constant Frequency_Type := |
| Nico Huber | 6621a14 | 2018-06-07 23:56:54 +0200 | [diff] [blame] | 302 | (if Haswell_On then 300_000_000 else 225_000_000); |
| Nico Huber | 74ec962 | 2016-11-19 03:00:43 +0100 | [diff] [blame] | 303 | |
| Nico Huber | b8ae618 | 2017-07-15 20:03:56 +0200 | [diff] [blame] | 304 | ---------------------------------------------------------------------------- |
| 305 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 306 | GTT_PTE_Size : <hswvar> := (if Has_64bit_GTT then 8 else 4); |
| Nico Huber | b8ae618 | 2017-07-15 20:03:56 +0200 | [diff] [blame] | 307 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 308 | Fence_Base : <ilkvar> := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 309 | (if not Sandybridge_On then 16#0000_3000# else 16#0010_0000#); |
| Nico Huber | b03c8f1 | 2017-08-25 13:29:08 +0200 | [diff] [blame] | 310 | |
| Nico Huber | d936561 | 2018-06-10 14:59:04 +0200 | [diff] [blame^] | 311 | Fence_Count : <ilkvar> := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 312 | (if not Ivybridge_On then 16 else 32); |
| Nico Huber | b03c8f1 | 2017-08-25 13:29:08 +0200 | [diff] [blame] | 313 | |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame] | 314 | ---------------------------------------------------------------------------- |
| 315 | |
| 316 | use type HW.Word16; |
| 317 | |
| 318 | function Is_Broadwell_H (Device_Id : Word16) return Boolean is |
| 319 | (Device_Id = 16#1612# or Device_Id = 16#1622# or Device_Id = 16#162a#); |
| 320 | |
| 321 | function Is_Skylake_U (Device_Id : Word16) return Boolean is |
| 322 | (Device_Id = 16#1906# or Device_Id = 16#1916# or Device_Id = 16#1923# or |
| 323 | Device_Id = 16#1926# or Device_Id = 16#1927#); |
| 324 | |
| 325 | -- Rather catch too much here than too little, |
| 326 | -- it's only used to distinguish generations. |
| 327 | function Is_GPU (Device_Id : Word16; CPU : CPU_Type; CPU_Var : CPU_Variant) |
| 328 | return Boolean is |
| 329 | (case CPU is |
| Arthur Heymans | 73ea032 | 2018-03-28 17:17:07 +0200 | [diff] [blame] | 330 | when G45 => (Device_Id and 16#ff02#) = 16#2e02# or |
| 331 | (Device_Id and 16#fffe#) = 16#2a42#, |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame] | 332 | when Ironlake => (Device_Id and 16#fff3#) = 16#0042#, |
| 333 | when Sandybridge => (Device_Id and 16#ffc2#) = 16#0102#, |
| 334 | when Ivybridge => (Device_Id and 16#ffc3#) = 16#0142#, |
| 335 | when Haswell => |
| 336 | (case CPU_Var is |
| 337 | when Normal => (Device_Id and 16#ffc3#) = 16#0402# or |
| 338 | (Device_Id and 16#ffc3#) = 16#0d02#, |
| 339 | when ULT => (Device_Id and 16#ffc3#) = 16#0a02#), |
| 340 | when Broadwell => ((Device_Id and 16#ffc3#) = 16#1602# or |
| 341 | (Device_Id and 16#ffcf#) = 16#160b# or |
| 342 | (Device_Id and 16#ffcf#) = 16#160d#) and |
| 343 | (case CPU_Var is |
| 344 | when Normal => Is_Broadwell_H (Device_Id), |
| 345 | when ULT => not Is_Broadwell_H (Device_Id)), |
| 346 | when Broxton => (Device_Id and 16#fffe#) = 16#5a84#, |
| 347 | when Skylake => ((Device_Id and 16#ffc3#) = 16#1902# or |
| 348 | (Device_Id and 16#ffcf#) = 16#190b# or |
| 349 | (Device_Id and 16#ffcf#) = 16#190d# or |
| 350 | (Device_Id and 16#fff9#) = 16#1921#) and |
| 351 | (case CPU_Var is |
| 352 | when Normal => not Is_Skylake_U (Device_Id), |
| 353 | when ULT => Is_Skylake_U (Device_Id))); |
| 354 | |
| 355 | function Compatible_GPU (Device_Id : Word16) return Boolean is |
| 356 | (Is_GPU (Device_Id, CPU, CPU_Var)); |
| 357 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 358 | end HW.GFX.GMA.Config; |