From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web09.16425.1640155809359774372 for ; Tue, 21 Dec 2021 22:50:10 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=Ny7giNtZ; spf=pass (domain: intel.com, ip: 134.134.136.65, 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=1640155809; x=1671691809; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GVe3vzKrMrTS1m5f5lwVABWC+TNN5a98zm64oORjYwY=; b=Ny7giNtZkX9HEa0sAkqETHmghSE1FLmfbyZBa5MBvTPpQDdabwJOM62P /Pp0trkRK8OEtVOea1xmCCw1qtfppcsY+CTXw9Vt37jIi48/zVZSZ9fQu O0wQQMmX6i2qm5SLW49+n05dciji3R2KszH3CQNQkkpiz58rR7rJcrb/f fG80RC/xOmkXLQMm2mUAIEIIZy/ioI1KdUoofnpMjexnxVJJ+TRH/oPbz R1LMPuHiiacX1NfTXEtzfGiPNkfsb+tZ5w8F0474etkIzi3CQbdzfQ5ja yGEe/R35mGXWdJhnqT3WYIfnJvGAN0aMbtch8DfHFRLIoD70yNfiWp9AZ w==; X-IronPort-AV: E=McAfee;i="6200,9189,10205"; a="240511716" X-IronPort-AV: E=Sophos;i="5.88,225,1635231600"; d="scan'208";a="240511716" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2021 22:50:08 -0800 X-IronPort-AV: E=Sophos;i="5.88,225,1635231600"; d="scan'208";a="664181882" Received: from kxinfux-mobl2.gar.corp.intel.com ([10.213.42.103]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2021 22:50:06 -0800 From: "VincentX Ke" To: devel@edk2.groups.io Cc: VincentX Ke , Hao A Wu , Ray Ni , Ian Chiu , Maggie Chu Subject: [PATCH v5 1/3] MdeModulePkg: Replace with UFS_UNIT_DESC to fix timeout problem Date: Wed, 22 Dec 2021 14:48:17 +0800 Message-Id: <20211222064819.1827-2-vincentx.ke@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20211222064819.1827-1-vincentx.ke@intel.com> References: <20211222064819.1827-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