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.web10.29149.1640233211398591117 for ; Wed, 22 Dec 2021 20:20:11 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=g76e+Ud1; spf=pass (domain: intel.com, ip: 192.55.52.88, 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=1640233211; x=1671769211; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GVe3vzKrMrTS1m5f5lwVABWC+TNN5a98zm64oORjYwY=; b=g76e+Ud1cc2F8GCye6BP78fYUMCMjNjuAkioFf17Q/DpPoI3JJAmUVBj TmtmclEG+b5GC453D/BjBtaX/4JawTFjxS4LmVfOpX8VN5VdA37CrKAyH En76AbPgcVhHj4zKzHlKLXtdUFCY7BOq/zuL0umEhWIy3yZ7g43jAYdtC 6Qr6ZlPOzKzqcQmhpYHAd+TujIU40/3YgRLm7oosTRVJUQVJAmi9m0CFu W1WDIMkuWMLooQCYU3RprqZzGxW2S2vjHaogkhHkDUWOrMzCzsVOexb4N ho6K8uy7EYzJTiM9IjTgP6m3Zhh6p2Lu7slWph47gH5IFqwWi7fAuMDWw w==; X-IronPort-AV: E=McAfee;i="6200,9189,10206"; a="264960076" X-IronPort-AV: E=Sophos;i="5.88,228,1635231600"; d="scan'208";a="264960076" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2021 20:20:11 -0800 X-IronPort-AV: E=Sophos;i="5.88,228,1635231600"; d="scan'208";a="617362999" Received: from kxinfux-mobl2.gar.corp.intel.com ([10.214.170.104]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2021 20:20:08 -0800 From: "VincentX Ke" To: devel@edk2.groups.io Cc: VincentX Ke , Hao A Wu , Ray Ni , Ian Chiu , Maggie Chu Subject: [PATCH v6 1/3] MdeModulePkg: Replace with UFS_UNIT_DESC to fix timeout problem Date: Thu, 23 Dec 2021 12:19:17 +0800 Message-Id: <20211223041919.1307-2-vincentx.ke@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20211223041919.1307-1-vincentx.ke@intel.com> References: <20211223041919.1307-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