From patchwork Thu Apr 28 15:51:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 66905 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp292768qge; Thu, 28 Apr 2016 08:51:39 -0700 (PDT) X-Received: by 10.66.193.202 with SMTP id hq10mr21156202pac.6.1461858699698; Thu, 28 Apr 2016 08:51:39 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id m66si10876371pfm.117.2016.04.28.08.51.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Apr 2016 08:51:39 -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 1A4BC1A1F43; Thu, 28 Apr 2016 08:51:39 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (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 7BF631A1F42 for ; Thu, 28 Apr 2016 08:51:37 -0700 (PDT) Received: by mail-wm0-x232.google.com with SMTP id n129so70811492wmn.1 for ; Thu, 28 Apr 2016 08:51:37 -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=4C4Aa/nAicgazNXuQC6My7BTnfASss+mZaTd070q/As=; b=gJHc6DwN1xTh7wa7905ukZVyyGq+kxf4puZKCJU97xr1KlSZt1DC620eqGVKJeCZrv DU/+QC28hZYWgEeP3wM899O039RrKQX2dgLft4lf0pi1a/jNGlZOCeKE/7C6u5sVttoG /JnerdHqBhRUgyyL4YCYqtayDnsOD8LjWm0I0= 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=4C4Aa/nAicgazNXuQC6My7BTnfASss+mZaTd070q/As=; b=IyCEZCdsI/JTF6pqYOPS4LJoZLXvDWgFy97idN3UEMXi1i40ZvfOCJsZYFAo3M/BMe gCRDvVrlXeut9N/yqY3VENmMmwt82J21PT3GMf1ZL5fp/MpaJg4QshsvIvbJ6Vt3Zr1J JRiO+gQabkFzX3mLL5H/C3CTIa6zBIEIzuLm2NkaePVVOrCAL/cfQb6gMfqIvlK4FHao I6arJS1hN/n1L2XBFjHswpx9XYCxDkTDjEY1HOBmfvuyAzciyHGW350fZPJp3l52Qmhc v9tU3kh9ax1lstoy+2DtZb4qai/nQDa9UnAfxt4p8ivpBx7AeuPvUTc35k+pv/EtGnV3 mYAg== X-Gm-Message-State: AOPr4FXEVrMwIYYTbASUYZde+a9cMc8iWNCLz/7rAtk1kImv+3Ashc+XS9rSDfYRmEb2egOX X-Received: by 10.28.47.208 with SMTP id v199mr33320367wmv.56.1461858696121; Thu, 28 Apr 2016 08:51:36 -0700 (PDT) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id hk7sm10308908wjb.5.2016.04.28.08.51.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Apr 2016 08:51:35 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, feng.tian@intel.com, star.zeng@intel.com Date: Thu, 28 Apr 2016 17:51:28 +0200 Message-Id: <1461858688-31517-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [PATCH] MdeModulePkg/PciBusDxe: don't create bogus descriptor if no resources needed X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" If the current PCI configuration requires no resources to be allocated at all (i.e., unpopulated bus), the PCI enumeration code creates a single ACPI_ADDRESS_SPACE_DESCRIPTOR memory descriptor with all fields cleared. This is rejected by the SubmitResources() implementation of the generic PciHostBridgeDxe in the following way: PciHostBridge: SubmitResources for PcieRoot(0x0) Mem: Granularity/SpecificFlag = 0 / 00 Length/Alignment = 0x0 / 0x0 PciBus: HostBridge->SubmitResources() - Invalid Parameter ASSERT_EFI_ERROR (Status = Invalid Parameter) ASSERT [PciBusDxe] .../PciBusDxe/PciLib.c(561): !EFI_ERROR (Status) So instead, create the empty configuration as a single entry of type EFI_ACPI_END_TAG_DESCRIPTOR. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 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/PciEnumerator.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c index 597c0834e0f5..469a2ddb8ac0 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c @@ -1307,15 +1307,12 @@ ConstructAcpiResourceRequestor ( // // If there is no resource request // - Configuration = AllocateZeroPool (sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR)); + Configuration = AllocateZeroPool (sizeof (EFI_ACPI_END_TAG_DESCRIPTOR)); if (Configuration == NULL) { return EFI_OUT_OF_RESOURCES; } - Ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) (Configuration); - Ptr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR; - - PtrEnd = (EFI_ACPI_END_TAG_DESCRIPTOR *) (Ptr + 1); + PtrEnd = (EFI_ACPI_END_TAG_DESCRIPTOR *) (Configuration); PtrEnd->Desc = ACPI_END_TAG_DESCRIPTOR; PtrEnd->Checksum = 0; }