]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Ebl/EfiDevice.c
Fix bug in LoadFv command. Don't free the buffer the file was loaded into as the...
[mirror_edk2.git] / EmbeddedPkg / Ebl / EfiDevice.c
index 80dcfcb5cc2c26373c567465301b5aae4c0cf3da..dafe0c9a05935b1a4eedfd0039e00e2bd0645e36 100644 (file)
@@ -207,44 +207,16 @@ EblDeviceCmd (
   IN CHAR8  **Argv\r
   )\r
 {\r
-  EFI_STATUS    Status;\r
   UINTN         Index;\r
   UINTN         CurrentRow;\r
   UINTN         Max;\r
-  EFI_OPEN_FILE *File;\r
 \r
   CurrentRow = 0;\r
 \r
   // Need to call here to make sure Device Counts are valid\r
   EblUpdateDeviceLists ();\r
 \r
-  //\r
-  // Probe for media insertion/removal in removable media devices\r
-  //\r
-  Max = EfiGetDeviceCounts (EfiOpenBlockIo);\r
-  if (Max != 0) {\r
-    for (Index = 0; Index < Max; Index++) {\r
-      File = EfiDeviceOpenByType (EfiOpenBlockIo, Index);\r
-      if (File != NULL) {\r
-        if (File->FsBlockIoMedia->RemovableMedia) {\r
-          if (File->FsBlockIoMedia->MediaPresent) {\r
-            // Probe to see if media is present\r
-            Status = File->FsBlockIo->ReadBlocks (File->FsBlockIo, File->FsBlockIo->Media->MediaId, (EFI_LBA)0, 0, NULL);\r
-            if (Status == EFI_NO_MEDIA) {\r
-              gBS->DisconnectController (File->EfiHandle, NULL, NULL);\r
-            }\r
-          } else {\r
-            // Probe for media insertion and connect partition and filesystem drivers if needed\r
-            gBS->ConnectController (File->EfiHandle, NULL, NULL, TRUE);\r
-          }\r
-        }\r
-        EfiClose (File);\r
-      }\r
-    }\r
-  }\r
-\r
   // Now we can print out the info...\r
-\r
   Max = EfiGetDeviceCounts (EfiOpenFirmwareVolume);\r
   if (Max != 0) {\r
     AsciiPrint ("Firmware Volume Devices:\n");\r
@@ -431,7 +403,9 @@ EblLoadFvCmd (
     }\r
       \r
     Status = gDS->ProcessFirmwareVolume (FvStart, FvSize, &FvHandle);\r
-    FreePool (FvStart);\r
+    if (EFI_ERROR (Status)) {\r
+      FreePool (FvStart);\r
+    } \r
   }\r
   return Status;\r
 }\r