From patchwork Thu Mar 15 04:00: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: 131735 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp618626ljb; Wed, 14 Mar 2018 21:01:13 -0700 (PDT) X-Google-Smtp-Source: AG47ELtVw91CFIYGqC+4NLiGK1YLXLechAztAHh2VZuwlSJmjNx+poelCC2Np3HZW5p7g/KKcU3W X-Received: by 10.98.133.193 with SMTP id m62mr6479494pfk.74.1521086472596; Wed, 14 Mar 2018 21:01:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521086472; cv=none; d=google.com; s=arc-20160816; b=Nxd0vnnHP4UKeQcW0Cz7JUsPNWg0AuheHycdN0QOK3CyVoTeahl8CZkYxZkx855YFF 67aSE0fKRxXMcl7z441ylbNgEHlTvuiLQ8hRHlWRUPObfHdRbjMxGJbewnoIaMZQppmQ 4pVi1r3qB3LA02hwosE7ZMqrGd2jjJG92uYaum6599HiopVO5w0VtDSNVaYS9sUQ9Xaw umELNLGo+lgdFGXxesTeMXAFj79CrzXDEQP7tRERgDV+heZnv3nWL6qt+wad/mqPuKuP /49pbQ3UaXF1sj7lCeTCOfDOGpThQPioUEyXwuFVwRuDbYm8Ee7LXJfmzRpG5q8YCxMg U5QQ== 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=KmkEZWm3yvr+FCRdRi9BEzDtsD+GEr6TV1J6w/LwhmA=; b=Y/nTtE487PfdwUIIxOUNQgkyjhB8MW4fFUA4UKFTuMhBegc9gsEf6fkjZVBDeC4Gno Z+b5DYo1yMxNyBURAy/scpsR6Hmvle+T4Q3VbS4fSRU9FDzYstTvvXNvQb470Iy3b/s8 R1P3e4O7KIUlrxPeXoVywjo1Om7WbReEtFPCH0R8EzSlVEDfhG8kVanzuqpDxsLWoS6Z 3IPukBK35yaf6rfj0d1KN3JzISVeitwemBSzpsO3Y6F/l8vQK9xMlgzcUFZB0S1ePh9s 4dfBkTIMMqB9IMHGXUTetDQBq56GErSetJDZb49v0GSBWdztZQ6+mHK5G+q8I0KBsJOd FCDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PL3G5DfS; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id u7-v6si3243455plz.562.2018.03.14.21.01.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Mar 2018 21:01:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PL3G5DfS; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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 F0BFD2095606B; Wed, 14 Mar 2018 20:54:45 -0700 (PDT) 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::244; helo=mail-pl0-x244.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pl0-x244.google.com (mail-pl0-x244.google.com [IPv6:2607:f8b0:400e:c01::244]) (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 BD91620956064 for ; Wed, 14 Mar 2018 20:54:44 -0700 (PDT) Received: by mail-pl0-x244.google.com with SMTP id ay1-v6so3017941plb.7 for ; Wed, 14 Mar 2018 21:01:08 -0700 (PDT) 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=rhviWW23udxmj5gdM/D8sUe3FXKlLK7DSnq5kj3vWis=; b=PL3G5DfS9e/gJenyArbVHrbmpGJRWiE5OsHXJH8Rm5FShzfnz7hGaoQhlr0YO8EUKq dHKr82sbEhUtPtRfQ0RE9epSBgk9WxpS9E3OBGzbxh6UQq+U7rbq0DTMj8pH/brOUK4A adapIuXc9emKwpOAOCKHxmkZ5sYOAFos4MaQA= 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=rhviWW23udxmj5gdM/D8sUe3FXKlLK7DSnq5kj3vWis=; b=WpwozYfb2tmKZYk1v00m7JilAdCHmZ7bmpgIT2LTCj+9ikNcdoqzU6PYtwvvODyS0B ki6DXer7Uu7UtqeC+BlKadfpx4SNVpSGgtwGW89ab2Z+JMFKxSKrzDZdFzSpMR0DaqhO usKLo8avel6+RcUV64R1c1bEy8hnn9iX2GSgofeV/sLjFp4E6AbzorvXwxWfozzxWILN Bwy2QDvjDY/Z1S3nWA/1Gm3ACwgqvGn8ytr8LwJ9i2+dLhsT00ZljOhsLGnlJ+917SEM Rtf6DlovObApvimC2aWlOH6yHEW2XRVUhvSCDJBu/CIaFr1G/h5VIBa5DNfxvIoOTNh+ Ddpw== X-Gm-Message-State: AElRT7GEzBNSofGpTw4X6q2WGkH9nJRjrmpqgW14hqVARk79mrL7ikJf rwEOOqlLFqowh7Ks/K6qCG/DhWEHaKI= X-Received: by 2002:a17:902:f81:: with SMTP id 1-v6mr6420289plz.265.1521086466451; Wed, 14 Mar 2018 21:01:06 -0700 (PDT) Received: from localhost.localdomain ([45.56.152.100]) by smtp.gmail.com with ESMTPSA id e4sm8107785pfa.166.2018.03.14.21.01.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Mar 2018 21:01:05 -0700 (PDT) From: Heyi Guo To: edk2-devel@lists.01.org Date: Thu, 15 Mar 2018 12:00:24 +0800 Message-Id: <1521086424-113954-7-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 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 , Yi Li , 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 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 | 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;