]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Add usb LUD support in BDS
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 18 Jul 2008 10:02:14 +0000 (10:02 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 18 Jul 2008 10:02:14 +0000 (10:02 +0000)
2. Enhance the orignal enumeration logic to check whether a internal shell boot option is valid.

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

MdeModulePkg/Library/GenericBdsLib/BdsBoot.c

index faa371b7b72602101b233c9422df2cdb25a7e39f..14df23af353dc024306440e5a3df80512fd70ba1 100644 (file)
@@ -182,6 +182,11 @@ BdsLibBootViaBootOption (
     //\r
     InitializeListHead (&TempBootLists);\r
     BdsLibRegisterNewOption (&TempBootLists, DevicePath, L"EFI Internal Shell", L"BootOrder");\r
+    //\r
+    // free the temporary device path created by BdsLibUpdateFvFileDevicePath()\r
+    //\r
+    gBS->FreePool (DevicePath); \r
+    DevicePath = Option->DevicePath;\r
   }\r
 \r
   //\r
@@ -1515,11 +1520,21 @@ BdsGetBootTypeFromDevicePath (
         break;\r
       case MESSAGING_DEVICE_PATH:\r
         //\r
-        // if the device path not only point to driver device, it is not a messaging device path.\r
+        // Get the last device path node\r
         //\r
         LastDeviceNode = NextDevicePathNode (TempDevicePath);\r
+        if (DevicePathSubType(LastDeviceNode) == MSG_DEVICE_LOGICAL_UNIT_DP) {\r
+          //\r
+          // if the next node type is Device Logical Unit, which specify the Logical Unit Number (LUN),\r
+          // skit it\r
+          //\r
+          LastDeviceNode = NextDevicePathNode (LastDeviceNode);\r
+        }\r
+        //\r
+        // if the device path not only point to driver device, it is not a messaging device path,\r
+        //\r
         if (!IsDevicePathEndType (LastDeviceNode)) {\r
-          break;\r
+          break;        \r
         }\r
 \r
         if (DevicePathSubType(TempDevicePath) == MSG_ATAPI_DP) {\r
@@ -1615,13 +1630,24 @@ BdsLibIsValidEFIBootOptDevicePath (
   }\r
 \r
   //\r
-  // If the boot option point to a internal Shell, it is a valid EFI boot option,\r
-  // and assume it is ready to boot now\r
+  // Check if it's a valid boot option for internal Shell\r
   //\r
   if (EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) LastDeviceNode) != NULL) {\r
-     return TRUE;\r
+    //\r
+    // If the boot option point to Internal FV shell, make sure it is valid\r
+    //\r
+    TempDevicePath = DevPath; \r
+    Status = BdsLibUpdateFvFileDevicePath (&TempDevicePath, &gEfiShellFileGuid);\r
+    if (Status == EFI_ALREADY_STARTED) {\r
+      return TRUE;\r
+    } else {\r
+      if (Status == EFI_SUCCESS) {\r
+        gBS->FreePool (TempDevicePath); \r
+      }\r
+      return FALSE;\r
+    }\r
   }\r
-\r
+  \r
   //\r
   // If the boot option point to a blockIO device, no matter whether or not it is a removeable device, it is a valid EFI boot option\r
   //\r
@@ -1825,6 +1851,7 @@ BdsLibUpdateFvFileDevicePath (
   // Second, if fail to find, try to enumerate all FV\r
   //\r
   if (!FindFvFile) {\r
+    FvHandleBuffer = NULL;\r
     gBS->LocateHandleBuffer (\r
           ByProtocol,\r
           &gEfiFirmwareVolume2ProtocolGuid,\r
@@ -1858,6 +1885,9 @@ BdsLibUpdateFvFileDevicePath (
       FoundFvHandle = FvHandleBuffer[Index];\r
       break;\r
     }\r
+    if (FvHandleBuffer !=NULL ) {\r
+      FreePool (FvHandleBuffer);  \r
+    }\r
   }\r
 \r
   if (FindFvFile) {\r