]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
Check if video device exists before trying to install Video OpROM.
[mirror_edk2.git] / IntelFrameworkModulePkg / Csm / LegacyBiosDxe / LegacyPci.c
index 910ed41b37911773d2d84e35e274b8c0c70abaf3..fd5641a874f21464fe8c6922d686da90eed26f38 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -1715,6 +1715,20 @@ PciShadowRoms (
     if (!EFI_ERROR (Status)) {\r
       continue;\r
     }\r
+    \r
+    //\r
+    // If legacy VBIOS Oprom has not been dispatched before, install legacy VBIOS here.\r
+    //\r
+    if (IS_PCI_DISPLAY (&Pci) && Index == 0) {    \r
+      Status = LegacyBiosInstallVgaRom (Private);\r
+      //\r
+      // A return status of EFI_NOT_FOUND is considered valid (No EFI\r
+      // driver is controlling video).\r
+      //\r
+      ASSERT ((Status == EFI_SUCCESS) || (Status == EFI_NOT_FOUND));\r
+      continue;\r
+    }\r
+\r
     //\r
     // Install legacy ROM\r
     //\r
@@ -2900,7 +2914,15 @@ LegacyBiosInstallPciRom (
       return EFI_UNSUPPORTED;\r
     }\r
 \r
-    if (!Private->VgaInstalled) {\r
+    Status = Private->LegacyBiosPlatform->GetPlatformHandle (\r
+                                            Private->LegacyBiosPlatform,\r
+                                            EfiGetPlatformVgaHandle,\r
+                                            0,\r
+                                            &HandleBuffer,\r
+                                            &HandleCount,\r
+                                            NULL\r
+                                            );\r
+    if ((!EFI_ERROR (Status)) && (!Private->VgaInstalled)) {\r
       //\r
       // A return status of EFI_NOT_FOUND is considered valid (No EFI\r
       // driver is controlling video.\r
@@ -2928,7 +2950,7 @@ LegacyBiosInstallPciRom (
     Pcir = (PCI_3_0_DATA_STRUCTURE *)\r
            ((UINT8 *) LocalRomImage + ((PCI_EXPANSION_ROM_HEADER *) LocalRomImage)->PcirOffset);\r
 \r
-    if (Pcir->Signature != PCI_DATA_STRUCTURE_SIGNATURE) {\r
+    if ((Pcir->Signature != PCI_DATA_STRUCTURE_SIGNATURE) || (Pcir->CodeType != PCI_CODE_TYPE_PCAT_IMAGE)) {\r
       mVgaInstallationInProgress = FALSE;\r
       return EFI_UNSUPPORTED;\r
     }\r