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 | * |
| 18 | * Copyright 2008 - 2012 ADVANCED MICRO DEVICES, INC. All Rights Reserved. |
| 19 | * |
| 20 | * AMD is granting you permission to use this software (the Materials) |
| 21 | * pursuant to the terms and conditions of your Software License Agreement |
| 22 | * with AMD. This header does *NOT* give you permission to use the Materials |
| 23 | * or any rights under AMD's intellectual property. Your use of any portion |
| 24 | * of these Materials shall constitute your acceptance of those terms and |
| 25 | * conditions. If you do not agree to the terms and conditions of the Software |
| 26 | * License Agreement, please do not use any portion of these Materials. |
| 27 | * |
| 28 | * CONFIDENTIALITY: The Materials and all other information, identified as |
| 29 | * confidential and provided to you by AMD shall be kept confidential in |
| 30 | * accordance with the terms and conditions of the Software License Agreement. |
| 31 | * |
| 32 | * LIMITATION OF LIABILITY: THE MATERIALS AND ANY OTHER RELATED INFORMATION |
| 33 | * PROVIDED TO YOU BY AMD ARE PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED |
| 34 | * WARRANTY OF ANY KIND, INCLUDING BUT NOT LIMITED TO WARRANTIES OF |
| 35 | * MERCHANTABILITY, NONINFRINGEMENT, TITLE, FITNESS FOR ANY PARTICULAR PURPOSE, |
| 36 | * OR WARRANTIES ARISING FROM CONDUCT, COURSE OF DEALING, OR USAGE OF TRADE. |
| 37 | * IN NO EVENT SHALL AMD OR ITS LICENSORS BE LIABLE FOR ANY DAMAGES WHATSOEVER |
| 38 | * (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS |
| 39 | * INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF AMD'S NEGLIGENCE, |
| 40 | * GROSS NEGLIGENCE, THE USE OF OR INABILITY TO USE THE MATERIALS OR ANY OTHER |
| 41 | * RELATED INFORMATION PROVIDED TO YOU BY AMD, EVEN IF AMD HAS BEEN ADVISED OF |
| 42 | * THE POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME JURISDICTIONS PROHIBIT THE |
| 43 | * EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, |
| 44 | * THE ABOVE LIMITATION MAY NOT APPLY TO YOU. |
| 45 | * |
| 46 | * AMD does not assume any responsibility for any errors which may appear in |
| 47 | * the Materials or any other related information provided to you by AMD, or |
| 48 | * result from use of the Materials or any related information. |
| 49 | * |
| 50 | * You agree that you will not reverse engineer or decompile the Materials. |
| 51 | * |
| 52 | * NO SUPPORT OBLIGATION: AMD is not obligated to furnish, support, or make any |
| 53 | * further information, software, technical information, know-how, or show-how |
| 54 | * available to you. Additionally, AMD retains the right to modify the |
| 55 | * Materials at any time, without notice, and is not obligated to provide such |
| 56 | * modified Materials to you. |
| 57 | * |
| 58 | * U.S. GOVERNMENT RESTRICTED RIGHTS: The Materials are provided with |
| 59 | * "RESTRICTED RIGHTS." Use, duplication, or disclosure by the Government is |
| 60 | * subject to the restrictions as set forth in FAR 52.227-14 and |
| 61 | * DFAR252.227-7013, et seq., or its successor. Use of the Materials by the |
| 62 | * Government constitutes acknowledgement of AMD's proprietary rights in them. |
| 63 | * |
| 64 | * EXPORT ASSURANCE: You agree and certify that neither the Materials, nor any |
| 65 | * direct product thereof will be exported directly or indirectly, into any |
| 66 | * country prohibited by the United States Export Administration Act and the |
| 67 | * regulations thereunder, without the required authorization from the U.S. |
| 68 | * government nor will be used for any purpose prohibited by the same. |
| 69 | * *************************************************************************** |
| 70 | * |
| 71 | */ |
| 72 | |
| 73 | |
| 74 | /*---------------------------------------------------------------------------------------- |
| 75 | * M O D U L E S U S E D |
| 76 | *---------------------------------------------------------------------------------------- |
| 77 | */ |
| 78 | #include "AGESA.h" |
| 79 | #include "Ids.h" |
| 80 | #include "amdlib.h" |
| 81 | #include "Gnb.h" |
| 82 | #include "GnbPcie.h" |
| 83 | #include "GnbGfx.h" |
| 84 | #include "GnbCommonLib.h" |
| 85 | #include "GnbPcieInitLibV1.h" |
| 86 | #include "GnbPcieConfig.h" |
| 87 | #include "GnbGfxFamServices.h" |
| 88 | #include "GnbRegistersLN.h" |
| 89 | #include "Filecode.h" |
| 90 | #define FILECODE PROC_GNB_MODULES_GNBGFXINITLIBV1_GFXENUMCONNECTORS_FILECODE |
| 91 | /*---------------------------------------------------------------------------------------- |
| 92 | * D E F I N I T I O N S A N D M A C R O S |
| 93 | *---------------------------------------------------------------------------------------- |
| 94 | */ |
| 95 | |
| 96 | |
| 97 | |
| 98 | /*---------------------------------------------------------------------------------------- |
| 99 | * T Y P E D E F S A N D S T R U C T U R E S |
| 100 | *---------------------------------------------------------------------------------------- |
| 101 | */ |
| 102 | |
| 103 | |
| 104 | typedef struct { |
| 105 | PCIE_CONNECTOR_TYPE ConnectorType; |
| 106 | UINT8 DisplayDeviceEnum; |
| 107 | UINT16 ConnectorEnum; |
| 108 | UINT16 EncoderEnum; |
| 109 | UINT8 ConnectorIndex; |
| 110 | } EXT_CONNECTOR_INFO; |
| 111 | |
| 112 | typedef struct { |
| 113 | UINT8 DisplayDeviceEnum; |
| 114 | UINT8 DeviceIndex; |
| 115 | UINT16 DeviceTag; |
| 116 | UINT16 DeviceAcpiEnum; |
| 117 | } EXT_DISPLAY_DEVICE_INFO; |
| 118 | |
| 119 | typedef struct { |
| 120 | AGESA_STATUS Status; |
| 121 | UINT8 DisplayDeviceEnum; |
| 122 | UINT8 RequestedPriorityIndex; |
| 123 | UINT8 CurrentPriorityIndex; |
| 124 | PCIe_ENGINE_CONFIG *Engine; |
| 125 | } CONNECTOR_ENUM_INFO; |
| 126 | |
| 127 | |
| 128 | /*---------------------------------------------------------------------------------------- |
| 129 | * 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 |
| 130 | *---------------------------------------------------------------------------------------- |
| 131 | */ |
| 132 | |
| 133 | AGESA_STATUS |
| 134 | GfxIntegratedEnumConnectorsForDevice ( |
| 135 | IN UINT8 DisplayDeviceEnum, |
| 136 | OUT EXT_DISPLAY_PATH *DisplayPathList, |
| 137 | IN OUT PCIe_PLATFORM_CONFIG *Pcie, |
| 138 | IN GFX_PLATFORM_CONFIG *Gfx |
| 139 | ); |
| 140 | |
| 141 | VOID |
| 142 | GfxIntegratedDebugDumpDisplayPath ( |
| 143 | IN EXT_DISPLAY_PATH *DisplayPath, |
| 144 | IN GFX_PLATFORM_CONFIG *Gfx |
| 145 | ); |
| 146 | |
| 147 | AGESA_STATUS |
| 148 | GfxIntegratedEnumerateAllConnectors ( |
| 149 | OUT EXT_DISPLAY_PATH *DisplayPathList, |
| 150 | IN OUT PCIe_PLATFORM_CONFIG *Pcie, |
| 151 | IN GFX_PLATFORM_CONFIG *Gfx |
| 152 | ); |
| 153 | |
| 154 | VOID |
| 155 | GfxIntegratedCopyDisplayInfo ( |
| 156 | IN PCIe_ENGINE_CONFIG *Engine, |
| 157 | OUT EXT_DISPLAY_PATH *DisplayPath, |
| 158 | OUT EXT_DISPLAY_PATH *SecondaryDisplayPath, |
| 159 | IN GFX_PLATFORM_CONFIG *Gfx |
| 160 | ); |
| 161 | |
| 162 | EXT_CONNECTOR_INFO ConnectorInfoTable[] = { |
| 163 | { |
| 164 | ConnectorTypeDP, |
| 165 | DEVICE_DFP, |
| 166 | CONNECTOR_DISPLAYPORT_ENUM, |
| 167 | ENCODER_NOT_PRESENT, |
| 168 | 0, |
| 169 | }, |
| 170 | { |
| 171 | ConnectorTypeEDP, |
| 172 | DEVICE_LCD, |
| 173 | CONNECTOR_eDP_ENUM, |
| 174 | ENCODER_NOT_PRESENT, |
| 175 | 1 |
| 176 | }, |
| 177 | { |
| 178 | ConnectorTypeSingleLinkDVI, |
| 179 | DEVICE_DFP, |
| 180 | CONNECTOR_SINGLE_LINK_DVI_D_ENUM, |
| 181 | ENCODER_NOT_PRESENT, |
| 182 | 2 |
| 183 | }, |
| 184 | { |
| 185 | ConnectorTypeDualLinkDVI, |
| 186 | DEVICE_DFP, |
| 187 | CONNECTOR_DUAL_LINK_DVI_D_ENUM, |
| 188 | ENCODER_NOT_PRESENT, |
| 189 | 3 |
| 190 | }, |
| 191 | { |
| 192 | ConnectorTypeHDMI, |
| 193 | DEVICE_DFP, |
| 194 | CONNECTOR_HDMI_TYPE_A_ENUM, |
| 195 | ENCODER_NOT_PRESENT, |
| 196 | 4 |
| 197 | }, |
| 198 | { |
| 199 | ConnectorTypeTravisDpToVga, |
| 200 | DEVICE_CRT, |
| 201 | CONNECTOR_VGA_ENUM, |
| 202 | ENCODER_TRAVIS_ENUM_ID1, |
| 203 | 5 |
| 204 | }, |
| 205 | { |
| 206 | ConnectorTypeTravisDpToLvds, |
| 207 | DEVICE_LCD, |
| 208 | CONNECTOR_LVDS_ENUM, |
| 209 | ENCODER_TRAVIS_ENUM_ID2, |
| 210 | 6 |
| 211 | }, |
| 212 | { |
| 213 | ConnectorTypeNutmegDpToVga, |
| 214 | DEVICE_CRT, |
| 215 | CONNECTOR_VGA_ENUM, |
| 216 | ENCODER_ALMOND_ENUM_ID1, |
| 217 | 5 |
| 218 | }, |
| 219 | { |
| 220 | ConnectorTypeSingleLinkDviI, |
| 221 | DEVICE_DFP, |
| 222 | CONNECTOR_SINGLE_LINK_DVI_I_ENUM, |
| 223 | ENCODER_NOT_PRESENT, |
| 224 | 5 |
| 225 | }, |
| 226 | { |
| 227 | ConnectorTypeCrt, |
| 228 | DEVICE_CRT, |
| 229 | CONNECTOR_VGA_ENUM, |
| 230 | ENCODER_NOT_PRESENT, |
| 231 | 5 |
| 232 | }, |
| 233 | { |
| 234 | ConnectorTypeLvds, |
| 235 | DEVICE_LCD, |
| 236 | CONNECTOR_LVDS_ENUM, |
| 237 | ENCODER_NOT_PRESENT, |
| 238 | 6 |
| 239 | }, |
| 240 | { |
| 241 | ConnectorTypeEDPToLvds, |
| 242 | DEVICE_LCD, |
| 243 | CONNECTOR_eDP_ENUM, |
| 244 | ENCODER_NOT_PRESENT, |
| 245 | 1 |
| 246 | }, |
| 247 | { |
| 248 | ConnectorTypeEDPToRealtecLvds, |
| 249 | DEVICE_LCD, |
| 250 | CONNECTOR_eDP_ENUM, |
| 251 | ENCODER_NOT_PRESENT, |
| 252 | 1 |
| 253 | }, |
| 254 | { |
| 255 | ConnectorTypeAutoDetect, |
| 256 | DEVICE_LCD, |
| 257 | CONNECTOR_LVDS_eDP_ENUM, |
| 258 | ENCODER_TRAVIS_ENUM_ID2, |
| 259 | 7 |
| 260 | }, |
| 261 | }; |
| 262 | |
| 263 | UINT8 ConnectorNumerArray[] = { |
| 264 | // DP eDP SDVI-D DDVI-D HDMI VGA LVDS Auto (eDP, LVDS, Travis LVDS) |
| 265 | 6, 1, 6, 6, 6, 1, 1, 2 |
| 266 | }; |
| 267 | /*----------------------------------------------------------------------------------------*/ |
| 268 | /** |
| 269 | * Enumerate all display connectors for specific display device type. |
| 270 | * |
| 271 | * |
| 272 | * |
| 273 | * @param[in] ConnectorType Connector type (see PCIe_DDI_DATA::ConnectorType). |
| 274 | * @retval Pointer to EXT_CONNECTOR_INFO |
| 275 | * @retval NULL if connector type unknown. |
| 276 | */ |
| 277 | STATIC EXT_CONNECTOR_INFO* |
| 278 | GfxIntegratedExtConnectorInfo ( |
| 279 | IN UINT8 ConnectorType |
| 280 | ) |
| 281 | { |
| 282 | UINTN Index; |
| 283 | for (Index = 0; Index < (sizeof (ConnectorInfoTable) / sizeof (EXT_CONNECTOR_INFO)); Index++) { |
| 284 | if (ConnectorInfoTable[Index].ConnectorType == ConnectorType) { |
| 285 | return &ConnectorInfoTable[Index]; |
| 286 | } |
| 287 | } |
| 288 | return NULL; |
| 289 | } |
| 290 | |
| 291 | EXT_DISPLAY_DEVICE_INFO DisplayDeviceInfoTable[] = { |
| 292 | { |
| 293 | DEVICE_CRT, |
| 294 | 1, |
| 295 | ATOM_DEVICE_CRT1_SUPPORT, |
| 296 | 0x100, |
| 297 | }, |
| 298 | { |
| 299 | DEVICE_LCD, |
| 300 | 1, |
| 301 | ATOM_DEVICE_LCD1_SUPPORT, |
| 302 | 0x110, |
| 303 | }, |
| 304 | { |
| 305 | DEVICE_DFP, |
| 306 | 1, |
| 307 | ATOM_DEVICE_DFP1_SUPPORT, |
| 308 | 0x210, |
| 309 | }, |
| 310 | { |
| 311 | DEVICE_DFP, |
| 312 | 2, |
| 313 | ATOM_DEVICE_DFP2_SUPPORT, |
| 314 | 0x220, |
| 315 | }, |
| 316 | { |
| 317 | DEVICE_DFP, |
| 318 | 3, |
| 319 | ATOM_DEVICE_DFP3_SUPPORT, |
| 320 | 0x230, |
| 321 | }, |
| 322 | { |
| 323 | DEVICE_DFP, |
| 324 | 4, |
| 325 | ATOM_DEVICE_DFP4_SUPPORT, |
| 326 | 0x240, |
| 327 | }, |
| 328 | { |
| 329 | DEVICE_DFP, |
| 330 | 5, |
| 331 | ATOM_DEVICE_DFP5_SUPPORT, |
| 332 | 0x250, |
| 333 | }, |
| 334 | { |
| 335 | DEVICE_DFP, |
| 336 | 6, |
| 337 | ATOM_DEVICE_DFP6_SUPPORT, |
| 338 | 0x260, |
| 339 | } |
| 340 | }; |
| 341 | /*----------------------------------------------------------------------------------------*/ |
| 342 | /** |
| 343 | * Enumerate all display connectors for specific display device type. |
| 344 | * |
| 345 | * |
| 346 | * |
| 347 | * @param[in] DisplayDeviceEnum Display device enum |
| 348 | * @param[in] DisplayDeviceIndex Display device index |
| 349 | * @retval Pointer to EXT_DISPLAY_DEVICE_INFO |
| 350 | * @retval NULL if can not get display device info |
| 351 | */ |
| 352 | STATIC EXT_DISPLAY_DEVICE_INFO* |
| 353 | GfxIntegratedExtDisplayDeviceInfo ( |
| 354 | IN UINT8 DisplayDeviceEnum, |
| 355 | IN UINT8 DisplayDeviceIndex |
| 356 | ) |
| 357 | { |
| 358 | UINT8 Index; |
| 359 | UINT8 LastIndex; |
| 360 | LastIndex = 0xff; |
| 361 | for (Index = 0; Index < (sizeof (DisplayDeviceInfoTable) / sizeof (EXT_DISPLAY_DEVICE_INFO)); Index++) { |
| 362 | if (DisplayDeviceInfoTable[Index].DisplayDeviceEnum == DisplayDeviceEnum) { |
| 363 | LastIndex = Index; |
| 364 | if (DisplayDeviceInfoTable[Index].DeviceIndex == DisplayDeviceIndex) { |
| 365 | return &DisplayDeviceInfoTable[Index]; |
| 366 | } |
| 367 | } |
| 368 | } |
| 369 | if (DisplayDeviceEnum == DEVICE_LCD && LastIndex != 0xff) { |
| 370 | return &DisplayDeviceInfoTable[LastIndex]; |
| 371 | } |
| 372 | return NULL; |
| 373 | } |
| 374 | |
| 375 | /*----------------------------------------------------------------------------------------*/ |
| 376 | /** |
| 377 | * Enumerate all display connectors |
| 378 | * |
| 379 | * |
| 380 | * |
| 381 | * @param[out] DisplayPathList Display path list |
| 382 | * @param[in,out] Pcie PCIe platform configuration info |
| 383 | * @param[in] Gfx Gfx configuration info |
| 384 | */ |
| 385 | AGESA_STATUS |
| 386 | GfxIntegratedEnumerateAllConnectors ( |
| 387 | OUT EXT_DISPLAY_PATH *DisplayPathList, |
| 388 | IN OUT PCIe_PLATFORM_CONFIG *Pcie, |
| 389 | IN GFX_PLATFORM_CONFIG *Gfx |
| 390 | ) |
| 391 | { |
| 392 | AGESA_STATUS AgesaStatus; |
| 393 | AGESA_STATUS Status; |
| 394 | AgesaStatus = AGESA_SUCCESS; |
| 395 | IDS_HDT_CONSOLE (GNB_TRACE, "GfxIntegratedEnumerateAllConnectors Enter\n"); |
| 396 | Status = GfxIntegratedEnumConnectorsForDevice ( |
| 397 | DEVICE_DFP, |
| 398 | DisplayPathList, |
| 399 | Pcie, |
| 400 | Gfx |
| 401 | ); |
| 402 | AGESA_STATUS_UPDATE (Status, AgesaStatus); |
| 403 | |
| 404 | Status = GfxIntegratedEnumConnectorsForDevice ( |
| 405 | DEVICE_CRT, |
| 406 | DisplayPathList, |
| 407 | Pcie, |
| 408 | Gfx |
| 409 | ); |
| 410 | AGESA_STATUS_UPDATE (Status, AgesaStatus); |
| 411 | |
| 412 | Status = GfxIntegratedEnumConnectorsForDevice ( |
| 413 | DEVICE_LCD, |
| 414 | DisplayPathList, |
| 415 | Pcie, |
| 416 | Gfx |
| 417 | ); |
| 418 | AGESA_STATUS_UPDATE (Status, AgesaStatus); |
| 419 | IDS_HDT_CONSOLE (GNB_TRACE, "GfxIntegratedEnumerateAllConnectors Exit [0x%x]\n", Status); |
| 420 | return AgesaStatus; |
| 421 | } |
| 422 | |
| 423 | /*----------------------------------------------------------------------------------------*/ |
| 424 | /** |
| 425 | * Enumerate all display connectors for specific display device type. |
| 426 | * |
| 427 | * |
| 428 | * |
| 429 | * @param[in] Engine Engine configuration info |
| 430 | * @param[in,out] Buffer Buffer pointer |
| 431 | * @param[in] Pcie PCIe configuration info |
| 432 | */ |
| 433 | VOID |
| 434 | STATIC |
| 435 | GfxIntegratedDdiInterfaceCallback ( |
| 436 | IN PCIe_ENGINE_CONFIG *Engine, |
| 437 | IN OUT VOID *Buffer, |
| 438 | IN PCIe_PLATFORM_CONFIG *Pcie |
| 439 | ) |
| 440 | { |
| 441 | CONNECTOR_ENUM_INFO *ConnectorEnumInfo; |
| 442 | EXT_CONNECTOR_INFO *ExtConnectorInfo; |
| 443 | ConnectorEnumInfo = (CONNECTOR_ENUM_INFO*) Buffer; |
| 444 | ExtConnectorInfo = GfxIntegratedExtConnectorInfo (Engine->Type.Ddi.DdiData.ConnectorType); |
| 445 | if (ExtConnectorInfo == NULL) { |
| 446 | AGESA_STATUS_UPDATE (AGESA_ERROR, ConnectorEnumInfo->Status); |
| 447 | PcieConfigDisableEngine (Engine); |
| 448 | return; |
| 449 | } |
| 450 | if (ExtConnectorInfo->DisplayDeviceEnum != ConnectorEnumInfo->DisplayDeviceEnum) { |
| 451 | //Not device type we are looking for |
| 452 | return; |
| 453 | } |
| 454 | if (Engine->Type.Ddi.DisplayPriorityIndex >= ConnectorEnumInfo->RequestedPriorityIndex && |
| 455 | Engine->Type.Ddi.DisplayPriorityIndex < ConnectorEnumInfo->CurrentPriorityIndex) { |
| 456 | ConnectorEnumInfo->CurrentPriorityIndex = Engine->Type.Ddi.DisplayPriorityIndex; |
| 457 | ConnectorEnumInfo->Engine = Engine; |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | /*----------------------------------------------------------------------------------------*/ |
| 462 | /** |
| 463 | * Enumerate all display connectors for specific display device type. |
| 464 | * |
| 465 | * |
| 466 | * |
| 467 | * @param[in] DisplayDeviceEnum Display device list |
| 468 | * @param[out] DisplayPathList Display path list |
| 469 | * @param[in,out] Pcie PCIe configuration info |
| 470 | * @param[in] Gfx Gfx configuration info |
| 471 | */ |
| 472 | AGESA_STATUS |
| 473 | GfxIntegratedEnumConnectorsForDevice ( |
| 474 | IN UINT8 DisplayDeviceEnum, |
| 475 | OUT EXT_DISPLAY_PATH *DisplayPathList, |
| 476 | IN OUT PCIe_PLATFORM_CONFIG *Pcie, |
| 477 | IN GFX_PLATFORM_CONFIG *Gfx |
| 478 | ) |
| 479 | { |
| 480 | UINT8 DisplayDeviceIndex; |
| 481 | CONNECTOR_ENUM_INFO ConnectorEnumInfo; |
| 482 | EXT_CONNECTOR_INFO *ExtConnectorInfo; |
| 483 | EXT_DISPLAY_DEVICE_INFO *ExtDisplayDeviceInfo; |
| 484 | AGESA_STATUS Status; |
| 485 | UINT8 ConnectorIdArray[sizeof (ConnectorNumerArray)]; |
| 486 | ConnectorEnumInfo.Status = AGESA_SUCCESS; |
| 487 | DisplayDeviceIndex = 1; |
| 488 | ConnectorEnumInfo.RequestedPriorityIndex = 0; |
| 489 | ConnectorEnumInfo.DisplayDeviceEnum = DisplayDeviceEnum; |
| 490 | LibAmdMemFill (ConnectorIdArray, 0x00, sizeof (ConnectorIdArray), GnbLibGetHeader (Gfx)); |
| 491 | do { |
| 492 | ConnectorEnumInfo.Engine = NULL; |
| 493 | ConnectorEnumInfo.CurrentPriorityIndex = 0xff; |
| 494 | PcieConfigRunProcForAllEngines ( |
| 495 | DESCRIPTOR_ALLOCATED | DESCRIPTOR_VIRTUAL | DESCRIPTOR_DDI_ENGINE, |
| 496 | GfxIntegratedDdiInterfaceCallback, |
| 497 | &ConnectorEnumInfo, |
| 498 | Pcie |
| 499 | ); |
| 500 | if (ConnectorEnumInfo.Engine == NULL) { |
| 501 | break; // No more connector support this |
| 502 | } |
| 503 | ConnectorEnumInfo.RequestedPriorityIndex = ConnectorEnumInfo.CurrentPriorityIndex + 1; |
| 504 | ExtConnectorInfo = GfxIntegratedExtConnectorInfo (ConnectorEnumInfo.Engine->Type.Ddi.DdiData.ConnectorType); |
| 505 | ASSERT (ExtConnectorInfo != NULL); |
| 506 | ASSERT (ExtConnectorInfo->ConnectorIndex < sizeof (ConnectorIdArray)); |
| 507 | if (ConnectorIdArray[ExtConnectorInfo->ConnectorIndex] >= ConnectorNumerArray[ExtConnectorInfo->ConnectorIndex]) { |
| 508 | //Run out of supported connectors |
| 509 | AGESA_STATUS_UPDATE (AGESA_ERROR, ConnectorEnumInfo.Status); |
| 510 | PcieConfigDisableEngine (ConnectorEnumInfo.Engine); |
| 511 | continue; |
| 512 | } |
| 513 | ConnectorEnumInfo.Engine->Type.Ddi.ConnectorId = ConnectorIdArray[ExtConnectorInfo->ConnectorIndex] + 1; |
| 514 | ExtDisplayDeviceInfo = GfxIntegratedExtDisplayDeviceInfo (DisplayDeviceEnum, DisplayDeviceIndex); |
| 515 | if (ExtDisplayDeviceInfo == NULL) { |
| 516 | //Run out of supported display device types |
| 517 | AGESA_STATUS_UPDATE (AGESA_ERROR, ConnectorEnumInfo.Status); |
| 518 | Status = AGESA_ERROR; |
| 519 | PcieConfigDisableEngine (ConnectorEnumInfo.Engine); |
| 520 | } |
| 521 | |
| 522 | if ((Gfx->Gnb3dStereoPinIndex != 0) && (ConnectorEnumInfo.Engine->Type.Ddi.DdiData.HdpIndex == (Gfx->Gnb3dStereoPinIndex - 1))) { |
| 523 | AGESA_STATUS_UPDATE (AGESA_ERROR, ConnectorEnumInfo.Status); |
| 524 | Status = AGESA_ERROR; |
| 525 | PcieConfigDisableEngine (ConnectorEnumInfo.Engine); |
| 526 | } |
| 527 | |
| 528 | ConnectorEnumInfo.Engine->Type.Ddi.DisplayDeviceId = DisplayDeviceIndex; |
| 529 | |
| 530 | Status = GfxFmMapEngineToDisplayPath (ConnectorEnumInfo.Engine, DisplayPathList, Gfx); |
| 531 | AGESA_STATUS_UPDATE (Status, ConnectorEnumInfo.Status); |
| 532 | if (Status != AGESA_SUCCESS) { |
| 533 | continue; |
| 534 | } |
| 535 | ConnectorIdArray[ExtConnectorInfo->ConnectorIndex]++; |
| 536 | DisplayDeviceIndex++; |
| 537 | } while (ConnectorEnumInfo.Engine != NULL); |
| 538 | return ConnectorEnumInfo.Status; |
| 539 | } |
| 540 | |
| 541 | /*----------------------------------------------------------------------------------------*/ |
| 542 | /** |
| 543 | * Initialize display path for given engine |
| 544 | * |
| 545 | * |
| 546 | * |
| 547 | * @param[in] Engine Engine configuration info |
| 548 | * @param[out] DisplayPath Display path list |
| 549 | * @param[out] SecondaryDisplayPath Secondary display path list |
| 550 | * @param[in] Gfx Gfx configuration info |
| 551 | */ |
| 552 | |
| 553 | VOID |
| 554 | GfxIntegratedCopyDisplayInfo ( |
| 555 | IN PCIe_ENGINE_CONFIG *Engine, |
| 556 | OUT EXT_DISPLAY_PATH *DisplayPath, |
| 557 | OUT EXT_DISPLAY_PATH *SecondaryDisplayPath, |
| 558 | IN GFX_PLATFORM_CONFIG *Gfx |
| 559 | ) |
| 560 | { |
| 561 | EXT_CONNECTOR_INFO *ExtConnectorInfo; |
| 562 | EXT_DISPLAY_DEVICE_INFO *ExtDisplayDeviceInfo; |
| 563 | ExtConnectorInfo = GfxIntegratedExtConnectorInfo (Engine->Type.Ddi.DdiData.ConnectorType); |
| 564 | ExtDisplayDeviceInfo = GfxIntegratedExtDisplayDeviceInfo (ExtConnectorInfo->DisplayDeviceEnum, Engine->Type.Ddi.DisplayDeviceId); |
| 565 | DisplayPath->usDeviceConnector = ExtConnectorInfo->ConnectorEnum | (Engine->Type.Ddi.ConnectorId << 8); |
| 566 | DisplayPath->usDeviceTag = ExtDisplayDeviceInfo->DeviceTag; |
| 567 | DisplayPath->usDeviceACPIEnum = ExtDisplayDeviceInfo->DeviceAcpiEnum; |
| 568 | DisplayPath->ucExtAUXDDCLutIndex = Engine->Type.Ddi.DdiData.AuxIndex; |
| 569 | DisplayPath->ucExtHPDPINLutIndex = Engine->Type.Ddi.DdiData.HdpIndex; |
| 570 | DisplayPath->ucChPNInvert = Engine->Type.Ddi.DdiData.LanePnInversionMask; |
| 571 | DisplayPath->usCaps = Engine->Type.Ddi.DdiData.Flags; |
| 572 | DisplayPath->usExtEncoderObjId = ExtConnectorInfo->EncoderEnum; |
| 573 | if (Engine->Type.Ddi.DdiData.Mapping[0].ChannelMappingValue == 0) { |
| 574 | DisplayPath->ChannelMapping.ucChannelMapping = (Engine->EngineData.StartLane < Engine->EngineData.EndLane) ? 0xE4 : 0x1B; |
| 575 | } else { |
| 576 | DisplayPath->ChannelMapping.ucChannelMapping = Engine->Type.Ddi.DdiData.Mapping[0].ChannelMappingValue; |
| 577 | } |
| 578 | GNB_DEBUG_CODE ( |
| 579 | GfxIntegratedDebugDumpDisplayPath (DisplayPath, Gfx); |
| 580 | ); |
| 581 | if (Engine->Type.Ddi.DdiData.ConnectorType == ConnectorTypeDualLinkDVI) { |
| 582 | if (SecondaryDisplayPath != NULL) { |
| 583 | SecondaryDisplayPath->usDeviceConnector = DisplayPath->usDeviceConnector; |
| 584 | } |
| 585 | GNB_DEBUG_CODE ( |
| 586 | GfxIntegratedDebugDumpDisplayPath (DisplayPath, Gfx); |
| 587 | ); |
| 588 | |
| 589 | if (Engine->Type.Ddi.DdiData.Mapping[1].ChannelMappingValue == 0) { |
| 590 | DisplayPath->ChannelMapping.ucChannelMapping = (Engine->EngineData.StartLane < Engine->EngineData.EndLane) ? 0xE4 : 0x1B; |
| 591 | } else { |
| 592 | DisplayPath->ChannelMapping.ucChannelMapping = Engine->Type.Ddi.DdiData.Mapping[1].ChannelMappingValue; |
| 593 | } |
| 594 | } |
| 595 | } |
| 596 | |
| 597 | |
| 598 | |
| 599 | /*----------------------------------------------------------------------------------------*/ |
| 600 | /** |
| 601 | * Dump display path settings |
| 602 | * |
| 603 | * |
| 604 | * |
| 605 | * @param[in] DisplayPath Display path |
| 606 | * @param[in] Gfx Gfx configuration |
| 607 | */ |
| 608 | |
| 609 | VOID |
| 610 | GfxIntegratedDebugDumpDisplayPath ( |
| 611 | IN EXT_DISPLAY_PATH *DisplayPath, |
| 612 | IN GFX_PLATFORM_CONFIG *Gfx |
| 613 | ) |
| 614 | { |
| 615 | IDS_HDT_CONSOLE (GFX_MISC, " usDeviceConnector = 0x%x\n", |
| 616 | DisplayPath->usDeviceConnector |
| 617 | ); |
| 618 | IDS_HDT_CONSOLE (GFX_MISC, " usDeviceTag = 0x%x\n", |
| 619 | DisplayPath->usDeviceTag |
| 620 | ); |
| 621 | IDS_HDT_CONSOLE (GFX_MISC, " usDeviceACPIEnum = 0x%x\n", |
| 622 | DisplayPath->usDeviceACPIEnum |
| 623 | ); |
| 624 | IDS_HDT_CONSOLE (GFX_MISC, " usExtEncoderObjId = 0x%x\n", |
| 625 | DisplayPath->usExtEncoderObjId |
| 626 | ); |
| 627 | IDS_HDT_CONSOLE (GFX_MISC, " ucChannelMapping = 0x%x\n", |
| 628 | DisplayPath->ChannelMapping.ucChannelMapping |
| 629 | ); |
| 630 | IDS_HDT_CONSOLE (GFX_MISC, " ucChPNInvert = 0x%x\n", |
| 631 | DisplayPath->ucChPNInvert |
| 632 | ); |
| 633 | IDS_HDT_CONSOLE (GFX_MISC, " usCaps = 0x%x\n", |
| 634 | DisplayPath->usCaps |
| 635 | ); |
| 636 | } |