summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dong <eric.dong@intel.com>2017-12-06 14:40:19 +0800
committerEric Dong <eric.dong@intel.com>2019-05-08 11:30:01 +0800
commit54d5ab6a7354c7f7d8828136fa4bb3119984bfad (patch)
treeade4c3172000ba06a75e3be7e10abda9a7c948f5
parent833f9f2696794bdc89a345ad89fc346cafe80ce0 (diff)
downloadedk2-54d5ab6a7354c7f7d8828136fa4bb3119984bfad.tar.gz
edk2-54d5ab6a7354c7f7d8828136fa4bb3119984bfad.tar.bz2
edk2-54d5ab6a7354c7f7d8828136fa4bb3119984bfad.zip
SecurityPkg/OpalPasswordSmm: Fix get BlockSid value error.
OpalDxe driver already enhanced to use TCG PP to send BlockSid request, so the old variable OPAL_EXTRA_INFO_VAR_NAME is not used by OpalDxe driver. But OpalSmm driver still consume this variable to decide whether need to send BlockSid when S3 resume. This patch fixed this issue by change OpalSmm driver to consume Tcg PP actions. Signed-off-by: Eric Dong <eric.dong@intel.com>
-rw-r--r--SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.c31
-rw-r--r--SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.h3
-rw-r--r--SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.inf4
3 files changed, 12 insertions, 26 deletions
diff --git a/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.c b/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.c
index 0ea92b15c0..5431b78331 100644
--- a/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.c
+++ b/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.c
@@ -51,8 +51,6 @@ UINT8 mSwSmiValue;
LIST_ENTRY *mOpalDeviceList;
LIST_ENTRY mSmmDeviceList = INITIALIZE_LIST_HEAD_VARIABLE (mSmmDeviceList);
-BOOLEAN mSendBlockSID = FALSE;
-
// AHCI
UINT32 mAhciBar = 0;
EFI_AHCI_REGISTERS mAhciRegisters;
@@ -347,10 +345,19 @@ SmmUnlockOpalPassword (
UINTN MemoryLength;
OPAL_SESSION Session;
BOOLEAN BlockSidSupport;
+ UINT32 PpStorageFlag;
+ BOOLEAN BlockSIDEnabled;
ZeroMem (StorePcieConfDataList, sizeof (StorePcieConfDataList));
Status = EFI_DEVICE_ERROR;
+ PpStorageFlag = Tcg2PhysicalPresenceLibGetManagementFlags ();
+ if ((PpStorageFlag & TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_ENABLE_BLOCK_SID) != 0) {
+ BlockSIDEnabled = TRUE;
+ } else {
+ BlockSIDEnabled = FALSE;
+ }
+
//
// try to unlock all locked hdd disks.
//
@@ -445,7 +452,7 @@ SmmUnlockOpalPassword (
}
}
- if (mSendBlockSID && BlockSidSupport) {
+ if (BlockSIDEnabled && BlockSidSupport) {
Result = OpalBlockSid (&Session, TRUE);
if (Result != TcgResultSuccess) {
break;
@@ -667,9 +674,6 @@ OpalPasswordSmmInit (
EFI_SMM_SW_REGISTER_CONTEXT Context;
EFI_HANDLE S3SleepEntryHandle;
EFI_SMM_SX_REGISTER_CONTEXT EntryRegisterContext;
- EFI_SMM_VARIABLE_PROTOCOL *SmmVariable;
- OPAL_EXTRA_INFO_VAR OpalExtraInfo;
- UINTN DataSize;
EFI_PHYSICAL_ADDRESS Address;
mBuffer = NULL;
@@ -778,21 +782,6 @@ OpalPasswordSmmInit (
//
mSwSmiValue = (UINT8) Context.SwSmiInputValue;
- Status = gSmst->SmmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID**)&SmmVariable);
- if (!EFI_ERROR (Status)) {
- DataSize = sizeof (OPAL_EXTRA_INFO_VAR);
- Status = SmmVariable->SmmGetVariable (
- OPAL_EXTRA_INFO_VAR_NAME,
- &gOpalExtraInfoVariableGuid,
- NULL,
- &DataSize,
- &OpalExtraInfo
- );
- if (!EFI_ERROR (Status)) {
- mSendBlockSID = OpalExtraInfo.EnableBlockSid;
- }
- }
-
return EFI_SUCCESS;
EXIT:
diff --git a/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.h b/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.h
index bc559f0bd1..00ce41a6ef 100644
--- a/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.h
+++ b/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.h
@@ -46,11 +46,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/DevicePathLib.h>
#include <Library/DxeServicesTableLib.h>
#include <Library/SmmIoLib.h>
+#include <Library/Tcg2PhysicalPresenceLib.h>
#include <IndustryStandard/Pci22.h>
-#include <Guid/OpalPasswordExtraInfoVariable.h>
-
#include "OpalAhciMode.h"
#include "OpalIdeMode.h"
#include "OpalNvmeMode.h"
diff --git a/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.inf b/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.inf
index c62fa13271..aa302e26ab 100644
--- a/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.inf
+++ b/SecurityPkg/Tcg/Opal/OpalPasswordSmm/OpalPasswordSmm.inf
@@ -59,9 +59,7 @@
DevicePathLib
OpalPasswordSupportLib
SmmIoLib
-
-[Guids]
- gOpalExtraInfoVariableGuid ## CONSUMES ## GUID
+ Tcg2PhysicalPresenceLib
[Protocols]
gEfiSmmSwDispatch2ProtocolGuid ## CONSUMES