]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/PartitionDxe: Add partition type guid to installed handle
authorJeff Brasen <jbrasen.qdt@qualcommdatacenter.com>
Mon, 26 Mar 2018 08:57:04 +0000 (16:57 +0800)
committerHao Wu <hao.a.wu@intel.com>
Thu, 29 Mar 2018 05:05:19 +0000 (13:05 +0800)
Add the partition type GUID for every partition to the installed handle,
this is required per the UEFI specification.

"The firmware must add the PartitionTypeGuid to the handle of every
active GPT partition using EFI_BOOT_SERVICES.InstallProtocolInterface()."

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jeff Brasen <jbrasen.qdt@qualcommdatacenter.com>
Reviewed-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/Udf.c

index 2084ee5abec20760d4e248c64a8def0af72ac613..a7b5434a08e7cf844b05e8d197f5d9e795c2fc39 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
   Decode an El Torito formatted CD-ROM\r
 \r
+Copyright (c) 2018 Qualcomm Datacenter Technologies, Inc.\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
@@ -265,7 +266,8 @@ PartitionInstallElToritoChildHandles (
                 &PartitionInfo,\r
                 Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize),\r
                 Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize) + CdDev.PartitionSize - 1,\r
-                SubBlockSize\r
+                SubBlockSize,\r
+                NULL\r
                 );\r
       if (!EFI_ERROR (Status)) {\r
         Found = EFI_SUCCESS;\r
index 2cd3e15e8acbcf49b07615dc4b184df0b64d7495..fe26a64541c2522db335d8d62a93b459559ae70d 100644 (file)
@@ -13,6 +13,7 @@
   PartitionValidGptTable(), PartitionCheckGptEntry() routine will accept disk\r
   partition content and validate the GPT table and GPT entry.\r
 \r
+Copyright (c) 2018 Qualcomm Datacenter Technologies, Inc.\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
@@ -419,7 +420,8 @@ PartitionInstallGptChildHandles (
                &PartitionInfo,\r
                Entry->StartingLBA,\r
                Entry->EndingLBA,\r
-               BlockSize\r
+               BlockSize,\r
+               &Entry->PartitionTypeGUID\r
                );\r
   }\r
 \r
index 55e9d26bae5c8bd0ccae1e005e5b8257f274ad9b..479745b657291e7426d60f2ae5e4f32f2b55afdc 100644 (file)
@@ -11,6 +11,7 @@
         always on the first sector of a media. The first sector also contains\r
         the legacy boot strap code.\r
 \r
+Copyright (c) 2018 Qualcomm Datacenter Technologies, Inc.\r
 Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>\r
 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
@@ -246,7 +247,8 @@ PartitionInstallMbrChildHandles (
                 &PartitionInfo,\r
                 HdDev.PartitionStart,\r
                 HdDev.PartitionStart + HdDev.PartitionSize - 1,\r
-                MBR_SIZE\r
+                MBR_SIZE,\r
+                ((Mbr->Partition[Index].OSIndicator == EFI_PARTITION) ? &gEfiPartTypeSystemPartGuid: NULL)\r
                 );\r
 \r
       if (!EFI_ERROR (Status)) {\r
@@ -317,7 +319,8 @@ PartitionInstallMbrChildHandles (
                  &PartitionInfo,\r
                  HdDev.PartitionStart - ParentHdDev.PartitionStart,\r
                  HdDev.PartitionStart - ParentHdDev.PartitionStart + HdDev.PartitionSize - 1,\r
-                 MBR_SIZE\r
+                 MBR_SIZE,\r
+                 ((Mbr->Partition[0].OSIndicator == EFI_PARTITION) ? &gEfiPartTypeSystemPartGuid: NULL)\r
                  );\r
       if (!EFI_ERROR (Status)) {\r
         Found = EFI_SUCCESS;\r
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
index c763c676a9ed30ffed0d80557920f4957e30cd0d..f1a05207bfa98bd257dd18195cbdfde2b4b13053 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 - 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
@@ -65,7 +66,7 @@ typedef struct {
   UINT32                       BlockSize;\r
   BOOLEAN                      InStop;\r
 \r
-  EFI_GUID                     *EspGuid;\r
+  EFI_GUID                     TypeGuid;\r
 \r
 } PARTITION_PRIVATE_DATA;\r
 \r
@@ -327,6 +328,7 @@ PartitionComponentNameGetControllerName (
   @param[in]  Start             Start Block.\r
   @param[in]  End               End Block.\r
   @param[in]  BlockSize         Child block size.\r
+  @param[in]  TypeGuid          Parition Type Guid.\r
 \r
   @retval EFI_SUCCESS       A child handle was added.\r
   @retval other             A child handle was not added.\r
@@ -345,7 +347,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
 /**\r
index 5aac5640f672b022e501fe2c8b687db0fcae589f..83bd1742311a1bdc588ac55d2acd3b0b12bcf13c 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
   Scan for an UDF file system on a formatted media.\r
 \r
+  Copyright (c) 2018 Qualcomm Datacenter Technologies, Inc.\r
   Copyright (C) 2014-2017 Paulo Alcantara <pcacjr@zytor.com>\r
 \r
   This program and the accompanying materials are licensed and made available\r
@@ -753,7 +754,8 @@ PartitionInstallUdfChildHandles (
     &PartitionInfo,\r
     StartingLBA,\r
     EndingLBA,\r
-    Media->BlockSize\r
+    Media->BlockSize,\r
+    NULL\r
     );\r
   if (EFI_ERROR (Status)) {\r
     return (ChildCreated ? EFI_SUCCESS : Status);\r