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>
This commit is contained in:
Jeff Brasen 2018-03-26 16:57:04 +08:00 committed by Hao Wu
parent 0760ed06a1
commit 709c9fd56b
6 changed files with 38 additions and 18 deletions

View File

@ -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;

View File

@ -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
);
}

View File

@ -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;

View File

@ -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
);

View File

@ -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
);
/**

View File

@ -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);