]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/PartitionDxe: Add impl of Partition Information Protocol
authorHao Wu <hao.a.wu@intel.com>
Tue, 20 Jun 2017 02:51:53 +0000 (10:51 +0800)
committerHao Wu <hao.a.wu@intel.com>
Tue, 11 Jul 2017 00:43:02 +0000 (08:43 +0800)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bret Barkelew <brbarkel@microsoft.com>
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c
MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h
MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf

index 2af38429dd3a20f10242a0725b7ea755ad24914f..2084ee5abec20760d4e248c64a8def0af72ac613 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Decode an El Torito formatted CD-ROM\r
 \r
 /** @file\r
   Decode an El Torito formatted CD-ROM\r
 \r
-Copyright (c) 2006 - 2016, 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
 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
@@ -44,22 +44,23 @@ PartitionInstallElToritoChildHandles (
   IN  EFI_DEVICE_PATH_PROTOCOL     *DevicePath\r
   )\r
 {\r
   IN  EFI_DEVICE_PATH_PROTOCOL     *DevicePath\r
   )\r
 {\r
-  EFI_STATUS              Status;\r
-  UINT64                  VolDescriptorOffset;\r
-  UINT32                  Lba2KB;\r
-  EFI_BLOCK_IO_MEDIA      *Media;\r
-  CDROM_VOLUME_DESCRIPTOR *VolDescriptor;\r
-  ELTORITO_CATALOG        *Catalog;\r
-  UINTN                   Check;\r
-  UINTN                   Index;\r
-  UINTN                   BootEntry;\r
-  UINTN                   MaxIndex;\r
-  UINT16                  *CheckBuffer;\r
-  CDROM_DEVICE_PATH       CdDev;\r
-  UINT32                  SubBlockSize;\r
-  UINT32                  SectorCount;\r
-  EFI_STATUS              Found;\r
-  UINT32                  VolSpaceSize;\r
+  EFI_STATUS                   Status;\r
+  UINT64                       VolDescriptorOffset;\r
+  UINT32                       Lba2KB;\r
+  EFI_BLOCK_IO_MEDIA           *Media;\r
+  CDROM_VOLUME_DESCRIPTOR      *VolDescriptor;\r
+  ELTORITO_CATALOG             *Catalog;\r
+  UINTN                        Check;\r
+  UINTN                        Index;\r
+  UINTN                        BootEntry;\r
+  UINTN                        MaxIndex;\r
+  UINT16                       *CheckBuffer;\r
+  CDROM_DEVICE_PATH            CdDev;\r
+  UINT32                       SubBlockSize;\r
+  UINT32                       SectorCount;\r
+  EFI_STATUS                   Found;\r
+  UINT32                       VolSpaceSize;\r
+  EFI_PARTITION_INFO_PROTOCOL  PartitionInfo;\r
 \r
   Found         = EFI_NOT_FOUND;\r
   Media         = BlockIo->Media;\r
 \r
   Found         = EFI_NOT_FOUND;\r
   Media         = BlockIo->Media;\r
@@ -248,6 +249,10 @@ PartitionInstallElToritoChildHandles (
                                 );\r
       }\r
 \r
                                 );\r
       }\r
 \r
+      ZeroMem (&PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));\r
+      PartitionInfo.Revision = EFI_PARTITION_INFO_PROTOCOL_REVISION;\r
+      PartitionInfo.Type     = PARTITION_TYPE_OTHER;\r
+\r
       Status = PartitionInstallChildHandle (\r
                 This,\r
                 Handle,\r
       Status = PartitionInstallChildHandle (\r
                 This,\r
                 Handle,\r
@@ -257,10 +262,10 @@ PartitionInstallElToritoChildHandles (
                 BlockIo2,\r
                 DevicePath,\r
                 (EFI_DEVICE_PATH_PROTOCOL *) &CdDev,\r
                 BlockIo2,\r
                 DevicePath,\r
                 (EFI_DEVICE_PATH_PROTOCOL *) &CdDev,\r
+                &PartitionInfo,\r
                 Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize),\r
                 Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize) + CdDev.PartitionSize - 1,\r
                 Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize),\r
                 Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize) + CdDev.PartitionSize - 1,\r
-                SubBlockSize,\r
-                FALSE\r
+                SubBlockSize\r
                 );\r
       if (!EFI_ERROR (Status)) {\r
         Found = EFI_SUCCESS;\r
                 );\r
       if (!EFI_ERROR (Status)) {\r
         Found = EFI_SUCCESS;\r
index 35860515c13b9da3284b2a5f0d5c57cad2032016..2cd3e15e8acbcf49b07615dc4b184df0b64d7495 100644 (file)
@@ -13,7 +13,7 @@
   PartitionValidGptTable(), PartitionCheckGptEntry() routine will accept disk\r
   partition content and validate the GPT table and GPT entry.\r
 \r
   PartitionValidGptTable(), PartitionCheckGptEntry() routine will accept disk\r
   partition content and validate the GPT table and GPT entry.\r
 \r
-Copyright (c) 2006 - 2013, 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
 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
@@ -205,19 +205,20 @@ PartitionInstallGptChildHandles (
   IN  EFI_DEVICE_PATH_PROTOCOL     *DevicePath\r
   )\r
 {\r
   IN  EFI_DEVICE_PATH_PROTOCOL     *DevicePath\r
   )\r
 {\r
-  EFI_STATUS                  Status;\r
-  UINT32                      BlockSize;\r
-  EFI_LBA                     LastBlock;\r
-  MASTER_BOOT_RECORD          *ProtectiveMbr;\r
-  EFI_PARTITION_TABLE_HEADER  *PrimaryHeader;\r
-  EFI_PARTITION_TABLE_HEADER  *BackupHeader;\r
-  EFI_PARTITION_ENTRY         *PartEntry;\r
-  EFI_PARTITION_ENTRY         *Entry;\r
-  EFI_PARTITION_ENTRY_STATUS  *PEntryStatus;\r
-  UINTN                       Index;\r
-  EFI_STATUS                  GptValidStatus;\r
-  HARDDRIVE_DEVICE_PATH       HdDev;\r
-  UINT32                      MediaId;\r
+  EFI_STATUS                   Status;\r
+  UINT32                       BlockSize;\r
+  EFI_LBA                      LastBlock;\r
+  MASTER_BOOT_RECORD           *ProtectiveMbr;\r
+  EFI_PARTITION_TABLE_HEADER   *PrimaryHeader;\r
+  EFI_PARTITION_TABLE_HEADER   *BackupHeader;\r
+  EFI_PARTITION_ENTRY          *PartEntry;\r
+  EFI_PARTITION_ENTRY          *Entry;\r
+  EFI_PARTITION_ENTRY_STATUS   *PEntryStatus;\r
+  UINTN                        Index;\r
+  EFI_STATUS                   GptValidStatus;\r
+  HARDDRIVE_DEVICE_PATH        HdDev;\r
+  UINT32                       MediaId;\r
+  EFI_PARTITION_INFO_PROTOCOL  PartitionInfo;\r
 \r
   ProtectiveMbr = NULL;\r
   PrimaryHeader = NULL;\r
 \r
   ProtectiveMbr = NULL;\r
   PrimaryHeader = NULL;\r
@@ -380,17 +381,25 @@ PartitionInstallGptChildHandles (
     }\r
 \r
     ZeroMem (&HdDev, sizeof (HdDev));\r
     }\r
 \r
     ZeroMem (&HdDev, sizeof (HdDev));\r
-    HdDev.Header.Type     = MEDIA_DEVICE_PATH;\r
-    HdDev.Header.SubType  = MEDIA_HARDDRIVE_DP;\r
+    HdDev.Header.Type      = MEDIA_DEVICE_PATH;\r
+    HdDev.Header.SubType   = MEDIA_HARDDRIVE_DP;\r
     SetDevicePathNodeLength (&HdDev.Header, sizeof (HdDev));\r
 \r
     SetDevicePathNodeLength (&HdDev.Header, sizeof (HdDev));\r
 \r
-    HdDev.PartitionNumber = (UINT32) Index + 1;\r
-    HdDev.MBRType         = MBR_TYPE_EFI_PARTITION_TABLE_HEADER;\r
-    HdDev.SignatureType   = SIGNATURE_TYPE_GUID;\r
-    HdDev.PartitionStart  = Entry->StartingLBA;\r
-    HdDev.PartitionSize   = Entry->EndingLBA - Entry->StartingLBA + 1;\r
+    HdDev.PartitionNumber  = (UINT32) Index + 1;\r
+    HdDev.MBRType          = MBR_TYPE_EFI_PARTITION_TABLE_HEADER;\r
+    HdDev.SignatureType    = SIGNATURE_TYPE_GUID;\r
+    HdDev.PartitionStart   = Entry->StartingLBA;\r
+    HdDev.PartitionSize    = Entry->EndingLBA - Entry->StartingLBA + 1;\r
     CopyMem (HdDev.Signature, &Entry->UniquePartitionGUID, sizeof (EFI_GUID));\r
 \r
     CopyMem (HdDev.Signature, &Entry->UniquePartitionGUID, sizeof (EFI_GUID));\r
 \r
+    ZeroMem (&PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));\r
+    PartitionInfo.Revision = EFI_PARTITION_INFO_PROTOCOL_REVISION;\r
+    PartitionInfo.Type     = PARTITION_TYPE_GPT;\r
+    if (CompareGuid (&Entry->PartitionTypeGUID, &gEfiPartTypeSystemPartGuid)) {\r
+      PartitionInfo.System = 1;\r
+    }\r
+    CopyMem (&PartitionInfo.Info.Gpt, Entry, sizeof (EFI_PARTITION_ENTRY));\r
+\r
     DEBUG ((EFI_D_INFO, " Index : %d\n", (UINT32) Index));\r
     DEBUG ((EFI_D_INFO, " Start LBA : %lx\n", (UINT64) HdDev.PartitionStart));\r
     DEBUG ((EFI_D_INFO, " End LBA : %lx\n", (UINT64) Entry->EndingLBA));\r
     DEBUG ((EFI_D_INFO, " Index : %d\n", (UINT32) Index));\r
     DEBUG ((EFI_D_INFO, " Start LBA : %lx\n", (UINT64) HdDev.PartitionStart));\r
     DEBUG ((EFI_D_INFO, " End LBA : %lx\n", (UINT64) Entry->EndingLBA));\r
@@ -407,10 +416,10 @@ PartitionInstallGptChildHandles (
                BlockIo2,\r
                DevicePath,\r
                (EFI_DEVICE_PATH_PROTOCOL *) &HdDev,\r
                BlockIo2,\r
                DevicePath,\r
                (EFI_DEVICE_PATH_PROTOCOL *) &HdDev,\r
+               &PartitionInfo,\r
                Entry->StartingLBA,\r
                Entry->EndingLBA,\r
                Entry->StartingLBA,\r
                Entry->EndingLBA,\r
-               BlockSize,\r
-               CompareGuid(&Entry->PartitionTypeGUID, &gEfiPartTypeSystemPartGuid)\r
+               BlockSize\r
                );\r
   }\r
 \r
                );\r
   }\r
 \r
index 377fb1931998cce0e9f2e8fd6ed66e8a48f7559d..55e9d26bae5c8bd0ccae1e005e5b8257f274ad9b 100644 (file)
@@ -12,7 +12,7 @@
         the legacy boot strap code.\r
 \r
 Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>\r
         the legacy boot strap code.\r
 \r
 Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>\r
-Copyright (c) 2006 - 2016, 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
 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
@@ -129,18 +129,19 @@ PartitionInstallMbrChildHandles (
   IN  EFI_DEVICE_PATH_PROTOCOL     *DevicePath\r
   )\r
 {\r
   IN  EFI_DEVICE_PATH_PROTOCOL     *DevicePath\r
   )\r
 {\r
-  EFI_STATUS                Status;\r
-  MASTER_BOOT_RECORD        *Mbr;\r
-  UINT32                    ExtMbrStartingLba;\r
-  UINT32                    Index;\r
-  HARDDRIVE_DEVICE_PATH     HdDev;\r
-  HARDDRIVE_DEVICE_PATH     ParentHdDev;\r
-  EFI_STATUS                Found;\r
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePathNode;\r
-  EFI_DEVICE_PATH_PROTOCOL  *LastDevicePathNode;\r
-  UINT32                    BlockSize;\r
-  UINT32                    MediaId;\r
-  EFI_LBA                   LastBlock;\r
+  EFI_STATUS                   Status;\r
+  MASTER_BOOT_RECORD           *Mbr;\r
+  UINT32                       ExtMbrStartingLba;\r
+  UINT32                       Index;\r
+  HARDDRIVE_DEVICE_PATH        HdDev;\r
+  HARDDRIVE_DEVICE_PATH        ParentHdDev;\r
+  EFI_STATUS                   Found;\r
+  EFI_DEVICE_PATH_PROTOCOL     *DevicePathNode;\r
+  EFI_DEVICE_PATH_PROTOCOL     *LastDevicePathNode;\r
+  UINT32                       BlockSize;\r
+  UINT32                       MediaId;\r
+  EFI_LBA                      LastBlock;\r
+  EFI_PARTITION_INFO_PROTOCOL  PartitionInfo;\r
 \r
   Found           = EFI_NOT_FOUND;\r
 \r
 \r
   Found           = EFI_NOT_FOUND;\r
 \r
@@ -225,6 +226,14 @@ PartitionInstallMbrChildHandles (
       HdDev.PartitionSize   = UNPACK_UINT32 (Mbr->Partition[Index].SizeInLBA);\r
       CopyMem (HdDev.Signature, &(Mbr->UniqueMbrSignature[0]), sizeof (Mbr->UniqueMbrSignature));\r
 \r
       HdDev.PartitionSize   = UNPACK_UINT32 (Mbr->Partition[Index].SizeInLBA);\r
       CopyMem (HdDev.Signature, &(Mbr->UniqueMbrSignature[0]), sizeof (Mbr->UniqueMbrSignature));\r
 \r
+      ZeroMem (&PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));\r
+      PartitionInfo.Revision = EFI_PARTITION_INFO_PROTOCOL_REVISION;\r
+      PartitionInfo.Type     = PARTITION_TYPE_MBR;\r
+      if (Mbr->Partition[Index].OSIndicator == EFI_PARTITION) {\r
+        PartitionInfo.System = 1;\r
+      }\r
+      CopyMem (&PartitionInfo.Info.Mbr, &Mbr->Partition[Index], sizeof (MBR_PARTITION_RECORD));\r
+\r
       Status = PartitionInstallChildHandle (\r
                 This,\r
                 Handle,\r
       Status = PartitionInstallChildHandle (\r
                 This,\r
                 Handle,\r
@@ -234,10 +243,10 @@ PartitionInstallMbrChildHandles (
                 BlockIo2,\r
                 DevicePath,\r
                 (EFI_DEVICE_PATH_PROTOCOL *) &HdDev,\r
                 BlockIo2,\r
                 DevicePath,\r
                 (EFI_DEVICE_PATH_PROTOCOL *) &HdDev,\r
+                &PartitionInfo,\r
                 HdDev.PartitionStart,\r
                 HdDev.PartitionStart + HdDev.PartitionSize - 1,\r
                 HdDev.PartitionStart,\r
                 HdDev.PartitionStart + HdDev.PartitionSize - 1,\r
-                MBR_SIZE,\r
-                (BOOLEAN) (Mbr->Partition[Index].OSIndicator == EFI_PARTITION)\r
+                MBR_SIZE\r
                 );\r
 \r
       if (!EFI_ERROR (Status)) {\r
                 );\r
 \r
       if (!EFI_ERROR (Status)) {\r
@@ -288,6 +297,14 @@ PartitionInstallMbrChildHandles (
       //\r
       *((UINT32 *) &HdDev.Signature[0]) = 0;\r
 \r
       //\r
       *((UINT32 *) &HdDev.Signature[0]) = 0;\r
 \r
+      ZeroMem (&PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));\r
+      PartitionInfo.Revision = EFI_PARTITION_INFO_PROTOCOL_REVISION;\r
+      PartitionInfo.Type     = PARTITION_TYPE_MBR;\r
+      if (Mbr->Partition[0].OSIndicator == EFI_PARTITION) {\r
+        PartitionInfo.System = 1;\r
+      }\r
+      CopyMem (&PartitionInfo.Info.Mbr, &Mbr->Partition[0], sizeof (MBR_PARTITION_RECORD));\r
+\r
       Status = PartitionInstallChildHandle (\r
                  This,\r
                  Handle,\r
       Status = PartitionInstallChildHandle (\r
                  This,\r
                  Handle,\r
@@ -297,10 +314,10 @@ PartitionInstallMbrChildHandles (
                  BlockIo2,\r
                  DevicePath,\r
                  (EFI_DEVICE_PATH_PROTOCOL *) &HdDev,\r
                  BlockIo2,\r
                  DevicePath,\r
                  (EFI_DEVICE_PATH_PROTOCOL *) &HdDev,\r
+                 &PartitionInfo,\r
                  HdDev.PartitionStart - ParentHdDev.PartitionStart,\r
                  HdDev.PartitionStart - ParentHdDev.PartitionStart + HdDev.PartitionSize - 1,\r
                  HdDev.PartitionStart - ParentHdDev.PartitionStart,\r
                  HdDev.PartitionStart - ParentHdDev.PartitionStart + HdDev.PartitionSize - 1,\r
-                 MBR_SIZE,\r
-                 (BOOLEAN) (Mbr->Partition[0].OSIndicator == EFI_PARTITION)\r
+                 MBR_SIZE\r
                  );\r
       if (!EFI_ERROR (Status)) {\r
         Found = EFI_SUCCESS;\r
                  );\r
       if (!EFI_ERROR (Status)) {\r
         Found = EFI_SUCCESS;\r
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
   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
 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
                          &Private->BlockIo,\r
                          &gEfiBlockIo2ProtocolGuid,\r
                          &Private->BlockIo2,\r
+                         &gEfiPartitionInfoProtocolGuid,\r
+                         &Private->PartitionInfo,\r
                          Private->EspGuid,\r
                          NULL,\r
                          NULL\r
                          Private->EspGuid,\r
                          NULL,\r
                          NULL\r
@@ -526,6 +528,8 @@ PartitionDriverBindingStop (
                        Private->DevicePath,\r
                        &gEfiBlockIoProtocolGuid,\r
                        &Private->BlockIo,\r
                        Private->DevicePath,\r
                        &gEfiBlockIoProtocolGuid,\r
                        &Private->BlockIo,\r
+                       &gEfiPartitionInfoProtocolGuid,\r
+                       &Private->PartitionInfo,\r
                        Private->EspGuid,\r
                        NULL,\r
                        NULL\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]  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]  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
 \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_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  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
   )\r
 {\r
   EFI_STATUS              Status;\r
@@ -1203,7 +1207,12 @@ PartitionInstallChildHandle (
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
     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
     Private->EspGuid = &gEfiPartTypeSystemPartGuid;\r
   } else {\r
     //\r
@@ -1225,6 +1234,8 @@ PartitionInstallChildHandle (
                     &Private->BlockIo,\r
                     &gEfiBlockIo2ProtocolGuid,\r
                     &Private->BlockIo2,\r
                     &Private->BlockIo,\r
                     &gEfiBlockIo2ProtocolGuid,\r
                     &Private->BlockIo2,\r
+                    &gEfiPartitionInfoProtocolGuid,\r
+                    &Private->PartitionInfo,\r
                     Private->EspGuid,\r
                     NULL,\r
                     NULL\r
                     Private->EspGuid,\r
                     NULL,\r
                     NULL\r
@@ -1236,6 +1247,8 @@ PartitionInstallChildHandle (
                     Private->DevicePath,\r
                     &gEfiBlockIoProtocolGuid,\r
                     &Private->BlockIo,\r
                     Private->DevicePath,\r
                     &gEfiBlockIoProtocolGuid,\r
                     &Private->BlockIo,\r
+                    &gEfiPartitionInfoProtocolGuid,\r
+                    &Private->PartitionInfo,\r
                     Private->EspGuid,\r
                     NULL,\r
                     NULL\r
                     Private->EspGuid,\r
                     NULL,\r
                     NULL\r
index 7cb19882cb2df0ab8f8ed18b3c2225175adc6de6..f2f61853173f0f2ad69064b0c7aebbf80063256e 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
   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 - 2011, 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
 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
@@ -27,6 +27,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/DriverBinding.h>\r
 #include <Protocol/DiskIo.h>\r
 #include <Protocol/DiskIo2.h>\r
 #include <Protocol/DriverBinding.h>\r
 #include <Protocol/DiskIo.h>\r
 #include <Protocol/DiskIo2.h>\r
+#include <Protocol/PartitionInfo.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/BaseLib.h>\r
@@ -45,25 +46,26 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 //\r
 #define PARTITION_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('P', 'a', 'r', 't')\r
 typedef struct {\r
 //\r
 #define PARTITION_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('P', 'a', 'r', 't')\r
 typedef struct {\r
-  UINT64                    Signature;\r
-\r
-  EFI_HANDLE                Handle;\r
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
-  EFI_BLOCK_IO_PROTOCOL     BlockIo;\r
-  EFI_BLOCK_IO2_PROTOCOL    BlockIo2;\r
-  EFI_BLOCK_IO_MEDIA        Media;\r
-  EFI_BLOCK_IO_MEDIA        Media2;//For BlockIO2\r
-\r
-  EFI_DISK_IO_PROTOCOL      *DiskIo;\r
-  EFI_DISK_IO2_PROTOCOL     *DiskIo2;\r
-  EFI_BLOCK_IO_PROTOCOL     *ParentBlockIo;\r
-  EFI_BLOCK_IO2_PROTOCOL    *ParentBlockIo2;\r
-  UINT64                    Start;\r
-  UINT64                    End;\r
-  UINT32                    BlockSize;\r
-  BOOLEAN                   InStop;\r
-\r
-  EFI_GUID                  *EspGuid;\r
+  UINT64                       Signature;\r
+\r
+  EFI_HANDLE                   Handle;\r
+  EFI_DEVICE_PATH_PROTOCOL     *DevicePath;\r
+  EFI_BLOCK_IO_PROTOCOL        BlockIo;\r
+  EFI_BLOCK_IO2_PROTOCOL       BlockIo2;\r
+  EFI_BLOCK_IO_MEDIA           Media;\r
+  EFI_BLOCK_IO_MEDIA           Media2;//For BlockIO2\r
+  EFI_PARTITION_INFO_PROTOCOL  PartitionInfo;\r
+\r
+  EFI_DISK_IO_PROTOCOL         *DiskIo;\r
+  EFI_DISK_IO2_PROTOCOL        *DiskIo2;\r
+  EFI_BLOCK_IO_PROTOCOL        *ParentBlockIo;\r
+  EFI_BLOCK_IO2_PROTOCOL       *ParentBlockIo2;\r
+  UINT64                       Start;\r
+  UINT64                       End;\r
+  UINT32                       BlockSize;\r
+  BOOLEAN                      InStop;\r
+\r
+  EFI_GUID                     *EspGuid;\r
 \r
 } PARTITION_PRIVATE_DATA;\r
 \r
 \r
 } PARTITION_PRIVATE_DATA;\r
 \r
@@ -321,10 +323,10 @@ PartitionComponentNameGetControllerName (
   @param[in]  ParentBlockIo2    Parent BlockIo2 interface.\r
   @param[in]  ParentDevicePath  Parent Device Path.\r
   @param[in]  DevicePathNode    Child Device Path node.\r
   @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]  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
 \r
   @retval EFI_SUCCESS       A child handle was added.\r
   @retval other             A child handle was not added.\r
@@ -340,10 +342,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_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  EFI_LBA                      Start,\r
   IN  EFI_LBA                      End,\r
-  IN  UINT32                       BlockSize,\r
-  IN  BOOLEAN                      InstallEspGuid\r
+  IN  UINT32                       BlockSize\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
index 680626378f3b841b3bf6f6a8d3015e15f26f4bbe..48212773e8c4d766349619d193ceff7d670ad178 100644 (file)
@@ -11,7 +11,7 @@
 #  This external input must be validated carefully to avoid security issue like\r
 #  buffer overflow, integer overflow.\r
 #\r
 #  This external input must be validated carefully to avoid security issue like\r
 #  buffer overflow, integer overflow.\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
 #  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
@@ -82,6 +82,7 @@
   ## BY_START\r
   ## TO_START\r
   gEfiDevicePathProtocolGuid\r
   ## BY_START\r
   ## TO_START\r
   gEfiDevicePathProtocolGuid\r
+  gEfiPartitionInfoProtocolGuid                 ## BY_START\r
   gEfiDiskIoProtocolGuid                        ## TO_START\r
   gEfiDiskIo2ProtocolGuid                       ## TO_START\r
 \r
   gEfiDiskIoProtocolGuid                        ## TO_START\r
   gEfiDiskIo2ProtocolGuid                       ## TO_START\r
 \r