]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. updated PCI/AGP Devices to check RemainingDevicePath in Supported() and Start...
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 15 Sep 2009 07:50:48 +0000 (07:50 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 15 Sep 2009 07:50:48 +0000 (07:50 +0000)
  a. Add check validation of RemainingDevicePath in Supported()
  b. In Star() function, if RemaingDevicePath is the End of Device Path Node, don't create child device and return EFI_SUCCESS.
2. fixed one device path issue in ScsiBus driver.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9264 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c

index d53fdc8eb38f433bb3eb7c742cc9b7664b23d607..e631fecf1110448262674183494615cf5f108273 100644 (file)
@@ -160,7 +160,7 @@ SCSIBusDriverBindingSupported (
       //\r
       if (Node->DevPath.Type != MESSAGING_DEVICE_PATH ||\r
           Node->DevPath.SubType != MSG_SCSI_DP ||\r
-          DevicePathNodeLength(&Node->DevPath) != sizeof(ATAPI_DEVICE_PATH)) {\r
+          DevicePathNodeLength(&Node->DevPath) != sizeof(SCSI_DEVICE_PATH)) {\r
         return EFI_UNSUPPORTED;\r
       }\r
     }\r
index 21bb4afee0278cee0a6f01e28eb9ca34407be320..789b23358df603e60f8975ac31fc54494497889a 100644 (file)
@@ -11,7 +11,7 @@
   documentation on UGA for details on how to write a UGA driver that is able\r
   to function both in the EFI pre-boot environment and from the OS runtime.\r
 \r
-  Copyright (c) 2006, Intel Corporation\r
+  Copyright (c) 2006 - 2009, Intel Corporation\r
   All rights reserved. This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -125,6 +125,7 @@ CirrusLogic5430ControllerDriverSupported (
   EFI_STATUS          Status;\r
   EFI_PCI_IO_PROTOCOL *PciIo;\r
   PCI_TYPE00          Pci;\r
+  EFI_DEV_PATH        *Node;\r
 \r
   //\r
   // Open the PCI I/O Protocol\r
@@ -168,16 +169,33 @@ CirrusLogic5430ControllerDriverSupported (
     //\r
     // See if this is a 5430 or a 5446 PCI controller\r
     //\r
-    if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_DEVICE_ID) {\r
-      Status = EFI_SUCCESS;\r
-    }\r
-\r
-    if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID) {\r
-      Status = EFI_SUCCESS;\r
-    }\r
-\r
-    if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5446_DEVICE_ID) {\r
+    if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_DEVICE_ID || \r
+        Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID ||\r
+        Pci.Hdr.DeviceId == CIRRUS_LOGIC_5446_DEVICE_ID) {\r
+        \r
       Status = EFI_SUCCESS;\r
+      //\r
+      // If this is an Intel 945 graphics controller,\r
+      // go further check RemainingDevicePath validation\r
+      //\r
+      if (RemainingDevicePath != NULL) {\r
+        Node = (EFI_DEV_PATH *) RemainingDevicePath;\r
+        //\r
+        // Check if RemainingDevicePath is the End of Device Path Node, \r
+        // if yes, return EFI_SUCCESS\r
+        //\r
+        if (!IsDevicePathEnd (Node)) {\r
+          //\r
+          // If RemainingDevicePath isn't the End of Device Path Node,\r
+          // check its validation\r
+          //\r
+          if (Node->DevPath.Type != ACPI_DEVICE_PATH ||\r
+              Node->DevPath.SubType != ACPI_ADR_DP ||\r
+              DevicePathNodeLength(&Node->DevPath) != sizeof(ACPI_ADR_DEVICE_PATH)) {\r
+            Status = EFI_UNSUPPORTED;\r
+          }\r
+        }\r
+      }\r
     }\r
   }\r
 \r
@@ -299,20 +317,32 @@ CirrusLogic5430ControllerDriverStart (
                                           ParentDevicePath,\r
                                           (EFI_DEVICE_PATH_PROTOCOL *) &AcpiDeviceNode\r
                                           );\r
-    } else {\r
+    } else if (!IsDevicePathEnd (RemainingDevicePath)) {\r
+      //\r
+      // If RemainingDevicePath isn't the End of Device Path Node, \r
+      // only scan the specified device by RemainingDevicePath\r
+      //\r
       Private->GopDevicePath = AppendDevicePathNode (ParentDevicePath, RemainingDevicePath);\r
+    } else {\r
+      //\r
+      // If RemainingDevicePath is the End of Device Path Node, \r
+      // don't create child device and return EFI_SUCCESS\r
+      //\r
+      Private->GopDevicePath = NULL;\r
+    }\r
+      \r
+    if (Private->GopDevicePath != NULL) {\r
+      //\r
+      // Creat child handle and device path protocol firstly\r
+      //\r
+      Private->Handle = NULL;\r
+      Status = gBS->InstallMultipleProtocolInterfaces (\r
+                      &Private->Handle,\r
+                      &gEfiDevicePathProtocolGuid,\r
+                      Private->GopDevicePath,\r
+                      NULL\r
+                      );\r
     }\r
-\r
-    //\r
-    // Creat child handle and device path protocol firstly\r
-    //\r
-    Private->Handle = NULL;\r
-    Status = gBS->InstallMultipleProtocolInterfaces (\r
-                    &Private->Handle,\r
-                    &gEfiDevicePathProtocolGuid,\r
-                    Private->GopDevicePath,\r
-                    NULL\r
-                    );\r
   }\r
 \r
   //\r
@@ -341,23 +371,31 @@ CirrusLogic5430ControllerDriverStart (
                     );\r
 \r
   } else if (FeaturePcdGet (PcdSupportGop)) {\r
-    //\r
-    // Start the GOP software stack.\r
-    //\r
-    Status = CirrusLogic5430GraphicsOutputConstructor (Private);\r
-    ASSERT_EFI_ERROR (Status);\r
-\r
-    Status = gBS->InstallMultipleProtocolInterfaces (\r
-                    &Private->Handle,\r
-                    &gEfiGraphicsOutputProtocolGuid,\r
-                    &Private->GraphicsOutput,\r
-                    &gEfiEdidDiscoveredProtocolGuid,\r
-                    &Private->EdidDiscovered,\r
-                    &gEfiEdidActiveProtocolGuid,\r
-                    &Private->EdidActive,\r
-                    NULL\r
-                    );\r
-\r
+    if (Private->GopDevicePath == NULL) {\r
+      //\r
+      // If RemainingDevicePath is the End of Device Path Node, \r
+      // don't create child device and return EFI_SUCCESS\r
+      //\r
+      Status = EFI_SUCCESS;\r
+    } else {\r
+  \r
+      //\r
+      // Start the GOP software stack.\r
+      //\r
+      Status = CirrusLogic5430GraphicsOutputConstructor (Private);\r
+      ASSERT_EFI_ERROR (Status);\r
+  \r
+      Status = gBS->InstallMultipleProtocolInterfaces (\r
+                      &Private->Handle,\r
+                      &gEfiGraphicsOutputProtocolGuid,\r
+                      &Private->GraphicsOutput,\r
+                      &gEfiEdidDiscoveredProtocolGuid,\r
+                      &Private->EdidDiscovered,\r
+                      &gEfiEdidActiveProtocolGuid,\r
+                      &Private->EdidActive,\r
+                      NULL\r
+                      );\r
+    }\r
   } else {\r
     //\r
     // This driver must support eithor GOP or UGA or both.\r