diff options
Diffstat (limited to 'SecurityPkg')
-rw-r--r-- | SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 70 |
1 files changed, 27 insertions, 43 deletions
diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c index 77905d2bf9..6bec54b932 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c @@ -2667,7 +2667,6 @@ OpalEfiDriverBindingSupported( {
EFI_STATUS Status;
EFI_STORAGE_SECURITY_COMMAND_PROTOCOL* SecurityCommand;
- EFI_BLOCK_IO_PROTOCOL* BlkIo;
if (mOpalEndOfDxe) {
return EFI_UNSUPPORTED;
@@ -2703,33 +2702,6 @@ OpalEfiDriverBindingSupported( Controller
);
- //
- // Test EFI_BLOCK_IO_PROTOCOL on controller Handle, required by EFI_STORAGE_SECURITY_COMMAND_PROTOCOL
- // function APIs
- //
- Status = gBS->OpenProtocol(
- Controller,
- &gEfiBlockIoProtocolGuid,
- (VOID **)&BlkIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR(Status)) {
- DEBUG((DEBUG_INFO, "No EFI_BLOCK_IO_PROTOCOL on controller\n"));
- return Status;
- }
-
- //
- // Close protocol and reopen in Start call
- //
- gBS->CloseProtocol(
- Controller,
- &gEfiBlockIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
return EFI_SUCCESS;
}
@@ -2827,30 +2799,42 @@ OpalEfiDriverBindingStart( );
if (EFI_ERROR(Status)) {
//
- // Close storage security that was opened
+ // Block_IO not supported on handle
//
- gBS->CloseProtocol(
- Controller,
- &gEfiStorageSecurityCommandProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
+ if(Status == EFI_UNSUPPORTED) {
+ BlkIo = NULL;
+ } else {
+ //
+ // Close storage security that was opened
+ //
+ gBS->CloseProtocol(
+ Controller,
+ &gEfiStorageSecurityCommandProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
- FreePool(Dev);
- return Status;
+ FreePool(Dev);
+ return Status;
+ }
}
//
// Save mediaId
//
- Dev->MediaId = BlkIo->Media->MediaId;
+ if(BlkIo == NULL) {
+ // If no Block IO present, use defined MediaId value.
+ Dev->MediaId = 0x0;
+ } else {
+ Dev->MediaId = BlkIo->Media->MediaId;
- gBS->CloseProtocol(
- Controller,
- &gEfiBlockIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
+ gBS->CloseProtocol(
+ Controller,
+ &gEfiBlockIoProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
);
+ }
//
// Acquire Ascii printable name of child, if not found, then ignore device
|