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