]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/PartitionDxe: Merge the discovery of ElTorito into UDF
authorHao Wu <hao.a.wu@intel.com>
Fri, 13 Oct 2017 07:14:51 +0000 (15:14 +0800)
committerHao Wu <hao.a.wu@intel.com>
Mon, 20 Nov 2017 00:54:17 +0000 (08:54 +0800)
In order to create all of the children (El Torito standard and UDF) for
a CD/DVD media in an entry of the PartitionDriverBindingStart(), this
commit merges the discovery of the El Torito feature
(PartitionInstallElToritoChildHandles) into function
PartitionInstallUdfChildHandles.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Paulo Alcantara <pcacjr@zytor.com>
MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c

index f6030e0897947c96ae98b0d35046b61d001cb893..603abfe55a80ccf89a175acd7479f1805c9442b8 100644 (file)
@@ -43,7 +43,6 @@ EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding = {
 //\r
 PARTITION_DETECT_ROUTINE mPartitionDetectRoutineTable[] = {\r
   PartitionInstallGptChildHandles,\r
-  PartitionInstallElToritoChildHandles,\r
   PartitionInstallMbrChildHandles,\r
   PartitionInstallUdfChildHandles,\r
   NULL\r
@@ -306,9 +305,9 @@ PartitionDriverBindingStart (
   if (BlockIo->Media->MediaPresent ||\r
       (BlockIo->Media->RemovableMedia && !BlockIo->Media->LogicalPartition)) {\r
     //\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
+    // Try for GPT, then legacy MBR partition types, and then UDF and El Torito.\r
+    // If the media supports a given partition type install child handles to\r
+    // represent the partitions described by the media.\r
     //\r
     Routine = &mPartitionDetectRoutineTable[0];\r
     while (*Routine != NULL) {\r
index 7eee74895872134d81cc2c99c23a3bf95bf54a71..5aac5640f672b022e501fe2c8b687db0fcae589f 100644 (file)
@@ -688,8 +688,10 @@ PartitionInstallUdfChildHandles (
   EFI_PARTITION_INFO_PROTOCOL  PartitionInfo;\r
   EFI_LBA                      StartingLBA;\r
   EFI_LBA                      EndingLBA;\r
+  BOOLEAN                      ChildCreated;\r
 \r
   Media = BlockIo->Media;\r
+  ChildCreated = FALSE;\r
 \r
   //\r
   // Check if UDF logical block size is multiple of underlying device block size\r
@@ -703,12 +705,30 @@ PartitionInstallUdfChildHandles (
     return EFI_NOT_FOUND;\r
   }\r
 \r
+  //\r
+  // Detect El Torito feature first.\r
+  // And always continue to search for UDF.\r
+  //\r
+  Status = PartitionInstallElToritoChildHandles (\r
+             This,\r
+             Handle,\r
+             DiskIo,\r
+             DiskIo2,\r
+             BlockIo,\r
+             BlockIo2,\r
+             DevicePath\r
+             );\r
+  if (!EFI_ERROR (Status)) {\r
+    DEBUG ((DEBUG_INFO, "PartitionDxe: El Torito standard found on handle 0x%p.\n", Handle));\r
+    ChildCreated = TRUE;\r
+  }\r
+\r
   //\r
   // Search for an UDF file system on block device\r
   //\r
   Status = FindUdfFileSystem (BlockIo, DiskIo, &StartingLBA, &EndingLBA);\r
   if (EFI_ERROR (Status)) {\r
-    return EFI_NOT_FOUND;\r
+    return (ChildCreated ? EFI_SUCCESS : EFI_NOT_FOUND);\r
   }\r
 \r
   //\r
@@ -735,6 +755,9 @@ PartitionInstallUdfChildHandles (
     EndingLBA,\r
     Media->BlockSize\r
     );\r
+  if (EFI_ERROR (Status)) {\r
+    return (ChildCreated ? EFI_SUCCESS : Status);\r
+  }\r
 \r
-  return Status;\r
+  return EFI_SUCCESS;\r
 }\r