From nobody Fri May 3 13:37:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+72119+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+72119+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1614121440; cv=none; d=zohomail.com; s=zohoarc; b=debn8Zrq31W2Cglznw7gTkyPpKQ27pa4CM0OLbe9JpI4sFnu0prwyXHvHpkAgTen4tehD+M3Igw4U/Ap00aS/QMNm3swlj2NEK+ee1Zo2H72kJ5k/kCzuZlwsclsxkDT1suT5O4IhyWZMRnIY8G2IDT1d9pNqYx6Qlsh3GhQKdk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614121440; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=bUt//DtdROgyg27mPcXJtmMsUB0cFWprfUYdxuVkJRs=; b=TFg6SxyV+VcexTNXB0EG3EgV0bGyCt0XYA069VWjYYJb8SbW/xp7bHnfKfMdIcPLsAzNVSyAQtc1GdlyKjUg//r8h08ndu573AY+s4w3A8JAEgrAAqvZYALgDmlU4WdGH+UMG8HbuBUTcWqyLULQLSgnhIeUP1St+PzqeaW6dQQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+72119+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1614121439972432.61459693950474; Tue, 23 Feb 2021 15:03:59 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id xuOmYY1788612xGZCEqn0uP1; Tue, 23 Feb 2021 15:03:59 -0800 X-Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web10.10428.1614090748694929237 for ; Tue, 23 Feb 2021 06:32:28 -0800 IronPort-SDR: yqFNRdoOFOqcu1dbkqWz1+BvyWwtIv1wU3RDs7aub6xp/EzPY1Lk2xlsKvdtJcYqlL+bCdc8ft YDzDsqteWVnw== X-IronPort-AV: E=McAfee;i="6000,8403,9903"; a="246235381" X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="246235381" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 06:32:27 -0800 IronPort-SDR: 1I5ljH8p5k+S7Tcil2KEq25Zj4AGUX4Zg/c2CH7AuVevnimOv/xcWRY0MHI8wdLOka7SQ6jhwD OARhvQEWTs0w== X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="403187697" X-Received: from pbandaru-mobl1.gar.corp.intel.com ([10.213.97.20]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 06:32:25 -0800 From: Purna Chandra Rao Bandaru To: devel@edk2.groups.io Cc: Purna Chandra Rao Bandaru , Mateusz Albecki , Ray Ni , Hao A Wu Subject: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe: Improve Device initialization polling Loop Date: Tue, 23 Feb 2021 20:02:15 +0530 Message-Id: <20210223143215.26752-1-purna.chandra.rao.bandaru@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,purna.chandra.rao.bandaru@intel.com X-Gm-Message-State: jByvTzOfI1tORfvIsUMuIkjCx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1614121439; bh=5CzjqUTXoTzmL2DAGZy81bn0AcmgttX0hP+FIx1hALQ=; h=Cc:Date:From:Reply-To:Subject:To; b=HXQuqC26s7Y7ywNLB22R0WQnGsblFg7nIclZj6R0E8Qv9rRH/RjV1egWukfvE4SF79M /fNcopptnysHpMfIwxlLohlgsH9+YKoRmtOYwPpVYjmAx2rDSPBNE/c7Zn8p55BbLMqDK jVwF9ZnZCmDu3SnJTM/SjhK4TQvIlXW+pEY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D3217 Current Ufs Pass thru driver polls for 5us and return success even when the timeout occurs. There are cards that can take upto 600ms for Init and hence increased the time out for fDeviceInit polling loop. Signed-off-by: Bandaru Cc: Mateusz Albecki Cc: Ray Ni Cc: Hao A Wu Change-Id: I6cb063b43bdf37790db8e60c3919153cd2f3c086 Reviewed-by: Hao A Wu --- MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 17 +++++++++++++---- MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h | 3 ++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c b/MdeModuleP= kg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c index 9768c2e6fb..92ff958f16 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c @@ -1,6 +1,6 @@ /** @file =20 - Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -749,7 +749,7 @@ UfsFinishDeviceInitialization ( { EFI_STATUS Status; UINT8 DeviceInitStatus; - UINT8 Timeout; + UINT32 Timeout; =20 DeviceInitStatus =3D 0xFF; =20 @@ -761,7 +761,10 @@ UfsFinishDeviceInitialization ( return Status; } =20 - Timeout =3D 5; + // + // There are cards that can take upto 600ms to clear fDeviceInit flag. + // + Timeout =3D UFS_INIT_COMPLETION_TIMEOUT; do { Status =3D UfsReadFlag (Private, UfsFlagDevInit, &DeviceInitStatus); if (EFI_ERROR (Status)) { @@ -771,7 +774,13 @@ UfsFinishDeviceInitialization ( Timeout--; } while (DeviceInitStatus !=3D 0 && Timeout !=3D 0); =20 - return EFI_SUCCESS; + if (Timeout =3D=3D 0) { + DEBUG ((DEBUG_ERROR, "UfsFinishDeviceInitialization DeviceInitStatus= =3D%x EFI_TIMEOUT \n", DeviceInitStatus)); + return EFI_TIMEOUT; + } else { + DEBUG ((DEBUG_INFO, "UfsFinishDeviceInitialization Timeout left=3D%x E= FI_SUCCESS \n", Timeout)); + return EFI_SUCCESS; + } } =20 /** diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h b/MdeModuleP= kg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h index ef33250c89..275351cf8e 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h @@ -1,6 +1,6 @@ /** @file =20 - Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -40,6 +40,7 @@ // #define UFS_MAX_LUNS 12 #define UFS_WLUN_PREFIX 0xC1 +#define UFS_INIT_COMPLETION_TIMEOUT 600000=20 =20 typedef struct { UINT8 Lun[UFS_MAX_LUNS]; --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#72119): https://edk2.groups.io/g/devel/message/72119 Mute This Topic: https://groups.io/mt/80864767/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-