From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E649F211E9FC5 for ; Mon, 1 Apr 2019 22:15:50 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Apr 2019 22:15:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,298,1549958400"; d="scan'208";a="334152988" Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.8]) by fmsmga005.fm.intel.com with ESMTP; 01 Apr 2019 22:15:49 -0700 From: Hao Wu To: edk2-devel@lists.01.org Cc: Hao Wu , Ray Ni , Eric Dong , Jian J Wang Date: Tue, 2 Apr 2019 13:15:45 +0800 Message-Id: <20190402051546.8244-2-hao.a.wu@intel.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20190402051546.8244-1-hao.a.wu@intel.com> References: <20190402051546.8244-1-hao.a.wu@intel.com> Subject: [PATCH v1 1/2] MdeModulePkg/AhciPei: Limit max transfer blocknum for 48-bit address X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Apr 2019 05:15:51 -0000 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 Contributed-under: TianoCore Contribution Agreement 1.1 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 54df31906f..939c5dbf4e 100644 --- a/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c +++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c @@ -55,7 +55,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