From patchwork Tue Feb 27 02:09:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 129730 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp868969lja; Mon, 26 Feb 2018 18:10:52 -0800 (PST) X-Google-Smtp-Source: AH8x225jVjjTzz+bXhfheJSRa3248nPLls57UHwCBs8JLFgT529GVkydl861ie/vkMc0R9owrTx4 X-Received: by 10.98.245.18 with SMTP id n18mr12291995pfh.25.1519697452392; Mon, 26 Feb 2018 18:10:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519697452; cv=none; d=google.com; s=arc-20160816; b=HZOgVKFYZbs6fwN948+iYAoILbN3xEtblClcxpcK2qVU84fXkGWr5NTEl8FYKIQhUH 5w8KprAC2pmKEhAReX26F1RrdkCqXNS8cEa69PHnCd5AxzpugaU9lVvEmGtKxBrUKQVQ 7T5H58D3RW/+ElppXq4kk/Te/p/LzGozrdqKEzL0SHvSVh/zoFzMiAxil49jaM8AVpxt oVjVPDKZZCYPXK+3BJevoe+bSw+hwwAFnbR1icrDJZgFh9GZDUOIWbHPVHrrqks/P/p5 JIoWHXu9b8XKNd0ZYYreFhBsFZFnOxgDzCcwrPx2Lv798e7EcOkkkGNw2VdxnwlZoV4r Mh8g== 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=0iPwGD9JQnn0B0UAzD0LuG74bkPk98YIgY5wXyApgpo=; b=XBZeeNUPdfmKx9NxcQtjh70QTzdsX5jPY1VmT49NPWItQbUTNF98iWZSpPRyIw6SGy 0TH6ZKpZMm4m5jbo4tWeqKWM4NrLlB2mkQZHgocgWqZ7CQ/Q3YiHHFBnt6NbrJjZBsjC hGPwOtMswwTj/6dA/MbX+InaH5laQ1P4aEsO265SaXW67uGnLEd5DS9b8z9dmwsXN6Eb geSuln8qsJcMl7dz3TM6xEIsvysTUA4q8PVcZ3HM6AfOXrUqwor5gglssgqrkQHiXcko 5sMVYroU9lyHyzsclKd8igBCNEU34kxR/mkjxOSWoiCzSK8yp56wNU5nJ4RmNb9D3rL1 mBHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HXr2a70i; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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. [198.145.21.10]) by mx.google.com with ESMTPS id y190si6336294pgd.177.2018.02.26.18.10.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Feb 2018 18:10:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HXr2a70i; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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 00DC8222630AE; Mon, 26 Feb 2018 18:04:46 -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:c01::243; helo=mail-pl0-x243.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) (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 5DC48209574EF for ; Mon, 26 Feb 2018 18:04:44 -0800 (PST) Received: by mail-pl0-x243.google.com with SMTP id s13so10466564plq.6 for ; Mon, 26 Feb 2018 18:10:50 -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=KY/TY1vQXahnUmVIDRxMzVNKvNFaI0EiawWm+wlL7A4=; b=HXr2a70ixIhw+KlLpKzPw0sFe2nspI4bvqBiicCzM8F/K+dAhA7WYTlJvgsZCW++6X B3MTTQO0CtZNiem8eOMewrltysUUH+uf8d4IzdcGoeLs4jdH/reVAvMH1G4kCK9RVMyZ ixs0zOEocgfLGnCBe73M1ZvU4zMEc73fU3NRo= 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=KY/TY1vQXahnUmVIDRxMzVNKvNFaI0EiawWm+wlL7A4=; b=N9HB8U1kZrtXNqa+hFwHg73zes88XxHHmMDYd+sVD6Jz+G1qwo+GHYOzlJkTGvMicI UZQUgqds7O7oi5WLnnATWd4N+50ueXpQ7U6qio/MM9Hc5+bjojvjUYhyjNEe2SwcfGOo QgoXwfXhqGqNLkgnskWzM1+V1RL8eUdjUlw+x4gjBx3lHi2+s3meEwUzKPNtnsLXshVc t9ZGN5roHtEgUDmHp11T8CfqmGVumWkzvPuemBM87kPOFcrigzd6/IUmNHiDr6oaDXjM Ba2DaunQJtBzeIM6layyL4p9H9hidzTKvwUA1faGIkxv/1aoDmRH4QbSavKfLdme3+rt RlOg== X-Gm-Message-State: APf1xPAFCVpuT16O7ML+DfY7e01SncYLlVZri/wX+WwiVDyoPXAtSJDg Auly1Oz0nDAykJ8Mey1d0mJyGX7t5QU= X-Received: by 2002:a17:902:8f95:: with SMTP id z21-v6mr12618954plo.132.1519697449738; Mon, 26 Feb 2018 18:10:49 -0800 (PST) Received: from localhost.localdomain ([104.237.91.49]) by smtp.gmail.com with ESMTPSA id a138sm21289210pfd.47.2018.02.26.18.10.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Feb 2018 18:10:49 -0800 (PST) From: Heyi Guo To: edk2-devel@lists.01.org Date: Tue, 27 Feb 2018 10:09:49 +0800 Message-Id: <1519697389-3525-4-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519697389-3525-1-git-send-email-heyi.guo@linaro.org> References: <1519697389-3525-1-git-send-email-heyi.guo@linaro.org> Subject: [edk2] [RFC v4 3/3] 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" 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 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;