| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 1 | -- |
| Nico Huber | 01b680f | 2017-06-09 16:24:22 +0200 | [diff] [blame] | 2 | -- Copyright (C) 2015-2017 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 |
| 17 | Initializes => Valid_Port_GPU |
| 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 | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 50 | Has_Pipe_DDI_Func : constant Boolean := CPU >= Haswell; |
| 51 | Has_Trans_Clk_Sel : constant Boolean := CPU >= Haswell; |
| 52 | Has_Pipe_MSA_Misc : constant Boolean := CPU >= Haswell; |
| 53 | Has_Pipeconf_Misc : constant Boolean := CPU >= Broadwell; |
| 54 | Has_Pipeconf_BPC : constant Boolean := CPU /= Haswell; |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 55 | Has_Plane_Control : constant Boolean := CPU >= Broxton; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 56 | Has_DSP_Linoff : constant Boolean := CPU <= Ivybridge; |
| Nico Huber | 4916e34 | 2016-11-04 14:37:53 +0100 | [diff] [blame] | 57 | Has_PF_Pipe_Select : constant Boolean := CPU in Ivybridge .. Haswell; |
| Nico Huber | fbb4220 | 2016-11-07 15:08:26 +0100 | [diff] [blame] | 58 | VGA_Plane_Workaround : constant Boolean := CPU = Ivybridge; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 59 | |
| 60 | ----- Panel power: ----- |
| 61 | Has_PP_Write_Protection : constant Boolean := CPU <= Ivybridge; |
| 62 | Has_PP_Port_Select : constant Boolean := CPU <= Ivybridge; |
| 63 | Use_PP_VDD_Override : constant Boolean := CPU <= Ivybridge; |
| 64 | |
| 65 | ----- PCH/FDI: --------- |
| Nico Huber | 1c3b928 | 2017-02-09 13:57:04 +0100 | [diff] [blame] | 66 | Has_PCH : constant Boolean := CPU /= Broxton; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 67 | Has_PCH_DAC : constant Boolean := CPU in Ironlake .. Ivybridge or |
| 68 | (CPU in Broadwell .. Haswell |
| 69 | and CPU_Var = Normal); |
| 70 | |
| 71 | Has_PCH_Aux_Channels : constant Boolean := CPU in Ironlake .. Broadwell; |
| 72 | |
| 73 | VGA_Has_Sync_Disable : constant Boolean := CPU <= Ivybridge; |
| 74 | |
| 75 | Has_Trans_Timing_Ovrrde : constant Boolean := CPU >= Sandybridge; |
| 76 | |
| 77 | Has_DPLL_SEL : constant Boolean := CPU in Ironlake .. Ivybridge; |
| 78 | Has_FDI_BPC : constant Boolean := CPU in Ironlake .. Ivybridge; |
| 79 | Has_FDI_Composite_Sel : constant Boolean := CPU = Ivybridge; |
| 80 | Has_Trans_DP_Ctl : constant Boolean := CPU in |
| 81 | Sandybridge .. Ivybridge; |
| 82 | Has_FDI_C : constant Boolean := CPU = Ivybridge; |
| 83 | |
| 84 | Has_FDI_RX_Power_Down : constant Boolean := CPU in Haswell .. Broadwell; |
| 85 | |
| 86 | ----- DDI: ------------- |
| 87 | End_EDP_Training_Late : constant Boolean := CPU in Haswell .. Broadwell; |
| 88 | Has_Per_DDI_Clock_Sel : constant Boolean := CPU in Haswell .. Broadwell; |
| 89 | Has_HOTPLUG_CTL : constant Boolean := CPU in Haswell .. Broadwell; |
| 90 | Has_SHOTPLUG_CTL_A : constant Boolean := (CPU in Haswell .. Broadwell |
| 91 | and CPU_Var = ULT) or |
| 92 | CPU >= Skylake; |
| 93 | |
| 94 | Has_DDI_D : constant Boolean := (CPU in Haswell .. Broadwell |
| 95 | and CPU_Var = Normal) |
| 96 | or CPU >= Skylake; |
| 97 | |
| Nico Huber | 18ff0c1 | 2017-06-12 15:41:31 +0200 | [diff] [blame] | 98 | Has_DDI_Buffer_Trans : constant Boolean := CPU >= Haswell and |
| 99 | CPU /= Broxton; |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 100 | Has_Low_Voltage_Swing : constant Boolean := CPU >= Broxton; |
| Nico Huber | 58afc20 | 2017-06-12 21:34:55 +0200 | [diff] [blame] | 101 | Has_Iboost_Config : constant Boolean := CPU >= Skylake; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 102 | |
| 103 | Need_DP_Aux_Mutex : constant Boolean := False; -- Skylake & (PSR | GTC) |
| 104 | |
| Nico Huber | 1c3b928 | 2017-02-09 13:57:04 +0100 | [diff] [blame] | 105 | Has_DDI_PHYs : constant Boolean := CPU = Broxton; |
| 106 | |
| 107 | ----- GMBUS: ----------- |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 108 | Ungate_GMBUS_Unit_Level : constant Boolean := CPU >= Skylake; |
| Nico Huber | 1c3b928 | 2017-02-09 13:57:04 +0100 | [diff] [blame] | 109 | GMBUS_Alternative_Pins : constant Boolean := CPU = Broxton; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 110 | |
| 111 | ----- Power: ----------- |
| 112 | Has_IPS : constant Boolean := (CPU = Haswell and |
| 113 | CPU_Var = ULT) or |
| 114 | CPU = Broadwell; |
| 115 | Has_IPS_CTL_Mailbox : constant Boolean := CPU = Broadwell; |
| 116 | |
| 117 | Has_Per_Pipe_SRD : constant Boolean := CPU >= Broadwell; |
| 118 | |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 119 | ----- GTT: ------------- |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 120 | Fold_39Bit_GTT_PTE : constant Boolean := CPU <= Haswell; |
| 121 | |
| 122 | ---------------------------------------------------------------------------- |
| 123 | |
| Nico Huber | 1b2c9a3 | 2016-11-20 03:42:08 +0100 | [diff] [blame] | 124 | Max_Pipe : constant Pipe_Index := |
| 125 | (if CPU <= Sandybridge |
| 126 | then Secondary |
| 127 | else Tertiary); |
| 128 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 129 | type Supported_Pipe_Array is array (Pipe_Index) of Boolean; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 130 | Supported_Pipe : constant Supported_Pipe_Array := |
| Nico Huber | 1b2c9a3 | 2016-11-20 03:42:08 +0100 | [diff] [blame] | 131 | (Primary => Primary <= Max_Pipe, |
| 132 | Secondary => Secondary <= Max_Pipe, |
| 133 | Tertiary => Tertiary <= Max_Pipe); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 134 | |
| 135 | type Valid_Per_Port is array (Port_Type) of Boolean; |
| 136 | type Valid_Per_GPU is array (CPU_Type) of Valid_Per_Port; |
| 137 | Valid_Port_GPU : Valid_Per_GPU := |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 138 | (Ironlake => |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 139 | (Disabled => False, |
| 140 | Internal => Config.Internal_Display = LVDS, |
| 141 | others => True), |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 142 | Sandybridge => |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 143 | (Disabled => False, |
| 144 | Internal => Config.Internal_Display = LVDS, |
| 145 | others => True), |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 146 | Ivybridge => |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 147 | (Disabled => False, |
| 148 | Internal => Config.Internal_Display /= None, |
| 149 | others => True), |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 150 | Haswell => |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 151 | (Disabled => False, |
| 152 | Internal => Config.Internal_Display = DP, |
| Nico Huber | 0d454cd | 2016-11-21 13:33:43 +0100 | [diff] [blame] | 153 | HDMI3 => CPU_Var = Normal, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 154 | DP3 => CPU_Var = Normal, |
| 155 | Analog => CPU_Var = Normal, |
| 156 | others => True), |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 157 | Broadwell => |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 158 | (Disabled => False, |
| 159 | Internal => Config.Internal_Display = DP, |
| Nico Huber | 0d454cd | 2016-11-21 13:33:43 +0100 | [diff] [blame] | 160 | HDMI3 => CPU_Var = Normal, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 161 | DP3 => CPU_Var = Normal, |
| 162 | Analog => CPU_Var = Normal, |
| 163 | others => True), |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 164 | Broxton => |
| 165 | (Internal => Config.Internal_Display = DP, |
| 166 | DP1 => True, |
| 167 | DP2 => True, |
| 168 | HDMI1 => True, |
| 169 | HDMI2 => True, |
| 170 | others => False), |
| 171 | Skylake => |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 172 | (Disabled => False, |
| 173 | Internal => Config.Internal_Display = DP, |
| 174 | Analog => False, |
| 175 | others => True)) |
| 176 | with |
| 177 | Part_Of => GMA.Config_State; |
| 178 | Valid_Port : Valid_Per_Port renames Valid_Port_GPU (CPU); |
| 179 | |
| Nico Huber | ac455ad | 2017-02-14 14:41:19 +0100 | [diff] [blame] | 180 | Last_Digital_Port : constant Digital_Port := |
| 181 | (if Has_DDI_D then DIGI_D else DIGI_C); |
| 182 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 183 | ---------------------------------------------------------------------------- |
| 184 | |
| Nico Huber | 3c544ee | 2016-11-20 04:56:58 +0100 | [diff] [blame] | 185 | type FDI_Per_Port is array (Port_Type) of Boolean; |
| 186 | Is_FDI_Port : constant FDI_Per_Port := |
| 187 | (case CPU is |
| 188 | when Ironlake .. Ivybridge => FDI_Per_Port' |
| 189 | (Internal => Internal_Display = LVDS, |
| 190 | others => True), |
| 191 | when Haswell => FDI_Per_Port' |
| 192 | (Analog => True, |
| 193 | others => False), |
| 194 | when Broadwell => FDI_Per_Port' |
| 195 | (Analog => CPU_Var = Normal, |
| 196 | others => False), |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 197 | when others => FDI_Per_Port' |
| Nico Huber | 3c544ee | 2016-11-20 04:56:58 +0100 | [diff] [blame] | 198 | (others => False)); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 199 | |
| 200 | type FDI_Lanes_Per_Port is array (GPU_Port) of DP_Lane_Count; |
| 201 | FDI_Lane_Count : constant FDI_Lanes_Per_Port := |
| 202 | (DIGI_D => DP_Lane_Count_2, |
| 203 | others => |
| 204 | (if CPU in Ironlake .. Ivybridge then |
| 205 | DP_Lane_Count_4 |
| 206 | else |
| 207 | DP_Lane_Count_2)); |
| 208 | |
| 209 | FDI_Training : constant FDI_Training_Type := |
| 210 | (case CPU is |
| 211 | when Ironlake => Simple_Training, |
| 212 | when Sandybridge => Full_Training, |
| 213 | when others => Auto_Training); |
| 214 | |
| Nico Huber | f54d096 | 2016-10-20 14:17:18 +0200 | [diff] [blame] | 215 | ---------------------------------------------------------------------------- |
| 216 | |
| Nico Huber | 247adf3 | 2017-06-12 14:39:11 +0200 | [diff] [blame] | 217 | Default_DDI_HDMI_Buffer_Translation : constant DDI_HDMI_Buf_Trans_Range := |
| 218 | (case CPU is |
| Nico Huber | 730f17c | 2017-06-12 15:51:25 +0200 | [diff] [blame] | 219 | when Haswell => 6, |
| 220 | when Broadwell => 7, |
| Nico Huber | 247adf3 | 2017-06-12 14:39:11 +0200 | [diff] [blame] | 221 | when Broxton => 8, |
| Nico Huber | 18ff0c1 | 2017-06-12 15:41:31 +0200 | [diff] [blame] | 222 | when Skylake => 8, |
| Nico Huber | 247adf3 | 2017-06-12 14:39:11 +0200 | [diff] [blame] | 223 | when others => 0); |
| 224 | |
| 225 | ---------------------------------------------------------------------------- |
| 226 | |
| Nico Huber | abe3de2 | 2016-10-20 15:03:46 +0200 | [diff] [blame] | 227 | Default_CDClk_Freq : constant Frequency_Type := |
| 228 | (case CPU is |
| 229 | when Ironlake | |
| 230 | Haswell | |
| 231 | Broadwell => 450_000_000, |
| 232 | when Sandybridge | |
| 233 | Ivybridge => 400_000_000, |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 234 | when Broxton => 288_000_000, |
| Nico Huber | abe3de2 | 2016-10-20 15:03:46 +0200 | [diff] [blame] | 235 | when Skylake => 337_500_000); |
| 236 | |
| Nico Huber | f54d096 | 2016-10-20 14:17:18 +0200 | [diff] [blame] | 237 | Default_RawClk_Freq : constant Frequency_Type := |
| 238 | (case CPU is |
| 239 | when Ironlake | |
| 240 | Sandybridge | |
| 241 | Ivybridge => 125_000_000, |
| 242 | when Haswell | |
| 243 | Broadwell => (if CPU_Var = Normal then |
| 244 | 125_000_000 |
| 245 | else |
| 246 | 24_000_000), |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 247 | when Broxton => Frequency_Type'First, -- none needed |
| Nico Huber | f54d096 | 2016-10-20 14:17:18 +0200 | [diff] [blame] | 248 | when Skylake => 24_000_000); |
| 249 | |
| Nico Huber | dcd274b | 2016-11-03 20:15:39 +0100 | [diff] [blame] | 250 | ---------------------------------------------------------------------------- |
| 251 | |
| 252 | -- Maximum source width with enabled scaler. This only accounts |
| 253 | -- for simple 1:1 pipe:scaler mappings. |
| 254 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 255 | type Width_Per_Pipe is array (Pipe_Index) of Width_Type; |
| Nico Huber | dcd274b | 2016-11-03 20:15:39 +0100 | [diff] [blame] | 256 | |
| 257 | Maximum_Scalable_Width : constant Width_Per_Pipe := |
| 258 | (case CPU is |
| 259 | when Ironlake..Haswell => |
| 260 | (Primary => 4096, |
| 261 | Secondary => 2048, |
| 262 | Tertiary => 2048), |
| 263 | when Broadwell..Skylake => |
| 264 | (Primary => 4096, |
| 265 | Secondary => 4096, |
| 266 | Tertiary => 4096)); |
| 267 | |
| Nico Huber | 74ec962 | 2016-11-19 03:00:43 +0100 | [diff] [blame] | 268 | ---------------------------------------------------------------------------- |
| 269 | |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 270 | -- FIXME: Unknown for Broxton, Linux' i915 contains a fixme too :-D |
| Nico Huber | 74ec962 | 2016-11-19 03:00:43 +0100 | [diff] [blame] | 271 | HDMI_Max_Clock_24bpp : constant Frequency_Type := |
| 272 | (if CPU >= Haswell then 300_000_000 else 225_000_000); |
| 273 | |
| Nico Huber | b8ae618 | 2017-07-15 20:03:56 +0200 | [diff] [blame] | 274 | ---------------------------------------------------------------------------- |
| 275 | |
| 276 | GTT_Offset : constant := (case CPU is |
| 277 | when Ironlake .. Haswell => 16#0020_0000#, |
| 278 | when Broadwell .. Skylake => 16#0080_0000#); |
| 279 | |
| 280 | GTT_Size : constant := (case CPU is |
| 281 | when Ironlake .. Haswell => 16#0020_0000#, |
| 282 | -- Limit Broadwell to 4MiB to have a stable |
| 283 | -- interface (i.e. same number of entries): |
| 284 | when Broadwell .. Skylake => 16#0040_0000#); |
| 285 | |
| 286 | GTT_PTE_Size : constant := (case CPU is |
| 287 | when Ironlake .. Haswell => 4, |
| 288 | when Broadwell .. Skylake => 8); |
| 289 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 290 | end HW.GFX.GMA.Config; |