| 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; |
| 43 | Has_EDP_Pipe : constant Boolean := CPU >= Haswell; |
| 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; |
| 49 | Has_Plane_Control : constant Boolean := CPU >= Skylake; |
| 50 | Has_DSP_Linoff : constant Boolean := CPU <= Ivybridge; |
| 51 | |
| 52 | ----- Panel power: ----- |
| 53 | Has_PP_Write_Protection : constant Boolean := CPU <= Ivybridge; |
| 54 | Has_PP_Port_Select : constant Boolean := CPU <= Ivybridge; |
| 55 | Use_PP_VDD_Override : constant Boolean := CPU <= Ivybridge; |
| 56 | |
| 57 | ----- PCH/FDI: --------- |
| 58 | Has_PCH_DAC : constant Boolean := CPU in Ironlake .. Ivybridge or |
| 59 | (CPU in Broadwell .. Haswell |
| 60 | and CPU_Var = Normal); |
| 61 | |
| 62 | Has_PCH_Aux_Channels : constant Boolean := CPU in Ironlake .. Broadwell; |
| 63 | |
| 64 | VGA_Has_Sync_Disable : constant Boolean := CPU <= Ivybridge; |
| 65 | |
| 66 | Has_Trans_Timing_Ovrrde : constant Boolean := CPU >= Sandybridge; |
| 67 | |
| 68 | Has_DPLL_SEL : constant Boolean := CPU in Ironlake .. Ivybridge; |
| 69 | Has_FDI_BPC : constant Boolean := CPU in Ironlake .. Ivybridge; |
| 70 | Has_FDI_Composite_Sel : constant Boolean := CPU = Ivybridge; |
| 71 | Has_Trans_DP_Ctl : constant Boolean := CPU in |
| 72 | Sandybridge .. Ivybridge; |
| 73 | Has_FDI_C : constant Boolean := CPU = Ivybridge; |
| 74 | |
| 75 | Has_FDI_RX_Power_Down : constant Boolean := CPU in Haswell .. Broadwell; |
| 76 | |
| 77 | ----- DDI: ------------- |
| 78 | End_EDP_Training_Late : constant Boolean := CPU in Haswell .. Broadwell; |
| 79 | Has_Per_DDI_Clock_Sel : constant Boolean := CPU in Haswell .. Broadwell; |
| 80 | Has_HOTPLUG_CTL : constant Boolean := CPU in Haswell .. Broadwell; |
| 81 | Has_SHOTPLUG_CTL_A : constant Boolean := (CPU in Haswell .. Broadwell |
| 82 | and CPU_Var = ULT) or |
| 83 | CPU >= Skylake; |
| 84 | |
| 85 | Has_DDI_D : constant Boolean := (CPU in Haswell .. Broadwell |
| 86 | and CPU_Var = Normal) |
| 87 | or CPU >= Skylake; |
| 88 | |
| 89 | Has_Low_Voltage_Swing : constant Boolean := CPU >= Skylake; |
| 90 | |
| 91 | Need_DP_Aux_Mutex : constant Boolean := False; -- Skylake & (PSR | GTC) |
| 92 | |
| 93 | Ungate_GMBUS_Unit_Level : constant Boolean := CPU >= Skylake; |
| 94 | |
| 95 | ----- Power: ----------- |
| 96 | Has_IPS : constant Boolean := (CPU = Haswell and |
| 97 | CPU_Var = ULT) or |
| 98 | CPU = Broadwell; |
| 99 | Has_IPS_CTL_Mailbox : constant Boolean := CPU = Broadwell; |
| 100 | |
| 101 | Has_Per_Pipe_SRD : constant Boolean := CPU >= Broadwell; |
| 102 | |
| 103 | ----- GTT: ----- |
| 104 | Fold_39Bit_GTT_PTE : constant Boolean := CPU <= Haswell; |
| 105 | |
| 106 | ---------------------------------------------------------------------------- |
| 107 | |
| 108 | type Supported_Pipe_Array is array (Config_Index) of Boolean; |
| 109 | Supported_Pipe : constant Supported_Pipe_Array := |
| 110 | (Primary => True, |
| 111 | Secondary => True, |
| 112 | Tertiary => CPU >= Ivybridge); |
| 113 | |
| 114 | type Valid_Per_Port is array (Port_Type) of Boolean; |
| 115 | type Valid_Per_GPU is array (CPU_Type) of Valid_Per_Port; |
| 116 | Valid_Port_GPU : Valid_Per_GPU := |
| 117 | (Ironlake => Valid_Per_Port' |
| 118 | (Disabled => False, |
| 119 | Internal => Config.Internal_Display = LVDS, |
| 120 | others => True), |
| 121 | Sandybridge => Valid_Per_Port' |
| 122 | (Disabled => False, |
| 123 | Internal => Config.Internal_Display = LVDS, |
| 124 | others => True), |
| 125 | Ivybridge => Valid_Per_Port' |
| 126 | (Disabled => False, |
| 127 | Internal => Config.Internal_Display /= None, |
| 128 | others => True), |
| 129 | Haswell => Valid_Per_Port' |
| 130 | (Disabled => False, |
| 131 | Internal => Config.Internal_Display = DP, |
| 132 | Digital3 => CPU_Var = Normal, |
| 133 | DP3 => CPU_Var = Normal, |
| 134 | Analog => CPU_Var = Normal, |
| 135 | others => True), |
| 136 | Broadwell => Valid_Per_Port' |
| 137 | (Disabled => False, |
| 138 | Internal => Config.Internal_Display = DP, |
| 139 | Digital3 => CPU_Var = Normal, |
| 140 | DP3 => CPU_Var = Normal, |
| 141 | Analog => CPU_Var = Normal, |
| 142 | others => True), |
| 143 | Skylake => Valid_Per_Port' |
| 144 | (Disabled => False, |
| 145 | Internal => Config.Internal_Display = DP, |
| 146 | Analog => False, |
| 147 | others => True)) |
| 148 | with |
| 149 | Part_Of => GMA.Config_State; |
| 150 | Valid_Port : Valid_Per_Port renames Valid_Port_GPU (CPU); |
| 151 | |
| 152 | ---------------------------------------------------------------------------- |
| 153 | |
| 154 | type FDI_Per_Port is array (GPU_Port) of Boolean; |
| 155 | type FDI_Per_GPU is array (CPU_Type) of FDI_Per_Port; |
| 156 | FDI_GPU : constant FDI_Per_GPU := |
| 157 | (Ironlake => FDI_Per_Port' |
| 158 | (DIGI_A => False, -- directly connected eDP |
| 159 | DIGI_B => True, |
| 160 | DIGI_C => True, |
| 161 | DIGI_D => True, |
| 162 | others => False), |
| 163 | Sandybridge => FDI_Per_Port' |
| 164 | (DIGI_A => False, -- directly connected eDP |
| 165 | DIGI_B => True, |
| 166 | DIGI_C => True, |
| 167 | DIGI_D => True, |
| 168 | others => False), |
| 169 | Ivybridge => FDI_Per_Port' |
| 170 | (DIGI_A => False, -- directly connected eDP |
| 171 | DIGI_B => True, |
| 172 | DIGI_C => True, |
| 173 | DIGI_D => True, |
| 174 | others => False), |
| 175 | Haswell => FDI_Per_Port' |
| 176 | (DIGI_A => False, |
| 177 | DIGI_B => False, |
| 178 | DIGI_C => False, |
| 179 | DIGI_D => False, |
| 180 | DIGI_E => True, -- VGA option through FDI |
| 181 | others => False), |
| 182 | Broadwell => FDI_Per_Port' |
| 183 | (DIGI_A => False, |
| 184 | DIGI_B => False, |
| 185 | DIGI_C => False, |
| 186 | DIGI_D => False, |
| 187 | DIGI_E => CPU_Var = Normal, -- VGA option through FDI |
| 188 | others => False), |
| 189 | Skylake => FDI_Per_Port' |
| 190 | (others => False)); |
| 191 | FDI_Port : FDI_Per_Port renames FDI_GPU (CPU); |
| 192 | |
| 193 | type FDI_Lanes_Per_Port is array (GPU_Port) of DP_Lane_Count; |
| 194 | FDI_Lane_Count : constant FDI_Lanes_Per_Port := |
| 195 | (DIGI_D => DP_Lane_Count_2, |
| 196 | others => |
| 197 | (if CPU in Ironlake .. Ivybridge then |
| 198 | DP_Lane_Count_4 |
| 199 | else |
| 200 | DP_Lane_Count_2)); |
| 201 | |
| 202 | FDI_Training : constant FDI_Training_Type := |
| 203 | (case CPU is |
| 204 | when Ironlake => Simple_Training, |
| 205 | when Sandybridge => Full_Training, |
| 206 | when others => Auto_Training); |
| 207 | |
| Nico Huber | f54d096 | 2016-10-20 14:17:18 +0200 | [diff] [blame] | 208 | ---------------------------------------------------------------------------- |
| 209 | |
| Nico Huber | abe3de2 | 2016-10-20 15:03:46 +0200 | [diff] [blame] | 210 | Default_CDClk_Freq : constant Frequency_Type := |
| 211 | (case CPU is |
| 212 | when Ironlake | |
| 213 | Haswell | |
| 214 | Broadwell => 450_000_000, |
| 215 | when Sandybridge | |
| 216 | Ivybridge => 400_000_000, |
| 217 | when Skylake => 337_500_000); |
| 218 | |
| Nico Huber | f54d096 | 2016-10-20 14:17:18 +0200 | [diff] [blame] | 219 | Default_RawClk_Freq : constant Frequency_Type := |
| 220 | (case CPU is |
| 221 | when Ironlake | |
| 222 | Sandybridge | |
| 223 | Ivybridge => 125_000_000, |
| 224 | when Haswell | |
| 225 | Broadwell => (if CPU_Var = Normal then |
| 226 | 125_000_000 |
| 227 | else |
| 228 | 24_000_000), |
| 229 | when Skylake => 24_000_000); |
| 230 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 231 | end HW.GFX.GMA.Config; |