| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 1 | -- |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 2 | -- Copyright (C) 2014-2017 secunet Security Networks AG |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 3 | -- Copyright (C) 2017 Nico Huber <nico.h@gmx.de> |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 4 | -- |
| 5 | -- This program is free software; you can redistribute it and/or modify |
| 6 | -- 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] | 7 | -- the Free Software Foundation; either version 2 of the License, or |
| 8 | -- (at your option) any later version. |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 9 | -- |
| 10 | -- This program is distributed in the hope that it will be useful, |
| 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | -- GNU General Public License for more details. |
| 14 | -- |
| 15 | |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 16 | with HW.MMIO_Range; |
| 17 | pragma Elaborate_All (HW.MMIO_Range); |
| 18 | with HW.PCI.Dev; |
| 19 | pragma Elaborate_All (HW.PCI.Dev); |
| 20 | |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 21 | with HW.GFX.Framebuffer_Filler; |
| 22 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 23 | with HW.GFX.GMA.Config; |
| Nico Huber | 8c45bcf | 2016-11-20 17:30:57 +0100 | [diff] [blame] | 24 | with HW.GFX.GMA.Config_Helpers; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 25 | with HW.GFX.GMA.Registers; |
| 26 | with HW.GFX.GMA.Power_And_Clocks; |
| 27 | with HW.GFX.GMA.Panel; |
| 28 | with HW.GFX.GMA.PLLs; |
| 29 | with HW.GFX.GMA.Port_Detect; |
| 30 | with HW.GFX.GMA.Connectors; |
| 31 | with HW.GFX.GMA.Connector_Info; |
| 32 | with HW.GFX.GMA.Pipe_Setup; |
| 33 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 34 | with HW.Debug; |
| 35 | with GNAT.Source_Info; |
| 36 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 37 | use type HW.Int32; |
| 38 | |
| 39 | package body HW.GFX.GMA |
| 40 | with Refined_State => |
| 41 | (State => |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 42 | (Dev.Address_State, |
| 43 | Registers.Address_State, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 44 | PLLs.State, Panel.Panel_State, |
| Nico Huber | 1a712d3 | 2017-01-09 15:11:04 +0100 | [diff] [blame] | 45 | Cur_Configs, Allocated_PLLs, |
| Nico Huber | c3f66f6 | 2017-07-16 21:39:54 +0200 | [diff] [blame] | 46 | HPD_Delay, Wait_For_HPD, |
| 47 | Linear_FB_Base), |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 48 | Init_State => Initialized, |
| 49 | Config_State => Config.Valid_Port_GPU, |
| 50 | Device_State => |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 51 | (Dev.PCI_State, Registers.Register_State, Registers.GTT_State)) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 52 | is |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 53 | pragma Disable_Atomic_Synchronization; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 54 | |
| 55 | subtype Port_Name is String (1 .. 8); |
| 56 | type Port_Name_Array is array (Port_Type) of Port_Name; |
| 57 | Port_Names : constant Port_Name_Array := |
| 58 | (Disabled => "Disabled", |
| 59 | Internal => "Internal", |
| 60 | DP1 => "DP1 ", |
| 61 | DP2 => "DP2 ", |
| 62 | DP3 => "DP3 ", |
| Nico Huber | 0d454cd | 2016-11-21 13:33:43 +0100 | [diff] [blame] | 63 | HDMI1 => "HDMI1 ", |
| 64 | HDMI2 => "HDMI2 ", |
| 65 | HDMI3 => "HDMI3 ", |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 66 | Analog => "Analog "); |
| 67 | |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 68 | package Dev is new HW.PCI.Dev (PCI.Address'(0, 2, 0)); |
| 69 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 70 | package Display_Controller renames Pipe_Setup; |
| 71 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 72 | type PLLs_Type is array (Pipe_Index) of PLLs.T; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 73 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 74 | type HPD_Type is array (Port_Type) of Boolean; |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 75 | type HPD_Delay_Type is array (Active_Port_Type) of Time.T; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 76 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 77 | Allocated_PLLs : PLLs_Type; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 78 | HPD_Delay : HPD_Delay_Type; |
| 79 | Wait_For_HPD : HPD_Type; |
| 80 | Initialized : Boolean := False; |
| 81 | |
| Nico Huber | c3f66f6 | 2017-07-16 21:39:54 +0200 | [diff] [blame] | 82 | Linear_FB_Base : Word64; |
| 83 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 84 | ---------------------------------------------------------------------------- |
| 85 | |
| Nico Huber | f54d096 | 2016-10-20 14:17:18 +0200 | [diff] [blame] | 86 | PCH_RAWCLK_FREQ_MASK : constant := 16#3ff# * 2 ** 0; |
| 87 | |
| 88 | function PCH_RAWCLK_FREQ (Freq : Frequency_Type) return Word32 |
| 89 | is |
| 90 | begin |
| 91 | return Word32 (Freq / 1_000_000); |
| 92 | end PCH_RAWCLK_FREQ; |
| 93 | |
| 94 | ---------------------------------------------------------------------------- |
| 95 | |
| Nico Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 96 | procedure Enable_Output |
| 97 | (Pipe : in Pipe_Index; |
| 98 | Pipe_Cfg : in Pipe_Config; |
| 99 | Success : out Boolean) |
| 100 | is |
| 101 | Port_Cfg : Port_Config; |
| 102 | begin |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 103 | pragma Debug (Debug.New_Line); |
| 104 | pragma Debug (Debug.Put_Line |
| 105 | ("Trying to enable port " & Port_Names (Pipe_Cfg.Port))); |
| 106 | |
| Nico Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 107 | Config_Helpers.Fill_Port_Config |
| 108 | (Port_Cfg, Pipe, Pipe_Cfg.Port, Pipe_Cfg.Mode, Success); |
| 109 | |
| 110 | if Success then |
| 111 | Success := Config_Helpers.Validate_Config |
| 112 | (Pipe_Cfg.Framebuffer, Port_Cfg, Pipe); |
| 113 | end if; |
| 114 | |
| Nico Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 115 | if Success then |
| Nico Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 116 | Connector_Info.Preferred_Link_Setting (Port_Cfg, Success); |
| 117 | end if; |
| 118 | |
| 119 | -- loop over all possible DP-lane configurations |
| 120 | -- (non-DP ports use a single fake configuration) |
| 121 | while Success loop |
| 122 | pragma Loop_Invariant |
| 123 | (Pipe_Cfg.Port in Active_Port_Type and |
| 124 | Port_Cfg.Mode = Port_Cfg.Mode'Loop_Entry); |
| 125 | |
| 126 | PLLs.Alloc |
| 127 | (Port_Cfg => Port_Cfg, |
| 128 | PLL => Allocated_PLLs (Pipe), |
| 129 | Success => Success); |
| 130 | |
| 131 | if Success then |
| 132 | -- try each DP-lane configuration twice |
| 133 | for Try in 1 .. 2 loop |
| 134 | pragma Loop_Invariant |
| 135 | (Pipe_Cfg.Port in Active_Port_Type); |
| 136 | |
| Nico Huber | 4798c66 | 2017-01-11 12:44:48 +0100 | [diff] [blame] | 137 | -- Clear pending hot-plug events before every try |
| 138 | Port_Detect.Clear_Hotplug_Detect (Pipe_Cfg.Port); |
| 139 | |
| Nico Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 140 | Connectors.Pre_On |
| 141 | (Pipe => Pipe, |
| 142 | Port_Cfg => Port_Cfg, |
| 143 | PLL_Hint => PLLs.Register_Value (Allocated_PLLs (Pipe)), |
| 144 | Success => Success); |
| 145 | |
| 146 | if Success then |
| 147 | Display_Controller.On |
| 148 | (Pipe => Pipe, |
| 149 | Port_Cfg => Port_Cfg, |
| 150 | Framebuffer => Pipe_Cfg.Framebuffer); |
| 151 | |
| 152 | Connectors.Post_On |
| 153 | (Port_Cfg => Port_Cfg, |
| 154 | PLL_Hint => PLLs.Register_Value (Allocated_PLLs (Pipe)), |
| 155 | Success => Success); |
| 156 | |
| 157 | if not Success then |
| 158 | Display_Controller.Off (Pipe); |
| 159 | Connectors.Post_Off (Port_Cfg); |
| 160 | end if; |
| 161 | end if; |
| 162 | |
| 163 | exit when Success; |
| 164 | end loop; |
| 165 | exit when Success; -- connection established => stop loop |
| 166 | |
| 167 | -- connection failed |
| 168 | PLLs.Free (Allocated_PLLs (Pipe)); |
| 169 | end if; |
| 170 | |
| 171 | Connector_Info.Next_Link_Setting (Port_Cfg, Success); |
| 172 | end loop; |
| 173 | |
| 174 | if Success then |
| 175 | pragma Debug (Debug.Put_Line |
| 176 | ("Enabled port " & Port_Names (Pipe_Cfg.Port))); |
| 177 | else |
| 178 | Wait_For_HPD (Pipe_Cfg.Port) := True; |
| 179 | if Pipe_Cfg.Port = Internal then |
| 180 | Panel.Off; |
| 181 | end if; |
| 182 | end if; |
| 183 | end Enable_Output; |
| 184 | |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 185 | procedure Disable_Output (Pipe : Pipe_Index; Pipe_Cfg : Pipe_Config) |
| 186 | is |
| 187 | Port_Cfg : Port_Config; |
| 188 | Success : Boolean; |
| 189 | begin |
| 190 | Config_Helpers.Fill_Port_Config |
| 191 | (Port_Cfg, Pipe, Pipe_Cfg.Port, Pipe_Cfg.Mode, Success); |
| 192 | if Success then |
| 193 | pragma Debug (Debug.New_Line); |
| 194 | pragma Debug (Debug.Put_Line |
| 195 | ("Disabling port " & Port_Names (Pipe_Cfg.Port))); |
| 196 | pragma Debug (Debug.New_Line); |
| 197 | |
| 198 | Connectors.Pre_Off (Port_Cfg); |
| 199 | Display_Controller.Off (Pipe); |
| 200 | Connectors.Post_Off (Port_Cfg); |
| 201 | |
| 202 | PLLs.Free (Allocated_PLLs (Pipe)); |
| 203 | end if; |
| 204 | end Disable_Output; |
| 205 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 206 | procedure Update_Outputs (Configs : Pipe_Configs) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 207 | is |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 208 | procedure Check_HPD (Port : in Active_Port_Type; Detected : out Boolean) |
| 209 | is |
| 210 | HPD_Delay_Over : constant Boolean := Time.Timed_Out (HPD_Delay (Port)); |
| 211 | begin |
| 212 | if HPD_Delay_Over then |
| 213 | Port_Detect.Hotplug_Detect (Port, Detected); |
| 214 | HPD_Delay (Port) := Time.MS_From_Now (333); |
| 215 | else |
| 216 | Detected := False; |
| 217 | end if; |
| 218 | end Check_HPD; |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 219 | |
| Nico Huber | 564103f | 2017-01-11 15:33:07 +0100 | [diff] [blame] | 220 | Power_Changed : Boolean := False; |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 221 | Old_Configs : Pipe_Configs; |
| Nico Huber | 564103f | 2017-01-11 15:33:07 +0100 | [diff] [blame] | 222 | |
| 223 | -- Only called when we actually tried to change something |
| 224 | -- so we don't congest the log with unnecessary messages. |
| 225 | procedure Update_Power |
| 226 | is |
| 227 | begin |
| 228 | if not Power_Changed then |
| 229 | Power_And_Clocks.Power_Up (Old_Configs, Configs); |
| 230 | Power_Changed := True; |
| 231 | end if; |
| 232 | end Update_Power; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 233 | begin |
| 234 | Old_Configs := Cur_Configs; |
| 235 | |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 236 | -- disable all pipes that changed or had a hot-plug event |
| 237 | for Pipe in Pipe_Index loop |
| 238 | declare |
| 239 | Unplug_Detected : Boolean; |
| 240 | Cur_Config : Pipe_Config renames Cur_Configs (Pipe); |
| 241 | New_Config : Pipe_Config renames Configs (Pipe); |
| 242 | begin |
| 243 | if Cur_Config.Port /= Disabled then |
| 244 | Check_HPD (Cur_Config.Port, Unplug_Detected); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 245 | |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 246 | if Cur_Config.Port /= New_Config.Port or |
| 247 | Cur_Config.Mode /= New_Config.Mode or |
| 248 | Unplug_Detected |
| 249 | then |
| 250 | Disable_Output (Pipe, Cur_Config); |
| 251 | Cur_Config.Port := Disabled; |
| Nico Huber | 564103f | 2017-01-11 15:33:07 +0100 | [diff] [blame] | 252 | Update_Power; |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 253 | end if; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 254 | end if; |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 255 | end; |
| 256 | end loop; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 257 | |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 258 | -- enable all pipes that changed and should be active |
| 259 | for Pipe in Pipe_Index loop |
| 260 | declare |
| 261 | Success : Boolean; |
| 262 | Cur_Config : Pipe_Config renames Cur_Configs (Pipe); |
| 263 | New_Config : Pipe_Config renames Configs (Pipe); |
| 264 | begin |
| 265 | if New_Config.Port /= Disabled and then |
| 266 | (Cur_Config.Port /= New_Config.Port or |
| 267 | Cur_Config.Mode /= New_Config.Mode) |
| 268 | then |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 269 | if Wait_For_HPD (New_Config.Port) then |
| 270 | Check_HPD (New_Config.Port, Success); |
| 271 | Wait_For_HPD (New_Config.Port) := not Success; |
| 272 | else |
| 273 | Success := True; |
| Nico Huber | 8c45bcf | 2016-11-20 17:30:57 +0100 | [diff] [blame] | 274 | end if; |
| Nico Huber | c7a4fee | 2016-11-03 18:18:03 +0100 | [diff] [blame] | 275 | |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 276 | if Success then |
| Nico Huber | 564103f | 2017-01-11 15:33:07 +0100 | [diff] [blame] | 277 | Update_Power; |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 278 | Enable_Output (Pipe, New_Config, Success); |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 279 | end if; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 280 | |
| 281 | if Success then |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 282 | Cur_Config := New_Config; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 283 | end if; |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 284 | |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 285 | -- update framebuffer offset only |
| 286 | elsif New_Config.Port /= Disabled and |
| 287 | Cur_Config.Framebuffer /= New_Config.Framebuffer |
| 288 | then |
| 289 | Display_Controller.Update_Offset (Pipe, New_Config.Framebuffer); |
| 290 | Cur_Config := New_Config; |
| 291 | end if; |
| 292 | end; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 293 | end loop; |
| 294 | |
| Nico Huber | 564103f | 2017-01-11 15:33:07 +0100 | [diff] [blame] | 295 | if Power_Changed then |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 296 | Power_And_Clocks.Power_Down (Old_Configs, Configs, Cur_Configs); |
| 297 | end if; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 298 | end Update_Outputs; |
| 299 | |
| 300 | ---------------------------------------------------------------------------- |
| 301 | |
| 302 | procedure Initialize |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 303 | (Write_Delay : in Word64 := 0; |
| Nico Huber | 793a8d4 | 2016-11-21 18:57:03 +0100 | [diff] [blame] | 304 | Clean_State : in Boolean := False; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 305 | Success : out Boolean) |
| 306 | with |
| 307 | Refined_Global => |
| 308 | (In_Out => |
| Nico Huber | e015e82 | 2017-08-25 20:12:09 +0200 | [diff] [blame] | 309 | (Config.Valid_Port_GPU, Dev.PCI_State, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 310 | Registers.Register_State, Port_IO.State), |
| 311 | Input => |
| 312 | (Time.State), |
| 313 | Output => |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 314 | (Dev.Address_State, |
| 315 | Registers.Address_State, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 316 | PLLs.State, Panel.Panel_State, |
| Nico Huber | 1a712d3 | 2017-01-09 15:11:04 +0100 | [diff] [blame] | 317 | Cur_Configs, Allocated_PLLs, |
| Nico Huber | c3f66f6 | 2017-07-16 21:39:54 +0200 | [diff] [blame] | 318 | HPD_Delay, Wait_For_HPD, |
| 319 | Linear_FB_Base, Initialized)) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 320 | is |
| 321 | use type HW.Word64; |
| 322 | |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 323 | PCI_MMIO_Base, PCI_GTT_Base : Word64; |
| 324 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 325 | Now : constant Time.T := Time.Now; |
| 326 | |
| 327 | procedure Check_Platform (Success : out Boolean) |
| 328 | is |
| 329 | Audio_VID_DID : Word32; |
| 330 | begin |
| 331 | case Config.CPU is |
| 332 | when Haswell .. Skylake => |
| 333 | Registers.Read (Registers.AUD_VID_DID, Audio_VID_DID); |
| 334 | when Ironlake .. Ivybridge => |
| 335 | Registers.Read (Registers.PCH_AUD_VID_DID, Audio_VID_DID); |
| 336 | end case; |
| 337 | Success := |
| 338 | (case Config.CPU is |
| Nico Huber | 21da574 | 2017-01-20 14:00:53 +0100 | [diff] [blame] | 339 | when Broxton => Audio_VID_DID = 16#8086_280a#, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 340 | when Skylake => Audio_VID_DID = 16#8086_2809#, |
| 341 | when Broadwell => Audio_VID_DID = 16#8086_2808#, |
| 342 | when Haswell => Audio_VID_DID = 16#8086_2807#, |
| 343 | when Ivybridge | |
| 344 | Sandybridge => Audio_VID_DID = 16#8086_2806# or |
| 345 | Audio_VID_DID = 16#8086_2805#, |
| Nico Huber | eeb5a39 | 2016-10-09 19:28:30 +0200 | [diff] [blame] | 346 | when Ironlake => Audio_VID_DID = 16#0000_0000#); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 347 | end Check_Platform; |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame^] | 348 | |
| 349 | procedure Check_Platform_PCI (Success : out Boolean) |
| 350 | is |
| 351 | use type HW.Word16; |
| 352 | Vendor, Device : Word16; |
| 353 | begin |
| 354 | Dev.Read16 (Vendor, PCI.Vendor_Id); |
| 355 | Dev.Read16 (Device, PCI.Device_Id); |
| 356 | |
| 357 | Success := Vendor = 16#8086# and Config.Compatible_GPU (Device); |
| 358 | end Check_Platform_PCI; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 359 | begin |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 360 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 361 | |
| 362 | pragma Debug (Debug.Set_Register_Write_Delay (Write_Delay)); |
| 363 | |
| Nico Huber | c3f66f6 | 2017-07-16 21:39:54 +0200 | [diff] [blame] | 364 | Linear_FB_Base := 0; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 365 | Wait_For_HPD := HPD_Type'(others => False); |
| 366 | HPD_Delay := HPD_Delay_Type'(others => Now); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 367 | Allocated_PLLs := (others => PLLs.Invalid); |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 368 | Cur_Configs := Pipe_Configs' |
| 369 | (others => Pipe_Config' |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 370 | (Port => Disabled, |
| 371 | Framebuffer => HW.GFX.Default_FB, |
| 372 | Mode => HW.GFX.Invalid_Mode)); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 373 | PLLs.Initialize; |
| 374 | |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 375 | Dev.Initialize (Success); |
| 376 | |
| 377 | if Success then |
| 378 | Dev.Map (PCI_MMIO_Base, PCI.Res0, Length => Config.GTT_Offset); |
| 379 | Dev.Map (PCI_GTT_Base, PCI.Res0, Offset => Config.GTT_Offset); |
| 380 | if PCI_MMIO_Base /= 0 and PCI_GTT_Base /= 0 then |
| 381 | Registers.Set_Register_Base (PCI_MMIO_Base, PCI_GTT_Base); |
| 382 | else |
| 383 | pragma Debug (Debug.Put_Line |
| 384 | ("ERROR: Couldn't map resoure0.")); |
| 385 | Registers.Set_Register_Base (Config.Default_MMIO_Base); |
| 386 | Success := Config.Default_MMIO_Base_Set; |
| 387 | end if; |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame^] | 388 | |
| 389 | if Success then |
| 390 | Check_Platform_PCI (Success); |
| 391 | end if; |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 392 | else |
| 393 | pragma Debug (Debug.Put_Line |
| 394 | ("WARNING: Couldn't initialize PCI dev.")); |
| 395 | Registers.Set_Register_Base (Config.Default_MMIO_Base); |
| 396 | Success := Config.Default_MMIO_Base_Set; |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 397 | |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame^] | 398 | if Success then |
| 399 | Check_Platform (Success); |
| 400 | end if; |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 401 | end if; |
| 402 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 403 | if not Success then |
| 404 | pragma Debug (Debug.Put_Line ("ERROR: Incompatible CPU or PCH.")); |
| 405 | |
| 406 | Panel.Static_Init; -- for flow analysis |
| 407 | |
| 408 | Initialized := False; |
| 409 | return; |
| 410 | end if; |
| 411 | |
| 412 | Panel.Setup_PP_Sequencer; |
| 413 | Port_Detect.Initialize; |
| Nico Huber | 0923b79 | 2017-06-09 15:28:41 +0200 | [diff] [blame] | 414 | Connectors.Initialize; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 415 | |
| Nico Huber | 793a8d4 | 2016-11-21 18:57:03 +0100 | [diff] [blame] | 416 | if Clean_State then |
| 417 | Power_And_Clocks.Pre_All_Off; |
| 418 | Connectors.Pre_All_Off; |
| 419 | Display_Controller.All_Off; |
| 420 | Connectors.Post_All_Off; |
| 421 | PLLs.All_Off; |
| 422 | Power_And_Clocks.Post_All_Off; |
| Nico Huber | 17d64b6 | 2017-07-15 20:51:25 +0200 | [diff] [blame] | 423 | Registers.Clear_Fences; |
| Nico Huber | 33912aa | 2016-12-06 20:36:23 +0100 | [diff] [blame] | 424 | else |
| 425 | -- According to PRMs, VGA plane is the only thing |
| Nico Huber | 3a0e2a0 | 2017-07-19 14:41:46 +0200 | [diff] [blame] | 426 | -- that's enabled by default after reset... |
| Nico Huber | 33912aa | 2016-12-06 20:36:23 +0100 | [diff] [blame] | 427 | Display_Controller.Legacy_VGA_Off; |
| Nico Huber | 3a0e2a0 | 2017-07-19 14:41:46 +0200 | [diff] [blame] | 428 | -- ... along with some DDI port bits since Skylake. |
| 429 | Connectors.Post_Reset_Off; |
| Nico Huber | 793a8d4 | 2016-11-21 18:57:03 +0100 | [diff] [blame] | 430 | end if; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 431 | |
| 432 | -------------------- Now restart from a clean state --------------------- |
| 433 | Power_And_Clocks.Initialize; |
| 434 | |
| Nico Huber | 1c3b928 | 2017-02-09 13:57:04 +0100 | [diff] [blame] | 435 | if Config.Has_PCH then |
| 436 | Registers.Unset_And_Set_Mask |
| 437 | (Register => Registers.PCH_RAWCLK_FREQ, |
| 438 | Mask_Unset => PCH_RAWCLK_FREQ_MASK, |
| 439 | Mask_Set => PCH_RAWCLK_FREQ (Config.Default_RawClk_Freq)); |
| 440 | end if; |
| Nico Huber | f54d096 | 2016-10-20 14:17:18 +0200 | [diff] [blame] | 441 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 442 | Initialized := True; |
| 443 | |
| 444 | end Initialize; |
| 445 | |
| 446 | function Is_Initialized return Boolean |
| 447 | with |
| 448 | Refined_Post => Is_Initialized'Result = Initialized |
| 449 | is |
| 450 | begin |
| 451 | return Initialized; |
| 452 | end Is_Initialized; |
| 453 | |
| 454 | ---------------------------------------------------------------------------- |
| 455 | |
| Nico Huber | 42fb2d0 | 2017-09-01 17:01:51 +0200 | [diff] [blame] | 456 | procedure Power_Up_VGA |
| 457 | is |
| 458 | Fake_Config : constant Pipe_Configs := |
| 459 | (Primary => |
| 460 | (Port => Analog, |
| 461 | Framebuffer => HW.GFX.Default_FB, |
| 462 | Mode => HW.GFX.Invalid_Mode), |
| 463 | others => |
| 464 | (Port => Disabled, |
| 465 | Framebuffer => HW.GFX.Default_FB, |
| 466 | Mode => HW.GFX.Invalid_Mode)); |
| 467 | begin |
| 468 | Power_And_Clocks.Power_Up (Cur_Configs, Fake_Config); |
| 469 | end Power_Up_VGA; |
| 470 | |
| 471 | ---------------------------------------------------------------------------- |
| 472 | |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 473 | function FB_First_Page (FB : Framebuffer_Type) return Natural is |
| 474 | (Natural (FB.Offset / GTT_Page_Size)); |
| 475 | function FB_Pages (FB : Framebuffer_Type) return Natural is |
| 476 | (Natural (Div_Round_Up (FB_Size (FB), GTT_Page_Size))); |
| 477 | function FB_Last_Page (FB : Framebuffer_Type) return Natural is |
| 478 | (FB_First_Page (FB) + FB_Pages (FB) - 1); |
| 479 | |
| 480 | -- Check basics and that it fits in GTT |
| 481 | function Valid_FB (FB : Framebuffer_Type) return Boolean is |
| 482 | (FB.Width <= FB.Stride and FB_Last_Page (FB) <= GTT_Range'Last); |
| 483 | |
| 484 | -- Also check that we don't overflow the GTT's 39-bit space |
| 485 | -- (always true with a 32-bit base) |
| 486 | function Valid_Phys_FB (FB : Framebuffer_Type; Phys_Base : Word32) |
| 487 | return Boolean is |
| 488 | (Valid_FB (FB) and |
| 489 | Int64 (Phys_Base) + Int64 (FB.Offset) + Int64 (FB_Size (FB)) <= |
| 490 | Int64 (GTT_Address_Type'Last)) |
| 491 | with |
| 492 | Ghost; |
| 493 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 494 | procedure Write_GTT |
| 495 | (GTT_Page : GTT_Range; |
| 496 | Device_Address : GTT_Address_Type; |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 497 | Valid : Boolean) |
| 498 | is |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 499 | begin |
| 500 | Registers.Write_GTT (GTT_Page, Device_Address, Valid); |
| 501 | end Write_GTT; |
| 502 | |
| Nico Huber | 194e57e | 2017-07-15 21:15:46 +0200 | [diff] [blame] | 503 | procedure Setup_Default_GTT (FB : Framebuffer_Type; Phys_Base : Word32) |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 504 | with |
| 505 | Pre => Is_Initialized and Valid_Phys_FB (FB, Phys_Base) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 506 | is |
| Nico Huber | 194e57e | 2017-07-15 21:15:46 +0200 | [diff] [blame] | 507 | Phys_Addr : GTT_Address_Type := |
| 508 | GTT_Address_Type (Phys_Base) + GTT_Address_Type (FB.Offset); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 509 | begin |
| Nico Huber | 194e57e | 2017-07-15 21:15:46 +0200 | [diff] [blame] | 510 | for Idx in FB_First_Page (FB) .. FB_Last_Page (FB) loop |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 511 | Registers.Write_GTT |
| 512 | (GTT_Page => Idx, |
| 513 | Device_Address => Phys_Addr, |
| 514 | Valid => True); |
| Nico Huber | 194e57e | 2017-07-15 21:15:46 +0200 | [diff] [blame] | 515 | Phys_Addr := Phys_Addr + GTT_Page_Size; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 516 | end loop; |
| 517 | end Setup_Default_GTT; |
| 518 | |
| 519 | ---------------------------------------------------------------------------- |
| 520 | |
| Nico Huber | eedde88 | 2017-07-16 02:54:39 +0200 | [diff] [blame] | 521 | use type HW.Word16; |
| 522 | subtype Stolen_Size_Range is Int64 range 0 .. 2 ** 33; |
| 523 | |
| 524 | function GGMS_Gen4 (GGC : Word16) return Natural is |
| 525 | (Natural (Shift_Right (GGC, 8) and 16#07#)); |
| 526 | function GTT_Size_Gen4 (GGC : Word16) return Natural is |
| 527 | (if GGMS_Gen4 (GGC) in 1 .. 3 then |
| 528 | (GGMS_Gen4 (GGC) + 1) * 2 ** 19 else 0); |
| 529 | |
| 530 | function GMS_Gen4 (GGC : Word16) return Natural is |
| 531 | (Natural (Shift_Right (GGC, 4) and 16#0f#)); |
| 532 | Valid_Stolen_Size_Gen4 : constant |
| 533 | array (Natural range 1 .. 13) of Stolen_Size_Range := |
| 534 | (1, 4, 8, 16, 32, 48, 64, 128, 256, 96, 160, 224, 352); |
| 535 | function Stolen_Size_Gen4 (GGC : Word16) return Stolen_Size_Range is |
| 536 | (if GMS_Gen4 (GGC) in Valid_Stolen_Size_Gen4'Range then |
| Arthur Heymans | 5fd9a31 | 2017-09-12 12:45:18 +0200 | [diff] [blame] | 537 | Valid_Stolen_Size_Gen4 (GMS_Gen4 (GGC)) * 2 ** 20 else 0); |
| Nico Huber | eedde88 | 2017-07-16 02:54:39 +0200 | [diff] [blame] | 538 | |
| 539 | function GTT_Size_Gen6 (GGC : Word16) return Natural is |
| 540 | (Natural (Shift_Right (GGC, 8) and 16#03#) * 2 ** 20); |
| 541 | |
| 542 | function Stolen_Size_Gen6 (GGC : Word16) return Stolen_Size_Range is |
| 543 | (Stolen_Size_Range (Shift_Right (GGC, 3) and 16#1f#) * 32 * 2 ** 20); |
| 544 | |
| 545 | function GTT_Size_Gen8 (GGC : Word16) return Natural is |
| 546 | (Natural (Shift_Right (GGC, 6) and 16#03#) * 2 ** 20); |
| 547 | |
| 548 | function GMS_Gen8 (GGC : Word16) return Stolen_Size_Range is |
| 549 | (Stolen_Size_Range (Shift_Right (GGC, 8) and 16#ff#)); |
| 550 | function Stolen_Size_Gen8 (GGC : Word16) return Stolen_Size_Range is |
| 551 | (GMS_Gen8 (GGC) * 32 * 2 ** 20); |
| 552 | |
| 553 | function Stolen_Size_Gen9 (GGC : Word16) return Stolen_Size_Range is |
| 554 | (if GMS_Gen8 (GGC) < 16#f0# then |
| 555 | Stolen_Size_Gen8 (GGC) |
| 556 | else |
| 557 | (GMS_Gen8 (GGC) - 16#f0# + 1) * 4 * 2 ** 20); |
| 558 | |
| 559 | procedure Decode_Stolen |
| 560 | (GTT_Size : out Natural; |
| 561 | Stolen_Size : out Stolen_Size_Range) |
| 562 | with |
| 563 | Pre => Is_Initialized |
| 564 | is |
| 565 | GGC_Reg : constant := |
| 566 | (case Config.CPU is |
| 567 | when Ironlake => 16#52#, |
| 568 | when Sandybridge .. Skylake => 16#50#); |
| 569 | GGC : Word16; |
| 570 | begin |
| 571 | Dev.Read16 (GGC, GGC_Reg); |
| 572 | case Config.CPU is |
| 573 | when Ironlake => |
| 574 | GTT_Size := GTT_Size_Gen4 (GGC); |
| 575 | Stolen_Size := Stolen_Size_Gen4 (GGC); |
| 576 | when Sandybridge .. Haswell => |
| 577 | GTT_Size := GTT_Size_Gen6 (GGC); |
| 578 | Stolen_Size := Stolen_Size_Gen6 (GGC); |
| 579 | when Broadwell => |
| 580 | GTT_Size := GTT_Size_Gen8 (GGC); |
| 581 | Stolen_Size := Stolen_Size_Gen8 (GGC); |
| 582 | when Broxton .. Skylake => |
| 583 | GTT_Size := GTT_Size_Gen8 (GGC); |
| 584 | Stolen_Size := Stolen_Size_Gen9 (GGC); |
| 585 | end case; |
| 586 | end Decode_Stolen; |
| 587 | |
| 588 | -- Additional runtime validation that FB fits stolen memory and aperture. |
| 589 | procedure Validate_FB (FB : Framebuffer_Type; Valid : out Boolean) |
| 590 | with |
| 591 | Pre => Is_Initialized, |
| 592 | Post => (if Valid then Valid_FB (FB)) |
| 593 | is |
| 594 | GTT_Size, Aperture_Size : Natural; |
| 595 | Stolen_Size : Stolen_Size_Range; |
| 596 | begin |
| 597 | Valid := Valid_FB (FB); |
| 598 | |
| 599 | if Valid then |
| 600 | Decode_Stolen (GTT_Size, Stolen_Size); |
| 601 | Dev.Resource_Size (Aperture_Size, PCI.Res2); |
| 602 | Valid := |
| 603 | FB_Last_Page (FB) < GTT_Size / Config.GTT_PTE_Size and |
| 604 | FB_Last_Page (FB) < Natural (Stolen_Size / GTT_Page_Size) and |
| 605 | FB_Last_Page (FB) < Aperture_Size / GTT_Page_Size; |
| 606 | pragma Debug (not Valid, Debug.Put |
| 607 | ("Stolen memory too small to hold framebuffer.")); |
| 608 | end if; |
| 609 | end Validate_FB; |
| 610 | |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 611 | procedure Setup_Default_FB |
| 612 | (FB : in Framebuffer_Type; |
| 613 | Clear : in Boolean := True; |
| 614 | Success : out Boolean) |
| 615 | is |
| 616 | GMA_Phys_Base : constant PCI.Index := 16#5c#; |
| 617 | GMA_Phys_Base_Mask : constant := 16#fff0_0000#; |
| 618 | |
| 619 | Phys_Base : Word32; |
| 620 | begin |
| Nico Huber | eedde88 | 2017-07-16 02:54:39 +0200 | [diff] [blame] | 621 | Validate_FB (FB, Success); |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 622 | |
| 623 | if Success then |
| 624 | Dev.Read32 (Phys_Base, GMA_Phys_Base); |
| 625 | Phys_Base := Phys_Base and GMA_Phys_Base_Mask; |
| 626 | Success := Phys_Base /= GMA_Phys_Base_Mask and Phys_Base /= 0; |
| 627 | pragma Debug (not Success, Debug.Put_Line |
| 628 | ("Failed to read stolen memory base.")); |
| 629 | if Success then |
| 630 | Setup_Default_GTT (FB, Phys_Base); |
| 631 | end if; |
| 632 | end if; |
| 633 | |
| 634 | if Success and then Clear then |
| 635 | declare |
| 636 | use type HW.Word64; |
| 637 | Linear_FB : Word64; |
| 638 | begin |
| Nico Huber | c3f66f6 | 2017-07-16 21:39:54 +0200 | [diff] [blame] | 639 | Map_Linear_FB (Linear_FB, FB); |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 640 | if Linear_FB /= 0 then |
| Nico Huber | c3f66f6 | 2017-07-16 21:39:54 +0200 | [diff] [blame] | 641 | Framebuffer_Filler.Fill (Linear_FB, FB); |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 642 | end if; |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 643 | end; |
| 644 | end if; |
| 645 | end Setup_Default_FB; |
| 646 | |
| Nico Huber | c3f66f6 | 2017-07-16 21:39:54 +0200 | [diff] [blame] | 647 | procedure Map_Linear_FB (Linear_FB : out Word64; FB : in Framebuffer_Type) |
| 648 | is |
| 649 | use type HW.Word64; |
| 650 | |
| 651 | Valid : Boolean; |
| 652 | begin |
| 653 | Linear_FB := 0; |
| 654 | |
| 655 | if Linear_FB_Base = 0 then |
| 656 | Dev.Map (Linear_FB_Base, PCI.Res2); |
| 657 | pragma Debug |
| 658 | (Linear_FB_Base = 0, Debug.Put_Line ("Failed to map resource2.")); |
| 659 | end if; |
| 660 | |
| 661 | if Linear_FB_Base /= 0 then |
| 662 | Validate_FB (FB, Valid); |
| 663 | if Valid then |
| 664 | Linear_FB := Linear_FB_Base + Word64 (FB.Offset); |
| 665 | end if; |
| 666 | end if; |
| 667 | end Map_Linear_FB; |
| 668 | |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 669 | ---------------------------------------------------------------------------- |
| 670 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 671 | procedure Dump_Configs (Configs : Pipe_Configs) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 672 | is |
| 673 | subtype Pipe_Name is String (1 .. 9); |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 674 | type Pipe_Name_Array is array (Pipe_Index) of Pipe_Name; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 675 | Pipe_Names : constant Pipe_Name_Array := |
| 676 | (Primary => "Primary ", |
| 677 | Secondary => "Secondary", |
| 678 | Tertiary => "Tertiary "); |
| 679 | begin |
| 680 | Debug.New_Line; |
| Paul Menzel | b83107c | 2017-05-04 09:02:33 +0200 | [diff] [blame] | 681 | Debug.Put_Line ("CONFIG =>"); |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 682 | for Pipe in Pipe_Index loop |
| 683 | if Pipe = Pipe_Index'First then |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 684 | Debug.Put (" ("); |
| 685 | else |
| 686 | Debug.Put (" "); |
| 687 | end if; |
| 688 | Debug.Put_Line (Pipe_Names (Pipe) & " =>"); |
| 689 | Debug.Put_Line |
| 690 | (" (Port => " & Port_Names (Configs (Pipe).Port) & ","); |
| 691 | Debug.Put_Line (" Framebuffer =>"); |
| 692 | Debug.Put (" (Width => "); |
| 693 | Debug.Put_Int32 (Configs (Pipe).Framebuffer.Width); |
| 694 | Debug.Put_Line (","); |
| 695 | Debug.Put (" Height => "); |
| 696 | Debug.Put_Int32 (Configs (Pipe).Framebuffer.Height); |
| 697 | Debug.Put_Line (","); |
| 698 | Debug.Put (" Stride => "); |
| 699 | Debug.Put_Int32 (Configs (Pipe).Framebuffer.Stride); |
| 700 | Debug.Put_Line (","); |
| 701 | Debug.Put (" Offset => "); |
| 702 | Debug.Put_Word32 (Configs (Pipe).Framebuffer.Offset); |
| 703 | Debug.Put_Line (","); |
| 704 | Debug.Put (" BPC => "); |
| 705 | Debug.Put_Int64 (Configs (Pipe).Framebuffer.BPC); |
| 706 | Debug.Put_Line ("),"); |
| 707 | Debug.Put_Line (" Mode =>"); |
| 708 | Debug.Put (" (Dotclock => "); |
| 709 | Debug.Put_Int64 (Configs (Pipe).Mode.Dotclock); |
| 710 | Debug.Put_Line (","); |
| 711 | Debug.Put (" H_Visible => "); |
| 712 | Debug.Put_Int16 (Configs (Pipe).Mode.H_Visible); |
| 713 | Debug.Put_Line (","); |
| 714 | Debug.Put (" H_Sync_Begin => "); |
| 715 | Debug.Put_Int16 (Configs (Pipe).Mode.H_Sync_Begin); |
| 716 | Debug.Put_Line (","); |
| 717 | Debug.Put (" H_Sync_End => "); |
| 718 | Debug.Put_Int16 (Configs (Pipe).Mode.H_Sync_End); |
| 719 | Debug.Put_Line (","); |
| 720 | Debug.Put (" H_Total => "); |
| 721 | Debug.Put_Int16 (Configs (Pipe).Mode.H_Total); |
| 722 | Debug.Put_Line (","); |
| 723 | Debug.Put (" V_Visible => "); |
| 724 | Debug.Put_Int16 (Configs (Pipe).Mode.V_Visible); |
| 725 | Debug.Put_Line (","); |
| 726 | Debug.Put (" V_Sync_Begin => "); |
| 727 | Debug.Put_Int16 (Configs (Pipe).Mode.V_Sync_Begin); |
| 728 | Debug.Put_Line (","); |
| 729 | Debug.Put (" V_Sync_End => "); |
| 730 | Debug.Put_Int16 (Configs (Pipe).Mode.V_Sync_End); |
| 731 | Debug.Put_Line (","); |
| 732 | Debug.Put (" V_Total => "); |
| 733 | Debug.Put_Int16 (Configs (Pipe).Mode.V_Total); |
| 734 | Debug.Put_Line (","); |
| 735 | Debug.Put_Line (" H_Sync_Active_High => " & |
| 736 | (if Configs (Pipe).Mode.H_Sync_Active_High |
| 737 | then "True," |
| 738 | else "False,")); |
| 739 | Debug.Put_Line (" V_Sync_Active_High => " & |
| 740 | (if Configs (Pipe).Mode.V_Sync_Active_High |
| 741 | then "True," |
| 742 | else "False,")); |
| 743 | Debug.Put (" BPC => "); |
| 744 | Debug.Put_Int64 (Configs (Pipe).Mode.BPC); |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 745 | if Pipe /= Pipe_Index'Last then |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 746 | Debug.Put_Line (")),"); |
| 747 | else |
| 748 | Debug.Put_Line (")));"); |
| 749 | end if; |
| 750 | end loop; |
| 751 | end Dump_Configs; |
| 752 | |
| 753 | end HW.GFX.GMA; |