MdeModulePkg/PciHostBridge: Move declaration of mIoMmu to header file

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 <ruiyu.ni@intel.com>
Suggested-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Ruiyu Ni 2018-09-25 10:58:56 +08:00
parent b8bfb92b4e
commit 69b4046504
4 changed files with 34 additions and 34 deletions

View File

@ -26,7 +26,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED CHAR16 *mPciResourceTypeStr[] = {
L"I/O", L"Mem", L"PMem", L"Mem64", L"PMem64", L"Bus" L"I/O", L"Mem", L"PMem", L"Mem64", L"PMem64", L"Bus"
}; };
EDKII_IOMMU_PROTOCOL *mIoMmuProtocol; EDKII_IOMMU_PROTOCOL *mIoMmu;
EFI_EVENT mIoMmuEvent; EFI_EVENT mIoMmuEvent;
VOID *mIoMmuRegistration; VOID *mIoMmuRegistration;
@ -363,7 +363,7 @@ IoMmuProtocolCallback (
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = gBS->LocateProtocol (&gEdkiiIoMmuProtocolGuid, NULL, (VOID **)&mIoMmuProtocol); Status = gBS->LocateProtocol (&gEdkiiIoMmuProtocolGuid, NULL, (VOID **)&mIoMmu);
if (!EFI_ERROR(Status)) { if (!EFI_ERROR(Status)) {
gBS->CloseEvent (mIoMmuEvent); gBS->CloseEvent (mIoMmuEvent);
} }

View File

@ -23,6 +23,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/MemoryAllocationLib.h> #include <Library/MemoryAllocationLib.h>
#include <Library/PciHostBridgeLib.h> #include <Library/PciHostBridgeLib.h>
#include <Protocol/PciHostBridgeResourceAllocation.h> #include <Protocol/PciHostBridgeResourceAllocation.h>
#include <Protocol/IoMmu.h>
#include "PciRootBridge.h" #include "PciRootBridge.h"
@ -269,4 +270,6 @@ GetTranslationByResourceType (
); );
extern EFI_CPU_IO2_PROTOCOL *mCpuIo; extern EFI_CPU_IO2_PROTOCOL *mCpuIo;
extern EDKII_IOMMU_PROTOCOL *mIoMmu;
#endif #endif

View File

@ -26,7 +26,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/CpuIo2.h> #include <Protocol/CpuIo2.h>
#include <Protocol/DevicePath.h> #include <Protocol/DevicePath.h>
#include <Protocol/PciRootBridgeIo.h> #include <Protocol/PciRootBridgeIo.h>
#include <Protocol/IoMmu.h>
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/DevicePathLib.h> #include <Library/DevicePathLib.h>
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>

View File

@ -17,8 +17,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "PciRootBridge.h" #include "PciRootBridge.h"
#include "PciHostResource.h" #include "PciHostResource.h"
extern EDKII_IOMMU_PROTOCOL *mIoMmuProtocol;
#define NO_MAPPING (VOID *) (UINTN) -1 #define NO_MAPPING (VOID *) (UINTN) -1
#define RESOURCE_VALID(Resource) ((Resource)->Base <= (Resource)->Limit) #define RESOURCE_VALID(Resource) ((Resource)->Base <= (Resource)->Limit)
@ -1269,7 +1267,7 @@ RootBridgeIoMap (
RootBridge = ROOT_BRIDGE_FROM_THIS (This); RootBridge = ROOT_BRIDGE_FROM_THIS (This);
if (mIoMmuProtocol != NULL) { if (mIoMmu != NULL) {
if (!RootBridge->DmaAbove4G) { if (!RootBridge->DmaAbove4G) {
// //
// Clear 64bit support // Clear 64bit support
@ -1278,14 +1276,14 @@ RootBridgeIoMap (
Operation = (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION) (Operation - EfiPciOperationBusMasterRead64); Operation = (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION) (Operation - EfiPciOperationBusMasterRead64);
} }
} }
Status = mIoMmuProtocol->Map ( Status = mIoMmu->Map (
mIoMmuProtocol, mIoMmu,
(EDKII_IOMMU_OPERATION) Operation, (EDKII_IOMMU_OPERATION) Operation,
HostAddress, HostAddress,
NumberOfBytes, NumberOfBytes,
DeviceAddress, DeviceAddress,
Mapping Mapping
); );
return Status; return Status;
} }
@ -1413,11 +1411,11 @@ RootBridgeIoUnmap (
PCI_ROOT_BRIDGE_INSTANCE *RootBridge; PCI_ROOT_BRIDGE_INSTANCE *RootBridge;
EFI_STATUS Status; EFI_STATUS Status;
if (mIoMmuProtocol != NULL) { if (mIoMmu != NULL) {
Status = mIoMmuProtocol->Unmap ( Status = mIoMmu->Unmap (
mIoMmuProtocol, mIoMmu,
Mapping Mapping
); );
return Status; return Status;
} }
@ -1539,21 +1537,21 @@ RootBridgeIoAllocateBuffer (
RootBridge = ROOT_BRIDGE_FROM_THIS (This); RootBridge = ROOT_BRIDGE_FROM_THIS (This);
if (mIoMmuProtocol != NULL) { if (mIoMmu != NULL) {
if (!RootBridge->DmaAbove4G) { if (!RootBridge->DmaAbove4G) {
// //
// Clear DUAL_ADDRESS_CYCLE // Clear DUAL_ADDRESS_CYCLE
// //
Attributes &= ~((UINT64) EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE); Attributes &= ~((UINT64) EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE);
} }
Status = mIoMmuProtocol->AllocateBuffer ( Status = mIoMmu->AllocateBuffer (
mIoMmuProtocol, mIoMmu,
Type, Type,
MemoryType, MemoryType,
Pages, Pages,
HostAddress, HostAddress,
Attributes Attributes
); );
return Status; return Status;
} }
@ -1603,12 +1601,12 @@ RootBridgeIoFreeBuffer (
{ {
EFI_STATUS Status; EFI_STATUS Status;
if (mIoMmuProtocol != NULL) { if (mIoMmu != NULL) {
Status = mIoMmuProtocol->FreeBuffer ( Status = mIoMmu->FreeBuffer (
mIoMmuProtocol, mIoMmu,
Pages, Pages,
HostAddress HostAddress
); );
return Status; return Status;
} }