From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 71F9B21155D3E for ; Mon, 24 Sep 2018 23:22:21 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Sep 2018 23:22:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,301,1534834800"; d="scan'208";a="91651466" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.8]) by fmsmga004.fm.intel.com with ESMTP; 24 Sep 2018 23:20:25 -0700 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Star Zeng Date: Tue, 25 Sep 2018 14:21:17 +0800 Message-Id: <20180925062117.34772-5-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.16.1.windows.1 In-Reply-To: <20180925062117.34772-1-ruiyu.ni@intel.com> References: <20180925062117.34772-1-ruiyu.ni@intel.com> Subject: [PATCH v2 4/4] MdeModulePkg/PciHostBridge: Move declaration of mIoMmu to header file X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2018 06:22:21 -0000 The change doesn't have functionality impact. It just renames the mIoMmuProtocol to mIoMmu and moves the\ declaration from PciRootBridgeIo.c to PciHostBridge.h. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Suggested-by: Star Zeng Cc: Star Zeng --- .../Bus/Pci/PciHostBridgeDxe/PciHostBridge.c | 4 +- .../Bus/Pci/PciHostBridgeDxe/PciHostBridge.h | 3 ++ .../Bus/Pci/PciHostBridgeDxe/PciRootBridge.h | 1 - .../Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c | 60 +++++++++++----------- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c index 0c1f75efcb..a74c6f0d30 100644 --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c @@ -26,7 +26,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED CHAR16 *mPciResourceTypeStr[] = { L"I/O", L"Mem", L"PMem", L"Mem64", L"PMem64", L"Bus" }; -EDKII_IOMMU_PROTOCOL *mIoMmuProtocol; +EDKII_IOMMU_PROTOCOL *mIoMmu; EFI_EVENT mIoMmuEvent; VOID *mIoMmuRegistration; @@ -363,7 +363,7 @@ IoMmuProtocolCallback ( { EFI_STATUS Status; - Status = gBS->LocateProtocol (&gEdkiiIoMmuProtocolGuid, NULL, (VOID **)&mIoMmuProtocol); + Status = gBS->LocateProtocol (&gEdkiiIoMmuProtocolGuid, NULL, (VOID **)&mIoMmu); if (!EFI_ERROR(Status)) { gBS->CloseEvent (mIoMmuEvent); } diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.h b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.h index bc9c7214dd..e0ed39eebc 100644 --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.h +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.h @@ -23,6 +23,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include "PciRootBridge.h" @@ -269,4 +270,6 @@ GetTranslationByResourceType ( ); extern EFI_CPU_IO2_PROTOCOL *mCpuIo; +extern EDKII_IOMMU_PROTOCOL *mIoMmu; + #endif diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h index 06871052e7..e8513c906f 100644 --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h @@ -26,7 +26,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include #include #include #include diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c index 16413b60a6..4c908fad88 100644 --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c @@ -17,8 +17,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "PciRootBridge.h" #include "PciHostResource.h" -extern EDKII_IOMMU_PROTOCOL *mIoMmuProtocol; - #define NO_MAPPING (VOID *) (UINTN) -1 #define RESOURCE_VALID(Resource) ((Resource)->Base <= (Resource)->Limit) @@ -1269,7 +1267,7 @@ RootBridgeIoMap ( RootBridge = ROOT_BRIDGE_FROM_THIS (This); - if (mIoMmuProtocol != NULL) { + if (mIoMmu != NULL) { if (!RootBridge->DmaAbove4G) { // // Clear 64bit support @@ -1278,14 +1276,14 @@ RootBridgeIoMap ( Operation = (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION) (Operation - EfiPciOperationBusMasterRead64); } } - Status = mIoMmuProtocol->Map ( - mIoMmuProtocol, - (EDKII_IOMMU_OPERATION) Operation, - HostAddress, - NumberOfBytes, - DeviceAddress, - Mapping - ); + Status = mIoMmu->Map ( + mIoMmu, + (EDKII_IOMMU_OPERATION) Operation, + HostAddress, + NumberOfBytes, + DeviceAddress, + Mapping + ); return Status; } @@ -1413,11 +1411,11 @@ RootBridgeIoUnmap ( PCI_ROOT_BRIDGE_INSTANCE *RootBridge; EFI_STATUS Status; - if (mIoMmuProtocol != NULL) { - Status = mIoMmuProtocol->Unmap ( - mIoMmuProtocol, - Mapping - ); + if (mIoMmu != NULL) { + Status = mIoMmu->Unmap ( + mIoMmu, + Mapping + ); return Status; } @@ -1539,21 +1537,21 @@ RootBridgeIoAllocateBuffer ( RootBridge = ROOT_BRIDGE_FROM_THIS (This); - if (mIoMmuProtocol != NULL) { + if (mIoMmu != NULL) { if (!RootBridge->DmaAbove4G) { // // Clear DUAL_ADDRESS_CYCLE // Attributes &= ~((UINT64) EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE); } - Status = mIoMmuProtocol->AllocateBuffer ( - mIoMmuProtocol, - Type, - MemoryType, - Pages, - HostAddress, - Attributes - ); + Status = mIoMmu->AllocateBuffer ( + mIoMmu, + Type, + MemoryType, + Pages, + HostAddress, + Attributes + ); return Status; } @@ -1603,12 +1601,12 @@ RootBridgeIoFreeBuffer ( { EFI_STATUS Status; - if (mIoMmuProtocol != NULL) { - Status = mIoMmuProtocol->FreeBuffer ( - mIoMmuProtocol, - Pages, - HostAddress - ); + if (mIoMmu != NULL) { + Status = mIoMmu->FreeBuffer ( + mIoMmu, + Pages, + HostAddress + ); return Status; } -- 2.16.1.windows.1