diff options
author | Feng Tian <feng.tian@intel.com> | 2016-06-29 11:15:50 +0800 |
---|---|---|
committer | Feng Tian <feng.tian@intel.com> | 2016-07-01 14:44:51 +0800 |
commit | a4c5a436c8bd9c8bef84f2642897fd5cca1dcfb6 (patch) | |
tree | 27f2ff44929e3d93507ff5ade7719c0ddeb619c0 /MdeModulePkg | |
parent | 3b1d8241d0dac25c5e678c364fa2754ac1731060 (diff) | |
download | edk2-platforms-a4c5a436c8bd9c8bef84f2642897fd5cca1dcfb6.tar.xz |
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>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c | 138 |
1 files changed, 45 insertions, 93 deletions
diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c index d3602a5000..5040882d62 100644 --- a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c +++ b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c @@ -443,77 +443,60 @@ InstallProtocolOnPartition ( //
// Install BlkIo/BlkIo2/Ssp for the specified partition
//
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Partition->Handle,
- &gEfiDevicePathProtocolGuid,
- Partition->DevicePath,
- &gEfiBlockIoProtocolGuid,
- &Partition->BlockIo,
- &gEfiBlockIo2ProtocolGuid,
- &Partition->BlockIo2,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
if (Partition->PartitionType != EmmcPartitionRPMB) {
- Status = gBS->InstallProtocolInterface (
+ Status = gBS->InstallMultipleProtocolInterfaces (
&Partition->Handle,
+ &gEfiDevicePathProtocolGuid,
+ Partition->DevicePath,
+ &gEfiBlockIoProtocolGuid,
+ &Partition->BlockIo,
+ &gEfiBlockIo2ProtocolGuid,
+ &Partition->BlockIo2,
&gEfiEraseBlockProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &Partition->EraseBlock
+ &Partition->EraseBlock,
+ NULL
);
if (EFI_ERROR (Status)) {
- gBS->UninstallMultipleProtocolInterfaces (
- &Partition->Handle,
- &gEfiDevicePathProtocolGuid,
- Partition->DevicePath,
- &gEfiBlockIoProtocolGuid,
- &Partition->BlockIo,
- &gEfiBlockIo2ProtocolGuid,
- &Partition->BlockIo2,
- NULL
- );
goto Error;
}
- }
- if (((Partition->PartitionType == EmmcPartitionUserData) ||
- (Partition->PartitionType == EmmcPartitionBoot1) ||
- (Partition->PartitionType == EmmcPartitionBoot2)) &&
- ((Device->Csd.Ccc & BIT10) != 0)) {
- Status = gBS->InstallProtocolInterface (
- &Partition->Handle,
- &gEfiStorageSecurityCommandProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &Partition->StorageSecurity
- );
- if (EFI_ERROR (Status)) {
- gBS->UninstallMultipleProtocolInterfaces (
- &Partition->Handle,
- &gEfiDevicePathProtocolGuid,
- Partition->DevicePath,
- &gEfiBlockIoProtocolGuid,
- &Partition->BlockIo,
- &gEfiBlockIo2ProtocolGuid,
- &Partition->BlockIo2,
- &gEfiEraseBlockProtocolGuid,
- &Partition->EraseBlock,
- NULL
- );
- goto Error;
+ if (((Partition->PartitionType == EmmcPartitionUserData) ||
+ (Partition->PartitionType == EmmcPartitionBoot1) ||
+ (Partition->PartitionType == EmmcPartitionBoot2)) &&
+ ((Device->Csd.Ccc & BIT10) != 0)) {
+ Status = gBS->InstallProtocolInterface (
+ &Partition->Handle,
+ &gEfiStorageSecurityCommandProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &Partition->StorageSecurity
+ );
+ if (EFI_ERROR (Status)) {
+ gBS->UninstallMultipleProtocolInterfaces (
+ &Partition->Handle,
+ &gEfiDevicePathProtocolGuid,
+ Partition->DevicePath,
+ &gEfiBlockIoProtocolGuid,
+ &Partition->BlockIo,
+ &gEfiBlockIo2ProtocolGuid,
+ &Partition->BlockIo2,
+ &gEfiEraseBlockProtocolGuid,
+ &Partition->EraseBlock,
+ NULL
+ );
+ goto Error;
+ }
}
+
+ gBS->OpenProtocol (
+ Device->Private->Controller,
+ &gEfiSdMmcPassThruProtocolGuid,
+ (VOID **) &(Device->Private->PassThru),
+ Device->Private->DriverBindingHandle,
+ Partition->Handle,
+ EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
+ );
}
- gBS->OpenProtocol (
- Device->Private->Controller,
- &gEfiSdMmcPassThruProtocolGuid,
- (VOID **) &(Device->Private->PassThru),
- Device->Private->DriverBindingHandle,
- 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)) {
@@ -1136,38 +1120,6 @@ EmmcDxeDriverBindingStop ( }
//
- // 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.
//
Status = gBS->OpenProtocol (
|