]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
MdeModulePkg/PartitionDxe: remove always false comparison
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / PartitionDxe / Partition.c
index 1c53bf0233fdda1a82d4078b4d80af15d9a1158b..f6030e0897947c96ae98b0d35046b61d001cb893 100644 (file)
@@ -1,10 +1,10 @@
 /** @file\r
   Partition driver that produces logical BlockIo devices from a physical\r
   BlockIo device. The logical BlockIo devices are based on the format\r
-  of the raw block devices media. Currently "El Torito CD-ROM", Legacy\r
+  of the raw block devices media. Currently "El Torito CD-ROM", UDF, Legacy\r
   MBR, and GPT partition schemes are supported.\r
 \r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
 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
@@ -45,6 +45,7 @@ PARTITION_DETECT_ROUTINE mPartitionDetectRoutineTable[] = {
   PartitionInstallGptChildHandles,\r
   PartitionInstallElToritoChildHandles,\r
   PartitionInstallMbrChildHandles,\r
+  PartitionInstallUdfChildHandles,\r
   NULL\r
 };\r
 \r
@@ -305,9 +306,9 @@ PartitionDriverBindingStart (
   if (BlockIo->Media->MediaPresent ||\r
       (BlockIo->Media->RemovableMedia && !BlockIo->Media->LogicalPartition)) {\r
     //\r
-    // Try for GPT, then El Torito, and then legacy MBR partition types. If the\r
-    // media supports a given partition type install child handles to represent\r
-    // the partitions described by the media.\r
+    // Try for GPT, then El Torito, then UDF, and then legacy MBR partition\r
+    // types. If the media supports a given partition type install child handles\r
+    // to represent the partitions described by the media.\r
     //\r
     Routine = &mPartitionDetectRoutineTable[0];\r
     while (*Routine != NULL) {\r
@@ -514,6 +515,8 @@ PartitionDriverBindingStop (
                          &Private->BlockIo,\r
                          &gEfiBlockIo2ProtocolGuid,\r
                          &Private->BlockIo2,\r
+                         &gEfiPartitionInfoProtocolGuid,\r
+                         &Private->PartitionInfo,\r
                          Private->EspGuid,\r
                          NULL,\r
                          NULL\r
@@ -526,6 +529,8 @@ PartitionDriverBindingStop (
                        Private->DevicePath,\r
                        &gEfiBlockIoProtocolGuid,\r
                        &Private->BlockIo,\r
+                       &gEfiPartitionInfoProtocolGuid,\r
+                       &Private->PartitionInfo,\r
                        Private->EspGuid,\r
                        NULL,\r
                        NULL\r
@@ -1092,10 +1097,10 @@ PartitionFlushBlocksEx (
   @param[in]  ParentBlockIo2    Parent BlockIo2 interface.\r
   @param[in]  ParentDevicePath  Parent Device Path.\r
   @param[in]  DevicePathNode    Child Device Path node.\r
+  @param[in]  PartitionInfo     Child Partition Information interface.\r
   @param[in]  Start             Start Block.\r
   @param[in]  End               End Block.\r
   @param[in]  BlockSize         Child block size.\r
-  @param[in]  InstallEspGuid    Flag to install EFI System Partition GUID on handle.\r
 \r
   @retval EFI_SUCCESS       A child handle was added.\r
   @retval other             A child handle was not added.\r
@@ -1111,10 +1116,10 @@ PartitionInstallChildHandle (
   IN  EFI_BLOCK_IO2_PROTOCOL       *ParentBlockIo2,\r
   IN  EFI_DEVICE_PATH_PROTOCOL     *ParentDevicePath,\r
   IN  EFI_DEVICE_PATH_PROTOCOL     *DevicePathNode,\r
+  IN  EFI_PARTITION_INFO_PROTOCOL  *PartitionInfo,\r
   IN  EFI_LBA                      Start,\r
   IN  EFI_LBA                      End,\r
-  IN  UINT32                       BlockSize,\r
-  IN  BOOLEAN                      InstallEspGuid\r
+  IN  UINT32                       BlockSize\r
   )\r
 {\r
   EFI_STATUS              Status;\r
@@ -1203,7 +1208,12 @@ PartitionInstallChildHandle (
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
-  if (InstallEspGuid) {\r
+  //\r
+  // Set the PartitionInfo into Private Data.\r
+  //\r
+  CopyMem (&Private->PartitionInfo, PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));\r
+\r
+  if ((PartitionInfo->System == 1)) {\r
     Private->EspGuid = &gEfiPartTypeSystemPartGuid;\r
   } else {\r
     //\r
@@ -1225,6 +1235,8 @@ PartitionInstallChildHandle (
                     &Private->BlockIo,\r
                     &gEfiBlockIo2ProtocolGuid,\r
                     &Private->BlockIo2,\r
+                    &gEfiPartitionInfoProtocolGuid,\r
+                    &Private->PartitionInfo,\r
                     Private->EspGuid,\r
                     NULL,\r
                     NULL\r
@@ -1236,6 +1248,8 @@ PartitionInstallChildHandle (
                     Private->DevicePath,\r
                     &gEfiBlockIoProtocolGuid,\r
                     &Private->BlockIo,\r
+                    &gEfiPartitionInfoProtocolGuid,\r
+                    &Private->PartitionInfo,\r
                     Private->EspGuid,\r
                     NULL,\r
                     NULL\r