From nobody Mon Dec 23 05:31:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 152108646988112.165874785530946; Wed, 14 Mar 2018 21:01:09 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 82D1020956066; Wed, 14 Mar 2018 20:54:42 -0700 (PDT) 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 CBC1920956066 for ; Wed, 14 Mar 2018 20:54:40 -0700 (PDT) Received: by mail-pg0-x241.google.com with SMTP id e9so2297714pgs.10 for ; Wed, 14 Mar 2018 21:01:04 -0700 (PDT) Received: from localhost.localdomain ([45.56.152.100]) by smtp.gmail.com with ESMTPSA id e4sm8107785pfa.166.2018.03.14.21.01.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Mar 2018 21:01:03 -0700 (PDT) X-Original-To: edk2-devel@lists.01.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; 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 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=Ls40rj9ABwSl9LQsgv8UPrD1J5WGgRgvchmgjSIO/30=; b=RlT7v2TfWMnEONHXYAuExhbRrtCAp2AOsan1psCwbE0IGw+9zmXZTic842H6R6t7rE zY0VPAXNEyHCSH+UB0CuT19lT+wsmGqmQf7Cy4xHtP/eEN/3FQivth5nHGybK7nlPE0t tw0JT8yIC8NFCI2aj5gHxovyUUuq9KeHOBznY= 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=Ls40rj9ABwSl9LQsgv8UPrD1J5WGgRgvchmgjSIO/30=; b=cuzdOODCwOgNXkejJkWAfPiKYvpjyKXGaJQSMAZ2AObwudZ2RhvA+ZWpgl+PHSZI73 C4EAIC5pgujGmVeiH9R6t2XfLP6Lky+dGI+ziC4nzFsv6kswLtmwi5e0ZVhmQKZrLapA +If6mn9zmXBEnY9Miammg8NqP5QsIm6quX3j02mBSrg+qayUYGrWkj1Z0YZFDVjb3Ng0 xMRX5S90GT1+F3TLfs/BbbkKbsKhJ+JUeoHJWpMAMevba0VT1WK0B1PvsVYERsXvavqn 0iSVk+ZZKnDravutEmEVv+iX8clJEHIs2b9yTsDq4qxpLfRjnC0qtwz4v5QAtP+br3cp /H6w== X-Gm-Message-State: AElRT7H7QSdShWPaigckygBcla1a0TVUjAGYJM3Alc/bG8BmQOQ7rm2Y OGyQk5l6Tt1g9Bcc5IDZ7YVZY0xXJL4= X-Google-Smtp-Source: AG47ELvcheVk+tYlWLHNLJ7pIXOuD4E7LeEAj9vBQLdfYX3hqKoLlWoIZ8aSbQ6iGueUiCT+TI2LPQ== X-Received: by 10.99.60.79 with SMTP id i15mr5554002pgn.399.1521086463962; Wed, 14 Mar 2018 21:01:03 -0700 (PDT) From: Heyi Guo To: edk2-devel@lists.01.org Date: Thu, 15 Mar 2018 12:00:23 +0800 Message-Id: <1521086424-113954-6-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521086424-113954-1-git-send-email-heyi.guo@linaro.org> References: <1521086424-113954-1-git-send-email-heyi.guo@linaro.org> Subject: [edk2] [PATCH v6 5/6] MdeModulePkg/PciBus: convert host address to device address 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 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" According to UEFI spec 2.7, PciRootBridgeIo->Configuration() should return host address (CPU view ddress) rather than device address (PCI view address), so in function GetMmioAddressTranslationOffset we need to convert the range to device address before comparing. And device address =3D host address + translation offset. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Heyi Guo Signed-off-by: Yi Li 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c b/MdeModulePkg/Bus/Pci/= PciBusDxe/PciIo.c index 190f4b0dc7ed..fef3eceb7f62 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c @@ -1812,10 +1812,14 @@ GetMmioAddressTranslationOffset ( return (UINT64) -1; } =20 + // According to UEFI 2.7, EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL::Configuration= () + // returns host address instead of device address, while AddrTranslation= Offset + // is not zero, and device address =3D host address + AddrTranslationOff= set, so + // we convert host address to device address for range compare. while (Configuration->Desc =3D=3D ACPI_ADDRESS_SPACE_DESCRIPTOR) { if ((Configuration->ResType =3D=3D ACPI_ADDRESS_SPACE_TYPE_MEM) && - (Configuration->AddrRangeMin <=3D AddrRangeMin) && - (Configuration->AddrRangeMin + Configuration->AddrLen >=3D AddrRan= geMin + AddrLen) + (Configuration->AddrRangeMin + Configuration->AddrTranslationOffse= t <=3D AddrRangeMin) && + (Configuration->AddrRangeMin + Configuration->AddrLen + Configurat= ion->AddrTranslationOffset >=3D AddrRangeMin + AddrLen) ) { return Configuration->AddrTranslationOffset; } --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel