From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 984F0222DDBE0 for ; Sun, 21 Jan 2018 22:19:00 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jan 2018 22:24:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,395,1511856000"; d="scan'208";a="168031239" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.19]) by orsmga004.jf.intel.com with ESMTP; 21 Jan 2018 22:24:25 -0800 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Star Zeng Date: Mon, 22 Jan 2018 14:24:20 +0800 Message-Id: <20180122062420.202548-3-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.15.1.windows.2 In-Reply-To: <20180122062420.202548-1-ruiyu.ni@intel.com> References: <20180122062420.202548-1-ruiyu.ni@intel.com> Subject: [PATCH 2/2] MdeModulePkg/PciBusDxe: Install PciEnumerationComplete after PciIo 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: , X-List-Received-Date: Mon, 22 Jan 2018 06:19:01 -0000 Per PI spec, the PciEnumerationComplete protocol installation should be after PciIo installation. Today's implementation installs the PciEnumerationComplete after hardware enumeration is completed, but before PciIo installation. The change corrects the spec/implementation gap. The change also benefits certain implementation that depends on the PciIo handle in PciEnumerationComplete callback. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Star Zeng --- MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c | 15 +++++++++++++-- MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 10 ---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c index 3bb5099bd3..c48e3bba96 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c @@ -360,8 +360,19 @@ PciBusDriverBindingStart ( // StartPciDevices (Controller); - gFullEnumeration = FALSE; - return EFI_SUCCESS; + if (gFullEnumeration) { + gFullEnumeration = FALSE; + + Status = gBS->InstallProtocolInterface ( + &PciRootBridgeIo->ParentHandle, + &gEfiPciEnumerationCompleteProtocolGuid, + EFI_NATIVE_INTERFACE, + NULL + ); + ASSERT_EFI_ERROR (Status); + } + + return Status; } /** diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c index f6aa327493..d5d3c07393 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c @@ -104,16 +104,6 @@ PciEnumerator ( return Status; } - Status = gBS->InstallProtocolInterface ( - &HostBridgeHandle, - &gEfiPciEnumerationCompleteProtocolGuid, - EFI_NATIVE_INTERFACE, - NULL - ); - if (EFI_ERROR (Status)) { - return Status; - } - return EFI_SUCCESS; } -- 2.15.1.windows.2