From patchwork Thu Mar 15 06:04:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 131751 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp703276ljb; Wed, 14 Mar 2018 23:05:28 -0700 (PDT) X-Google-Smtp-Source: AG47ELvg62saGignSrmo/OSA+lJtXBCBriEZxGLSCm+267CkcPu0cX/o90hSsiYBiuXP+FrvAAj3 X-Received: by 2002:a17:902:32a2:: with SMTP id z31-v6mr6607461plb.32.1521093928740; Wed, 14 Mar 2018 23:05:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521093928; cv=none; d=google.com; s=arc-20160816; b=LRLygRAMkpLvgJ5mJN8Qlxm4xwqY3O7mu25ABOm8K9MAlY1Dgz2KHYTC4YXLKSSyqY ANa5gcPB7mglal0A+SIbSxO/pd7dAzSWyH4i9fteDc16p3zCcmJ+Xl/q0Y8lgTqe6mjK iNTr+PBIJA1u2rnipVlflq1RN3pVEZKgO/G0qJIPIgS1kyowjyQ8z5/fPdABXVDw54+D CzmV6ZXYbBpkJCP4WiFomOCkEsoaMAoG/8TRyRR29WUTRQFOekvYaj9tubMhznIR+r1k 87EBvkBK2OT0WtJ2LP3i6oUrs/4KWMZG0GhrEHicQXFm1hIgnC30OooV5IafwDvw4XEE cWiA== 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=msdU6aRJW79twBqfT+diDOEdQcLquhaRcHFeky+oETQ=; b=WMqBr04qqbm977v1Xlb2jMcJYekTuzg+QVeYPwNuc39x7hUzf3jIudxtQs0rqJjRD3 /fHxUFUwQpcib7PWfJ1IDmmSAZArktteSJFVrQ780yqULU5/uf+zLvehaXGBatLt6Gf/ /PKM/XueVFb4ZQePCMFrBNYJ6AAhdscGdP1YAaCPKiF4SYh2j1flbEjY1tp/dWuYafLy NEh0g1VLtqrVc2LSHNWgIwS0rVOK8Miq31/YtLLRXuQmcFpM7kfZLFhke/xSxn8oqvBT pwFGTVGIZONbukPUnRH4J/u3/GddWzpIpaa0NkUdhZH64ZkDHum0tBQ7fDdzWM7Lnm2y v3yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Jril/SOa; 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 u21si3376605pfl.176.2018.03.14.23.05.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Mar 2018 23:05:28 -0700 (PDT) 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=Jril/SOa; 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 79F032202E4BA; Wed, 14 Mar 2018 22:59:04 -0700 (PDT) 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:c00::244; helo=mail-pf0-x244.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (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 3616C21E08283 for ; Wed, 14 Mar 2018 22:59:03 -0700 (PDT) Received: by mail-pf0-x244.google.com with SMTP id q13so2465507pff.0 for ; Wed, 14 Mar 2018 23:05:26 -0700 (PDT) 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=iYcOSp5Oiml897XHxDqe3TJg8iUlUm8UnBiyS9ZiZ4Y=; b=Jril/SOaGN/OGTpSZU4sIEceRce+60NFA45H0HiajbPMvspc0Pnf3z9CQzXymROkJt FVNHtk3kx2Q3llB8t+qWqmboXWPnzqDZWnWxB6iE7aMpZmyPx9kMSWuXu7/23YFe6w+q jertah/9Tk4+yxwuRUcIDzsvHfRamjYD0iCUo= 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=iYcOSp5Oiml897XHxDqe3TJg8iUlUm8UnBiyS9ZiZ4Y=; b=jwoSy8VdCfj+bajbSvx5jzSpxChmGedz5YppmUIbhr4ZI6fmgkAcl0b6xeRE4L/zqd eRY9OdlC6s7AKz/izPGsPg8XdBeL2p643YUzpj+6KxPE8YuyV9vf0n9Wq70h5CA4R5rn oSa0cenu/UAcRWdUrPVB1hBddiMRef1fQxNDKd6pvxHSFgd96fPTxeAz/EOJAlGemwn9 dATKagui6ryPiVkIG2VsM6PV8f0pxSSZZDQQl17vtPcOQJvTltyrtMNRZiyDjfQqu+WI ZaAo7EfP7DRWi0+jv/0bQPz+iI0MecvnLbjSbeA92uM7HyOWlEl4S6OcS0T3Q/tAktNi uYOg== X-Gm-Message-State: AElRT7E25Rt5Ud+c7/Kq/11GYDKLRjs1lJGR8FVfpssrq9/u9Yz4iHUz WpnGHoqF8SGVhOty3zARXQHujptI+2k= X-Received: by 10.99.96.79 with SMTP id u76mr520462pgb.199.1521093926487; Wed, 14 Mar 2018 23:05:26 -0700 (PDT) Received: from localhost.localdomain ([45.56.152.100]) by smtp.gmail.com with ESMTPSA id 70sm7436192pgb.86.2018.03.14.23.05.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Mar 2018 23:05:26 -0700 (PDT) From: Heyi Guo To: edk2-devel@lists.01.org Date: Thu, 15 Mar 2018 14:04:03 +0800 Message-Id: <1521093843-48615-7-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521093843-48615-1-git-send-email-heyi.guo@linaro.org> References: <1521093843-48615-1-git-send-email-heyi.guo@linaro.org> Subject: [edk2] [PATCH v7 6/6] 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 , Yi Li , 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" According to UEFI spec 2.7, PciIo->GetBarAttributes should return host address (CPU view ddress) rather than device address (PCI view address), and device address = host address + address translation offset, so we subtract translation from device address before returning. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Heyi Guo Signed-off-by: Yi Li Reviewed-by: Ni Ruiyu 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 | 4 ++++ 1 file changed, 4 insertions(+) -- 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 fef3eceb7f62..62179eb44bbd 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c @@ -1972,6 +1972,10 @@ PciIoGetBarAttributes ( return EFI_UNSUPPORTED; } } + + // According to UEFI spec 2.7, we need return host address for + // PciIo->GetBarAttributes, and host address = device address - translation. + Descriptor->AddrRangeMin -= Descriptor->AddrTranslationOffset; } return EFI_SUCCESS;