]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
MdeModulePkg/PartitionDxe: Add partition type guid to installed handle
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / PartitionDxe / Partition.c
index 46c0877ceeae4455df8128cc397af2feac92786f..71acdcc8985140e4883288a42925a7662b4f1fd5 100644 (file)
@@ -4,6 +4,7 @@
   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) 2018 Qualcomm Datacenter Technologies, Inc.\r
 Copyright (c) 2006 - 2018, 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
@@ -401,6 +402,7 @@ PartitionDriverBindingStop (
   BOOLEAN                 AllChildrenStopped;\r
   PARTITION_PRIVATE_DATA  *Private;\r
   EFI_DISK_IO_PROTOCOL    *DiskIo;\r
+  EFI_GUID                *TypeGuid;\r
 \r
   BlockIo  = NULL;\r
   BlockIo2 = NULL;\r
@@ -493,6 +495,13 @@ PartitionDriverBindingStop (
            This->DriverBindingHandle,\r
            ChildHandleBuffer[Index]\r
            );\r
+\r
+    if (IsZeroGuid (&Private->TypeGuid)) {\r
+      TypeGuid = NULL;\r
+    } else {\r
+      TypeGuid = &Private->TypeGuid;\r
+    }\r
+\r
     //\r
     // All Software protocols have be freed from the handle so remove it.\r
     // Remove the BlockIo Protocol if has.\r
@@ -516,7 +525,7 @@ PartitionDriverBindingStop (
                          &Private->BlockIo2,\r
                          &gEfiPartitionInfoProtocolGuid,\r
                          &Private->PartitionInfo,\r
-                         Private->EspGuid,\r
+                         TypeGuid,\r
                          NULL,\r
                          NULL\r
                          );\r
@@ -530,7 +539,7 @@ PartitionDriverBindingStop (
                        &Private->BlockIo,\r
                        &gEfiPartitionInfoProtocolGuid,\r
                        &Private->PartitionInfo,\r
-                       Private->EspGuid,\r
+                       TypeGuid,\r
                        NULL,\r
                        NULL\r
                        );\r
@@ -1104,6 +1113,7 @@ PartitionFlushBlocksEx (
   @param[in]  Start             Start Block.\r
   @param[in]  End               End Block.\r
   @param[in]  BlockSize         Child block size.\r
+  @param[in]  TypeGuid          Partition GUID Type.\r
 \r
   @retval EFI_SUCCESS       A child handle was added.\r
   @retval other             A child handle was not added.\r
@@ -1122,7 +1132,8 @@ PartitionInstallChildHandle (
   IN  EFI_PARTITION_INFO_PROTOCOL  *PartitionInfo,\r
   IN  EFI_LBA                      Start,\r
   IN  EFI_LBA                      End,\r
-  IN  UINT32                       BlockSize\r
+  IN  UINT32                       BlockSize,\r
+  IN  EFI_GUID                     *TypeGuid\r
   )\r
 {\r
   EFI_STATUS              Status;\r
@@ -1216,13 +1227,10 @@ PartitionInstallChildHandle (
   //\r
   CopyMem (&Private->PartitionInfo, PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));\r
 \r
-  if (PartitionInfo->System == 1) {\r
-    Private->EspGuid = &gEfiPartTypeSystemPartGuid;\r
+  if (TypeGuid != NULL) {\r
+    CopyGuid(&(Private->TypeGuid), TypeGuid);\r
   } else {\r
-    //\r
-    // If NULL InstallMultipleProtocolInterfaces will ignore it.\r
-    //\r
-    Private->EspGuid = NULL;\r
+    ZeroMem ((VOID *)&(Private->TypeGuid), sizeof (EFI_GUID));\r
   }\r
 \r
   //\r
@@ -1240,7 +1248,7 @@ PartitionInstallChildHandle (
                     &Private->BlockIo2,\r
                     &gEfiPartitionInfoProtocolGuid,\r
                     &Private->PartitionInfo,\r
-                    Private->EspGuid,\r
+                    TypeGuid,\r
                     NULL,\r
                     NULL\r
                     );\r
@@ -1253,7 +1261,7 @@ PartitionInstallChildHandle (
                     &Private->BlockIo,\r
                     &gEfiPartitionInfoProtocolGuid,\r
                     &Private->PartitionInfo,\r
-                    Private->EspGuid,\r
+                    TypeGuid,\r
                     NULL,\r
                     NULL\r
                     );\r