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