blob: b4e52f6e17894111eda4f03227e401bccb8d43d7 [file] [log] [blame]
Nico Huber83693c82016-10-08 22:17:55 +02001--
Nico Huber01b680f2017-06-09 16:24:22 +02002-- Copyright (C) 2015-2017 secunet Security Networks AG
Nico Huber83693c82016-10-08 22:17:55 +02003--
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
Nico Huber247adf32017-06-12 14:39:11 +020030 DDI_HDMI_Buffer_Translation : constant Integer := -1;
31
Nico Huber83693c82016-10-08 22:17:55 +020032 Default_MMIO_Base : constant := <<DEFAULT_MMIO_BASE>>;
33
34 LVDS_Dual_Threshold : constant := 95_000_000;
35
36 ----------------------------------------------------------------------------
37
Nico Huber2b6f6992017-07-09 18:11:34 +020038 Default_MMIO_Base_Set : constant Boolean := Default_MMIO_Base /= 0;
39
Nico Huber83693c82016-10-08 22:17:55 +020040 Has_Internal_Display : constant Boolean := Internal_Display /= None;
41 Internal_Is_EDP : constant Boolean := Internal_Display = DP;
Nico Huber1c3b9282017-02-09 13:57:04 +010042 Has_Presence_Straps : constant Boolean := CPU /= Broxton;
Nico Huber83693c82016-10-08 22:17:55 +020043
44 ----- CPU pipe: --------
45 Disable_Trickle_Feed : constant Boolean := not
46 (CPU in Haswell .. Broadwell);
47 Pipe_Enabled_Workaround : constant Boolean := CPU = Broadwell;
Nico Huber7ad2d652016-12-07 15:19:32 +010048 Has_EDP_Transcoder : constant Boolean := CPU >= Haswell;
Nico Huber83693c82016-10-08 22:17:55 +020049 Has_Pipe_DDI_Func : constant Boolean := CPU >= Haswell;
50 Has_Trans_Clk_Sel : constant Boolean := CPU >= Haswell;
51 Has_Pipe_MSA_Misc : constant Boolean := CPU >= Haswell;
52 Has_Pipeconf_Misc : constant Boolean := CPU >= Broadwell;
53 Has_Pipeconf_BPC : constant Boolean := CPU /= Haswell;
Nico Huber21da5742017-01-20 14:00:53 +010054 Has_Plane_Control : constant Boolean := CPU >= Broxton;
Nico Huber83693c82016-10-08 22:17:55 +020055 Has_DSP_Linoff : constant Boolean := CPU <= Ivybridge;
Nico Huber4916e342016-11-04 14:37:53 +010056 Has_PF_Pipe_Select : constant Boolean := CPU in Ivybridge .. Haswell;
Nico Huberfbb42202016-11-07 15:08:26 +010057 VGA_Plane_Workaround : constant Boolean := CPU = Ivybridge;
Nico Huber83693c82016-10-08 22:17:55 +020058
59 ----- Panel power: -----
60 Has_PP_Write_Protection : constant Boolean := CPU <= Ivybridge;
61 Has_PP_Port_Select : constant Boolean := CPU <= Ivybridge;
62 Use_PP_VDD_Override : constant Boolean := CPU <= Ivybridge;
63
64 ----- PCH/FDI: ---------
Nico Huber1c3b9282017-02-09 13:57:04 +010065 Has_PCH : constant Boolean := CPU /= Broxton;
Nico Huber83693c82016-10-08 22:17:55 +020066 Has_PCH_DAC : constant Boolean := CPU in Ironlake .. Ivybridge or
67 (CPU in Broadwell .. Haswell
68 and CPU_Var = Normal);
69
70 Has_PCH_Aux_Channels : constant Boolean := CPU in Ironlake .. Broadwell;
71
72 VGA_Has_Sync_Disable : constant Boolean := CPU <= Ivybridge;
73
74 Has_Trans_Timing_Ovrrde : constant Boolean := CPU >= Sandybridge;
75
76 Has_DPLL_SEL : constant Boolean := CPU in Ironlake .. Ivybridge;
77 Has_FDI_BPC : constant Boolean := CPU in Ironlake .. Ivybridge;
78 Has_FDI_Composite_Sel : constant Boolean := CPU = Ivybridge;
79 Has_Trans_DP_Ctl : constant Boolean := CPU in
80 Sandybridge .. Ivybridge;
81 Has_FDI_C : constant Boolean := CPU = Ivybridge;
82
83 Has_FDI_RX_Power_Down : constant Boolean := CPU in Haswell .. Broadwell;
84
85 ----- DDI: -------------
86 End_EDP_Training_Late : constant Boolean := CPU in Haswell .. Broadwell;
87 Has_Per_DDI_Clock_Sel : constant Boolean := CPU in Haswell .. Broadwell;
88 Has_HOTPLUG_CTL : constant Boolean := CPU in Haswell .. Broadwell;
89 Has_SHOTPLUG_CTL_A : constant Boolean := (CPU in Haswell .. Broadwell
90 and CPU_Var = ULT) or
91 CPU >= Skylake;
92
93 Has_DDI_D : constant Boolean := (CPU in Haswell .. Broadwell
94 and CPU_Var = Normal)
95 or CPU >= Skylake;
96
Nico Huber18ff0c12017-06-12 15:41:31 +020097 Has_DDI_Buffer_Trans : constant Boolean := CPU >= Haswell and
98 CPU /= Broxton;
Nico Huber21da5742017-01-20 14:00:53 +010099 Has_Low_Voltage_Swing : constant Boolean := CPU >= Broxton;
Nico Huber58afc202017-06-12 21:34:55 +0200100 Has_Iboost_Config : constant Boolean := CPU >= Skylake;
Nico Huber83693c82016-10-08 22:17:55 +0200101
102 Need_DP_Aux_Mutex : constant Boolean := False; -- Skylake & (PSR | GTC)
103
Nico Huber1c3b9282017-02-09 13:57:04 +0100104 Has_DDI_PHYs : constant Boolean := CPU = Broxton;
105
106 ----- GMBUS: -----------
Nico Huber83693c82016-10-08 22:17:55 +0200107 Ungate_GMBUS_Unit_Level : constant Boolean := CPU >= Skylake;
Nico Huber1c3b9282017-02-09 13:57:04 +0100108 GMBUS_Alternative_Pins : constant Boolean := CPU = Broxton;
Nico Huber83693c82016-10-08 22:17:55 +0200109
110 ----- Power: -----------
111 Has_IPS : constant Boolean := (CPU = Haswell and
112 CPU_Var = ULT) or
113 CPU = Broadwell;
114 Has_IPS_CTL_Mailbox : constant Boolean := CPU = Broadwell;
115
116 Has_Per_Pipe_SRD : constant Boolean := CPU >= Broadwell;
117
Nico Huber21da5742017-01-20 14:00:53 +0100118 ----- GTT: -------------
Nico Huber83693c82016-10-08 22:17:55 +0200119 Fold_39Bit_GTT_PTE : constant Boolean := CPU <= Haswell;
120
121 ----------------------------------------------------------------------------
122
Nico Huber1b2c9a32016-11-20 03:42:08 +0100123 Max_Pipe : constant Pipe_Index :=
124 (if CPU <= Sandybridge
125 then Secondary
126 else Tertiary);
127
Nico Huber99f10f32016-11-20 00:34:05 +0100128 type Supported_Pipe_Array is array (Pipe_Index) of Boolean;
Nico Huber83693c82016-10-08 22:17:55 +0200129 Supported_Pipe : constant Supported_Pipe_Array :=
Nico Huber1b2c9a32016-11-20 03:42:08 +0100130 (Primary => Primary <= Max_Pipe,
131 Secondary => Secondary <= Max_Pipe,
132 Tertiary => Tertiary <= Max_Pipe);
Nico Huber83693c82016-10-08 22:17:55 +0200133
134 type Valid_Per_Port is array (Port_Type) of Boolean;
135 type Valid_Per_GPU is array (CPU_Type) of Valid_Per_Port;
136 Valid_Port_GPU : Valid_Per_GPU :=
Nico Huber21da5742017-01-20 14:00:53 +0100137 (Ironlake =>
Nico Huber83693c82016-10-08 22:17:55 +0200138 (Disabled => False,
139 Internal => Config.Internal_Display = LVDS,
140 others => True),
Nico Huber21da5742017-01-20 14:00:53 +0100141 Sandybridge =>
Nico Huber83693c82016-10-08 22:17:55 +0200142 (Disabled => False,
143 Internal => Config.Internal_Display = LVDS,
144 others => True),
Nico Huber21da5742017-01-20 14:00:53 +0100145 Ivybridge =>
Nico Huber83693c82016-10-08 22:17:55 +0200146 (Disabled => False,
147 Internal => Config.Internal_Display /= None,
148 others => True),
Nico Huber21da5742017-01-20 14:00:53 +0100149 Haswell =>
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 Broadwell =>
Nico Huber83693c82016-10-08 22:17:55 +0200157 (Disabled => False,
158 Internal => Config.Internal_Display = DP,
Nico Huber0d454cd2016-11-21 13:33:43 +0100159 HDMI3 => CPU_Var = Normal,
Nico Huber83693c82016-10-08 22:17:55 +0200160 DP3 => CPU_Var = Normal,
161 Analog => CPU_Var = Normal,
162 others => True),
Nico Huber21da5742017-01-20 14:00:53 +0100163 Broxton =>
164 (Internal => Config.Internal_Display = DP,
165 DP1 => True,
166 DP2 => True,
167 HDMI1 => True,
168 HDMI2 => True,
169 others => False),
170 Skylake =>
Nico Huber83693c82016-10-08 22:17:55 +0200171 (Disabled => False,
172 Internal => Config.Internal_Display = DP,
173 Analog => False,
174 others => True))
175 with
176 Part_Of => GMA.Config_State;
177 Valid_Port : Valid_Per_Port renames Valid_Port_GPU (CPU);
178
Nico Huberac455ad2017-02-14 14:41:19 +0100179 Last_Digital_Port : constant Digital_Port :=
180 (if Has_DDI_D then DIGI_D else DIGI_C);
181
Nico Huber83693c82016-10-08 22:17:55 +0200182 ----------------------------------------------------------------------------
183
Nico Huber3c544ee2016-11-20 04:56:58 +0100184 type FDI_Per_Port is array (Port_Type) of Boolean;
185 Is_FDI_Port : constant FDI_Per_Port :=
186 (case CPU is
187 when Ironlake .. Ivybridge => FDI_Per_Port'
188 (Internal => Internal_Display = LVDS,
189 others => True),
190 when Haswell => FDI_Per_Port'
191 (Analog => True,
192 others => False),
193 when Broadwell => FDI_Per_Port'
194 (Analog => CPU_Var = Normal,
195 others => False),
Nico Huber21da5742017-01-20 14:00:53 +0100196 when others => FDI_Per_Port'
Nico Huber3c544ee2016-11-20 04:56:58 +0100197 (others => False));
Nico Huber83693c82016-10-08 22:17:55 +0200198
199 type FDI_Lanes_Per_Port is array (GPU_Port) of DP_Lane_Count;
200 FDI_Lane_Count : constant FDI_Lanes_Per_Port :=
201 (DIGI_D => DP_Lane_Count_2,
202 others =>
203 (if CPU in Ironlake .. Ivybridge then
204 DP_Lane_Count_4
205 else
206 DP_Lane_Count_2));
207
208 FDI_Training : constant FDI_Training_Type :=
209 (case CPU is
210 when Ironlake => Simple_Training,
211 when Sandybridge => Full_Training,
212 when others => Auto_Training);
213
Nico Huberf54d0962016-10-20 14:17:18 +0200214 ----------------------------------------------------------------------------
215
Nico Huber247adf32017-06-12 14:39:11 +0200216 Default_DDI_HDMI_Buffer_Translation : constant DDI_HDMI_Buf_Trans_Range :=
217 (case CPU is
Nico Huber730f17c2017-06-12 15:51:25 +0200218 when Haswell => 6,
219 when Broadwell => 7,
Nico Huber247adf32017-06-12 14:39:11 +0200220 when Broxton => 8,
Nico Huber18ff0c12017-06-12 15:41:31 +0200221 when Skylake => 8,
Nico Huber247adf32017-06-12 14:39:11 +0200222 when others => 0);
223
224 ----------------------------------------------------------------------------
225
Nico Huberabe3de22016-10-20 15:03:46 +0200226 Default_CDClk_Freq : constant Frequency_Type :=
227 (case CPU is
228 when Ironlake |
229 Haswell |
230 Broadwell => 450_000_000,
231 when Sandybridge |
232 Ivybridge => 400_000_000,
Nico Huber21da5742017-01-20 14:00:53 +0100233 when Broxton => 288_000_000,
Nico Huberabe3de22016-10-20 15:03:46 +0200234 when Skylake => 337_500_000);
235
Nico Huberf54d0962016-10-20 14:17:18 +0200236 Default_RawClk_Freq : constant Frequency_Type :=
237 (case CPU is
238 when Ironlake |
239 Sandybridge |
240 Ivybridge => 125_000_000,
241 when Haswell |
242 Broadwell => (if CPU_Var = Normal then
243 125_000_000
244 else
245 24_000_000),
Nico Huber21da5742017-01-20 14:00:53 +0100246 when Broxton => Frequency_Type'First, -- none needed
Nico Huberf54d0962016-10-20 14:17:18 +0200247 when Skylake => 24_000_000);
248
Nico Huberdcd274b2016-11-03 20:15:39 +0100249 ----------------------------------------------------------------------------
250
251 -- Maximum source width with enabled scaler. This only accounts
252 -- for simple 1:1 pipe:scaler mappings.
253
Nico Huber99f10f32016-11-20 00:34:05 +0100254 type Width_Per_Pipe is array (Pipe_Index) of Width_Type;
Nico Huberdcd274b2016-11-03 20:15:39 +0100255
256 Maximum_Scalable_Width : constant Width_Per_Pipe :=
257 (case CPU is
258 when Ironlake..Haswell =>
259 (Primary => 4096,
260 Secondary => 2048,
261 Tertiary => 2048),
262 when Broadwell..Skylake =>
263 (Primary => 4096,
264 Secondary => 4096,
265 Tertiary => 4096));
266
Nico Huber74ec9622016-11-19 03:00:43 +0100267 ----------------------------------------------------------------------------
268
Nico Huber21da5742017-01-20 14:00:53 +0100269 -- FIXME: Unknown for Broxton, Linux' i915 contains a fixme too :-D
Nico Huber74ec9622016-11-19 03:00:43 +0100270 HDMI_Max_Clock_24bpp : constant Frequency_Type :=
271 (if CPU >= Haswell then 300_000_000 else 225_000_000);
272
Nico Huberb8ae6182017-07-15 20:03:56 +0200273 ----------------------------------------------------------------------------
274
275 GTT_Offset : constant := (case CPU is
276 when Ironlake .. Haswell => 16#0020_0000#,
277 when Broadwell .. Skylake => 16#0080_0000#);
278
279 GTT_Size : constant := (case CPU is
280 when Ironlake .. Haswell => 16#0020_0000#,
281 -- Limit Broadwell to 4MiB to have a stable
282 -- interface (i.e. same number of entries):
283 when Broadwell .. Skylake => 16#0040_0000#);
284
285 GTT_PTE_Size : constant := (case CPU is
286 when Ironlake .. Haswell => 4,
287 when Broadwell .. Skylake => 8);
288
Nico Huber83693c82016-10-08 22:17:55 +0200289end HW.GFX.GMA.Config;