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.web08.29919.1640243303065241192 for ; Wed, 22 Dec 2021 23:08:23 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=DwYVMsEr; 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=1640243303; x=1671779303; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GVe3vzKrMrTS1m5f5lwVABWC+TNN5a98zm64oORjYwY=; b=DwYVMsErZXcljRX4AqqjzlcSV4FRiiE2tsj4bVtl99ZpgomsctsO9ZtA aQh7w50uie+hw7seeZzZfp1kfhzF5Kc2i/M3EkNscIR9bgAfu4/LDzR+H 2Pyh+jYkHglhq1hDcSCdU0gtegUuwhLkfIQLe8hVe7++a2RzGcySY1+Uj YbPed3UUp4rPz87gIx6mcBFgtq1eSVqeGXGcAcjOPZeoQYcRBY6+02yxU 2Xd7ljmQ2b1UTYYHCcFmLw7uCNn8XXmcFnN+Orr9jxdyQ4kLPmeoLNnbR 1tX/2vBHuOnx2W4p5CpWQAxBIW/qFlaPdlEvIpm8n7ZIgE2wRJBtQRnxZ Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10206"; a="227616826" X-IronPort-AV: E=Sophos;i="5.88,228,1635231600"; d="scan'208";a="227616826" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2021 23:08:21 -0800 X-IronPort-AV: E=Sophos;i="5.88,228,1635231600"; d="scan'208";a="521984447" Received: from kxinfux-mobl2.gar.corp.intel.com ([10.214.170.104]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2021 23:08:19 -0800 From: "VincentX Ke" To: devel@edk2.groups.io Cc: VincentX Ke , Hao A Wu , Ray Ni , Ian Chiu , Maggie Chu Subject: [PATCH v7 1/3] MdeModulePkg: Replace with UFS_UNIT_DESC to fix timeout problem Date: Thu, 23 Dec 2021 15:07:52 +0800 Message-Id: <20211223070754.2190-2-vincentx.ke@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20211223070754.2190-1-vincentx.ke@intel.com> References: <20211223070754.2190-1-vincentx.ke@intel.com> 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 | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c index b331c0f3e3..b8651ff998 100644 --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -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,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) { - 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.31.1.windows.1