From patchwork Thu Mar 1 06:57:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 130114 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp2452465edc; Wed, 28 Feb 2018 22:58:21 -0800 (PST) X-Google-Smtp-Source: AG47ELvxRfuD3w3xYEZ4nBIfeOUUEuUJKaAtHdW73kFu9mT5XOfPKNbGv1A0oeKdNBtZ0QJ/Gm9R X-Received: by 2002:a17:902:6c41:: with SMTP id h1-v6mr935137pln.25.1519887500994; Wed, 28 Feb 2018 22:58:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519887500; cv=none; d=google.com; s=arc-20160816; b=GCIoL6jjcEinh7i04b8JN+12A2Kuf6OFjh4ag3uF7NXYDBGeVaHJunucFXsahlSNI0 wTx89BcoD5qqcWL2V/IyqvycKiBH/0DCq7cqsOBHbSVQhxJ5FFgLd5xD5YDISIyqSCWQ F6b6dKFKnL1zxKj6vmnhlWT2zbtaUBaVgyHybKU2gjONaqHl37l6bBfxhKyjT/4Bx9ZT HKH7BCKAk5fOzLQVCAZnvnXP8dhacjKyZu/RwXytZ672DHX+K/Iull232KSXbPizUvcr VV1IKiBzoP4LTUmX08pYm5XAOvJ8p5a9HPnUOfVUqGqrD33SenzN0jYnWrMIPiRpNNFf a3Lg== 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=qjyKc0zxm5X1qCgmzIx1Cz2uj3+LOzy8rzytS0MBeK78udEXMs7CaiR+84zU/cN25Y du/V04DbokNINt32VBeCgC1T+hNKrdpSxVcVZ07gJqskF+PrSL/8IHVXv+AKRo/yNOvT K14TGIVVEpVAvsZuZXb7WmKs4fsQ25W5uo0CkDxfzVKgrMQ8wTMwrGfeYRyYIaUFRrFh +tVGto6tqJ2I7kAFsWo8x4KTzD3cY5unwxFGMeVYELBxHKOoXJ+/QD5TwfxaXYas+8Vf 6vN+aPAdKKENA21ZpE6GOFcRIGQeSTsMDWz3yHhjbcKDGCDBXTx3NSXZXnxev4i/S/t1 b0fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=C0Z7fC2l; 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 21si2548867pfj.306.2018.02.28.22.58.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 22:58:20 -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=C0Z7fC2l; 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 2BEFC2034D8F8; Wed, 28 Feb 2018 22:52:12 -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::242; helo=mail-pl0-x242.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pl0-x242.google.com (mail-pl0-x242.google.com [IPv6:2607:f8b0:400e:c01::242]) (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 BFA692242384D for ; Wed, 28 Feb 2018 22:52:10 -0800 (PST) Received: by mail-pl0-x242.google.com with SMTP id c11-v6so3152165plo.0 for ; Wed, 28 Feb 2018 22:58:19 -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=C0Z7fC2lCygcR8cvpPcq0bUD4ZmjjeZr0xha3Cs/Qun/jdFt+mLavFHZISVjL3whhB JYCobcH3faygDsS2RnmUO1GYnIxN9fflqvJdU5oDOfcUJkrn91DI7ED+FQUF/08KxT3K Mydy9d6g6AIKpGxoxSSI4coAYc2U3B5ZjvDFs= 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=TDII5gcmMVz4NNKHzX3Co492OtD86rPL7KsHgA7dAZd03QJaIJ/zCDwNs4lgqzRjLG MHnGoDzxVF2ka2qv2J+v9O3zkKn44w8S5c/3uD0QGNBr53PTCPOhLc1qGuhD0ZgLiXvE AECU+34FGJ3jblf1C/5IWgPUGjzjLB+qHKvgNWVvd816Qu9+rwYkF/Oem9KH1YVlu4IN +7bK3xWDI0cgWJtKxgky2yo53mr6K0BW8BB6R0ra2x7x1AMbwBThSAkpn5zXClIUcieU js8jadNEs3RIZKzTCl7FeAMOXF3ufprHu7PbtknIexvvtx49+57KRk00UTqcah+phO0E nbbg== X-Gm-Message-State: APf1xPDQvdf2pnZaDHrBxP6Gw49LbIVmwOS6mBPpnIQwD/aDCjtg6Ydr JxlAM+TpW2P2fprtekLyxeKIuiJRR00= X-Received: by 2002:a17:902:5596:: with SMTP id g22-v6mr942437pli.4.1519887498609; Wed, 28 Feb 2018 22:58:18 -0800 (PST) Received: from localhost.localdomain ([45.56.152.115]) by smtp.gmail.com with ESMTPSA id p63sm6489867pfk.74.2018.02.28.22.58.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Feb 2018 22:58:18 -0800 (PST) From: Heyi Guo To: edk2-devel@lists.01.org Date: Thu, 1 Mar 2018 14:57:24 +0800 Message-Id: <1519887444-75510-7-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519887444-75510-1-git-send-email-heyi.guo@linaro.org> References: <1519887444-75510-1-git-send-email-heyi.guo@linaro.org> Subject: [edk2] [PATCH v5 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 , 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;