Re: [edk2] [PATCH v2 4/4] MdeModulePkg/PciHostBridge: Move declaration of mIoMmu to header file

2018-09-25 Thread Laszlo Ersek
On 09/25/18 08:21, Ruiyu Ni wrote:
> The change doesn't have functionality impact.
> It just renames the mIoMmuProtocol to mIoMmu and moves the\
> declaration from PciRootBridgeIo.c to PciHostBridge.h.

Before pushing the patch, please remove the stray backslash from the
commit message.

Thanks
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 4/4] MdeModulePkg/PciHostBridge: Move declaration of mIoMmu to header file

2018-09-25 Thread Laszlo Ersek
On 09/25/18 08:21, Ruiyu Ni wrote:
> 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 (, NULL, (VOID 
> **));
> +  Status = gBS->LocateProtocol (, NULL, (VOID 
> **));
>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_STATUSStatus;
>  
> -  if (mIoMmuProtocol != NULL) {
> -Status = mIoMmuProtocol->Unmap (
> -   mIoMmuProtocol,
> -   Mapping
> -   );
> +  if (mIoMmu != NULL) {
> +Status = mIoMmu->Unmap (
> +   mIoMmu,
> +   Mapping
> +   );
> 

[edk2] [PATCH v2 4/4] MdeModulePkg/PciHostBridge: Move declaration of mIoMmu to header file

2018-09-25 Thread Ruiyu Ni
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 (, NULL, (VOID 
**));
+  Status = gBS->LocateProtocol (, NULL, (VOID 
**));
   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_STATUSStatus;
 
-  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)