From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: hao.a.wu@intel.com) Received: from mga04.intel.com (mga04.intel.com []) by groups.io with SMTP; Tue, 09 Apr 2019 18:13:15 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Apr 2019 18:13:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,331,1549958400"; d="scan'208";a="336459874" Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.8]) by fmsmga005.fm.intel.com with ESMTP; 09 Apr 2019 18:13:14 -0700 From: "Wu, Hao A" To: devel@edk2.groups.io Cc: Hao Wu , Ray Ni , Eric Dong , Jian J Wang Subject: [PATCH v2 1/2] MdeModulePkg/AhciPei: Limit max transfer blocknum for 48-bit address Date: Wed, 10 Apr 2019 09:13:12 +0800 Message-Id: <20190410011313.4268-2-hao.a.wu@intel.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20190410011313.4268-1-hao.a.wu@intel.com> References: <20190410011313.4268-1-hao.a.wu@intel.com> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1483 Due to the limited resource on the VTd DMA buffer size in the PEI phase, the driver will limit the maximum transfer block number for 48-bit addressing. This commit aims to prevent the potential failure on calls to the IOMMU 'Map' service. Cc: Ray Ni Cc: Eric Dong Cc: Jian J Wang Signed-off-by: Hao Wu --- MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c b/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c index a83c213a47..f9174e68b1 100644 --- a/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c +++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c @@ -48,7 +48,12 @@ UINT8 mAtaTrustCommands[2] = { // Look up table (Lba48Bit) for maximum transfer block number // #define MAX_28BIT_TRANSFER_BLOCK_NUM 0x100 -#define MAX_48BIT_TRANSFER_BLOCK_NUM 0xFFFF +// +// Due to limited resource on VTd PEI DMA buffer size, driver limits the +// maximum transfer block number for 48-bit addressing. +// Setting to 0x800 here means 1M bytes for device with 512-byte block size. +// +#define MAX_48BIT_TRANSFER_BLOCK_NUM 0x800 UINT32 mMaxTransferBlockNumber[2] = { MAX_28BIT_TRANSFER_BLOCK_NUM, -- 2.12.0.windows.1