From patchwork Thu Feb 22 06:54:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 129161 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp280585lja; Wed, 21 Feb 2018 22:55:11 -0800 (PST) X-Google-Smtp-Source: AH8x227rxj2PE79zxzTjutNVRJYQ4o1ogcl2lne9gtluIh7lJ7nyaJHcBzlIzPnylIQxXco1iByz X-Received: by 10.101.81.204 with SMTP id i12mr4836655pgq.206.1519282511211; Wed, 21 Feb 2018 22:55:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519282511; cv=none; d=google.com; s=arc-20160816; b=WKtCgUCoHvjrpufT6hEk8tIAP3Po5cWcX+3vw2NSrJ00bOv5TnM8M7YbioQFSHmKdl OXkQYsyWl29dS/0CQkANcyVUPRO8nQJG/mMkp/Fky8sTVeH4fBrSGW+2p3EwST2M//Ur IOozT9e37Er4/KihX3fB8zf1Gn0yz1dgQ97teXU7dGgACXJe+IbQJ0WK4kSBcB8MdJ4v OMUf6GTMvyXsOOrf5R7EufwChP5ZG/XDjRAlBF986GtwDBpHMMfmRreAaWHsH0KuhUA+ zo/XM2ZSfndaVDRnkAg3Ui6OIxKsY483JzaXhdwaw+4P+M55Bvno98wueOUehJDn+GmU 92LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=n6SYxiMvvxonSeEni7YC9eFcUGfaQ7q+fe9bNsiZW0g=; b=xeZHmjrCcRvizD6XgWvo3sQ4iRdPAy+AqD/sMYMMmrKZPMk9cvIHXh1PT/pVB3qWbv RYAmWr0LH4e4fOrbmCS1r5/hO13HPPD07EaQKIc2DAXRPPfb1IrELHAv1aMnfyi6h1Lh 8FpEpW8CyPEHidFf0rAlA/15kne9vMgFOtUxyTCIjEoyD20AZGt0taD/ukkQV+BoMJXH I33vOV6mFGPeC1CA36njVCsxSJ8ZMjCY/t6ZhqDafmPz95mYfVrzW1/Bu1WicRYZj4kk NmOvHWiYRMkSfYhXHPdeRQDa/CVmiz/8463hH0e1VALe+bZuv41SabbCRCDPSglz6op3 AcJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=YymQMF+F; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id p125si2923492pga.97.2018.02.21.22.55.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 22:55:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=YymQMF+F; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3A339223230EA; Wed, 21 Feb 2018 22:49:10 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c05::241; helo=mail-pg0-x241.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C1AA62034D8DA for ; Wed, 21 Feb 2018 22:49:08 -0800 (PST) Received: by mail-pg0-x241.google.com with SMTP id w17so1678590pgv.6 for ; Wed, 21 Feb 2018 22:55:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+GJo2QQXZEN++sPMqRowakOjtGx+V6d9h5IFqO803no=; b=YymQMF+F4UsUboJDukORe9WZgW8u/DvODOKGKBZuOfV6iqGcLhuEvzlH7Z5afUSP10 C0nXNiMOHTHfKCH7sYy45rTFe4XZWEOXl3eSJdYnCeXPtFtqxjcqYe4TmoIi9l+n4T2F PYSbfcO4RQdbbi8A3Un8noRXskAnt6ZkBPZec= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+GJo2QQXZEN++sPMqRowakOjtGx+V6d9h5IFqO803no=; b=Xj6wV9yHm0sqfzN8Dse9aaOzY2qT/wSW8lYexUz7+8ETJtdaiCFOzkp6SVYd9dR8jA RdBkt/jsbVXtSTFxlsqhNJHS1w1rkwcBF1qqChZWWElM+Wz6XMBg2AWfe13Rv19BWdKn uto+5Ydl9fNlFXulIjL+Nd96/WF2cCHqnoNufe7MSVrkH7v7vM5ZvHdLdJaWEeRLi2R2 AE+mHmO55jXySsWy60NWJ8jvEAzLIQRXzWhlX9AGXjkLcbBRPntgHDzSUcE2wddbU6wM 6tTEm8Typlz+C0GSFMA7z981hwAEY6HLrdq0d+ioz/nBwobKo7J3HChfR2gl2bAXqoge 8V3A== X-Gm-Message-State: APf1xPD36cXiHY8lQ2oCsQELjeanVJuj/HpwR7MswyyX6pkul/UrmE/G 1p6CC5+oWP1E6Q8hpt/e7ZOSITkDmB4= X-Received: by 10.99.125.16 with SMTP id y16mr4780627pgc.3.1519282508615; Wed, 21 Feb 2018 22:55:08 -0800 (PST) Received: from localhost.localdomain ([45.56.152.187]) by smtp.gmail.com with ESMTPSA id v88sm35677342pfd.68.2018.02.21.22.55.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Feb 2018 22:55:08 -0800 (PST) From: Heyi Guo To: edk2-devel@lists.01.org Date: Thu, 22 Feb 2018 14:54:34 +0800 Message-Id: <1519282474-94811-3-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519282474-94811-1-git-send-email-heyi.guo@linaro.org> References: <1519282474-94811-1-git-send-email-heyi.guo@linaro.org> Subject: [edk2] [RFC v2 2/2] MdeModulePkg/PciBus: return CPU address for GetBarAttributes X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni , Eric Dong , Ard Biesheuvel , Heyi Guo , Michael D Kinney , Laszlo Ersek , Star Zeng MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" PciIo::GetBarAttributes should return CPU view address according to UEFI spec 2.7, so we change the implementation to follow the spec. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Heyi Guo Cc: Ruiyu Ni Cc: Ard Biesheuvel Cc: Star Zeng Cc: Eric Dong Cc: Laszlo Ersek Cc: Michael D Kinney --- MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c index 190f4b0..0aafcba 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c @@ -1814,8 +1814,8 @@ GetMmioAddressTranslationOffset ( while (Configuration->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) { if ((Configuration->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) && - (Configuration->AddrRangeMin <= AddrRangeMin) && - (Configuration->AddrRangeMin + Configuration->AddrLen >= AddrRangeMin + AddrLen) + (Configuration->AddrRangeMin + Configuration->AddrTranslationOffset <= AddrRangeMin) && + (Configuration->AddrRangeMin + Configuration->AddrLen + Configuration->AddrTranslationOffset >= AddrRangeMin + AddrLen) ) { return Configuration->AddrTranslationOffset; } @@ -1968,6 +1968,11 @@ PciIoGetBarAttributes ( return EFI_UNSUPPORTED; } } + + // According to UEFI spec 2.7, we need return CPU view address for PciIo::GetBarAttributes, + // and PCI view = CPU view + translation + Descriptor->AddrRangeMin -= Descriptor->AddrTranslationOffset; + Descriptor->AddrRangeMax -= Descriptor->AddrTranslationOffset; } return EFI_SUCCESS;