Check the BlockSid feature capability through check
BlockSid header in the DiscoveryHeader.

Cc: Feng Tian <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <[email protected]>
---
 SecurityPkg/Include/Library/TcgStorageOpalLib.h            | 6 ++++++
 SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalCore.c | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/SecurityPkg/Include/Library/TcgStorageOpalLib.h 
b/SecurityPkg/Include/Library/TcgStorageOpalLib.h
index a9b4f2f..108affc 100644
--- a/SecurityPkg/Include/Library/TcgStorageOpalLib.h
+++ b/SecurityPkg/Include/Library/TcgStorageOpalLib.h
@@ -76,6 +76,12 @@ typedef struct {
     //  1 - The initial C_PIN_SID PIN value is equal to the C_PIN_MSID PIN 
value
     //
     UINT32 CpinUponRevert : 1;
+
+    //
+    // Media encryption supported (0 - not supported, 1 - supported)
+    //
+    UINT32 BlockSid : 1;
+
 } OPAL_DISK_SUPPORT_ATTRIBUTE;
 
 //
diff --git a/SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalCore.c 
b/SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalCore.c
index e4e4399..c1826a0 100644
--- a/SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalCore.c
+++ b/SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalCore.c
@@ -1515,6 +1515,12 @@ OpalGetSupportedAttributesInfo(
     SupportedAttributes->MediaEncryption = Feat->Locking.MediaEncryption;
   }
 
+  Size = 0;
+  Feat = (OPAL_LEVEL0_FEATURE_DESCRIPTOR*) TcgGetFeature (DiscoveryHeader, 
TCG_FEATURE_BLOCK_SID, &Size);
+  if (Feat != NULL && Size >= sizeof (TCG_BLOCK_SID_FEATURE_DESCRIPTOR)) {
+    SupportedAttributes->BlockSid = TRUE;
+  }
+
   DEBUG ((DEBUG_INFO, "Base COMID 0x%04X \n", *OpalBaseComId));
 
 
-- 
2.6.4.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to