zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [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: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $ |
| 13 | * |
| 14 | */ |
| 15 | /* |
| 16 | ***************************************************************************** |
| 17 | * |
Siyuan Wang | 641f00c | 2013-06-08 11:50:55 +0800 | [diff] [blame] | 18 | * Copyright (c) 2008 - 2012, Advanced Micro Devices, Inc. |
| 19 | * All rights reserved. |
| 20 | * |
| 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. |
| 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 |
| 30 | * from this software without specific prior written permission. |
| 31 | * |
| 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. |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 42 | * *************************************************************************** |
| 43 | * |
| 44 | */ |
| 45 | |
| 46 | |
| 47 | /*---------------------------------------------------------------------------------------- |
| 48 | * M O D U L E S U S E D |
| 49 | *---------------------------------------------------------------------------------------- |
| 50 | */ |
| 51 | #include "AGESA.h" |
| 52 | #include "Ids.h" |
| 53 | #include "amdlib.h" |
| 54 | #include "Gnb.h" |
| 55 | #include "GnbPcie.h" |
| 56 | #include "GnbGfx.h" |
| 57 | #include "GnbCommonLib.h" |
| 58 | #include "GnbPcieInitLibV1.h" |
| 59 | #include "GnbPcieConfig.h" |
| 60 | #include "GnbGfxFamServices.h" |
| 61 | #include "GnbRegistersLN.h" |
| 62 | #include "Filecode.h" |
| 63 | #define FILECODE PROC_GNB_MODULES_GNBGFXINITLIBV1_GFXENUMCONNECTORS_FILECODE |
| 64 | /*---------------------------------------------------------------------------------------- |
| 65 | * D E F I N I T I O N S A N D M A C R O S |
| 66 | *---------------------------------------------------------------------------------------- |
| 67 | */ |
| 68 | |
| 69 | |
| 70 | |
| 71 | /*---------------------------------------------------------------------------------------- |
| 72 | * T Y P E D E F S A N D S T R U C T U R E S |
| 73 | *---------------------------------------------------------------------------------------- |
| 74 | */ |
| 75 | |
| 76 | |
| 77 | typedef struct { |
| 78 | PCIE_CONNECTOR_TYPE ConnectorType; |
| 79 | UINT8 DisplayDeviceEnum; |
| 80 | UINT16 ConnectorEnum; |
| 81 | UINT16 EncoderEnum; |
| 82 | UINT8 ConnectorIndex; |
| 83 | } EXT_CONNECTOR_INFO; |
| 84 | |
| 85 | typedef struct { |
| 86 | UINT8 DisplayDeviceEnum; |
| 87 | UINT8 DeviceIndex; |
| 88 | UINT16 DeviceTag; |
| 89 | UINT16 DeviceAcpiEnum; |
| 90 | } EXT_DISPLAY_DEVICE_INFO; |
| 91 | |
| 92 | typedef struct { |
| 93 | AGESA_STATUS Status; |
| 94 | UINT8 DisplayDeviceEnum; |
| 95 | UINT8 RequestedPriorityIndex; |
| 96 | UINT8 CurrentPriorityIndex; |
| 97 | PCIe_ENGINE_CONFIG *Engine; |
| 98 | } CONNECTOR_ENUM_INFO; |
| 99 | |
| 100 | |
| 101 | /*---------------------------------------------------------------------------------------- |
| 102 | * 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 |
| 103 | *---------------------------------------------------------------------------------------- |
| 104 | */ |
| 105 | |
| 106 | AGESA_STATUS |
| 107 | GfxIntegratedEnumConnectorsForDevice ( |
| 108 | IN UINT8 DisplayDeviceEnum, |
| 109 | OUT EXT_DISPLAY_PATH *DisplayPathList, |
| 110 | IN OUT PCIe_PLATFORM_CONFIG *Pcie, |
| 111 | IN GFX_PLATFORM_CONFIG *Gfx |
| 112 | ); |
| 113 | |
| 114 | VOID |
| 115 | GfxIntegratedDebugDumpDisplayPath ( |
| 116 | IN EXT_DISPLAY_PATH *DisplayPath, |
| 117 | IN GFX_PLATFORM_CONFIG *Gfx |
| 118 | ); |
| 119 | |
| 120 | AGESA_STATUS |
| 121 | GfxIntegratedEnumerateAllConnectors ( |
| 122 | OUT EXT_DISPLAY_PATH *DisplayPathList, |
| 123 | IN OUT PCIe_PLATFORM_CONFIG *Pcie, |
| 124 | IN GFX_PLATFORM_CONFIG *Gfx |
| 125 | ); |
| 126 | |
| 127 | VOID |
| 128 | GfxIntegratedCopyDisplayInfo ( |
| 129 | IN PCIe_ENGINE_CONFIG *Engine, |
| 130 | OUT EXT_DISPLAY_PATH *DisplayPath, |
| 131 | OUT EXT_DISPLAY_PATH *SecondaryDisplayPath, |
| 132 | IN GFX_PLATFORM_CONFIG *Gfx |
| 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 | ConnectorTypeEDPToLvds, |
| 215 | DEVICE_LCD, |
| 216 | CONNECTOR_eDP_ENUM, |
| 217 | ENCODER_NOT_PRESENT, |
| 218 | 1 |
| 219 | }, |
| 220 | { |
| 221 | ConnectorTypeEDPToRealtecLvds, |
| 222 | DEVICE_LCD, |
| 223 | CONNECTOR_eDP_ENUM, |
| 224 | ENCODER_NOT_PRESENT, |
| 225 | 1 |
| 226 | }, |
| 227 | { |
| 228 | ConnectorTypeAutoDetect, |
| 229 | DEVICE_LCD, |
| 230 | CONNECTOR_LVDS_eDP_ENUM, |
| 231 | ENCODER_TRAVIS_ENUM_ID2, |
| 232 | 7 |
| 233 | }, |
| 234 | }; |
| 235 | |
| 236 | UINT8 ConnectorNumerArray[] = { |
| 237 | // DP eDP SDVI-D DDVI-D HDMI VGA LVDS Auto (eDP, LVDS, Travis LVDS) |
| 238 | 6, 1, 6, 6, 6, 1, 1, 2 |
| 239 | }; |
| 240 | /*----------------------------------------------------------------------------------------*/ |
| 241 | /** |
| 242 | * Enumerate all display connectors for specific display device type. |
| 243 | * |
| 244 | * |
| 245 | * |
| 246 | * @param[in] ConnectorType Connector type (see PCIe_DDI_DATA::ConnectorType). |
| 247 | * @retval Pointer to EXT_CONNECTOR_INFO |
| 248 | * @retval NULL if connector type unknown. |
| 249 | */ |
| 250 | STATIC EXT_CONNECTOR_INFO* |
| 251 | GfxIntegratedExtConnectorInfo ( |
| 252 | IN UINT8 ConnectorType |
| 253 | ) |
| 254 | { |
| 255 | UINTN Index; |
Patrick Georgi | 6b688f5 | 2021-02-12 13:49:11 +0100 | [diff] [blame^] | 256 | for (Index = 0; Index < ARRAY_SIZE(ConnectorInfoTable); Index++) { |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 257 | if (ConnectorInfoTable[Index].ConnectorType == ConnectorType) { |
| 258 | return &ConnectorInfoTable[Index]; |
| 259 | } |
| 260 | } |
| 261 | return NULL; |
| 262 | } |
| 263 | |
| 264 | EXT_DISPLAY_DEVICE_INFO DisplayDeviceInfoTable[] = { |
| 265 | { |
| 266 | DEVICE_CRT, |
| 267 | 1, |
| 268 | ATOM_DEVICE_CRT1_SUPPORT, |
| 269 | 0x100, |
| 270 | }, |
| 271 | { |
| 272 | DEVICE_LCD, |
| 273 | 1, |
| 274 | ATOM_DEVICE_LCD1_SUPPORT, |
| 275 | 0x110, |
| 276 | }, |
| 277 | { |
| 278 | DEVICE_DFP, |
| 279 | 1, |
| 280 | ATOM_DEVICE_DFP1_SUPPORT, |
| 281 | 0x210, |
| 282 | }, |
| 283 | { |
| 284 | DEVICE_DFP, |
| 285 | 2, |
| 286 | ATOM_DEVICE_DFP2_SUPPORT, |
| 287 | 0x220, |
| 288 | }, |
| 289 | { |
| 290 | DEVICE_DFP, |
| 291 | 3, |
| 292 | ATOM_DEVICE_DFP3_SUPPORT, |
| 293 | 0x230, |
| 294 | }, |
| 295 | { |
| 296 | DEVICE_DFP, |
| 297 | 4, |
| 298 | ATOM_DEVICE_DFP4_SUPPORT, |
| 299 | 0x240, |
| 300 | }, |
| 301 | { |
| 302 | DEVICE_DFP, |
| 303 | 5, |
| 304 | ATOM_DEVICE_DFP5_SUPPORT, |
| 305 | 0x250, |
| 306 | }, |
| 307 | { |
| 308 | DEVICE_DFP, |
| 309 | 6, |
| 310 | ATOM_DEVICE_DFP6_SUPPORT, |
| 311 | 0x260, |
| 312 | } |
| 313 | }; |
| 314 | /*----------------------------------------------------------------------------------------*/ |
| 315 | /** |
| 316 | * Enumerate all display connectors for specific display device type. |
| 317 | * |
| 318 | * |
| 319 | * |
| 320 | * @param[in] DisplayDeviceEnum Display device enum |
| 321 | * @param[in] DisplayDeviceIndex Display device index |
| 322 | * @retval Pointer to EXT_DISPLAY_DEVICE_INFO |
| 323 | * @retval NULL if can not get display device info |
| 324 | */ |
| 325 | STATIC EXT_DISPLAY_DEVICE_INFO* |
| 326 | GfxIntegratedExtDisplayDeviceInfo ( |
| 327 | IN UINT8 DisplayDeviceEnum, |
| 328 | IN UINT8 DisplayDeviceIndex |
| 329 | ) |
| 330 | { |
| 331 | UINT8 Index; |
| 332 | UINT8 LastIndex; |
| 333 | LastIndex = 0xff; |
Patrick Georgi | 6b688f5 | 2021-02-12 13:49:11 +0100 | [diff] [blame^] | 334 | for (Index = 0; Index < ARRAY_SIZE(DisplayDeviceInfoTable); Index++) { |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 335 | if (DisplayDeviceInfoTable[Index].DisplayDeviceEnum == DisplayDeviceEnum) { |
| 336 | LastIndex = Index; |
| 337 | if (DisplayDeviceInfoTable[Index].DeviceIndex == DisplayDeviceIndex) { |
| 338 | return &DisplayDeviceInfoTable[Index]; |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | if (DisplayDeviceEnum == DEVICE_LCD && LastIndex != 0xff) { |
| 343 | return &DisplayDeviceInfoTable[LastIndex]; |
| 344 | } |
| 345 | return NULL; |
| 346 | } |
| 347 | |
| 348 | /*----------------------------------------------------------------------------------------*/ |
| 349 | /** |
| 350 | * Enumerate all display connectors |
| 351 | * |
| 352 | * |
| 353 | * |
| 354 | * @param[out] DisplayPathList Display path list |
| 355 | * @param[in,out] Pcie PCIe platform configuration info |
| 356 | * @param[in] Gfx Gfx configuration info |
| 357 | */ |
| 358 | AGESA_STATUS |
| 359 | GfxIntegratedEnumerateAllConnectors ( |
| 360 | OUT EXT_DISPLAY_PATH *DisplayPathList, |
| 361 | IN OUT PCIe_PLATFORM_CONFIG *Pcie, |
| 362 | IN GFX_PLATFORM_CONFIG *Gfx |
| 363 | ) |
| 364 | { |
| 365 | AGESA_STATUS AgesaStatus; |
| 366 | AGESA_STATUS Status; |
| 367 | AgesaStatus = AGESA_SUCCESS; |
| 368 | IDS_HDT_CONSOLE (GNB_TRACE, "GfxIntegratedEnumerateAllConnectors Enter\n"); |
| 369 | Status = GfxIntegratedEnumConnectorsForDevice ( |
| 370 | DEVICE_DFP, |
| 371 | DisplayPathList, |
| 372 | Pcie, |
| 373 | Gfx |
| 374 | ); |
| 375 | AGESA_STATUS_UPDATE (Status, AgesaStatus); |
| 376 | |
| 377 | Status = GfxIntegratedEnumConnectorsForDevice ( |
| 378 | DEVICE_CRT, |
| 379 | DisplayPathList, |
| 380 | Pcie, |
| 381 | Gfx |
| 382 | ); |
| 383 | AGESA_STATUS_UPDATE (Status, AgesaStatus); |
| 384 | |
| 385 | Status = GfxIntegratedEnumConnectorsForDevice ( |
| 386 | DEVICE_LCD, |
| 387 | DisplayPathList, |
| 388 | Pcie, |
| 389 | Gfx |
| 390 | ); |
| 391 | AGESA_STATUS_UPDATE (Status, AgesaStatus); |
| 392 | IDS_HDT_CONSOLE (GNB_TRACE, "GfxIntegratedEnumerateAllConnectors Exit [0x%x]\n", Status); |
| 393 | return AgesaStatus; |
| 394 | } |
| 395 | |
| 396 | /*----------------------------------------------------------------------------------------*/ |
| 397 | /** |
| 398 | * Enumerate all display connectors for specific display device type. |
| 399 | * |
| 400 | * |
| 401 | * |
| 402 | * @param[in] Engine Engine configuration info |
| 403 | * @param[in,out] Buffer Buffer pointer |
| 404 | * @param[in] Pcie PCIe configuration info |
| 405 | */ |
| 406 | VOID |
| 407 | STATIC |
| 408 | GfxIntegratedDdiInterfaceCallback ( |
| 409 | IN PCIe_ENGINE_CONFIG *Engine, |
| 410 | IN OUT VOID *Buffer, |
| 411 | IN PCIe_PLATFORM_CONFIG *Pcie |
| 412 | ) |
| 413 | { |
| 414 | CONNECTOR_ENUM_INFO *ConnectorEnumInfo; |
| 415 | EXT_CONNECTOR_INFO *ExtConnectorInfo; |
| 416 | ConnectorEnumInfo = (CONNECTOR_ENUM_INFO*) Buffer; |
| 417 | ExtConnectorInfo = GfxIntegratedExtConnectorInfo (Engine->Type.Ddi.DdiData.ConnectorType); |
| 418 | if (ExtConnectorInfo == NULL) { |
| 419 | AGESA_STATUS_UPDATE (AGESA_ERROR, ConnectorEnumInfo->Status); |
| 420 | PcieConfigDisableEngine (Engine); |
| 421 | return; |
| 422 | } |
| 423 | if (ExtConnectorInfo->DisplayDeviceEnum != ConnectorEnumInfo->DisplayDeviceEnum) { |
| 424 | //Not device type we are looking for |
| 425 | return; |
| 426 | } |
| 427 | if (Engine->Type.Ddi.DisplayPriorityIndex >= ConnectorEnumInfo->RequestedPriorityIndex && |
| 428 | Engine->Type.Ddi.DisplayPriorityIndex < ConnectorEnumInfo->CurrentPriorityIndex) { |
| 429 | ConnectorEnumInfo->CurrentPriorityIndex = Engine->Type.Ddi.DisplayPriorityIndex; |
| 430 | ConnectorEnumInfo->Engine = Engine; |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | /*----------------------------------------------------------------------------------------*/ |
| 435 | /** |
| 436 | * Enumerate all display connectors for specific display device type. |
| 437 | * |
| 438 | * |
| 439 | * |
| 440 | * @param[in] DisplayDeviceEnum Display device list |
| 441 | * @param[out] DisplayPathList Display path list |
| 442 | * @param[in,out] Pcie PCIe configuration info |
| 443 | * @param[in] Gfx Gfx configuration info |
| 444 | */ |
| 445 | AGESA_STATUS |
| 446 | GfxIntegratedEnumConnectorsForDevice ( |
| 447 | IN UINT8 DisplayDeviceEnum, |
| 448 | OUT EXT_DISPLAY_PATH *DisplayPathList, |
| 449 | IN OUT PCIe_PLATFORM_CONFIG *Pcie, |
| 450 | IN GFX_PLATFORM_CONFIG *Gfx |
| 451 | ) |
| 452 | { |
| 453 | UINT8 DisplayDeviceIndex; |
| 454 | CONNECTOR_ENUM_INFO ConnectorEnumInfo; |
| 455 | EXT_CONNECTOR_INFO *ExtConnectorInfo; |
| 456 | EXT_DISPLAY_DEVICE_INFO *ExtDisplayDeviceInfo; |
| 457 | AGESA_STATUS Status; |
| 458 | UINT8 ConnectorIdArray[sizeof (ConnectorNumerArray)]; |
| 459 | ConnectorEnumInfo.Status = AGESA_SUCCESS; |
| 460 | DisplayDeviceIndex = 1; |
| 461 | ConnectorEnumInfo.RequestedPriorityIndex = 0; |
| 462 | ConnectorEnumInfo.DisplayDeviceEnum = DisplayDeviceEnum; |
| 463 | LibAmdMemFill (ConnectorIdArray, 0x00, sizeof (ConnectorIdArray), GnbLibGetHeader (Gfx)); |
| 464 | do { |
| 465 | ConnectorEnumInfo.Engine = NULL; |
| 466 | ConnectorEnumInfo.CurrentPriorityIndex = 0xff; |
| 467 | PcieConfigRunProcForAllEngines ( |
| 468 | DESCRIPTOR_ALLOCATED | DESCRIPTOR_VIRTUAL | DESCRIPTOR_DDI_ENGINE, |
| 469 | GfxIntegratedDdiInterfaceCallback, |
| 470 | &ConnectorEnumInfo, |
| 471 | Pcie |
| 472 | ); |
| 473 | if (ConnectorEnumInfo.Engine == NULL) { |
| 474 | break; // No more connector support this |
| 475 | } |
| 476 | ConnectorEnumInfo.RequestedPriorityIndex = ConnectorEnumInfo.CurrentPriorityIndex + 1; |
| 477 | ExtConnectorInfo = GfxIntegratedExtConnectorInfo (ConnectorEnumInfo.Engine->Type.Ddi.DdiData.ConnectorType); |
| 478 | ASSERT (ExtConnectorInfo != NULL); |
| 479 | ASSERT (ExtConnectorInfo->ConnectorIndex < sizeof (ConnectorIdArray)); |
| 480 | if (ConnectorIdArray[ExtConnectorInfo->ConnectorIndex] >= ConnectorNumerArray[ExtConnectorInfo->ConnectorIndex]) { |
| 481 | //Run out of supported connectors |
| 482 | AGESA_STATUS_UPDATE (AGESA_ERROR, ConnectorEnumInfo.Status); |
| 483 | PcieConfigDisableEngine (ConnectorEnumInfo.Engine); |
| 484 | continue; |
| 485 | } |
| 486 | ConnectorEnumInfo.Engine->Type.Ddi.ConnectorId = ConnectorIdArray[ExtConnectorInfo->ConnectorIndex] + 1; |
| 487 | ExtDisplayDeviceInfo = GfxIntegratedExtDisplayDeviceInfo (DisplayDeviceEnum, DisplayDeviceIndex); |
| 488 | if (ExtDisplayDeviceInfo == NULL) { |
| 489 | //Run out of supported display device types |
| 490 | AGESA_STATUS_UPDATE (AGESA_ERROR, ConnectorEnumInfo.Status); |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 491 | PcieConfigDisableEngine (ConnectorEnumInfo.Engine); |
| 492 | } |
| 493 | |
| 494 | if ((Gfx->Gnb3dStereoPinIndex != 0) && (ConnectorEnumInfo.Engine->Type.Ddi.DdiData.HdpIndex == (Gfx->Gnb3dStereoPinIndex - 1))) { |
| 495 | AGESA_STATUS_UPDATE (AGESA_ERROR, ConnectorEnumInfo.Status); |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 496 | PcieConfigDisableEngine (ConnectorEnumInfo.Engine); |
| 497 | } |
| 498 | |
| 499 | ConnectorEnumInfo.Engine->Type.Ddi.DisplayDeviceId = DisplayDeviceIndex; |
| 500 | |
| 501 | Status = GfxFmMapEngineToDisplayPath (ConnectorEnumInfo.Engine, DisplayPathList, Gfx); |
| 502 | AGESA_STATUS_UPDATE (Status, ConnectorEnumInfo.Status); |
| 503 | if (Status != AGESA_SUCCESS) { |
| 504 | continue; |
| 505 | } |
| 506 | ConnectorIdArray[ExtConnectorInfo->ConnectorIndex]++; |
| 507 | DisplayDeviceIndex++; |
| 508 | } while (ConnectorEnumInfo.Engine != NULL); |
| 509 | return ConnectorEnumInfo.Status; |
| 510 | } |
| 511 | |
| 512 | /*----------------------------------------------------------------------------------------*/ |
| 513 | /** |
| 514 | * Initialize display path for given engine |
| 515 | * |
| 516 | * |
| 517 | * |
| 518 | * @param[in] Engine Engine configuration info |
| 519 | * @param[out] DisplayPath Display path list |
| 520 | * @param[out] SecondaryDisplayPath Secondary display path list |
| 521 | * @param[in] Gfx Gfx configuration info |
| 522 | */ |
| 523 | |
| 524 | VOID |
| 525 | GfxIntegratedCopyDisplayInfo ( |
| 526 | IN PCIe_ENGINE_CONFIG *Engine, |
| 527 | OUT EXT_DISPLAY_PATH *DisplayPath, |
| 528 | OUT EXT_DISPLAY_PATH *SecondaryDisplayPath, |
| 529 | IN GFX_PLATFORM_CONFIG *Gfx |
| 530 | ) |
| 531 | { |
| 532 | EXT_CONNECTOR_INFO *ExtConnectorInfo; |
| 533 | EXT_DISPLAY_DEVICE_INFO *ExtDisplayDeviceInfo; |
| 534 | ExtConnectorInfo = GfxIntegratedExtConnectorInfo (Engine->Type.Ddi.DdiData.ConnectorType); |
| 535 | ExtDisplayDeviceInfo = GfxIntegratedExtDisplayDeviceInfo (ExtConnectorInfo->DisplayDeviceEnum, Engine->Type.Ddi.DisplayDeviceId); |
| 536 | DisplayPath->usDeviceConnector = ExtConnectorInfo->ConnectorEnum | (Engine->Type.Ddi.ConnectorId << 8); |
| 537 | DisplayPath->usDeviceTag = ExtDisplayDeviceInfo->DeviceTag; |
| 538 | DisplayPath->usDeviceACPIEnum = ExtDisplayDeviceInfo->DeviceAcpiEnum; |
| 539 | DisplayPath->ucExtAUXDDCLutIndex = Engine->Type.Ddi.DdiData.AuxIndex; |
| 540 | DisplayPath->ucExtHPDPINLutIndex = Engine->Type.Ddi.DdiData.HdpIndex; |
| 541 | DisplayPath->ucChPNInvert = Engine->Type.Ddi.DdiData.LanePnInversionMask; |
| 542 | DisplayPath->usCaps = Engine->Type.Ddi.DdiData.Flags; |
| 543 | DisplayPath->usExtEncoderObjId = ExtConnectorInfo->EncoderEnum; |
| 544 | if (Engine->Type.Ddi.DdiData.Mapping[0].ChannelMappingValue == 0) { |
| 545 | DisplayPath->ChannelMapping.ucChannelMapping = (Engine->EngineData.StartLane < Engine->EngineData.EndLane) ? 0xE4 : 0x1B; |
| 546 | } else { |
| 547 | DisplayPath->ChannelMapping.ucChannelMapping = Engine->Type.Ddi.DdiData.Mapping[0].ChannelMappingValue; |
| 548 | } |
| 549 | GNB_DEBUG_CODE ( |
| 550 | GfxIntegratedDebugDumpDisplayPath (DisplayPath, Gfx); |
| 551 | ); |
| 552 | if (Engine->Type.Ddi.DdiData.ConnectorType == ConnectorTypeDualLinkDVI) { |
| 553 | if (SecondaryDisplayPath != NULL) { |
| 554 | SecondaryDisplayPath->usDeviceConnector = DisplayPath->usDeviceConnector; |
| 555 | } |
| 556 | GNB_DEBUG_CODE ( |
| 557 | GfxIntegratedDebugDumpDisplayPath (DisplayPath, Gfx); |
| 558 | ); |
| 559 | |
| 560 | if (Engine->Type.Ddi.DdiData.Mapping[1].ChannelMappingValue == 0) { |
| 561 | DisplayPath->ChannelMapping.ucChannelMapping = (Engine->EngineData.StartLane < Engine->EngineData.EndLane) ? 0xE4 : 0x1B; |
| 562 | } else { |
| 563 | DisplayPath->ChannelMapping.ucChannelMapping = Engine->Type.Ddi.DdiData.Mapping[1].ChannelMappingValue; |
| 564 | } |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | |
| 569 | |
| 570 | /*----------------------------------------------------------------------------------------*/ |
| 571 | /** |
| 572 | * Dump display path settings |
| 573 | * |
| 574 | * |
| 575 | * |
| 576 | * @param[in] DisplayPath Display path |
| 577 | * @param[in] Gfx Gfx configuration |
| 578 | */ |
| 579 | |
| 580 | VOID |
| 581 | GfxIntegratedDebugDumpDisplayPath ( |
| 582 | IN EXT_DISPLAY_PATH *DisplayPath, |
| 583 | IN GFX_PLATFORM_CONFIG *Gfx |
| 584 | ) |
| 585 | { |
| 586 | IDS_HDT_CONSOLE (GFX_MISC, " usDeviceConnector = 0x%x\n", |
| 587 | DisplayPath->usDeviceConnector |
| 588 | ); |
| 589 | IDS_HDT_CONSOLE (GFX_MISC, " usDeviceTag = 0x%x\n", |
| 590 | DisplayPath->usDeviceTag |
| 591 | ); |
| 592 | IDS_HDT_CONSOLE (GFX_MISC, " usDeviceACPIEnum = 0x%x\n", |
| 593 | DisplayPath->usDeviceACPIEnum |
| 594 | ); |
| 595 | IDS_HDT_CONSOLE (GFX_MISC, " usExtEncoderObjId = 0x%x\n", |
| 596 | DisplayPath->usExtEncoderObjId |
| 597 | ); |
| 598 | IDS_HDT_CONSOLE (GFX_MISC, " ucChannelMapping = 0x%x\n", |
| 599 | DisplayPath->ChannelMapping.ucChannelMapping |
| 600 | ); |
| 601 | IDS_HDT_CONSOLE (GFX_MISC, " ucChPNInvert = 0x%x\n", |
| 602 | DisplayPath->ucChPNInvert |
| 603 | ); |
| 604 | IDS_HDT_CONSOLE (GFX_MISC, " usCaps = 0x%x\n", |
| 605 | DisplayPath->usCaps |
| 606 | ); |
| 607 | } |