From nobody Thu Dec 26 02:01:06 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1505106088817148.8880261557356; Sun, 10 Sep 2017 22:01:28 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BD9642095BB78; Sun, 10 Sep 2017 21:58:31 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 4984520945BE2 for ; Sun, 10 Sep 2017 21:58:30 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP; 10 Sep 2017 22:01:25 -0700 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.7]) by orsmga003.jf.intel.com with ESMTP; 10 Sep 2017 22:01:23 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,376,1500966000"; d="scan'208";a="1013044046" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Mon, 11 Sep 2017 13:01:21 +0800 Message-Id: <20170911050121.85708-1-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.12.2.windows.2 Subject: [edk2] [PATCH] MdeModulePkg/PciBusDxe: GetBarAttributes() returns Host address X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Benjamin Herrenschmidt , Ard Biesheuvel , Dong Wei , Andrew Fish , Laszlo Ersek MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Per the UEFI Spec, GetBarAttributes() should return the Host address. But current implementation returns the address read from the BAR, which is the Device address. Per the description of AddressTranslationOffset in ACPI spec: "For bridges that translate addresses across the bridge, this is the offset that must be added to the address on the secondary side to obtain the address on the primary side." HostAddress =3D DeviceAddress + AddressTranslationOffset. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Ard Biesheuvel Cc: Benjamin Herrenschmidt Cc: Andrew Fish Cc: Dong Wei Cc: Laszlo Ersek Cc: Bartosz Szczepanek --- MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c b/MdeModulePkg/Bus/Pci/= PciBusDxe/PciIo.c index cc7125e4fc..852d35d710 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c @@ -1955,7 +1955,7 @@ PciIoGetBarAttributes ( End->Checksum =3D 0; =20 // - // Get the Address Translation Offset + // Get the Address Translation Offset and convert the Device address t= o Host address. // if (Descriptor->ResType =3D=3D ACPI_ADDRESS_SPACE_TYPE_MEM) { Descriptor->AddrTranslationOffset =3D GetMmioAddressTranslationOffse= t ( @@ -1967,6 +1967,7 @@ PciIoGetBarAttributes ( FreePool (Descriptor); return EFI_UNSUPPORTED; } + Descriptor->AddrRangeMin +=3D Descriptor->AddrTranslationOffset; } } =20 --=20 2.12.2.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel