From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web12.36118.1639538651103317804 for ; Tue, 14 Dec 2021 19:24:11 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.com header.s=intel header.b=j0ctqaTW; spf=pass (domain: intel.com, ip: 134.134.136.20, 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=1639538651; x=1671074651; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ABP8dUaX6m/BXJqYQaEvwhdQLSLd8a4p/6K6ALcNC9U=; b=j0ctqaTW7X5T4gxYmuiWBHMdDaV57Df+2xJftlYiNVptZNjJzX0Aj7yf 5iWDy+/09btaANR29rcFBwqjNHIcK8Xh6TMU0t96TX0z+l+UcSiI14DK1 C7wXHuIeA/R1K02FGr7SxMFNwWIksKUJrHPCI8xnhuQlz5QcR2ZqALpPT PzCx4hv1G6u6fV9XVs3Ed0haxdAdBegibV4yS49GsOLVgdN8rDpH1iJ+Y DgS7UC27NXGK8SIyB3l/LQVrie5joI14jGrf7ZVgD3xzBgMuTnSr33xR5 4sqRv65wPFE65V/jkgheBk5UYqabE6jd1IZBfwQZNB/+aFFcGmZ6zjI9h w==; X-IronPort-AV: E=McAfee;i="6200,9189,10198"; a="226417139" X-IronPort-AV: E=Sophos;i="5.88,207,1635231600"; d="scan'208";a="226417139" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2021 19:24:10 -0800 X-IronPort-AV: E=Sophos;i="5.88,207,1635231600"; d="scan'208";a="518574390" Received: from kxinfux-win10.gar.corp.intel.com ([10.227.107.41]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2021 19:24:08 -0800 From: "VincentX Ke" To: devel@edk2.groups.io Cc: VincentX Ke , Hao A Wu , Ray Ni , Ian Chiu , Maggie Chu Subject: [PATCH v3] MdeModulePkg: Replace with UFS_UNIT_DESC to fix response timeout problem. Date: Wed, 15 Dec 2021 11:23:28 +0800 Message-Id: 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