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.web09.35088.1639533451291821560 for ; Tue, 14 Dec 2021 17:57:31 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.com header.s=intel header.b=Yw3SSGdd; spf=pass (domain: intel.com, ip: 192.55.52.88, 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=1639533451; x=1671069451; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=U+lm3aV4Y058hrnLwAU83B+YvIqwNXrEABVug29lXvw=; b=Yw3SSGddq69xjVADlDzqDkESrbPEetbEBMm/jc+SfIvyvDgi3ouMDEcR 74OZTf7o+xTQC0gQMhB+yo42tnemdmoovbXE0lfkvBVCiHU015GpevSZB /eUBbDZbY8xyFD5k+mWKDY0HsUG7Rdg998fXlXpELJ1aXGw2DJD9Efdn7 6EJ5VmQNKlZYWxa0DogkbJYpYUKc1lxmDaH8Lw2CflATOtEAyfMXOmXWW kBFZ+5tPQ2e8PAL/E8wXSSQWjAFm1BvFRO2CBs5exlok7Ew9MfyvlDBGH Euy0C+7+lEQ5iD7tVvpcs70WGohWV+7ic2BQOxwU065RJ7b8k8TU/WJsm w==; X-IronPort-AV: E=McAfee;i="6200,9189,10198"; a="263272731" X-IronPort-AV: E=Sophos;i="5.88,207,1635231600"; d="scan'208";a="263272731" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2021 17:57:26 -0800 X-IronPort-AV: E=Sophos;i="5.88,207,1635231600"; d="scan'208";a="604700733" Received: from kxinfux-win10.gar.corp.intel.com ([10.227.107.41]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2021 17:57:24 -0800 From: "VincentX Ke" To: devel@edk2.groups.io Cc: VincentX Ke , Hao A Wu , Ray Ni , Ian Chiu , Maggie Chu Subject: [PATCH v2] MdeModulePkg: Replace with UFS_UNIT_DESC to fix response timeout problem. Date: Wed, 15 Dec 2021 09:57:00 +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..96a1f38727 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) { + 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 LUN %X is enabled\n", Index)); Private->Luns.BitMask |= (BIT0 << Index); - DEBUG ((DEBUG_INFO, "Ufs %d Lun %d is enabled\n", Controller, Index)); } } -- 2.18.0.windows.1