From patchwork Fri Feb 23 08:53:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 129336 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp362085lja; Fri, 23 Feb 2018 00:54:00 -0800 (PST) X-Google-Smtp-Source: AH8x227JMbzcv0RXLSLG67I7QWsrDZMliRRTH5e4wSNdjgltffz08lZhpJGLqJgsmSeWeb/5t/GV X-Received: by 10.101.93.135 with SMTP id f7mr858845pgt.82.1519376040050; Fri, 23 Feb 2018 00:54:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519376040; cv=none; d=google.com; s=arc-20160816; b=QJJDm+8rlfvH/GkCvhdhRJSH2t2RF2PEk0OzLkS02XDDt/DilV+uRvwVXC8DZPxGEa Q+V8okBfxUyyBBNl3gt3ysQo1KWkld5TxNgu0lMaj9nRBmJd9muQtBSJJmjNrZpUoSrC u8CEUWviqXyhGRPpd6C5br4mu4Ag5fasc5f1zldZNitS6f6xgEYUO74sleZLgVEV0iZf cxrXdoxQqc6di30dXM0m/ySGQLuf6oTy3t5WTqlIdkqtj/iwWPqsKPlCFZuc4Knw5gf1 u4ubfRBsu3/Ss9+zrSP2KXkoZpwGNsZTkJ9ID/HwIbAi8UG76gmd3BSEGaYb37oL1GlI 4UwA== 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=8t0/JYJ6h8YuK0HpAvUjBMlhor3vuYd/lmEhQ64ciI0=; b=QF0SuOE5rAuDLSV/rp5dsfWI0Lwe2fZu0pqhqjZsEaCRRkTAOaBewykhSNV9DMmyLw I84MKXnp34h2j8sUmQYVOtpIA2946v9GXGGpnBQQpvTKQiQ3tYA3HZmBOZ1lMU/IGZAY R3dEPKEW/7JO1CYWAR9EPApruFuwFPXNnPS3529KKSZFolKKxRLz8PvqkpOMYxB9toSF 2GGV3pvO7HxecdDatkIJEb3CJdD41vz9+sk+umgrmnXA935Lz70CAJ825DCCeZfZ5nFh JuiDE6E5MZ9bI2cPp+b9Ii722JemGK/GPkHuv7U+QYaSV8xB4mwNNzZxiqKPGtdFuS0O fTKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=EPPAbSQ7; 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 u7si1490959pfb.216.2018.02.23.00.53.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 00:54:00 -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=EPPAbSQ7; 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 F034922436958; Fri, 23 Feb 2018 00:47:57 -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::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 410102243694C for ; Fri, 23 Feb 2018 00:47:56 -0800 (PST) Received: by mail-pl0-x244.google.com with SMTP id w21so4548926plp.11 for ; Fri, 23 Feb 2018 00:53:57 -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=yZtA1A2jW8WTfz6GGtR8b/Eimt6mCsZxTmwmmlhp46U=; b=EPPAbSQ74H4+lykyC76reDZaOxU/aLzExXHB5EilITIebYgz++7M3VdQav7ZWELHnU kpaGdK6ufx0ZKR6QjS94EmjezTndhSIeEGYn6WDr4wbj/87ItI4R90s8Sja8j0AQ2G6Q blE3Lq4E+puzlvxOk3TzT1zW+d1GV49WPmRMc= 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=yZtA1A2jW8WTfz6GGtR8b/Eimt6mCsZxTmwmmlhp46U=; b=Yr7HFNQ9XqKI9ihWl6D/nlxXYF4XW7oFluhWHWL0YU+hRIPc/ugerZbtadoybJe5Fz nkshklcJ88t+3+RYCOt9ifrkHFVqgdhR/Z8CIMEYVjnc6fq2pr5KH+VLmvxE4msJy59O 9CTO/TcuZtYa9QEh0gEqcefYsZIVrw1u6Zg0Jq/JR08+vbOxp+91G7X/mguV4oAVXby/ g3RJP3s4/cMfVzwaUMFkHbLTQcf/82Wc5LHF3XzigHlRvIT04jehN1C3DJHVsrpYPE29 W0HjXlwsyMLN2qk+wZZ6+TfYnGk1ak2G04qZg5ykJWmc+6RRYVTEOPJT792WZOzWikie Yyww== X-Gm-Message-State: APf1xPABGKxn0CDcrMH+QJBTryRdUISIvnzPNgnv4t69ZepOFuF5PicD e0B48ek//jrUMS7jOgP5JhI9Y7sKTCo= X-Received: by 2002:a17:902:6e8c:: with SMTP id v12-v6mr1031972plk.424.1519376037336; Fri, 23 Feb 2018 00:53:57 -0800 (PST) Received: from localhost.localdomain ([45.56.152.187]) by smtp.gmail.com with ESMTPSA id j25sm3422694pgn.92.2018.02.23.00.53.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Feb 2018 00:53:56 -0800 (PST) From: Heyi Guo To: edk2-devel@lists.01.org Date: Fri, 23 Feb 2018 16:53:28 +0800 Message-Id: <1519376008-110662-4-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519376008-110662-1-git-send-email-heyi.guo@linaro.org> References: <1519376008-110662-1-git-send-email-heyi.guo@linaro.org> Subject: [edk2] [RFC v3 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 fef3ece..62179eb 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;