\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
#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
\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
\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
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
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