X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=MdePkg%2FLibrary%2FUefiPciSegmentLibPciRootBridgeIo%2FPciSegmentLib.h;fp=MdePkg%2FLibrary%2FUefiPciSegmentLibPciRootBridgeIo%2FPciSegmentLib.h;h=00129edea6bb405ee4e16f97115df9e8c5dcaac7;hb=6f6ae61dc605f06a9fc27ffc295cc2f6f7b26dda;hp=0000000000000000000000000000000000000000;hpb=a2461f6bc79e20cd379c034a0d128c64852ff8c4;p=mirror_edk2.git diff --git a/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.h b/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.h new file mode 100644 index 0000000000..00129edea6 --- /dev/null +++ b/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.h @@ -0,0 +1,59 @@ +/** @file + Include file of PciSegmentPciRootBridgeIo Library. + + Copyright (c) 2007 - 2008, Intel Corporation All rights + reserved. This program and the accompanying materials are + licensed and made available under the terms and conditions of + the BSD License which accompanies this distribution. The full + text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __DXE_PCI_SEGMENT_LIB__ +#define __DXE_PCI_SEGMENT_LIB__ + +#include + +#include + +#include +#include +#include +#include +#include + +#include + +typedef struct { + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo; + UINT32 SegmentNumber; + UINT64 MinBusNumber; + UINT64 MaxBusNumber; +} PCI_ROOT_BRIDGE_DATA; + +/** + Assert the validity of a PCI Segment address. + A valid PCI address should not contain 1's in bits 31:28 + + @param A The address to validate. + @param M Additional bits to assert to be zero. + +**/ +#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \ + ASSERT (((A) & (0xf0000000 | (M))) == 0) + +/** + Translate PCI Lib address into format of PCI Root Bridge I/O Protocol + + @param A Address that encodes the PCI Bus, Device, Function and + Register. + +**/ +#define PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS(A) \ + ((((A) << 4) & 0xff000000) | (((A) >> 4) & 0x00000700) | (((A) << 1) & 0x001f0000) | (LShiftU64((A) & 0xfff, 32))) + +#endif