Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 1 | /* $NoKeywords:$ */ |
| 2 | /** |
| 3 | * @file |
| 4 | * |
| 5 | * Service procedure to initialize Integrated Info Table |
| 6 | * |
| 7 | * |
| 8 | * |
| 9 | * @xrefitem bom "File Content Label" "Release Content" |
| 10 | * @e project: AGESA |
| 11 | * @e sub-project: GNB |
| 12 | * @e \$Revision: 38950 $ @e \$Date: 2010-10-03 23:49:09 -0700 (Sun, 03 Oct 2010) $ |
| 13 | * |
| 14 | */ |
| 15 | /* |
| 16 | ***************************************************************************** |
| 17 | * |
| 18 | * Copyright (c) 2011, Advanced Micro Devices, Inc. |
| 19 | * All rights reserved. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 20 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 21 | * Redistribution and use in source and binary forms, with or without |
| 22 | * modification, are permitted provided that the following conditions are met: |
| 23 | * * Redistributions of source code must retain the above copyright |
| 24 | * notice, this list of conditions and the following disclaimer. |
| 25 | * * Redistributions in binary form must reproduce the above copyright |
| 26 | * notice, this list of conditions and the following disclaimer in the |
| 27 | * documentation and/or other materials provided with the distribution. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 28 | * * Neither the name of Advanced Micro Devices, Inc. nor the names of |
| 29 | * its contributors may be used to endorse or promote products derived |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 30 | * from this software without specific prior written permission. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 31 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 33 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 35 | * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY |
| 36 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 37 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 38 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 39 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 40 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 41 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 42 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 43 | * *************************************************************************** |
| 44 | * |
| 45 | */ |
| 46 | |
| 47 | |
| 48 | /*---------------------------------------------------------------------------------------- |
| 49 | * M O D U L E S U S E D |
| 50 | *---------------------------------------------------------------------------------------- |
| 51 | */ |
| 52 | #include "AGESA.h" |
| 53 | #include "Ids.h" |
| 54 | #include "amdlib.h" |
| 55 | #include "Gnb.h" |
| 56 | #include "GnbPcie.h" |
| 57 | #include "GnbGfx.h" |
| 58 | #include GNB_MODULE_DEFINITIONS (GnbCommonLib) |
| 59 | #include GNB_MODULE_DEFINITIONS (GnbPcieInitLibV1) |
| 60 | #include GNB_MODULE_DEFINITIONS (GnbPcieConfig) |
| 61 | #include "GnbGfxFamServices.h" |
efdesign98 | 84cbce2 | 2011-08-04 12:09:17 -0600 | [diff] [blame] | 62 | #include "GfxEnumConnectors.h" |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 63 | #include "GnbRegistersON.h" |
| 64 | #include "Filecode.h" |
| 65 | #define FILECODE PROC_GNB_MODULES_GNBGFXINITLIBV1_GFXENUMCONNECTORS_FILECODE |
| 66 | /*---------------------------------------------------------------------------------------- |
| 67 | * D E F I N I T I O N S A N D M A C R O S |
| 68 | *---------------------------------------------------------------------------------------- |
| 69 | */ |
| 70 | |
| 71 | |
| 72 | |
| 73 | /*---------------------------------------------------------------------------------------- |
| 74 | * T Y P E D E F S A N D S T R U C T U R E S |
| 75 | *---------------------------------------------------------------------------------------- |
| 76 | */ |
| 77 | |
| 78 | |
| 79 | typedef struct { |
| 80 | PCIE_CONNECTOR_TYPE ConnectorType; |
| 81 | UINT8 DisplayDeviceEnum; |
| 82 | UINT16 ConnectorEnum; |
| 83 | UINT16 EncoderEnum; |
| 84 | UINT8 ConnectorIndex; |
| 85 | } EXT_CONNECTOR_INFO; |
| 86 | |
| 87 | typedef struct { |
| 88 | UINT8 DisplayDeviceEnum; |
| 89 | UINT8 DeviceIndex; |
| 90 | UINT16 DeviceTag; |
| 91 | UINT16 DeviceAcpiEnum; |
| 92 | } EXT_DISPLAY_DEVICE_INFO; |
| 93 | |
| 94 | typedef struct { |
| 95 | AGESA_STATUS Status; |
| 96 | UINT8 DisplayDeviceEnum; |
| 97 | UINT8 RequestedPriorityIndex; |
| 98 | UINT8 CurrentPriorityIndex; |
| 99 | PCIe_ENGINE_CONFIG *Engine; |
| 100 | } CONNECTOR_ENUM_INFO; |
| 101 | |
| 102 | |
| 103 | /*---------------------------------------------------------------------------------------- |
| 104 | * P R O T O T Y P E S O F L O C A L F U N C T I O N S |
| 105 | *---------------------------------------------------------------------------------------- |
| 106 | */ |
| 107 | |
efdesign98 | 84cbce2 | 2011-08-04 12:09:17 -0600 | [diff] [blame] | 108 | EXT_CONNECTOR_INFO* |
| 109 | GfxIntegratedExtConnectorInfo ( |
| 110 | IN UINT8 ConnectorType |
| 111 | ); |
| 112 | |
| 113 | EXT_DISPLAY_DEVICE_INFO* |
| 114 | GfxIntegratedExtDisplayDeviceInfo ( |
| 115 | IN UINT8 DisplayDeviceEnum, |
| 116 | IN UINT8 DisplayDeviceIndex |
| 117 | ); |
| 118 | |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 119 | AGESA_STATUS |
| 120 | GfxIntegratedEnumConnectorsForDevice ( |
| 121 | IN UINT8 DisplayDeviceEnum, |
| 122 | OUT EXT_DISPLAY_PATH *DisplayPathList, |
| 123 | IN OUT PCIe_PLATFORM_CONFIG *Pcie, |
| 124 | IN GFX_PLATFORM_CONFIG *Gfx |
| 125 | ); |
| 126 | |
| 127 | VOID |
| 128 | GfxIntegratedDebugDumpDisplayPath ( |
| 129 | IN EXT_DISPLAY_PATH *DisplayPath, |
| 130 | IN GFX_PLATFORM_CONFIG *Gfx |
| 131 | ); |
| 132 | |
| 133 | |
| 134 | |
| 135 | EXT_CONNECTOR_INFO ConnectorInfoTable[] = { |
| 136 | { |
| 137 | ConnectorTypeDP, |
| 138 | DEVICE_DFP, |
| 139 | CONNECTOR_DISPLAYPORT_ENUM, |
| 140 | ENCODER_NOT_PRESENT, |
| 141 | 0, |
| 142 | }, |
| 143 | { |
| 144 | ConnectorTypeEDP, |
| 145 | DEVICE_LCD, |
| 146 | CONNECTOR_eDP_ENUM, |
| 147 | ENCODER_NOT_PRESENT, |
| 148 | 1 |
| 149 | }, |
| 150 | { |
| 151 | ConnectorTypeSingleLinkDVI, |
| 152 | DEVICE_DFP, |
| 153 | CONNECTOR_SINGLE_LINK_DVI_D_ENUM, |
| 154 | ENCODER_NOT_PRESENT, |
| 155 | 2 |
| 156 | }, |
| 157 | { |
| 158 | ConnectorTypeDualLinkDVI, |
| 159 | DEVICE_DFP, |
| 160 | CONNECTOR_DUAL_LINK_DVI_D_ENUM, |
| 161 | ENCODER_NOT_PRESENT, |
| 162 | 3 |
| 163 | }, |
| 164 | { |
| 165 | ConnectorTypeHDMI, |
| 166 | DEVICE_DFP, |
| 167 | CONNECTOR_HDMI_TYPE_A_ENUM, |
| 168 | ENCODER_NOT_PRESENT, |
| 169 | 4 |
| 170 | }, |
| 171 | { |
| 172 | ConnectorTypeTravisDpToVga, |
| 173 | DEVICE_CRT, |
| 174 | CONNECTOR_VGA_ENUM, |
| 175 | ENCODER_TRAVIS_ENUM_ID1, |
| 176 | 5 |
| 177 | }, |
| 178 | { |
| 179 | ConnectorTypeTravisDpToLvds, |
| 180 | DEVICE_LCD, |
| 181 | CONNECTOR_LVDS_ENUM, |
| 182 | ENCODER_TRAVIS_ENUM_ID2, |
| 183 | 6 |
| 184 | }, |
| 185 | { |
| 186 | ConnectorTypeNutmegDpToVga, |
| 187 | DEVICE_CRT, |
| 188 | CONNECTOR_VGA_ENUM, |
| 189 | ENCODER_ALMOND_ENUM_ID1, |
| 190 | 5 |
| 191 | }, |
| 192 | { |
| 193 | ConnectorTypeSingleLinkDviI, |
| 194 | DEVICE_DFP, |
| 195 | CONNECTOR_SINGLE_LINK_DVI_I_ENUM, |
| 196 | ENCODER_NOT_PRESENT, |
| 197 | 5 |
| 198 | }, |
| 199 | { |
| 200 | ConnectorTypeCrt, |
| 201 | DEVICE_CRT, |
| 202 | CONNECTOR_VGA_ENUM, |
| 203 | ENCODER_NOT_PRESENT, |
| 204 | 5 |
| 205 | }, |
| 206 | { |
| 207 | ConnectorTypeLvds, |
| 208 | DEVICE_LCD, |
| 209 | CONNECTOR_LVDS_ENUM, |
| 210 | ENCODER_NOT_PRESENT, |
| 211 | 6 |
| 212 | }, |
| 213 | { |
| 214 | ConnectorTypeAutoDetect, |
| 215 | DEVICE_LCD, |
| 216 | CONNECTOR_LVDS_eDP_ENUM, |
| 217 | ENCODER_TRAVIS_ENUM_ID2, |
| 218 | 7 |
| 219 | } |
| 220 | }; |
| 221 | |
| 222 | UINT8 ConnectorNumerArray[] = { |
| 223 | // DP eDP SDVI-D DDVI-D HDMI VGA LVDS Auto (eDP, LVDS, Travis LVDS) |
| 224 | 6, 1, 6, 6, 6, 1, 1, 2 |
| 225 | }; |
| 226 | /*----------------------------------------------------------------------------------------*/ |
| 227 | /** |
| 228 | * Enumerate all display connectors for specific display device type. |
| 229 | * |
| 230 | * |
| 231 | * |
| 232 | * @param[in] ConnectorType Connector type (see PCIe_DDI_DATA::ConnectorType). |
| 233 | * @retval Pointer to EXT_CONNECTOR_INFO |
| 234 | * @retval NULL if connector type unknown. |
| 235 | */ |
| 236 | EXT_CONNECTOR_INFO* |
| 237 | GfxIntegratedExtConnectorInfo ( |
| 238 | IN UINT8 ConnectorType |
| 239 | ) |
| 240 | { |
| 241 | UINTN Index; |
| 242 | for (Index = 0; Index < (sizeof (ConnectorInfoTable) / sizeof (EXT_CONNECTOR_INFO)); Index++) { |
| 243 | if (ConnectorInfoTable[Index].ConnectorType == ConnectorType) { |
| 244 | return &ConnectorInfoTable[Index]; |
| 245 | } |
| 246 | } |
| 247 | return NULL; |
| 248 | } |
| 249 | |
| 250 | EXT_DISPLAY_DEVICE_INFO DisplayDeviceInfoTable[] = { |
| 251 | { |
| 252 | DEVICE_CRT, |
| 253 | 1, |
| 254 | ATOM_DEVICE_CRT1_SUPPORT, |
| 255 | 0x100, |
| 256 | }, |
| 257 | { |
| 258 | DEVICE_LCD, |
| 259 | 1, |
| 260 | ATOM_DEVICE_LCD1_SUPPORT, |
| 261 | 0x110, |
| 262 | }, |
| 263 | { |
| 264 | DEVICE_DFP, |
| 265 | 1, |
| 266 | ATOM_DEVICE_DFP1_SUPPORT, |
| 267 | 0x210, |
| 268 | }, |
| 269 | { |
| 270 | DEVICE_DFP, |
| 271 | 2, |
| 272 | ATOM_DEVICE_DFP2_SUPPORT, |
| 273 | 0x220, |
| 274 | }, |
| 275 | { |
| 276 | DEVICE_DFP, |
| 277 | 3, |
| 278 | ATOM_DEVICE_DFP3_SUPPORT, |
| 279 | 0x230, |
| 280 | }, |
| 281 | { |
| 282 | DEVICE_DFP, |
| 283 | 4, |
| 284 | ATOM_DEVICE_DFP4_SUPPORT, |
| 285 | 0x240, |
| 286 | }, |
| 287 | { |
| 288 | DEVICE_DFP, |
| 289 | 5, |
| 290 | ATOM_DEVICE_DFP5_SUPPORT, |
| 291 | 0x250, |
| 292 | }, |
| 293 | { |
| 294 | DEVICE_DFP, |
| 295 | 6, |
| 296 | ATOM_DEVICE_DFP6_SUPPORT, |
| 297 | 0x260, |
| 298 | } |
| 299 | }; |
| 300 | /*----------------------------------------------------------------------------------------*/ |
| 301 | /** |
| 302 | * Enumerate all display connectors for specific display device type. |
| 303 | * |
| 304 | * |
| 305 | * |
| 306 | * @param[in] DisplayDeviceEnum Display device enum |
| 307 | * @param[in] DisplayDeviceIndex Display device index |
| 308 | * @retval Pointer to EXT_DISPLAY_DEVICE_INFO |
| 309 | * @retval NULL if can not get display device info |
| 310 | */ |
| 311 | EXT_DISPLAY_DEVICE_INFO* |
| 312 | GfxIntegratedExtDisplayDeviceInfo ( |
| 313 | IN UINT8 DisplayDeviceEnum, |
| 314 | IN UINT8 DisplayDeviceIndex |
| 315 | ) |
| 316 | { |
| 317 | UINT8 Index; |
| 318 | UINT8 LastIndex; |
| 319 | LastIndex = 0xff; |
| 320 | for (Index = 0; Index < (sizeof (DisplayDeviceInfoTable) / sizeof (EXT_DISPLAY_DEVICE_INFO)); Index++) { |
| 321 | if (DisplayDeviceInfoTable[Index].DisplayDeviceEnum == DisplayDeviceEnum) { |
| 322 | LastIndex = Index; |
| 323 | if (DisplayDeviceInfoTable[Index].DeviceIndex == DisplayDeviceIndex) { |
| 324 | return &DisplayDeviceInfoTable[Index]; |
| 325 | } |
| 326 | } |
| 327 | } |
| 328 | if (DisplayDeviceEnum == DEVICE_LCD && LastIndex != 0xff) { |
| 329 | return &DisplayDeviceInfoTable[LastIndex]; |
| 330 | } |
| 331 | return NULL; |
| 332 | } |
| 333 | |
| 334 | /*----------------------------------------------------------------------------------------*/ |
| 335 | /** |
| 336 | * Enumerate all display connectors |
| 337 | * |
| 338 | * |
| 339 | * |
| 340 | * @param[out] DisplayPathList Display path list |
| 341 | * @param[in,out] Pcie PCIe platform configuration info |
| 342 | * @param[in] Gfx Gfx configuration info |
| 343 | */ |
| 344 | AGESA_STATUS |
| 345 | GfxIntegratedEnumerateAllConnectors ( |
| 346 | OUT EXT_DISPLAY_PATH *DisplayPathList, |
| 347 | IN OUT PCIe_PLATFORM_CONFIG *Pcie, |
| 348 | IN GFX_PLATFORM_CONFIG *Gfx |
| 349 | ) |
| 350 | { |
| 351 | AGESA_STATUS AgesaStatus; |
| 352 | AGESA_STATUS Status; |
| 353 | AgesaStatus = AGESA_SUCCESS; |
| 354 | IDS_HDT_CONSOLE (GNB_TRACE, "GfxIntegratedEnumerateAllConnectors Enter\n"); |
| 355 | Status = GfxIntegratedEnumConnectorsForDevice ( |
| 356 | DEVICE_DFP, |
| 357 | DisplayPathList, |
| 358 | Pcie, |
| 359 | Gfx |
| 360 | ); |
| 361 | AGESA_STATUS_UPDATE (Status, AgesaStatus); |
| 362 | |
| 363 | Status = GfxIntegratedEnumConnectorsForDevice ( |
| 364 | DEVICE_CRT, |
| 365 | DisplayPathList, |
| 366 | Pcie, |
| 367 | Gfx |
| 368 | ); |
| 369 | AGESA_STATUS_UPDATE (Status, AgesaStatus); |
| 370 | |
| 371 | Status = GfxIntegratedEnumConnectorsForDevice ( |
| 372 | DEVICE_LCD, |
| 373 | DisplayPathList, |
| 374 | Pcie, |
| 375 | Gfx |
| 376 | ); |
| 377 | AGESA_STATUS_UPDATE (Status, AgesaStatus); |
| 378 | IDS_HDT_CONSOLE (GNB_TRACE, "GfxIntegratedEnumerateAllConnectors Exit [0x%x]\n", Status); |
| 379 | return AgesaStatus; |
| 380 | } |
| 381 | |
| 382 | /*----------------------------------------------------------------------------------------*/ |
| 383 | /** |
| 384 | * Enumerate all display connectors for specific display device type. |
| 385 | * |
| 386 | * |
| 387 | * |
| 388 | * @param[in] Engine Engine configuration info |
| 389 | * @param[in,out] Buffer Buffer pointer |
| 390 | * @param[in] Pcie PCIe configuration info |
| 391 | */ |
| 392 | VOID |
| 393 | STATIC |
| 394 | GfxIntegratedDdiInterfaceCallback ( |
| 395 | IN PCIe_ENGINE_CONFIG *Engine, |
| 396 | IN OUT VOID *Buffer, |
| 397 | IN PCIe_PLATFORM_CONFIG *Pcie |
| 398 | ) |
| 399 | { |
| 400 | CONNECTOR_ENUM_INFO *ConnectorEnumInfo; |
| 401 | EXT_CONNECTOR_INFO *ExtConnectorInfo; |
| 402 | ConnectorEnumInfo = (CONNECTOR_ENUM_INFO*) Buffer; |
| 403 | ExtConnectorInfo = GfxIntegratedExtConnectorInfo (Engine->Type.Ddi.DdiData.ConnectorType); |
| 404 | if (ExtConnectorInfo == NULL) { |
| 405 | AGESA_STATUS_UPDATE (AGESA_ERROR, ConnectorEnumInfo->Status); |
| 406 | PcieConfigDisableEngine (Engine); |
| 407 | return; |
| 408 | } |
| 409 | if (ExtConnectorInfo->DisplayDeviceEnum != ConnectorEnumInfo->DisplayDeviceEnum) { |
| 410 | //Not device type we are looking for |
| 411 | return; |
| 412 | } |
| 413 | if (Engine->Type.Ddi.DisplayPriorityIndex >= ConnectorEnumInfo->RequestedPriorityIndex && |
| 414 | Engine->Type.Ddi.DisplayPriorityIndex < ConnectorEnumInfo->CurrentPriorityIndex) { |
| 415 | ConnectorEnumInfo->CurrentPriorityIndex = Engine->Type.Ddi.DisplayPriorityIndex; |
| 416 | ConnectorEnumInfo->Engine = Engine; |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | /*----------------------------------------------------------------------------------------*/ |
| 421 | /** |
| 422 | * Enumerate all display connectors for specific display device type. |
| 423 | * |
| 424 | * |
| 425 | * |
| 426 | * @param[in] DisplayDeviceEnum Display device list |
| 427 | * @param[out] DisplayPathList Display path list |
| 428 | * @param[in,out] Pcie PCIe configuration info |
| 429 | * @param[in] Gfx Gfx configuration info |
| 430 | */ |
| 431 | AGESA_STATUS |
| 432 | GfxIntegratedEnumConnectorsForDevice ( |
| 433 | IN UINT8 DisplayDeviceEnum, |
| 434 | OUT EXT_DISPLAY_PATH *DisplayPathList, |
| 435 | IN OUT PCIe_PLATFORM_CONFIG *Pcie, |
| 436 | IN GFX_PLATFORM_CONFIG *Gfx |
| 437 | ) |
| 438 | { |
| 439 | UINT8 DisplayDeviceIndex; |
| 440 | CONNECTOR_ENUM_INFO ConnectorEnumInfo; |
| 441 | EXT_CONNECTOR_INFO *ExtConnectorInfo; |
| 442 | EXT_DISPLAY_DEVICE_INFO *ExtDisplayDeviceInfo; |
| 443 | AGESA_STATUS Status; |
| 444 | UINT8 ConnectorIdArray[sizeof (ConnectorNumerArray)]; |
| 445 | ConnectorEnumInfo.Status = AGESA_SUCCESS; |
| 446 | DisplayDeviceIndex = 1; |
| 447 | ConnectorEnumInfo.RequestedPriorityIndex = 0; |
| 448 | ConnectorEnumInfo.DisplayDeviceEnum = DisplayDeviceEnum; |
| 449 | LibAmdMemFill (ConnectorIdArray, 0x00, sizeof (ConnectorIdArray), GnbLibGetHeader (Gfx)); |
| 450 | do { |
| 451 | ConnectorEnumInfo.Engine = NULL; |
| 452 | ConnectorEnumInfo.CurrentPriorityIndex = 0xff; |
| 453 | PcieConfigRunProcForAllEngines ( |
| 454 | DESCRIPTOR_ALLOCATED | DESCRIPTOR_VIRTUAL | DESCRIPTOR_DDI_ENGINE, |
| 455 | GfxIntegratedDdiInterfaceCallback, |
| 456 | &ConnectorEnumInfo, |
| 457 | Pcie |
| 458 | ); |
| 459 | if (ConnectorEnumInfo.Engine == NULL) { |
| 460 | break; // No more connector support this |
| 461 | } |
| 462 | ConnectorEnumInfo.RequestedPriorityIndex = ConnectorEnumInfo.CurrentPriorityIndex + 1; |
| 463 | ExtConnectorInfo = GfxIntegratedExtConnectorInfo (ConnectorEnumInfo.Engine->Type.Ddi.DdiData.ConnectorType); |
| 464 | ASSERT (ExtConnectorInfo != NULL); |
| 465 | ASSERT (ExtConnectorInfo->ConnectorIndex < sizeof (ConnectorIdArray)); |
| 466 | if (ConnectorIdArray[ExtConnectorInfo->ConnectorIndex] >= ConnectorNumerArray[ExtConnectorInfo->ConnectorIndex]) { |
| 467 | //Run out of supported connectors |
| 468 | AGESA_STATUS_UPDATE (AGESA_ERROR, ConnectorEnumInfo.Status); |
| 469 | PcieConfigDisableEngine (ConnectorEnumInfo.Engine); |
| 470 | continue; |
| 471 | } |
| 472 | ConnectorEnumInfo.Engine->Type.Ddi.ConnectorId = ConnectorIdArray[ExtConnectorInfo->ConnectorIndex] + 1; |
| 473 | ExtDisplayDeviceInfo = GfxIntegratedExtDisplayDeviceInfo (DisplayDeviceEnum, DisplayDeviceIndex); |
| 474 | if (ExtDisplayDeviceInfo == NULL) { |
| 475 | //Run out of supported display device types |
| 476 | AGESA_STATUS_UPDATE (AGESA_ERROR, ConnectorEnumInfo.Status); |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 477 | PcieConfigDisableEngine (ConnectorEnumInfo.Engine); |
| 478 | } |
| 479 | |
| 480 | if ((Gfx->Gnb3dStereoPinIndex != 0) && (ConnectorEnumInfo.Engine->Type.Ddi.DdiData.HdpIndex == (Gfx->Gnb3dStereoPinIndex - 1))) { |
| 481 | AGESA_STATUS_UPDATE (AGESA_ERROR, ConnectorEnumInfo.Status); |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 482 | PcieConfigDisableEngine (ConnectorEnumInfo.Engine); |
| 483 | } |
| 484 | |
| 485 | ConnectorEnumInfo.Engine->Type.Ddi.DisplayDeviceId = DisplayDeviceIndex; |
| 486 | |
| 487 | Status = GfxFmMapEngineToDisplayPath (ConnectorEnumInfo.Engine, DisplayPathList, Gfx); |
| 488 | AGESA_STATUS_UPDATE (Status, ConnectorEnumInfo.Status); |
| 489 | if (Status != AGESA_SUCCESS) { |
| 490 | continue; |
| 491 | } |
| 492 | ConnectorIdArray[ExtConnectorInfo->ConnectorIndex]++; |
| 493 | DisplayDeviceIndex++; |
| 494 | } while (ConnectorEnumInfo.Engine != NULL); |
| 495 | return ConnectorEnumInfo.Status; |
| 496 | } |
| 497 | |
| 498 | /*----------------------------------------------------------------------------------------*/ |
| 499 | /** |
| 500 | * Initialize display path for given engine |
| 501 | * |
| 502 | * |
| 503 | * |
| 504 | * @param[in] Engine Engine configuration info |
| 505 | * @param[out] DisplayPath Display path list |
| 506 | * @param[out] SecondaryDisplayPath Secondary display path list |
| 507 | * @param[in] Gfx Gfx configuration info |
| 508 | */ |
| 509 | |
| 510 | VOID |
| 511 | GfxIntegratedCopyDisplayInfo ( |
| 512 | IN PCIe_ENGINE_CONFIG *Engine, |
| 513 | OUT EXT_DISPLAY_PATH *DisplayPath, |
| 514 | OUT EXT_DISPLAY_PATH *SecondaryDisplayPath, |
| 515 | IN GFX_PLATFORM_CONFIG *Gfx |
| 516 | ) |
| 517 | { |
| 518 | EXT_CONNECTOR_INFO *ExtConnectorInfo; |
| 519 | EXT_DISPLAY_DEVICE_INFO *ExtDisplayDeviceInfo; |
| 520 | ExtConnectorInfo = GfxIntegratedExtConnectorInfo (Engine->Type.Ddi.DdiData.ConnectorType); |
| 521 | ExtDisplayDeviceInfo = GfxIntegratedExtDisplayDeviceInfo (ExtConnectorInfo->DisplayDeviceEnum, Engine->Type.Ddi.DisplayDeviceId); |
| 522 | DisplayPath->usDeviceConnector = ExtConnectorInfo->ConnectorEnum | (Engine->Type.Ddi.ConnectorId << 8); |
| 523 | DisplayPath->usDeviceTag = ExtDisplayDeviceInfo->DeviceTag; |
| 524 | DisplayPath->usDeviceACPIEnum = ExtDisplayDeviceInfo->DeviceAcpiEnum; |
| 525 | DisplayPath->ucExtAUXDDCLutIndex = Engine->Type.Ddi.DdiData.AuxIndex; |
| 526 | DisplayPath->ucExtHPDPINLutIndex = Engine->Type.Ddi.DdiData.HdpIndex; |
| 527 | DisplayPath->usExtEncoderObjId = ExtConnectorInfo->EncoderEnum; |
| 528 | if (Engine->Type.Ddi.DdiData.Mapping[0].ChannelMappingValue == 0) { |
| 529 | DisplayPath->ChannelMapping.ucChannelMapping = (Engine->EngineData.StartLane < Engine->EngineData.EndLane) ? 0xE4 : 0x1B; |
| 530 | } else { |
| 531 | DisplayPath->ChannelMapping.ucChannelMapping = Engine->Type.Ddi.DdiData.Mapping[0].ChannelMappingValue; |
| 532 | } |
| 533 | GNB_DEBUG_CODE ( |
| 534 | GfxIntegratedDebugDumpDisplayPath (DisplayPath, Gfx); |
| 535 | ); |
| 536 | if (Engine->Type.Ddi.DdiData.ConnectorType == ConnectorTypeDualLinkDVI) { |
| 537 | ASSERT (SecondaryDisplayPath != NULL); |
| 538 | GNB_DEBUG_CODE ( |
| 539 | GfxIntegratedDebugDumpDisplayPath (DisplayPath, Gfx); |
| 540 | ); |
| 541 | SecondaryDisplayPath->usDeviceConnector = DisplayPath->usDeviceConnector; |
| 542 | if (Engine->Type.Ddi.DdiData.Mapping[1].ChannelMappingValue == 0) { |
| 543 | DisplayPath->ChannelMapping.ucChannelMapping = (Engine->EngineData.StartLane < Engine->EngineData.EndLane) ? 0xE4 : 0x1B; |
| 544 | } else { |
| 545 | DisplayPath->ChannelMapping.ucChannelMapping = Engine->Type.Ddi.DdiData.Mapping[1].ChannelMappingValue; |
| 546 | } |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | |
| 551 | |
| 552 | /*----------------------------------------------------------------------------------------*/ |
| 553 | /** |
| 554 | * Dump display path settings |
| 555 | * |
| 556 | * |
| 557 | * |
| 558 | * @param[in] DisplayPath Display path |
| 559 | * @param[in] Gfx Gfx configuration |
| 560 | */ |
| 561 | |
| 562 | VOID |
| 563 | GfxIntegratedDebugDumpDisplayPath ( |
| 564 | IN EXT_DISPLAY_PATH *DisplayPath, |
| 565 | IN GFX_PLATFORM_CONFIG *Gfx |
| 566 | ) |
| 567 | { |
| 568 | IDS_HDT_CONSOLE (GFX_MISC, " usDeviceConnector = 0x%x\n", |
| 569 | DisplayPath->usDeviceConnector |
| 570 | ); |
| 571 | IDS_HDT_CONSOLE (GFX_MISC, " usDeviceTag = 0x%x\n", |
| 572 | DisplayPath->usDeviceTag |
| 573 | ); |
| 574 | IDS_HDT_CONSOLE (GFX_MISC, " usDeviceACPIEnum = 0x%x\n", |
| 575 | DisplayPath->usDeviceACPIEnum |
| 576 | ); |
| 577 | IDS_HDT_CONSOLE (GFX_MISC, " usExtEncoderObjId = 0x%x\n", |
| 578 | DisplayPath->usExtEncoderObjId |
| 579 | ); |
| 580 | IDS_HDT_CONSOLE (GFX_MISC, " ucChannelMapping = 0x%x\n", |
| 581 | DisplayPath->ChannelMapping.ucChannelMapping |
| 582 | ); |
| 583 | |
| 584 | } |