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