]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.h
RenameRename DxePciLibPciRootBridgeIo to UefiPciLibPciRootBridgeIo.
[mirror_edk2.git] / MdePkg / Library / UefiPciSegmentLibPciRootBridgeIo / PciSegmentLib.h
diff --git a/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.h b/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.h
new file mode 100644 (file)
index 0000000..00129ed
--- /dev/null
@@ -0,0 +1,59 @@
+/** @file\r
+  Include file of PciSegmentPciRootBridgeIo Library.\r
+\r
+  Copyright (c) 2007 - 2008, Intel Corporation All rights\r
+  reserved. This program and the accompanying materials are\r
+  licensed and made available under the terms and conditions of\r
+  the BSD License which accompanies this distribution.  The full\r
+  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
+\r
+**/\r
+\r
+#ifndef __DXE_PCI_SEGMENT_LIB__\r
+#define __DXE_PCI_SEGMENT_LIB__\r
+\r
+#include <PiDxe.h>\r
+\r
+#include <Protocol/PciRootBridgeIo.h>\r
+\r
+#include <Library/PciSegmentLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+#include <IndustryStandard/Acpi.h>\r
+\r
+typedef struct {\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL    *PciRootBridgeIo;\r
+  UINT32                             SegmentNumber;\r
+  UINT64                             MinBusNumber;\r
+  UINT64                             MaxBusNumber;\r
+} PCI_ROOT_BRIDGE_DATA;\r
+\r
+/**\r
+  Assert the validity of a PCI Segment address.\r
+  A valid PCI address should not contain 1's in bits 31:28\r
+\r
+  @param  A The address to validate.\r
+  @param  M Additional bits to assert to be zero.\r
+\r
+**/\r
+#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \\r
+  ASSERT (((A) & (0xf0000000 | (M))) == 0)\r
+\r
+/**\r
+  Translate PCI Lib address into format of PCI Root Bridge I/O Protocol\r
+\r
+  @param  A  Address that encodes the PCI Bus, Device, Function and\r
+             Register.\r
+\r
+**/\r
+#define PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS(A) \\r
+  ((((A) << 4) & 0xff000000) | (((A) >> 4) & 0x00000700) | (((A) << 1) & 0x001f0000) | (LShiftU64((A) & 0xfff, 32)))\r
+\r
+#endif\r