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