diff options
author | Eric Dong <eric.dong@intel.com> | 2016-04-22 10:59:34 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2016-05-05 12:52:47 +0800 |
commit | be08755355ef16bf86ebed01762c6c9cb319b48a (patch) | |
tree | 272e71f7d0fca9743e4a32ebaabe27d30fbc073b /SecurityPkg/Tcg/Opal | |
parent | 8d3d84508f06d1b7c8269deb16f234646b0a4585 (diff) | |
download | edk2-platforms-be08755355ef16bf86ebed01762c6c9cb319b48a.tar.xz |
SecurityPkg OpalPasswordDxe: Check BlockSid capability before send command.
Not all opal device support BlockSid feature. So Add
code logic to check the capability before send BlockSid
command.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Diffstat (limited to 'SecurityPkg/Tcg/Opal')
-rw-r--r-- | SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriver.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriver.c b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriver.c index 4a4fa6a56d..7c6deb8f39 100644 --- a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriver.c +++ b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriver.c @@ -388,14 +388,11 @@ ReadyToBootCallback ( {
EFI_STATUS Status;
OPAL_DRIVER_DEVICE* Itr;
- UINT8 Count;
TCG_RESULT Result;
OPAL_EXTRA_INFO_VAR OpalExtraInfo;
UINTN DataSize;
OPAL_SESSION Session;
- Count = 0;
-
gBS->CloseEvent (Event);
DataSize = sizeof (OPAL_EXTRA_INFO_VAR);
@@ -415,21 +412,21 @@ ReadyToBootCallback ( // Send BlockSID command to each Opal disk
//
Itr = mOpalDriver.DeviceList;
- Count = 0;
while (Itr != NULL) {
- ZeroMem(&Session, sizeof(Session));
- Session.Sscp = Itr->OpalDisk.Sscp;
- Session.MediaId = Itr->OpalDisk.MediaId;
- Session.OpalBaseComId = Itr->OpalDisk.OpalBaseComId;
-
- Result = OpalBlockSid (&Session, TRUE); // HardwareReset must always be TRUE
- if (Result != TcgResultSuccess) {
- DEBUG ((DEBUG_ERROR, "OpalBlockSid fail\n"));
- break;
+ if (Itr->OpalDisk.SupportedAttributes.BlockSid) {
+ ZeroMem(&Session, sizeof(Session));
+ Session.Sscp = Itr->OpalDisk.Sscp;
+ Session.MediaId = Itr->OpalDisk.MediaId;
+ Session.OpalBaseComId = Itr->OpalDisk.OpalBaseComId;
+
+ Result = OpalBlockSid (&Session, TRUE); // HardwareReset must always be TRUE
+ if (Result != TcgResultSuccess) {
+ DEBUG ((DEBUG_ERROR, "OpalBlockSid fail\n"));
+ break;
+ }
}
Itr = Itr->Next;
- Count++;
}
}
}
|