diff options
author | Zurcher, Christopher J <christopher.j.zurcher@intel.com> | 2019-09-27 10:19:58 +0800 |
---|---|---|
committer | Hao A Wu <hao.a.wu@intel.com> | 2019-09-29 16:43:45 +0800 |
commit | 43bb4e379b20759284ea499d17c8f503a127b666 (patch) | |
tree | 4a2a6e433790301b3da57ed4278afd025692b01d | |
parent | 9b14509b16a90ebe5d418d403295efaff76d95d4 (diff) | |
download | edk2-43bb4e379b20759284ea499d17c8f503a127b666.tar.gz edk2-43bb4e379b20759284ea499d17c8f503a127b666.tar.bz2 edk2-43bb4e379b20759284ea499d17c8f503a127b666.zip |
MdeModulePkg/UfsPassThruDxe: Check for RPMB W-LUN (SecurityLun)
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1546
Currently UfsPassThru only checks for 8 common LUNs. This adds a check
for the RPMB Well-known LUN and sets the corresponding bit-mask. Further
handling of the WLUN is already present in the driver.
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Christopher J Zurcher <christopher.j.zurcher@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
-rw-r--r-- | MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c index b12404aacb..26c5a8b855 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c @@ -822,7 +822,9 @@ UfsPassThruDriverBindingStart ( UINTN UfsHcBase;
UINT32 Index;
UFS_UNIT_DESC UnitDescriptor;
+ UFS_DEV_DESC DeviceDescriptor;
UINT32 UnitDescriptorSize;
+ UINT32 DeviceDescriptorSize;
Status = EFI_SUCCESS;
UfsHc = NULL;
@@ -916,7 +918,6 @@ UfsPassThruDriverBindingStart ( //
// Check if 8 common luns are active and set corresponding bit mask.
- // TODO: Parse device descriptor to decide if exposing RPMB LUN to upper layer for authentication access.
//
UnitDescriptorSize = sizeof (UFS_UNIT_DESC);
for (Index = 0; Index < 8; Index++) {
@@ -932,6 +933,20 @@ UfsPassThruDriverBindingStart ( }
//
+ // Check if RPMB WLUN is supported and set corresponding bit mask.
+ //
+ DeviceDescriptorSize = sizeof (UFS_DEV_DESC);
+ Status = UfsRwDeviceDesc (Private, TRUE, UfsDeviceDesc, 0, 0, &DeviceDescriptor, &DeviceDescriptorSize);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "Failed to read device descriptor, status = %r\n", Status));
+ } else {
+ if (DeviceDescriptor.SecurityLun == 0x1) {
+ DEBUG ((DEBUG_INFO, "UFS WLUN RPMB is supported\n"));
+ Private->Luns.BitMask |= BIT11;
+ }
+ }
+
+ //
// Start the asynchronous interrupt monitor
//
Status = gBS->CreateEvent (
|