]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
Don't need call SAP measure GPT table, which can be covered in SAP implementation.
[mirror_edk2.git] / IntelFrameworkModulePkg / Library / GenericBdsLib / BdsBoot.c
index f5e7a153cc5995dfebfc604e9072d70af1064245..c022c15ee015b0bc18533bb3e96a743666a2bb49 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   BDS Lib functions which relate with create or process the boot option.\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2004 - 2009, Intel Corporation. <BR>\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
@@ -55,7 +55,7 @@ BdsLibDoLegacyBoot (
   BdsRefreshBbsTableForBoot (Option);\r
 \r
   //\r
-  // Write boot to OS performance data to a file\r
+  // Write boot to OS performance data for legacy boot.\r
   //\r
   PERF_CODE (\r
     WriteBootToOsPerformanceData ();\r
@@ -77,7 +77,7 @@ BdsLibDoLegacyBoot (
 \r
   @retval TRUE      This boot option matches a valid EFI NV Boot####.\r
   @retval FALSE     If not.\r
-  \r
+\r
 **/\r
 BOOLEAN\r
 IsBootOptionValidNVVarialbe (\r
@@ -100,7 +100,7 @@ IsBootOptionValidNVVarialbe (
   }\r
 \r
   //\r
-  // If the Boot Option Number and Device Path matches, OptionToCheck matches a \r
+  // If the Boot Option Number and Device Path matches, OptionToCheck matches a\r
   // valid EFI NV Boot####.\r
   //\r
   if ((OptionToCheck->BootCurrent == BootOption->BootCurrent) &&\r
@@ -110,7 +110,7 @@ IsBootOptionValidNVVarialbe (
   }\r
 \r
   FreePool (BootOption);\r
-    \r
+\r
   return Valid;\r
 }\r
 /**\r
@@ -145,12 +145,11 @@ BdsLibBootViaBootOption (
   EFI_DEVICE_PATH_PROTOCOL  *WorkingDevicePath;\r
   EFI_ACPI_S3_SAVE_PROTOCOL *AcpiS3Save;\r
   LIST_ENTRY                TempBootLists;\r
-  EFI_SECURITY_ARCH_PROTOCOL *SecurityProtocol;\r
 \r
   //\r
   // Record the performance data for End of BDS\r
   //\r
-  PERF_END (0, "BDS", NULL, 0);\r
+  PERF_END(NULL, "BDS", NULL, 0);\r
 \r
   *ExitDataSize = 0;\r
   *ExitData     = NULL;\r
@@ -187,8 +186,8 @@ BdsLibBootViaBootOption (
   // Signal the EVT_SIGNAL_READY_TO_BOOT event\r
   //\r
   EfiSignalEventReadyToBoot();\r
-  \r
-  \r
+\r
+\r
   //\r
   // Set Boot Current\r
   //\r
@@ -233,28 +232,77 @@ BdsLibBootViaBootOption (
     //\r
     InitializeListHead (&TempBootLists);\r
     BdsLibRegisterNewOption (&TempBootLists, DevicePath, L"EFI Internal Shell", L"BootOrder");\r
-    \r
+\r
     //\r
     // free the temporary device path created by BdsLibUpdateFvFileDevicePath()\r
     //\r
-    FreePool (DevicePath); \r
+    FreePool (DevicePath);\r
     DevicePath = Option->DevicePath;\r
   }\r
 \r
-  //\r
-  // Measure GPT Table by SAP protocol.\r
-  //\r
-  Status = gBS->LocateProtocol (\r
-                  &gEfiSecurityArchProtocolGuid,\r
-                  NULL,\r
-                  (VOID**) &SecurityProtocol\r
-                  );\r
-  if (!EFI_ERROR (Status)) {\r
-    Status = SecurityProtocol->FileAuthenticationState (SecurityProtocol, 0, DevicePath);\r
-  }\r
-\r
-  DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Booting %S\n", Option->Description));\r
+  DEBUG_CODE_BEGIN();\r
+    UINTN                     DevicePathTypeValue;\r
+    CHAR16                    *HiiString;\r
+    CHAR16                    *BootStringNumber;\r
+    UINTN                     BufferSize;\r
+  \r
+    DevicePathTypeValue = BdsGetBootTypeFromDevicePath (Option->DevicePath);\r
+  \r
+    //\r
+    // store number string of boot option temporary.\r
+    //\r
+    HiiString = NULL;\r
+    switch (DevicePathTypeValue) {\r
+    case BDS_EFI_ACPI_FLOPPY_BOOT:\r
+      HiiString = L"EFI Floppy";\r
+      break;\r
+    case BDS_EFI_MEDIA_CDROM_BOOT:\r
+    case BDS_EFI_MESSAGE_SATA_BOOT:\r
+    case BDS_EFI_MESSAGE_ATAPI_BOOT:\r
+      HiiString = L"EFI DVD/CDROM";\r
+      break;\r
+    case BDS_EFI_MESSAGE_USB_DEVICE_BOOT:\r
+      HiiString = L"EFI USB Device";\r
+      break;\r
+    case BDS_EFI_MESSAGE_SCSI_BOOT:\r
+      HiiString = L"EFI SCSI Device";\r
+      break;\r
+    case BDS_EFI_MESSAGE_MISC_BOOT:\r
+      HiiString = L"EFI Misc Device";\r
+      break;\r
+    case BDS_EFI_MESSAGE_MAC_BOOT:\r
+      HiiString = L"EFI Network";\r
+      break;\r
+    case BBS_DEVICE_PATH:\r
+      //\r
+      // Do nothing for legacy boot option.\r
+      //\r
+      break;\r
+    default:\r
+      DEBUG((EFI_D_INFO, "Can not find HiiString for given device path type 0x%x\n", DevicePathTypeValue));\r
+    }\r
 \r
+    //\r
+    // If found Hii description string then cat Hii string with original description.\r
+    //\r
+    if (HiiString != NULL) {\r
+      BootStringNumber = Option->Description;\r
+      BufferSize = StrSize(BootStringNumber);\r
+      BufferSize += StrSize(HiiString);\r
+      Option->Description = AllocateZeroPool(BufferSize);\r
+      StrCpy (Option->Description, HiiString);\r
+      if (StrnCmp (BootStringNumber, L"0", 1) != 0) {\r
+        StrCat (Option->Description, L" ");\r
+        StrCat (Option->Description, BootStringNumber);\r
+      } \r
+      \r
+      FreePool (BootStringNumber);\r
+    }\r
+  \r
+    DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Booting %S\n", Option->Description));\r
+    \r
+  DEBUG_CODE_END();\r
+  \r
   Status = gBS->LoadImage (\r
                   TRUE,\r
                   mBdsImageHandle,\r
@@ -265,7 +313,7 @@ BdsLibBootViaBootOption (
                   );\r
 \r
   //\r
-  // If we didn't find an image directly, we need to try as if it is a removable device boot opotion\r
+  // If we didn't find an image directly, we need to try as if it is a removable device boot option\r
   // and load the image according to the default boot behavior for removable device.\r
   //\r
   if (EFI_ERROR (Status)) {\r
@@ -323,6 +371,13 @@ BdsLibBootViaBootOption (
   //\r
   gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);\r
 \r
+  //\r
+  // Write boot to OS performance data for UEFI boot\r
+  //\r
+  PERF_CODE (\r
+    WriteBootToOsPerformanceData ();\r
+  );\r
+\r
   Status = gBS->StartImage (ImageHandle, ExitDataSize, ExitData);\r
   DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Image Return Status = %r\n", Status));\r
 \r
@@ -394,7 +449,7 @@ BdsExpandPartitionPartialDevicePathToFull (
                       &mHdBootVariablePrivateGuid,\r
                       &CachedDevicePathSize\r
                       );\r
-                      \r
+\r
   if (CachedDevicePath != NULL) {\r
     TempNewDevicePath = CachedDevicePath;\r
     DeviceExist = FALSE;\r
@@ -442,7 +497,7 @@ BdsExpandPartitionPartialDevicePathToFull (
         TempNewDevicePath = CachedDevicePath;\r
         CachedDevicePath  = BdsLibDelPartMatchInstance (CachedDevicePath, Instance );\r
         FreePool (TempNewDevicePath);\r
-        \r
+\r
         //\r
         // Second, append the remaining path after the matched instance\r
         //\r
@@ -460,7 +515,7 @@ BdsExpandPartitionPartialDevicePathToFull (
                         CachedDevicePath\r
                         );\r
       }\r
-      \r
+\r
       FreePool (Instance);\r
       FreePool (CachedDevicePath);\r
       return FullDevicePath;\r
@@ -559,7 +614,7 @@ BdsExpandPartitionPartialDevicePathToFull (
       break;\r
     }\r
   }\r
-  \r
+\r
   FreePool (CachedDevicePath);\r
   if (BlockIoBuffer != NULL) {\r
     FreePool (BlockIoBuffer);\r
@@ -594,7 +649,7 @@ MatchPartitionDevicePathNode (
   if ((BlockIoDevicePath == NULL) || (HardDriveDevicePath == NULL)) {\r
     return FALSE;\r
   }\r
-  \r
+\r
   //\r
   // Make PreviousDevicePath == the device path node before the end node\r
   //\r
@@ -623,7 +678,7 @@ MatchPartitionDevicePathNode (
   //\r
   TmpHdPath = (HARDDRIVE_DEVICE_PATH *) BlockIoHdDevicePathNode;\r
   Match = FALSE;\r
-  \r
+\r
   //\r
   // Check for the match\r
   //\r
@@ -711,7 +766,7 @@ BdsLibDeleteOptionFromHandle (
                       &gEfiGlobalVariableGuid,\r
                       &BootOptionSize\r
                       );\r
-                      \r
+\r
     if (BootOptionVar == NULL) {\r
       FreePool (BootOrder);\r
       return EFI_OUT_OF_RESOURCES;\r
@@ -872,40 +927,40 @@ BdsDeleteAllInvalidEfiBootOption (
 \r
 /**\r
   For EFI boot option, BDS separate them as six types:\r
-  1. Network - The boot option points to the SimpleNetworkProtocol device. \r
+  1. Network - The boot option points to the SimpleNetworkProtocol device.\r
                Bds will try to automatically create this type boot option when enumerate.\r
-  2. Shell   - The boot option points to internal flash shell. \r
+  2. Shell   - The boot option points to internal flash shell.\r
                Bds will try to automatically create this type boot option when enumerate.\r
   3. Removable BlockIo      - The boot option only points to the removable media\r
                               device, like USB flash disk, DVD, Floppy etc.\r
                               These device should contain a *removable* blockIo\r
                               protocol in their device handle.\r
-                              Bds will try to automatically create this type boot option \r
+                              Bds will try to automatically create this type boot option\r
                               when enumerate.\r
-  4. Fixed BlockIo          - The boot option only points to a Fixed blockIo device, \r
+  4. Fixed BlockIo          - The boot option only points to a Fixed blockIo device,\r
                               like HardDisk.\r
                               These device should contain a *fixed* blockIo\r
                               protocol in their device handle.\r
                               BDS will skip fixed blockIo devices, and NOT\r
-                              automatically create boot option for them. But BDS \r
-                              will help to delete those fixed blockIo boot option, \r
+                              automatically create boot option for them. But BDS\r
+                              will help to delete those fixed blockIo boot option,\r
                               whose description rule conflict with other auto-created\r
                               boot options.\r
-  5. Non-BlockIo Simplefile - The boot option points to a device whose handle \r
+  5. Non-BlockIo Simplefile - The boot option points to a device whose handle\r
                               has SimpleFileSystem Protocol, but has no blockio\r
                               protocol. These devices do not offer blockIo\r
-                              protocol, but BDS still can get the \r
+                              protocol, but BDS still can get the\r
                               \EFI\BOOT\boot{machinename}.EFI by SimpleFileSystem\r
                               Protocol.\r
-  6. File    - The boot option points to a file. These boot options are usually \r
+  6. File    - The boot option points to a file. These boot options are usually\r
                created by user manually or OS loader. BDS will not delete or modify\r
-               these boot options.        \r
-    \r
+               these boot options.\r
+\r
   This function will enumerate all possible boot device in the system, and\r
-  automatically create boot options for Network, Shell, Removable BlockIo, \r
+  automatically create boot options for Network, Shell, Removable BlockIo,\r
   and Non-BlockIo Simplefile devices.\r
   It will only execute once of every boot.\r
-  \r
+\r
   @param  BdsBootOptionList      The header of the link list which indexed all\r
                                  current boot options\r
 \r
@@ -956,7 +1011,7 @@ BdsLibEnumerateAllBootOption (
   MiscNumber    = 0;\r
   ScsiNumber    = 0;\r
   ZeroMem (Buffer, sizeof (Buffer));\r
-  \r
+\r
   //\r
   // If the boot device enumerate happened, just get the boot\r
   // device from the boot order variable\r
@@ -965,7 +1020,7 @@ BdsLibEnumerateAllBootOption (
     Status = BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");\r
     return Status;\r
   }\r
-  \r
+\r
   //\r
   // Notes: this dirty code is to get the legacy boot option from the\r
   // BBS table and create to variable as the EFI boot option, it should\r
@@ -977,7 +1032,7 @@ BdsLibEnumerateAllBootOption (
   // Delete invalid boot option\r
   //\r
   BdsDeleteAllInvalidEfiBootOption ();\r
-  \r
+\r
   //\r
   // Parse removable media\r
   //\r
@@ -988,7 +1043,7 @@ BdsLibEnumerateAllBootOption (
         &NumberBlockIoHandles,\r
         &BlockIoHandles\r
         );\r
-        \r
+\r
   for (Index = 0; Index < NumberBlockIoHandles; Index++) {\r
     Status = gBS->HandleProtocol (\r
                     BlockIoHandles[Index],\r
@@ -1008,36 +1063,36 @@ BdsLibEnumerateAllBootOption (
 \r
     switch (DevicePathType) {\r
     case BDS_EFI_ACPI_FLOPPY_BOOT:\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_FLOPPY_NUM, FloppyNumber); \r
+      UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", FloppyNumber);\r
       BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);\r
       FloppyNumber++;\r
       break;\r
-    \r
+\r
     //\r
     // Assume a removable SATA device should be the DVD/CD device\r
     //\r
     case BDS_EFI_MESSAGE_ATAPI_BOOT:\r
     case BDS_EFI_MESSAGE_SATA_BOOT:\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_DVD_NUM, CdromNumber);\r
+      UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", CdromNumber);\r
       BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);\r
       CdromNumber++;\r
       break;\r
 \r
     case BDS_EFI_MESSAGE_USB_DEVICE_BOOT:\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_USB_NUM, UsbNumber);\r
+      UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", UsbNumber);\r
       BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);\r
       UsbNumber++;\r
       break;\r
 \r
     case BDS_EFI_MESSAGE_SCSI_BOOT:\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_SCSI_NUM, ScsiNumber);\r
-      BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);      \r
+      UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", ScsiNumber);\r
+      BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);\r
       ScsiNumber++;\r
       break;\r
 \r
     case BDS_EFI_MESSAGE_MISC_BOOT:\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_MISC_NUM, MiscNumber);\r
-      BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);      \r
+      UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", MiscNumber);\r
+      BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);\r
       MiscNumber++;\r
       break;\r
 \r
@@ -1098,7 +1153,7 @@ BdsLibEnumerateAllBootOption (
       //\r
       BdsLibDeleteOptionFromHandle (FileSystemHandles[Index]);\r
     } else {\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NON_BLOCK_NUM, NonBlockNumber);\r
+      UnicodeSPrint (Buffer, sizeof (Buffer), L"EFI Non-Block Boot Device %d", NonBlockNumber);\r
       BdsLibBuildOptionFromHandle (FileSystemHandles[Index], BdsBootOptionList, Buffer);\r
       NonBlockNumber++;\r
     }\r
@@ -1120,7 +1175,7 @@ BdsLibEnumerateAllBootOption (
         );\r
 \r
   for (Index = 0; Index < NumberSimpleNetworkHandles; Index++) {\r
-    UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NETWORK_NUM, Index);\r
+    UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", Index);\r
     BdsLibBuildOptionFromHandle (SimpleNetworkHandles[Index], BdsBootOptionList, Buffer);\r
   }\r
 \r
@@ -1333,7 +1388,7 @@ BdsLibGetBootableHandle (
   EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION   Hdr;\r
 \r
   UpdatedDevicePath = DevicePath;\r
-  \r
+\r
   //\r
   // Check whether the device is connected\r
   //\r
@@ -1386,7 +1441,7 @@ BdsLibGetBootableHandle (
   //\r
   DupDevicePath = DuplicateDevicePath (DevicePath);\r
   ASSERT (DupDevicePath != NULL);\r
-  \r
+\r
   UpdatedDevicePath = DupDevicePath;\r
   Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &UpdatedDevicePath, &Handle);\r
   //\r
@@ -1531,7 +1586,7 @@ BdsLibNetworkBootWithMediaPresent (
 \r
   @param  DevicePath                      The bootable device Path to check\r
 \r
-  @retval BDS_EFI_MEDIA_HD_BOOT           If given device path contains MEDIA_DEVICE_PATH type device path node \r
+  @retval BDS_EFI_MEDIA_HD_BOOT           If given device path contains MEDIA_DEVICE_PATH type device path node\r
                                           which subtype is MEDIA_HARDDRIVE_DP\r
   @retval BDS_EFI_MEDIA_CDROM_BOOT        If given device path contains MEDIA_DEVICE_PATH type device path node\r
                                           which subtype is MEDIA_CDROM_DP\r
@@ -1546,7 +1601,7 @@ BdsLibNetworkBootWithMediaPresent (
   @retval BDS_EFI_MESSAGE_MISC_BOOT       If the device path not contains any media device path node,  and\r
                                           its last device path node point to a message device path node.\r
   @retval BDS_LEGACY_BBS_BOOT             If given device path contains BBS_DEVICE_PATH type device path node.\r
-  @retval BDS_EFI_UNSUPPORT               An EFI Removable BlockIO device path not point to a media and message device,   \r
+  @retval BDS_EFI_UNSUPPORT               An EFI Removable BlockIO device path not point to a media and message device,\r
 \r
 **/\r
 UINT32\r
@@ -1599,7 +1654,7 @@ BdsGetBootTypeFromDevicePath (
         // 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
@@ -1610,6 +1665,8 @@ BdsGetBootTypeFromDevicePath (
           return BDS_EFI_MESSAGE_SCSI_BOOT;\r
         } else if (DevicePathSubType(TempDevicePath) == MSG_SATA_DP) {\r
           return BDS_EFI_MESSAGE_SATA_BOOT;\r
+        } else if (DevicePathSubType(TempDevicePath) == MSG_MAC_ADDR_DP) {\r
+          return BDS_EFI_MESSAGE_MAC_BOOT;\r
         }\r
         return BDS_EFI_MESSAGE_MISC_BOOT;\r
       default:\r
@@ -1621,41 +1678,6 @@ BdsGetBootTypeFromDevicePath (
   return BDS_EFI_UNSUPPORT;\r
 }\r
 \r
-\r
-/** \r
-  Check whether the descriptionis is conflict with the description reserved for\r
-  auto-created boot options.\r
-\r
-  @param  Description  The Description in a boot option\r
-  \r
-  @retval TRUE    The description is conflict with the description reserved for\r
-                  auto-created boot options.\r
-  @retval FALSE   The description is not conflict with the description reserved.\r
-  \r
-**/\r
-BOOLEAN\r
-EFIAPI\r
-CheckDescritptionConflict (\r
-  IN CHAR16                       *Description\r
-  )\r
-{\r
-  if (Description == NULL) {\r
-    return FALSE;  \r
-  }\r
-  if ((CompareMem (Description, DESCRIPTION_FLOPPY, StrLen (DESCRIPTION_FLOPPY) * sizeof (CHAR16)) == 0)  ||\r
-      (CompareMem (Description, DESCRIPTION_DVD, StrLen (DESCRIPTION_DVD) * sizeof (CHAR16)) == 0)        ||\r
-      (CompareMem (Description, DESCRIPTION_USB, StrLen (DESCRIPTION_USB) * sizeof (CHAR16)) == 0)        ||\r
-      (CompareMem (Description, DESCRIPTION_SCSI, StrLen (DESCRIPTION_SCSI) * sizeof (CHAR16)) == 0)      ||\r
-      (CompareMem (Description, DESCRIPTION_MISC, StrLen (DESCRIPTION_MISC) * sizeof (CHAR16)) == 0)      ||\r
-      (CompareMem (Description, DESCRIPTION_NETWORK, StrLen (DESCRIPTION_NETWORK) * sizeof (CHAR16)) == 0)||\r
-      (CompareMem (Description, DESCRIPTION_NON_BLOCK, StrLen (DESCRIPTION_NON_BLOCK) * sizeof (CHAR16)) == 0)) { \r
-     return TRUE;\r
-  }\r
-\r
-  return FALSE;\r
-}\r
-\r
-\r
 /**\r
   Check whether the Device path in a boot option point to a valid bootable device,\r
   And if CheckMedia is true, check the device is ready to boot now.\r
@@ -1708,7 +1730,7 @@ BdsLibIsValidEFIBootOptDevicePathExt (
 \r
   TempDevicePath = DevPath;\r
   LastDeviceNode = DevPath;\r
-  \r
+\r
   //\r
   // Check if it's a valid boot option for network boot device\r
   // Only check if there is SimpleNetworkProtocol installed. If yes, that means\r
@@ -1731,7 +1753,7 @@ BdsLibIsValidEFIBootOptDevicePathExt (
                     &Handle\r
                     );\r
   }\r
-  \r
+\r
   if (!EFI_ERROR (Status)) {\r
     if (CheckMedia) {\r
       //\r
@@ -1765,22 +1787,22 @@ BdsLibIsValidEFIBootOptDevicePathExt (
     //\r
     // If the boot option point to Internal FV shell, make sure it is valid\r
     //\r
-    TempDevicePath = DevPath; \r
+    TempDevicePath = DevPath;\r
     Status = BdsLibUpdateFvFileDevicePath (&TempDevicePath, PcdGetPtr(PcdShellFile));\r
     if (Status == EFI_ALREADY_STARTED) {\r
       return TRUE;\r
     } else {\r
       if (Status == EFI_SUCCESS) {\r
-        FreePool (TempDevicePath); \r
+        FreePool (TempDevicePath);\r
       }\r
       return FALSE;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // If the boot option point to a blockIO device:\r
   //    if it is a removable blockIo device, it is valid.\r
-  //    if it is a fixed blockIo device, check its description confliction. \r
+  //    if it is a fixed blockIo device, check its description confliction.\r
   //\r
   TempDevicePath = DevPath;\r
   Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &TempDevicePath, &Handle);\r
@@ -1797,24 +1819,10 @@ BdsLibIsValidEFIBootOptDevicePathExt (
       Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &TempDevicePath, &Handle);\r
     }\r
   }\r
-  \r
+\r
   if (!EFI_ERROR (Status)) {\r
     Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlockIo);\r
     if (!EFI_ERROR (Status)) {\r
-      if (!BlockIo->Media->RemovableMedia) {\r
-        //\r
-        // For the Fixed block devices, check its description whether conflict\r
-        // with other auto-created boot options. BDS permit a boot option point to \r
-        // Fixed block device, but not permit it use the description reserved for\r
-        // auto-created boot options.\r
-        // The check is to cover the bug, that replace a removable BlockIo device\r
-        // with a fixed BlockIo device at the same port, but the removable device's\r
-        // boot option can not be automatically deleted.\r
-        //\r
-        if (CheckDescritptionConflict (Description)) {\r
-           return FALSE; \r
-        }\r
-      }      \r
       if (CheckMedia) {\r
         //\r
         // Test if it is ready to boot now\r
@@ -1900,7 +1908,7 @@ BdsLibUpdateFvFileDevicePath (
   if (FileGuid == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   //\r
   // Check whether the device path point to the default the input Fv file\r
   //\r
@@ -2034,7 +2042,7 @@ BdsLibUpdateFvFileDevicePath (
     }\r
 \r
     if (FvHandleBuffer != NULL) {\r
-      FreePool (FvHandleBuffer);  \r
+      FreePool (FvHandleBuffer);\r
     }\r
   }\r
 \r