From patchwork Thu Sep 15 14:54:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 76326 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp2489193qgf; Thu, 15 Sep 2016 07:55:12 -0700 (PDT) X-Received: by 10.98.79.213 with SMTP id f82mr15386472pfj.64.1473951312178; Thu, 15 Sep 2016 07:55:12 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id n28si39726798pfa.263.2016.09.15.07.55.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Sep 2016 07:55: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; 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 dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 240B21A1EFA; Thu, 15 Sep 2016 07:55:11 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-qk0-x22f.google.com (mail-qk0-x22f.google.com [IPv6:2607:f8b0:400d:c09::22f]) (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 7FDF81A1EE9 for ; Thu, 15 Sep 2016 07:55:09 -0700 (PDT) Received: by mail-qk0-x22f.google.com with SMTP id t7so55153160qkh.2 for ; Thu, 15 Sep 2016 07:55:09 -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; bh=mODcNbDNaH7T/pP3gn2zpXgQnrfc3WAYeXwqeTZbVds=; b=Fu9TDXBoSZXi6bCigHIblMktJF52OrZ5zyagSpnx98IOO6qFmP1Kulywn5D4wgvVkq 96QLLFJxv7eqg6CJtwQpkn+8Nb6tYeX4fKPocrXey85DxgRY5E2EC23UjKTnVOcTjMMM wUIZJTU1zCr8zqIqvQOsuEE8sww5gAEokW1gQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=mODcNbDNaH7T/pP3gn2zpXgQnrfc3WAYeXwqeTZbVds=; b=QWFO3Z4dCznbRL0bmz3ZJs9LTRoCTEV+N2J33533e8iLwE/fuSzhIAX+EH38FYLpT6 o+i2wyGfEVl6lXaeJ3ordxSIIkX/CbawXMwFzbPWRjRg9Pymy2SDKP+MY621q0YURaUU KiCMvpHc8epY8huKXWTNdNYy5fD9XHpe3ttqPsZCzE/u5wNBy4VcPdrBRuX2z6/f8/ox Mr0MTIXCKsBLRUNipec4QlvaWBE7fX0b2Tb9dSWJCLBmvZAKTQGFX0kvamANm6xfIyrh rKNZEamKEEVEv++HekzSZwJY8BPT99oykbBobC9WR2z8o3/Jh8UxAJf10L8S4ZmzVdCd /vMA== X-Gm-Message-State: AE9vXwO99qOj9cXADUr+J25jNtT+9LT7UNqABYEHSP5o1HovFwUrTRjp7y+R7nQ+gq7qP4jo X-Received: by 10.194.100.199 with SMTP id fa7mr9825313wjb.16.1473951308339; Thu, 15 Sep 2016 07:55:08 -0700 (PDT) Received: from localhost.localdomain ([197.131.252.189]) by smtp.gmail.com with ESMTPSA id d62sm2832998wmd.7.2016.09.15.07.55.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Sep 2016 07:55:07 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, liming.gao@intel.com, star.zeng@intel.com, feng.tian@intel.com, ruiyu.ni@intel.com, leif.lindholm@linaro.org, afish@apple.com, michael.d.kinney@intel.com Date: Thu, 15 Sep 2016 15:54:56 +0100 Message-Id: <1473951296-19120-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [PATCH] MdeModulePkg/PciBusDxe: make OPROM BAR degradation X64 specific X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jiewen.yao@intel.com, lersek@redhat.com, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" The 'universal' PCI bus driver in MdeModulePkg contains a quirk to degrade 64-bit PCI MMIO BARs to 32-bit in the presence of an option ROM on the same PCI controller. This quirk is highly specific to not just the X64 architecture in general, but to the PC platform in particular, given that only X64 platforms that require legacy PC BIOS compatibility require it. However, making the quirk dependent on the presence of the legacy BIOS protocol met with resistance, due to the fact that it introduces a dependency on the IntelFrameworkModulePkg package. So instead, make the quirk dependent on whether we are compiling for the X64 architecture, by putting the #ifdef MDE_CPU_X64/#endif preprocessor directives around it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- Since nobody proposed any alternatives to the solution I proposed, let's just make the quirk disappear on architectures that have no use for it. Note that forcing non-X64 architectures to install a driver that produces the IncompatiblePciDevice protocol only to make the PCI bus driver behave normally (and which, incidentally, can only be produced once per platform, making it difficult to provide a default implementation that can be widely reused) is not acceptable IMO. If anything, this should require an IncompatiblePlatform protocol that informs the PCI bus driver that a special quirk is required, but I am aware that this is difficult to accomplish without breaking backward compatibility. Hence this compromise. MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c index b0632d53b82b..b4771a822d65 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c @@ -1052,6 +1052,7 @@ DegradeResource ( IN PCI_RESOURCE_NODE *PMem64Node ) { +#ifdef MDE_CPU_X64 PCI_IO_DEVICE *PciIoDevice; LIST_ENTRY *ChildDeviceLink; LIST_ENTRY *ChildNodeLink; @@ -1101,6 +1102,7 @@ DegradeResource ( } ChildDeviceLink = ChildDeviceLink->ForwardLink; } +#endif // // If firmware is in 32-bit mode,