From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web10.3792.1639728607499767309 for ; Fri, 17 Dec 2021 00:10:08 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=T0awTLBb; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: vincentx.ke@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639728607; x=1671264607; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ABP8dUaX6m/BXJqYQaEvwhdQLSLd8a4p/6K6ALcNC9U=; b=T0awTLBbGkcsFil50mxvDw9ngNbjEN7T/znVACy6B0GNc1s1Vrj3d6g8 bP/JxlINxdGpgpg3piRyD+MRLsNl2OgXKit02PfRg/v+BhW2cMrdzDNFU ncDc9rkndK3hnvuLdsf2txcfnDavDWRk/9w2dDhw0TWlJRwT8eRTXKQ/a M4WnsTQXGvI/cA3WeL2Z3+T4iph/AvueR/3bh695CrJjLV6zXZC0PuOuI q3Z8fyd7L2cP8V2WNOqLsvZrqpGgZF7tn0EKsFRK3tQY232B9nQmyPPEU BdBi4fBkHUSDWL4vVuTE5ZXGHQbvFj0H9+hloWl3L0piIHjcJO9KB5RPY Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10200"; a="226566943" X-IronPort-AV: E=Sophos;i="5.88,213,1635231600"; d="scan'208";a="226566943" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2021 00:10:05 -0800 X-IronPort-AV: E=Sophos;i="5.88,213,1635231600"; d="scan'208";a="605830872" Received: from kxinfux-win10.gar.corp.intel.com ([10.227.107.41]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2021 00:10:04 -0800 From: "VincentX Ke" To: devel@edk2.groups.io Cc: VincentX Ke , Hao A Wu , Ray Ni , Ian Chiu , Maggie Chu Subject: [PATCH v4] MdeModulePkg: Replace with UFS_UNIT_DESC to fix timeout problem Date: Fri, 17 Dec 2021 16:09:39 +0800 Message-Id: <3251e10d5f7b004a93bccba80d3e82916e0bb672.1639728124.git.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 | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c index b331c0f3e3..9ad1e19fe0 100644 --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c @@ -1037,9 +1037,9 @@ 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; // // Shadow this PEIM to run from memory @@ -1126,19 +1126,17 @@ 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) { - Private->Luns.BitMask |= (BIT0 << Index); + Status = UfsRwDeviceDesc (Private, TRUE, UfsUnitDesc, (UINT8) Index, 0, &UnitDescriptor, sizeof (UFS_UNIT_DESC)); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Fail to read UFS Unit Descriptor, Index = %X, Status = %r\n", Index, Status)); + continue; + } + if (UnitDescriptor.LunEn == 0x1) { DEBUG ((DEBUG_INFO, "Ufs %d Lun %d is enabled\n", Controller, Index)); + Private->Luns.BitMask |= (BIT0 << Index); } } -- 2.18.0.windows.1