From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Cc: lersek@redhat.com, jiewen.yao@intel.com, Ard Biesheuvel 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: [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: , X-List-Received-Date: Thu, 15 Sep 2016 14:55:09 -0000 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(+) 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, -- 2.7.4