From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: christopher.j.zurcher@intel.com) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by groups.io with SMTP; Fri, 06 Sep 2019 15:12:19 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Sep 2019 15:12:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,474,1559545200"; d="scan'208";a="195568581" Received: from cjzurch-desk.amr.corp.intel.com ([10.9.70.181]) by orsmga002.jf.intel.com with ESMTP; 06 Sep 2019 15:12:17 -0700 From: "Zurcher, Christopher J" To: devel@edk2.groups.io Cc: Michael D Kinney , Jiewen Yao , Jian J Wang , Liming Gao Subject: [PATCH v6 2/4] MdeModulePkg/UfsPassThruDxe: Check for RPMB W-LUN (SecurityLun) Date: Fri, 6 Sep 2019 15:12:14 -0700 Message-Id: <20190906221217.34180-3-christopher.j.zurcher@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20190906221217.34180-1-christopher.j.zurcher@intel.com> References: <20190906221217.34180-1-christopher.j.zurcher@intel.com> 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 Cc: Jiewen Yao Cc: Jian J Wang Cc: Liming Gao Signed-off-by: Christopher J Zurcher --- MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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++) { @@ -931,6 +932,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 // -- 2.16.2.windows.1