summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Disk
diff options
context:
space:
mode:
authorJeff Brasen <jbrasen.qdt@qualcommdatacenter.com>2018-03-26 16:57:04 +0800
committerHao Wu <hao.a.wu@intel.com>2018-03-29 13:05:19 +0800
commit709c9fd56b2a3303e679858a4927e382f255d8e4 (patch)
tree08aba92094f658329458076143b25f997b51f18f /MdeModulePkg/Universal/Disk
parent0760ed06a139aa6f84568147e3ee4fe919469238 (diff)
downloadedk2-709c9fd56b2a3303e679858a4927e382f255d8e4.zip
edk2-709c9fd56b2a3303e679858a4927e382f255d8e4.tar.gz
edk2-709c9fd56b2a3303e679858a4927e382f255d8e4.tar.bz2
MdeModulePkg/PartitionDxe: Add partition type guid to installed handle
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>
Diffstat (limited to 'MdeModulePkg/Universal/Disk')
-rw-r--r--MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c4
-rw-r--r--MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c4
-rw-r--r--MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c7
-rw-r--r--MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c30
-rw-r--r--MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h7
-rw-r--r--MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c4
6 files changed, 38 insertions, 18 deletions
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c b/MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c
index 2084ee5..a7b5434 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c
@@ -1,6 +1,7 @@
/** @file
Decode an El Torito formatted CD-ROM
+Copyright (c) 2018 Qualcomm Datacenter Technologies, Inc.
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -265,7 +266,8 @@ PartitionInstallElToritoChildHandles (
&PartitionInfo,
Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize),
Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize) + CdDev.PartitionSize - 1,
- SubBlockSize
+ SubBlockSize,
+ NULL
);
if (!EFI_ERROR (Status)) {
Found = EFI_SUCCESS;
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
index 2cd3e15..fe26a64 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
@@ -13,6 +13,7 @@
PartitionValidGptTable(), PartitionCheckGptEntry() routine will accept disk
partition content and validate the GPT table and GPT entry.
+Copyright (c) 2018 Qualcomm Datacenter Technologies, Inc.
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -419,7 +420,8 @@ PartitionInstallGptChildHandles (
&PartitionInfo,
Entry->StartingLBA,
Entry->EndingLBA,
- BlockSize
+ BlockSize,
+ &Entry->PartitionTypeGUID
);
}
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
index 55e9d26..479745b 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
@@ -11,6 +11,7 @@
always on the first sector of a media. The first sector also contains
the legacy boot strap code.
+Copyright (c) 2018 Qualcomm Datacenter Technologies, Inc.
Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
@@ -246,7 +247,8 @@ PartitionInstallMbrChildHandles (
&PartitionInfo,
HdDev.PartitionStart,
HdDev.PartitionStart + HdDev.PartitionSize - 1,
- MBR_SIZE
+ MBR_SIZE,
+ ((Mbr->Partition[Index].OSIndicator == EFI_PARTITION) ? &gEfiPartTypeSystemPartGuid: NULL)
);
if (!EFI_ERROR (Status)) {
@@ -317,7 +319,8 @@ PartitionInstallMbrChildHandles (
&PartitionInfo,
HdDev.PartitionStart - ParentHdDev.PartitionStart,
HdDev.PartitionStart - ParentHdDev.PartitionStart + HdDev.PartitionSize - 1,
- MBR_SIZE
+ MBR_SIZE,
+ ((Mbr->Partition[0].OSIndicator == EFI_PARTITION) ? &gEfiPartTypeSystemPartGuid: NULL)
);
if (!EFI_ERROR (Status)) {
Found = EFI_SUCCESS;
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
index 46c0877..71acdcc 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
@@ -4,6 +4,7 @@
of the raw block devices media. Currently "El Torito CD-ROM", UDF, Legacy
MBR, and GPT partition schemes are supported.
+Copyright (c) 2018 Qualcomm Datacenter Technologies, Inc.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -401,6 +402,7 @@ PartitionDriverBindingStop (
BOOLEAN AllChildrenStopped;
PARTITION_PRIVATE_DATA *Private;
EFI_DISK_IO_PROTOCOL *DiskIo;
+ EFI_GUID *TypeGuid;
BlockIo = NULL;
BlockIo2 = NULL;
@@ -493,6 +495,13 @@ PartitionDriverBindingStop (
This->DriverBindingHandle,
ChildHandleBuffer[Index]
);
+
+ if (IsZeroGuid (&Private->TypeGuid)) {
+ TypeGuid = NULL;
+ } else {
+ TypeGuid = &Private->TypeGuid;
+ }
+
//
// All Software protocols have be freed from the handle so remove it.
// Remove the BlockIo Protocol if has.
@@ -516,7 +525,7 @@ PartitionDriverBindingStop (
&Private->BlockIo2,
&gEfiPartitionInfoProtocolGuid,
&Private->PartitionInfo,
- Private->EspGuid,
+ TypeGuid,
NULL,
NULL
);
@@ -530,7 +539,7 @@ PartitionDriverBindingStop (
&Private->BlockIo,
&gEfiPartitionInfoProtocolGuid,
&Private->PartitionInfo,
- Private->EspGuid,
+ TypeGuid,
NULL,
NULL
);
@@ -1104,6 +1113,7 @@ PartitionFlushBlocksEx (
@param[in] Start Start Block.
@param[in] End End Block.
@param[in] BlockSize Child block size.
+ @param[in] TypeGuid Partition GUID Type.
@retval EFI_SUCCESS A child handle was added.
@retval other A child handle was not added.
@@ -1122,7 +1132,8 @@ PartitionInstallChildHandle (
IN EFI_PARTITION_INFO_PROTOCOL *PartitionInfo,
IN EFI_LBA Start,
IN EFI_LBA End,
- IN UINT32 BlockSize
+ IN UINT32 BlockSize,
+ IN EFI_GUID *TypeGuid
)
{
EFI_STATUS Status;
@@ -1216,13 +1227,10 @@ PartitionInstallChildHandle (
//
CopyMem (&Private->PartitionInfo, PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));
- if (PartitionInfo->System == 1) {
- Private->EspGuid = &gEfiPartTypeSystemPartGuid;
+ if (TypeGuid != NULL) {
+ CopyGuid(&(Private->TypeGuid), TypeGuid);
} else {
- //
- // If NULL InstallMultipleProtocolInterfaces will ignore it.
- //
- Private->EspGuid = NULL;
+ ZeroMem ((VOID *)&(Private->TypeGuid), sizeof (EFI_GUID));
}
//
@@ -1240,7 +1248,7 @@ PartitionInstallChildHandle (
&Private->BlockIo2,
&gEfiPartitionInfoProtocolGuid,
&Private->PartitionInfo,
- Private->EspGuid,
+ TypeGuid,
NULL,
NULL
);
@@ -1253,7 +1261,7 @@ PartitionInstallChildHandle (
&Private->BlockIo,
&gEfiPartitionInfoProtocolGuid,
&Private->PartitionInfo,
- Private->EspGuid,
+ TypeGuid,
NULL,
NULL
);
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h
index c763c67..f1a0520 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h
@@ -4,6 +4,7 @@
of the raw block devices media. Currently "El Torito CD-ROM", UDF, Legacy
MBR, and GPT partition schemes are supported.
+Copyright (c) 2018 Qualcomm Datacenter Technologies, Inc.
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -65,7 +66,7 @@ typedef struct {
UINT32 BlockSize;
BOOLEAN InStop;
- EFI_GUID *EspGuid;
+ EFI_GUID TypeGuid;
} PARTITION_PRIVATE_DATA;
@@ -327,6 +328,7 @@ PartitionComponentNameGetControllerName (
@param[in] Start Start Block.
@param[in] End End Block.
@param[in] BlockSize Child block size.
+ @param[in] TypeGuid Parition Type Guid.
@retval EFI_SUCCESS A child handle was added.
@retval other A child handle was not added.
@@ -345,7 +347,8 @@ PartitionInstallChildHandle (
IN EFI_PARTITION_INFO_PROTOCOL *PartitionInfo,
IN EFI_LBA Start,
IN EFI_LBA End,
- IN UINT32 BlockSize
+ IN UINT32 BlockSize,
+ IN EFI_GUID *TypeGuid
);
/**
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c
index 5aac564..83bd174 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c
@@ -1,6 +1,7 @@
/** @file
Scan for an UDF file system on a formatted media.
+ Copyright (c) 2018 Qualcomm Datacenter Technologies, Inc.
Copyright (C) 2014-2017 Paulo Alcantara <pcacjr@zytor.com>
This program and the accompanying materials are licensed and made available
@@ -753,7 +754,8 @@ PartitionInstallUdfChildHandles (
&PartitionInfo,
StartingLBA,
EndingLBA,
- Media->BlockSize
+ Media->BlockSize,
+ NULL
);
if (EFI_ERROR (Status)) {
return (ChildCreated ? EFI_SUCCESS : Status);