]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
MdeModulePkg/PartitionDxe: Add impl of Partition Information Protocol
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / PartitionDxe / Partition.c
index 1c53bf0233fdda1a82d4078b4d80af15d9a1158b..5a7d119b43970f9c10dcbe9f6caa713b7b0705cf 100644 (file)
@@ -4,7 +4,7 @@
   of the raw block devices media. Currently "El Torito CD-ROM", 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
@@ -514,6 +514,8 @@ PartitionDriverBindingStop (
                          &Private->BlockIo,\r
                          &gEfiBlockIo2ProtocolGuid,\r
                          &Private->BlockIo2,\r
+                         &gEfiPartitionInfoProtocolGuid,\r
+                         &Private->PartitionInfo,\r
                          Private->EspGuid,\r
                          NULL,\r
                          NULL\r
@@ -526,6 +528,8 @@ PartitionDriverBindingStop (
                        Private->DevicePath,\r
                        &gEfiBlockIoProtocolGuid,\r
                        &Private->BlockIo,\r
+                       &gEfiPartitionInfoProtocolGuid,\r
+                       &Private->PartitionInfo,\r
                        Private->EspGuid,\r
                        NULL,\r
                        NULL\r
@@ -1092,10 +1096,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 +1115,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 +1207,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 +1234,8 @@ PartitionInstallChildHandle (
                     &Private->BlockIo,\r
                     &gEfiBlockIo2ProtocolGuid,\r
                     &Private->BlockIo2,\r
+                    &gEfiPartitionInfoProtocolGuid,\r
+                    &Private->PartitionInfo,\r
                     Private->EspGuid,\r
                     NULL,\r
                     NULL\r
@@ -1236,6 +1247,8 @@ PartitionInstallChildHandle (
                     Private->DevicePath,\r
                     &gEfiBlockIoProtocolGuid,\r
                     &Private->BlockIo,\r
+                    &gEfiPartitionInfoProtocolGuid,\r
+                    &Private->PartitionInfo,\r
                     Private->EspGuid,\r
                     NULL,\r
                     NULL\r