From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web12.23029.1639464822568551151 for ; Mon, 13 Dec 2021 22:53:43 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.com header.s=intel header.b=oCeOktpT; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: vincentx.ke@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639464822; x=1671000822; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=VSCkVWViWAP0XqT8FY//2Mgoq3k0QT9MRw09V10rbkQ=; b=oCeOktpTTc69RiKKlcilpyrgcLysxiJdpeOcefHiO7s/rmGLb9iYZxw8 Xq6nWNIeBbq+20aRxZsCOavBBi22nbYblno5Go6jNqg6tHxeoqOIoCFmB o0wx6SOyP9bFQNZg5yCF7HVnKfaAzxUdT2wC9jtnR84gaSuYWaIh+K8uH UOa6Aq6Cgd0jMi+sfrBOga07jQWXVK1YLd4Gjq0lyMRD2NE3x1WxzvCq0 F9oTVU0K8PQqOEAYikBe6jnEyat1T1K9LMz6Rw2UlhRHvX8B3ZzY3ZBA8 NMfXxQcBNUM5UF7vmViewnrb2jjO1BW+H1/w8qgjhdZ823g3I+NNlX6k+ g==; X-IronPort-AV: E=McAfee;i="6200,9189,10197"; a="263050812" X-IronPort-AV: E=Sophos;i="5.88,204,1635231600"; d="scan'208";a="263050812" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2021 22:51:04 -0800 X-IronPort-AV: E=Sophos;i="5.88,204,1635231600"; d="scan'208";a="681938550" Received: from kxinfux-win10.gar.corp.intel.com ([10.227.107.41]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2021 22:51:02 -0800 From: vincentx.ke@intel.com To: devel@edk2.groups.io Cc: VincentX Ke , Hao A Wu , Ray Ni , Ian Chiu , Maggie Chu Subject: [PATCH] MdeModulePkg: Replace with UfsUnitDesc to fix response timeout problem. Date: Tue, 14 Dec 2021 14:50:14 +0800 Message-Id: <20211214065014.14912-1-vincentx.ke@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3714 Replace with UFS_UNIT_DESC to fix response timeout problem. Cc: Hao A Wu Cc: Ray Ni Cc: Ian Chiu Cc: Maggie Chu Signed-off-by: VincentX Ke --- .../Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c index b331c0f3e3..3a55348cac 100644 --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c @@ -1037,9 +1037,10 @@ InitializeUfsBlockIoPeim ( UFS_PEIM_HC_PRIVATE_DATA *Private; EDKII_UFS_HOST_CONTROLLER_PPI *UfsHcPpi; UINT32 Index; - UFS_CONFIG_DESC Config; UINTN MmioBase; UINT8 Controller; + UFS_UNIT_DESC UnitDescriptor; + UINT32 UnitDescriptorSize; // // Shadow this PEIM to run from memory @@ -1126,19 +1127,18 @@ InitializeUfsBlockIoPeim ( } // - // Get Ufs Device's Lun Info by reading Configuration Descriptor. + // Check if 8 common luns are active and set corresponding bit mask. // - Status = UfsRwDeviceDesc (Private, TRUE, UfsConfigDesc, 0, 0, &Config, sizeof (UFS_CONFIG_DESC)); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "Ufs Get Configuration Descriptor Error, Status = %r\n", Status)); - Controller++; - continue; - } - - for (Index = 0; Index < UFS_PEIM_MAX_LUNS; Index++) { - if (Config.UnitDescConfParams[Index].LunEn != 0) { + UnitDescriptorSize = sizeof (UFS_UNIT_DESC); + for (Index = 0; Index < 8; Index++) { + Status = UfsRwDeviceDesc (Private, TRUE, UfsUnitDesc, (UINT8) Index, 0, &UnitDescriptor, UnitDescriptorSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed to read unit descriptor, index = %X, status = %r\n", Index, Status)); + continue; + } + if (UnitDescriptor.LunEn == 0x1) { + DEBUG ((DEBUG_INFO, "UFS LUN %X is enabled\n", Index)); Private->Luns.BitMask |= (BIT0 << Index); - DEBUG ((DEBUG_INFO, "Ufs %d Lun %d is enabled\n", Controller, Index)); } } -- 2.18.0.windows.1