blob: ec41c407a8fb171cab498c5f2f1aeaf87846ab6b [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
38 Has_Internal_Display : constant Boolean := Internal_Display /= None;
39 Internal_Is_EDP : constant Boolean := Internal_Display = DP;
Nico Huber1c3b9282017-02-09 13:57:04 +010040 Has_Presence_Straps : constant Boolean := CPU /= Broxton;
Nico Huber83693c82016-10-08 22:17:55 +020041
42 ----- CPU pipe: --------
43 Disable_Trickle_Feed : constant Boolean := not
44 (CPU in Haswell .. Broadwell);
45 Pipe_Enabled_Workaround : constant Boolean := CPU = Broadwell;
Nico Huber7ad2d652016-12-07 15:19:32 +010046 Has_EDP_Transcoder : constant Boolean := CPU >= Haswell;
Nico Huber83693c82016-10-08 22:17:55 +020047 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 Huber21da5742017-01-20 14:00:53 +010052 Has_Plane_Control : constant Boolean := CPU >= Broxton;
Nico Huber83693c82016-10-08 22:17:55 +020053 Has_DSP_Linoff : constant Boolean := CPU <= Ivybridge;
Nico Huber4916e342016-11-04 14:37:53 +010054 Has_PF_Pipe_Select : constant Boolean := CPU in Ivybridge .. Haswell;
Nico Huberfbb42202016-11-07 15:08:26 +010055 VGA_Plane_Workaround : constant Boolean := CPU = Ivybridge;
Nico Huber83693c82016-10-08 22:17:55 +020056
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 Huber1c3b9282017-02-09 13:57:04 +010063 Has_PCH : constant Boolean := CPU /= Broxton;
Nico Huber83693c82016-10-08 22:17:55 +020064 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 Huber18ff0c12017-06-12 15:41:31 +020095 Has_DDI_Buffer_Trans : constant Boolean := CPU >= Haswell and
96 CPU /= Broxton;
Nico Huber21da5742017-01-20 14:00:53 +010097 Has_Low_Voltage_Swing : constant Boolean := CPU >= Broxton;
Nico Huber83693c82016-10-08 22:17:55 +020098
99 Need_DP_Aux_Mutex : constant Boolean := False; -- Skylake & (PSR | GTC)
100
Nico Huber1c3b9282017-02-09 13:57:04 +0100101 Has_DDI_PHYs : constant Boolean := CPU = Broxton;
102
103 ----- GMBUS: -----------
Nico Huber83693c82016-10-08 22:17:55 +0200104 Ungate_GMBUS_Unit_Level : constant Boolean := CPU >= Skylake;
Nico Huber1c3b9282017-02-09 13:57:04 +0100105 GMBUS_Alternative_Pins : constant Boolean := CPU = Broxton;
Nico Huber83693c82016-10-08 22:17:55 +0200106
107 ----- Power: -----------
108 Has_IPS : constant Boolean := (CPU = Haswell and
109 CPU_Var = ULT) or
110 CPU = Broadwell;
111 Has_IPS_CTL_Mailbox : constant Boolean := CPU = Broadwell;
112
113 Has_Per_Pipe_SRD : constant Boolean := CPU >= Broadwell;
114
Nico Huber21da5742017-01-20 14:00:53 +0100115 ----- GTT: -------------
Nico Huber83693c82016-10-08 22:17:55 +0200116 Fold_39Bit_GTT_PTE : constant Boolean := CPU <= Haswell;
117
118 ----------------------------------------------------------------------------
119
Nico Huber1b2c9a32016-11-20 03:42:08 +0100120 Max_Pipe : constant Pipe_Index :=
121 (if CPU <= Sandybridge
122 then Secondary
123 else Tertiary);
124
Nico Huber99f10f32016-11-20 00:34:05 +0100125 type Supported_Pipe_Array is array (Pipe_Index) of Boolean;
Nico Huber83693c82016-10-08 22:17:55 +0200126 Supported_Pipe : constant Supported_Pipe_Array :=
Nico Huber1b2c9a32016-11-20 03:42:08 +0100127 (Primary => Primary <= Max_Pipe,
128 Secondary => Secondary <= Max_Pipe,
129 Tertiary => Tertiary <= Max_Pipe);
Nico Huber83693c82016-10-08 22:17:55 +0200130
131 type Valid_Per_Port is array (Port_Type) of Boolean;
132 type Valid_Per_GPU is array (CPU_Type) of Valid_Per_Port;
133 Valid_Port_GPU : Valid_Per_GPU :=
Nico Huber21da5742017-01-20 14:00:53 +0100134 (Ironlake =>
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 Sandybridge =>
Nico Huber83693c82016-10-08 22:17:55 +0200139 (Disabled => False,
140 Internal => Config.Internal_Display = LVDS,
141 others => True),
Nico Huber21da5742017-01-20 14:00:53 +0100142 Ivybridge =>
Nico Huber83693c82016-10-08 22:17:55 +0200143 (Disabled => False,
144 Internal => Config.Internal_Display /= None,
145 others => True),
Nico Huber21da5742017-01-20 14:00:53 +0100146 Haswell =>
Nico Huber83693c82016-10-08 22:17:55 +0200147 (Disabled => False,
148 Internal => Config.Internal_Display = DP,
Nico Huber0d454cd2016-11-21 13:33:43 +0100149 HDMI3 => CPU_Var = Normal,
Nico Huber83693c82016-10-08 22:17:55 +0200150 DP3 => CPU_Var = Normal,
151 Analog => CPU_Var = Normal,
152 others => True),
Nico Huber21da5742017-01-20 14:00:53 +0100153 Broadwell =>
Nico Huber83693c82016-10-08 22:17:55 +0200154 (Disabled => False,
155 Internal => Config.Internal_Display = DP,
Nico Huber0d454cd2016-11-21 13:33:43 +0100156 HDMI3 => CPU_Var = Normal,
Nico Huber83693c82016-10-08 22:17:55 +0200157 DP3 => CPU_Var = Normal,
158 Analog => CPU_Var = Normal,
159 others => True),
Nico Huber21da5742017-01-20 14:00:53 +0100160 Broxton =>
161 (Internal => Config.Internal_Display = DP,
162 DP1 => True,
163 DP2 => True,
164 HDMI1 => True,
165 HDMI2 => True,
166 others => False),
167 Skylake =>
Nico Huber83693c82016-10-08 22:17:55 +0200168 (Disabled => False,
169 Internal => Config.Internal_Display = DP,
170 Analog => False,
171 others => True))
172 with
173 Part_Of => GMA.Config_State;
174 Valid_Port : Valid_Per_Port renames Valid_Port_GPU (CPU);
175
Nico Huberac455ad2017-02-14 14:41:19 +0100176 Last_Digital_Port : constant Digital_Port :=
177 (if Has_DDI_D then DIGI_D else DIGI_C);
178
Nico Huber83693c82016-10-08 22:17:55 +0200179 ----------------------------------------------------------------------------
180
Nico Huber3c544ee2016-11-20 04:56:58 +0100181 type FDI_Per_Port is array (Port_Type) of Boolean;
182 Is_FDI_Port : constant FDI_Per_Port :=
183 (case CPU is
184 when Ironlake .. Ivybridge => FDI_Per_Port'
185 (Internal => Internal_Display = LVDS,
186 others => True),
187 when Haswell => FDI_Per_Port'
188 (Analog => True,
189 others => False),
190 when Broadwell => FDI_Per_Port'
191 (Analog => CPU_Var = Normal,
192 others => False),
Nico Huber21da5742017-01-20 14:00:53 +0100193 when others => FDI_Per_Port'
Nico Huber3c544ee2016-11-20 04:56:58 +0100194 (others => False));
Nico Huber83693c82016-10-08 22:17:55 +0200195
196 type FDI_Lanes_Per_Port is array (GPU_Port) of DP_Lane_Count;
197 FDI_Lane_Count : constant FDI_Lanes_Per_Port :=
198 (DIGI_D => DP_Lane_Count_2,
199 others =>
200 (if CPU in Ironlake .. Ivybridge then
201 DP_Lane_Count_4
202 else
203 DP_Lane_Count_2));
204
205 FDI_Training : constant FDI_Training_Type :=
206 (case CPU is
207 when Ironlake => Simple_Training,
208 when Sandybridge => Full_Training,
209 when others => Auto_Training);
210
Nico Huberf54d0962016-10-20 14:17:18 +0200211 ----------------------------------------------------------------------------
212
Nico Huber247adf32017-06-12 14:39:11 +0200213 Default_DDI_HDMI_Buffer_Translation : constant DDI_HDMI_Buf_Trans_Range :=
214 (case CPU is
Nico Huber730f17c2017-06-12 15:51:25 +0200215 when Haswell => 6,
216 when Broadwell => 7,
Nico Huber247adf32017-06-12 14:39:11 +0200217 when Broxton => 8,
Nico Huber18ff0c12017-06-12 15:41:31 +0200218 when Skylake => 8,
Nico Huber247adf32017-06-12 14:39:11 +0200219 when others => 0);
220
221 ----------------------------------------------------------------------------
222
Nico Huberabe3de22016-10-20 15:03:46 +0200223 Default_CDClk_Freq : constant Frequency_Type :=
224 (case CPU is
225 when Ironlake |
226 Haswell |
227 Broadwell => 450_000_000,
228 when Sandybridge |
229 Ivybridge => 400_000_000,
Nico Huber21da5742017-01-20 14:00:53 +0100230 when Broxton => 288_000_000,
Nico Huberabe3de22016-10-20 15:03:46 +0200231 when Skylake => 337_500_000);
232
Nico Huberf54d0962016-10-20 14:17:18 +0200233 Default_RawClk_Freq : constant Frequency_Type :=
234 (case CPU is
235 when Ironlake |
236 Sandybridge |
237 Ivybridge => 125_000_000,
238 when Haswell |
239 Broadwell => (if CPU_Var = Normal then
240 125_000_000
241 else
242 24_000_000),
Nico Huber21da5742017-01-20 14:00:53 +0100243 when Broxton => Frequency_Type'First, -- none needed
Nico Huberf54d0962016-10-20 14:17:18 +0200244 when Skylake => 24_000_000);
245
Nico Huberdcd274b2016-11-03 20:15:39 +0100246 ----------------------------------------------------------------------------
247
248 -- Maximum source width with enabled scaler. This only accounts
249 -- for simple 1:1 pipe:scaler mappings.
250
Nico Huber99f10f32016-11-20 00:34:05 +0100251 type Width_Per_Pipe is array (Pipe_Index) of Width_Type;
Nico Huberdcd274b2016-11-03 20:15:39 +0100252
253 Maximum_Scalable_Width : constant Width_Per_Pipe :=
254 (case CPU is
255 when Ironlake..Haswell =>
256 (Primary => 4096,
257 Secondary => 2048,
258 Tertiary => 2048),
259 when Broadwell..Skylake =>
260 (Primary => 4096,
261 Secondary => 4096,
262 Tertiary => 4096));
263
Nico Huber74ec9622016-11-19 03:00:43 +0100264 ----------------------------------------------------------------------------
265
Nico Huber21da5742017-01-20 14:00:53 +0100266 -- FIXME: Unknown for Broxton, Linux' i915 contains a fixme too :-D
Nico Huber74ec9622016-11-19 03:00:43 +0100267 HDMI_Max_Clock_24bpp : constant Frequency_Type :=
268 (if CPU >= Haswell then 300_000_000 else 225_000_000);
269
Nico Huber83693c82016-10-08 22:17:55 +0200270end HW.GFX.GMA.Config;