From nobody Mon Dec 23 09:16:19 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 1519282511970150.5262006026345; Wed, 21 Feb 2018 22:55:11 -0800 (PST) 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) 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) 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) 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=+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-Google-Smtp-Source: AH8x227mMfyCYLwqWcc/HOGZljV7aq0gFJjG1Fi/HdwTbFaXdrpZNSsT81bgZC/3oZ1aV4qCGJr6Ig== X-Received: by 10.99.125.16 with SMTP id y16mr4780627pgc.3.1519282508615; 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 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" 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(-) 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 ( =20 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; } @@ -1968,6 +1968,11 @@ PciIoGetBarAttributes ( return EFI_UNSUPPORTED; } } + + // According to UEFI spec 2.7, we need return CPU view address for Pci= Io::GetBarAttributes, + // and PCI view =3D CPU view + translation + Descriptor->AddrRangeMin -=3D Descriptor->AddrTranslationOffset; + Descriptor->AddrRangeMax -=3D Descriptor->AddrTranslationOffset; } =20 return EFI_SUCCESS; --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel