blob: 2bb916aded5aba53f04aa681211fd89c31954655 [file] [log] [blame]
Nico Huber83693c82016-10-08 22:17:55 +02001--
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 Huber125a29e2016-10-18 00:23:54 +02006-- the Free Software Foundation; either version 2 of the License, or
7-- (at your option) any later version.
Nico Huber83693c82016-10-08 22:17:55 +02008--
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
15private package HW.GFX.GMA.Config
16with
17 Initializes => Valid_Port_GPU
18is
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 Huberd55afeb2016-10-21 14:31:10 +020026 Analog_I2C_Port : constant PCH_Port := <<ANALOG_I2C_PORT>>;
27
Nico Huber83693c82016-10-08 22:17:55 +020028 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;
Nico Huber1c3b9282017-02-09 13:57:04 +010038 Has_Presence_Straps : constant Boolean := CPU /= Broxton;
Nico Huber83693c82016-10-08 22:17:55 +020039
40 ----- CPU pipe: --------
41 Disable_Trickle_Feed : constant Boolean := not
42 (CPU in Haswell .. Broadwell);
43 Pipe_Enabled_Workaround : constant Boolean := CPU = Broadwell;
Nico Huber7ad2d652016-12-07 15:19:32 +010044 Has_EDP_Transcoder : constant Boolean := CPU >= Haswell;
Nico Huber83693c82016-10-08 22:17:55 +020045 Has_Pipe_DDI_Func : constant Boolean := CPU >= Haswell;
46 Has_Trans_Clk_Sel : constant Boolean := CPU >= Haswell;
47 Has_Pipe_MSA_Misc : constant Boolean := CPU >= Haswell;
48 Has_Pipeconf_Misc : constant Boolean := CPU >= Broadwell;
49 Has_Pipeconf_BPC : constant Boolean := CPU /= Haswell;
Nico Huber21da5742017-01-20 14:00:53 +010050 Has_Plane_Control : constant Boolean := CPU >= Broxton;
Nico Huber83693c82016-10-08 22:17:55 +020051 Has_DSP_Linoff : constant Boolean := CPU <= Ivybridge;
Nico Huber4916e342016-11-04 14:37:53 +010052 Has_PF_Pipe_Select : constant Boolean := CPU in Ivybridge .. Haswell;
Nico Huberfbb42202016-11-07 15:08:26 +010053 VGA_Plane_Workaround : constant Boolean := CPU = Ivybridge;
Nico Huber83693c82016-10-08 22:17:55 +020054
55 ----- Panel power: -----
56 Has_PP_Write_Protection : constant Boolean := CPU <= Ivybridge;
57 Has_PP_Port_Select : constant Boolean := CPU <= Ivybridge;
58 Use_PP_VDD_Override : constant Boolean := CPU <= Ivybridge;
59
60 ----- PCH/FDI: ---------
Nico Huber1c3b9282017-02-09 13:57:04 +010061 Has_PCH : constant Boolean := CPU /= Broxton;
Nico Huber83693c82016-10-08 22:17:55 +020062 Has_PCH_DAC : constant Boolean := CPU in Ironlake .. Ivybridge or
63 (CPU in Broadwell .. Haswell
64 and CPU_Var = Normal);
65
66 Has_PCH_Aux_Channels : constant Boolean := CPU in Ironlake .. Broadwell;
67
68 VGA_Has_Sync_Disable : constant Boolean := CPU <= Ivybridge;
69
70 Has_Trans_Timing_Ovrrde : constant Boolean := CPU >= Sandybridge;
71
72 Has_DPLL_SEL : constant Boolean := CPU in Ironlake .. Ivybridge;
73 Has_FDI_BPC : constant Boolean := CPU in Ironlake .. Ivybridge;
74 Has_FDI_Composite_Sel : constant Boolean := CPU = Ivybridge;
75 Has_Trans_DP_Ctl : constant Boolean := CPU in
76 Sandybridge .. Ivybridge;
77 Has_FDI_C : constant Boolean := CPU = Ivybridge;
78
79 Has_FDI_RX_Power_Down : constant Boolean := CPU in Haswell .. Broadwell;
80
81 ----- DDI: -------------
82 End_EDP_Training_Late : constant Boolean := CPU in Haswell .. Broadwell;
83 Has_Per_DDI_Clock_Sel : constant Boolean := CPU in Haswell .. Broadwell;
84 Has_HOTPLUG_CTL : constant Boolean := CPU in Haswell .. Broadwell;
85 Has_SHOTPLUG_CTL_A : constant Boolean := (CPU in Haswell .. Broadwell
86 and CPU_Var = ULT) or
87 CPU >= Skylake;
88
89 Has_DDI_D : constant Boolean := (CPU in Haswell .. Broadwell
90 and CPU_Var = Normal)
91 or CPU >= Skylake;
92
Nico Huber21da5742017-01-20 14:00:53 +010093 Has_Low_Voltage_Swing : constant Boolean := CPU >= Broxton;
Nico Huber83693c82016-10-08 22:17:55 +020094
95 Need_DP_Aux_Mutex : constant Boolean := False; -- Skylake & (PSR | GTC)
96
Nico Huber1c3b9282017-02-09 13:57:04 +010097 Has_DDI_PHYs : constant Boolean := CPU = Broxton;
98
99 ----- GMBUS: -----------
Nico Huber83693c82016-10-08 22:17:55 +0200100 Ungate_GMBUS_Unit_Level : constant Boolean := CPU >= Skylake;
Nico Huber1c3b9282017-02-09 13:57:04 +0100101 GMBUS_Alternative_Pins : constant Boolean := CPU = Broxton;
Nico Huber83693c82016-10-08 22:17:55 +0200102
103 ----- Power: -----------
104 Has_IPS : constant Boolean := (CPU = Haswell and
105 CPU_Var = ULT) or
106 CPU = Broadwell;
107 Has_IPS_CTL_Mailbox : constant Boolean := CPU = Broadwell;
108
109 Has_Per_Pipe_SRD : constant Boolean := CPU >= Broadwell;
110
Nico Huber21da5742017-01-20 14:00:53 +0100111 ----- GTT: -------------
Nico Huber83693c82016-10-08 22:17:55 +0200112 Fold_39Bit_GTT_PTE : constant Boolean := CPU <= Haswell;
113
114 ----------------------------------------------------------------------------
115
Nico Huber1b2c9a32016-11-20 03:42:08 +0100116 Max_Pipe : constant Pipe_Index :=
117 (if CPU <= Sandybridge
118 then Secondary
119 else Tertiary);
120
Nico Huber99f10f32016-11-20 00:34:05 +0100121 type Supported_Pipe_Array is array (Pipe_Index) of Boolean;
Nico Huber83693c82016-10-08 22:17:55 +0200122 Supported_Pipe : constant Supported_Pipe_Array :=
Nico Huber1b2c9a32016-11-20 03:42:08 +0100123 (Primary => Primary <= Max_Pipe,
124 Secondary => Secondary <= Max_Pipe,
125 Tertiary => Tertiary <= Max_Pipe);
Nico Huber83693c82016-10-08 22:17:55 +0200126
127 type Valid_Per_Port is array (Port_Type) of Boolean;
128 type Valid_Per_GPU is array (CPU_Type) of Valid_Per_Port;
129 Valid_Port_GPU : Valid_Per_GPU :=
Nico Huber21da5742017-01-20 14:00:53 +0100130 (Ironlake =>
Nico Huber83693c82016-10-08 22:17:55 +0200131 (Disabled => False,
132 Internal => Config.Internal_Display = LVDS,
133 others => True),
Nico Huber21da5742017-01-20 14:00:53 +0100134 Sandybridge =>
Nico Huber83693c82016-10-08 22:17:55 +0200135 (Disabled => False,
136 Internal => Config.Internal_Display = LVDS,
137 others => True),
Nico Huber21da5742017-01-20 14:00:53 +0100138 Ivybridge =>
Nico Huber83693c82016-10-08 22:17:55 +0200139 (Disabled => False,
140 Internal => Config.Internal_Display /= None,
141 others => True),
Nico Huber21da5742017-01-20 14:00:53 +0100142 Haswell =>
Nico Huber83693c82016-10-08 22:17:55 +0200143 (Disabled => False,
144 Internal => Config.Internal_Display = DP,
Nico Huber0d454cd2016-11-21 13:33:43 +0100145 HDMI3 => CPU_Var = Normal,
Nico Huber83693c82016-10-08 22:17:55 +0200146 DP3 => CPU_Var = Normal,
147 Analog => CPU_Var = Normal,
148 others => True),
Nico Huber21da5742017-01-20 14:00:53 +0100149 Broadwell =>
Nico Huber83693c82016-10-08 22:17:55 +0200150 (Disabled => False,
151 Internal => Config.Internal_Display = DP,
Nico Huber0d454cd2016-11-21 13:33:43 +0100152 HDMI3 => CPU_Var = Normal,
Nico Huber83693c82016-10-08 22:17:55 +0200153 DP3 => CPU_Var = Normal,
154 Analog => CPU_Var = Normal,
155 others => True),
Nico Huber21da5742017-01-20 14:00:53 +0100156 Broxton =>
157 (Internal => Config.Internal_Display = DP,
158 DP1 => True,
159 DP2 => True,
160 HDMI1 => True,
161 HDMI2 => True,
162 others => False),
163 Skylake =>
Nico Huber83693c82016-10-08 22:17:55 +0200164 (Disabled => False,
165 Internal => Config.Internal_Display = DP,
166 Analog => False,
167 others => True))
168 with
169 Part_Of => GMA.Config_State;
170 Valid_Port : Valid_Per_Port renames Valid_Port_GPU (CPU);
171
Nico Huberac455ad2017-02-14 14:41:19 +0100172 Last_Digital_Port : constant Digital_Port :=
173 (if Has_DDI_D then DIGI_D else DIGI_C);
174
Nico Huber83693c82016-10-08 22:17:55 +0200175 ----------------------------------------------------------------------------
176
Nico Huber3c544ee2016-11-20 04:56:58 +0100177 type FDI_Per_Port is array (Port_Type) of Boolean;
178 Is_FDI_Port : constant FDI_Per_Port :=
179 (case CPU is
180 when Ironlake .. Ivybridge => FDI_Per_Port'
181 (Internal => Internal_Display = LVDS,
182 others => True),
183 when Haswell => FDI_Per_Port'
184 (Analog => True,
185 others => False),
186 when Broadwell => FDI_Per_Port'
187 (Analog => CPU_Var = Normal,
188 others => False),
Nico Huber21da5742017-01-20 14:00:53 +0100189 when others => FDI_Per_Port'
Nico Huber3c544ee2016-11-20 04:56:58 +0100190 (others => False));
Nico Huber83693c82016-10-08 22:17:55 +0200191
192 type FDI_Lanes_Per_Port is array (GPU_Port) of DP_Lane_Count;
193 FDI_Lane_Count : constant FDI_Lanes_Per_Port :=
194 (DIGI_D => DP_Lane_Count_2,
195 others =>
196 (if CPU in Ironlake .. Ivybridge then
197 DP_Lane_Count_4
198 else
199 DP_Lane_Count_2));
200
201 FDI_Training : constant FDI_Training_Type :=
202 (case CPU is
203 when Ironlake => Simple_Training,
204 when Sandybridge => Full_Training,
205 when others => Auto_Training);
206
Nico Huberf54d0962016-10-20 14:17:18 +0200207 ----------------------------------------------------------------------------
208
Nico Huberabe3de22016-10-20 15:03:46 +0200209 Default_CDClk_Freq : constant Frequency_Type :=
210 (case CPU is
211 when Ironlake |
212 Haswell |
213 Broadwell => 450_000_000,
214 when Sandybridge |
215 Ivybridge => 400_000_000,
Nico Huber21da5742017-01-20 14:00:53 +0100216 when Broxton => 288_000_000,
Nico Huberabe3de22016-10-20 15:03:46 +0200217 when Skylake => 337_500_000);
218
Nico Huberf54d0962016-10-20 14:17:18 +0200219 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),
Nico Huber21da5742017-01-20 14:00:53 +0100229 when Broxton => Frequency_Type'First, -- none needed
Nico Huberf54d0962016-10-20 14:17:18 +0200230 when Skylake => 24_000_000);
231
Nico Huberdcd274b2016-11-03 20:15:39 +0100232 ----------------------------------------------------------------------------
233
234 -- Maximum source width with enabled scaler. This only accounts
235 -- for simple 1:1 pipe:scaler mappings.
236
Nico Huber99f10f32016-11-20 00:34:05 +0100237 type Width_Per_Pipe is array (Pipe_Index) of Width_Type;
Nico Huberdcd274b2016-11-03 20:15:39 +0100238
239 Maximum_Scalable_Width : constant Width_Per_Pipe :=
240 (case CPU is
241 when Ironlake..Haswell =>
242 (Primary => 4096,
243 Secondary => 2048,
244 Tertiary => 2048),
245 when Broadwell..Skylake =>
246 (Primary => 4096,
247 Secondary => 4096,
248 Tertiary => 4096));
249
Nico Huber74ec9622016-11-19 03:00:43 +0100250 ----------------------------------------------------------------------------
251
Nico Huber21da5742017-01-20 14:00:53 +0100252 -- FIXME: Unknown for Broxton, Linux' i915 contains a fixme too :-D
Nico Huber74ec9622016-11-19 03:00:43 +0100253 HDMI_Max_Clock_24bpp : constant Frequency_Type :=
254 (if CPU >= Haswell then 300_000_000 else 225_000_000);
255
Nico Huber83693c82016-10-08 22:17:55 +0200256end HW.GFX.GMA.Config;