]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / PciHostBridgeDxe / PciHostBridge.h
index 288823c7784aaa64bd3caecb5c850cbf40157fcf..755ab75b19f55e336269d27316af22959d0a61fa 100644 (file)
@@ -2,14 +2,8 @@
 \r
   The Header file of the Pci Host Bridge Driver.\r
 \r
-Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -23,6 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/PciHostBridgeLib.h>\r
 #include <Protocol/PciHostBridgeResourceAllocation.h>\r
+#include <Protocol/IoMmu.h>\r
 \r
 #include "PciRootBridge.h"\r
 \r
@@ -37,6 +32,13 @@ typedef struct {
 \r
 #define PCI_HOST_BRIDGE_FROM_THIS(a) CR (a, PCI_HOST_BRIDGE_INSTANCE, ResAlloc, PCI_HOST_BRIDGE_SIGNATURE)\r
 \r
+//\r
+// Macros to translate device address to host address and vice versa. According\r
+// to UEFI 2.7, device address = host address + translation offset.\r
+//\r
+#define TO_HOST_ADDRESS(DeviceAddress,TranslationOffset) ((DeviceAddress) - (TranslationOffset))\r
+#define TO_DEVICE_ADDRESS(HostAddress,TranslationOffset) ((HostAddress) + (TranslationOffset))\r
+\r
 //\r
 // Driver Entry Point\r
 //\r
@@ -65,12 +67,12 @@ InitializePciHostBridge (
 \r
   Enter a certain phase of the PCI enumeration process.\r
 \r
-  @param This   -  The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.\r
-  @param Phase  -  The phase during enumeration.\r
+  @param This   The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.\r
+  @param Phase  The phase during enumeration.\r
 \r
-  @retval EFI_SUCCESS            -  Succeed.\r
-  @retval EFI_INVALID_PARAMETER  -  Wrong phase parameter passed in.\r
-  @retval EFI_NOT_READY          -  Resources have not been submitted yet.\r
+  @retval EFI_SUCCESS            Succeed.\r
+  @retval EFI_INVALID_PARAMETER  Wrong phase parameter passed in.\r
+  @retval EFI_NOT_READY          Resources have not been submitted yet.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -85,15 +87,15 @@ NotifyPhase (
   Return the device handle of the next PCI root bridge that is associated with\r
   this Host Bridge.\r
 \r
-  @param This              The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.\r
-  RootBridgeHandle  -  Returns the device handle of the next PCI Root Bridge.\r
-                       On input, it holds the RootBridgeHandle returned by the most\r
-                       recent call to GetNextRootBridge().The handle for the first\r
-                       PCI Root Bridge is returned if RootBridgeHandle is NULL on input.\r
+  @param This              The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.\r
+  @param RootBridgeHandle  Returns the device handle of the next PCI Root Bridge.\r
+                           On input, it holds the RootBridgeHandle returned by the most\r
+                           recent call to GetNextRootBridge().The handle for the first\r
+                           PCI Root Bridge is returned if RootBridgeHandle is NULL on input.\r
 \r
-  @retval EFI_SUCCESS            -  Succeed.\r
-  @retval EFI_NOT_FOUND          -  Next PCI root bridge not found.\r
-  @retval EFI_INVALID_PARAMETER  -  Wrong parameter passed in.\r
+  @retval EFI_SUCCESS            Succeed.\r
+  @retval EFI_NOT_FOUND          Next PCI root bridge not found.\r
+  @retval EFI_INVALID_PARAMETER  Wrong parameter passed in.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -247,6 +249,21 @@ ResourceConflict (
   IN  PCI_HOST_BRIDGE_INSTANCE *HostBridge\r
   );\r
 \r
-extern EFI_METRONOME_ARCH_PROTOCOL *mMetronome;\r
+/**\r
+  This routine gets translation offset from a root bridge instance by resource type.\r
+\r
+  @param RootBridge The Root Bridge Instance for the resources.\r
+  @param ResourceType The Resource Type of the translation offset.\r
+\r
+  @retval The Translation Offset of the specified resource.\r
+**/\r
+UINT64\r
+GetTranslationByResourceType (\r
+  IN  PCI_ROOT_BRIDGE_INSTANCE     *RootBridge,\r
+  IN  PCI_RESOURCE_TYPE            ResourceType\r
+  );\r
+\r
 extern EFI_CPU_IO2_PROTOCOL        *mCpuIo;\r
+extern EDKII_IOMMU_PROTOCOL        *mIoMmu;\r
+\r
 #endif\r