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