MdeModulePkg/EmmcDxe: Don't expose BlockIo interface for RPMB partition

This change is to avoid UEFI SCT failure as UEFI SCT has no knowledge
about how to accessing a EMMC RPMB partition.

The user needs to access RPMB partition should get access through
EFI_SD_MMC_PASS_THRU protocol with authentication key & mac.

Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
This commit is contained in:
Feng Tian 2016-06-29 11:15:50 +08:00
parent 3b1d8241d0
commit a4c5a436c8
1 changed files with 45 additions and 93 deletions

View File

@ -443,6 +443,7 @@ InstallProtocolOnPartition (
//
// Install BlkIo/BlkIo2/Ssp for the specified partition
//
if (Partition->PartitionType != EmmcPartitionRPMB) {
Status = gBS->InstallMultipleProtocolInterfaces (
&Partition->Handle,
&gEfiDevicePathProtocolGuid,
@ -451,33 +452,13 @@ InstallProtocolOnPartition (
&Partition->BlockIo,
&gEfiBlockIo2ProtocolGuid,
&Partition->BlockIo2,
NULL
);
if (EFI_ERROR (Status)) {
goto Error;
}
if (Partition->PartitionType != EmmcPartitionRPMB) {
Status = gBS->InstallProtocolInterface (
&Partition->Handle,
&gEfiEraseBlockProtocolGuid,
EFI_NATIVE_INTERFACE,
&Partition->EraseBlock
);
if (EFI_ERROR (Status)) {
gBS->UninstallMultipleProtocolInterfaces (
&Partition->Handle,
&gEfiDevicePathProtocolGuid,
Partition->DevicePath,
&gEfiBlockIoProtocolGuid,
&Partition->BlockIo,
&gEfiBlockIo2ProtocolGuid,
&Partition->BlockIo2,
&Partition->EraseBlock,
NULL
);
if (EFI_ERROR (Status)) {
goto Error;
}
}
if (((Partition->PartitionType == EmmcPartitionUserData) ||
(Partition->PartitionType == EmmcPartitionBoot1) ||
@ -514,6 +495,8 @@ InstallProtocolOnPartition (
Partition->Handle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
}
} else {
Status = EFI_INVALID_PARAMETER;
}
@ -993,7 +976,6 @@ EmmcDxeDriverBindingStop (
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_BLOCK_IO2_PROTOCOL *BlockIo2;
EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *StorageSecurity;
EFI_ERASE_BLOCK_PROTOCOL *EraseBlock;
LIST_ENTRY *Link;
LIST_ENTRY *NextLink;
EMMC_REQUEST *Request;
@ -1120,6 +1102,8 @@ EmmcDxeDriverBindingStop (
&Partition->BlockIo,
&gEfiBlockIo2ProtocolGuid,
&Partition->BlockIo2,
&gEfiEraseBlockProtocolGuid,
&Partition->EraseBlock,
NULL
);
if (EFI_ERROR (Status)) {
@ -1135,38 +1119,6 @@ EmmcDxeDriverBindingStop (
continue;
}
//
// If Erase Block Protocol is installed, then uninstall this protocol.
//
Status = gBS->OpenProtocol (
ChildHandleBuffer[Index],
&gEfiEraseBlockProtocolGuid,
(VOID **) &EraseBlock,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (!EFI_ERROR (Status)) {
Status = gBS->UninstallProtocolInterface (
ChildHandleBuffer[Index],
&gEfiEraseBlockProtocolGuid,
&Partition->EraseBlock
);
if (EFI_ERROR (Status)) {
gBS->OpenProtocol (
Controller,
&gEfiSdMmcPassThruProtocolGuid,
(VOID **) &Partition->Device->Private->PassThru,
This->DriverBindingHandle,
ChildHandleBuffer[Index],
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
AllChildrenStopped = FALSE;
continue;
}
}
//
// If Storage Security Command Protocol is installed, then uninstall this protocol.
//