1 /** @file 2 PCI Host Bridge Library consumed by PciHostBridgeDxe driver returning 3 the platform specific information about the PCI Host Bridge. 4 5 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials are 7 licensed and made available under the terms and conditions of 8 the BSD License which accompanies this distribution. The full 9 text of the license may be found at 10 http://opensource.org/licenses/bsd-license.php. 11 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 14 15 **/ 16 #ifndef __PCI_HOST_BRIDGE_LIB_H__ 17 #define __PCI_HOST_BRIDGE_LIB_H__ 18 19 // 20 // (Base > Limit) indicates an aperture is not available. 21 // 22 typedef struct { 23 UINT64 Base; 24 UINT64 Limit; 25 } PCI_ROOT_BRIDGE_APERTURE; 26 27 typedef struct { 28 UINT32 Segment; ///< Segment number. 29 UINT64 Supports; ///< Supported attributes. 30 ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes() 31 ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. 32 UINT64 Attributes; ///< Initial attributes. 33 ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes() 34 ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. 35 BOOLEAN DmaAbove4G; ///< DMA above 4GB memory. 36 ///< Set to TRUE when root bridge supports DMA above 4GB memory. 37 BOOLEAN NoExtendedConfigSpace; ///< When FALSE, the root bridge supports 38 ///< Extended (4096-byte) Configuration Space. 39 ///< When TRUE, the root bridge supports 40 ///< 256-byte Configuration Space only. 41 BOOLEAN ResourceAssigned; ///< Resource assignment status of the root bridge. 42 ///< Set to TRUE if Bus/IO/MMIO resources for root bridge have been assigned. 43 UINT64 AllocationAttributes; ///< Allocation attributes. 44 ///< Refer to EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM and 45 ///< EFI_PCI_HOST_BRIDGE_MEM64_DECODE used by GetAllocAttributes() 46 ///< in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL. 47 PCI_ROOT_BRIDGE_APERTURE Bus; ///< Bus aperture which can be used by the root bridge. 48 PCI_ROOT_BRIDGE_APERTURE Io; ///< IO aperture which can be used by the root bridge. 49 PCI_ROOT_BRIDGE_APERTURE Mem; ///< MMIO aperture below 4GB which can be used by the root bridge. 50 PCI_ROOT_BRIDGE_APERTURE MemAbove4G; ///< MMIO aperture above 4GB which can be used by the root bridge. 51 PCI_ROOT_BRIDGE_APERTURE PMem; ///< Prefetchable MMIO aperture below 4GB which can be used by the root bridge. 52 PCI_ROOT_BRIDGE_APERTURE PMemAbove4G; ///< Prefetchable MMIO aperture above 4GB which can be used by the root bridge. 53 EFI_DEVICE_PATH_PROTOCOL *DevicePath; ///< Device path. 54 } PCI_ROOT_BRIDGE; 55 56 /** 57 Return all the root bridge instances in an array. 58 59 @param Count Return the count of root bridge instances. 60 61 @return All the root bridge instances in an array. 62 The array should be passed into PciHostBridgeFreeRootBridges() 63 when it's not used. 64 **/ 65 PCI_ROOT_BRIDGE * 66 EFIAPI 67 PciHostBridgeGetRootBridges ( 68 UINTN *Count 69 ); 70 71 /** 72 Free the root bridge instances array returned from PciHostBridgeGetRootBridges(). 73 74 @param Bridges The root bridge instances array. 75 @param Count The count of the array. 76 **/ 77 VOID 78 EFIAPI 79 PciHostBridgeFreeRootBridges ( 80 PCI_ROOT_BRIDGE *Bridges, 81 UINTN Count 82 ); 83 84 /** 85 Inform the platform that the resource conflict happens. 86 87 @param HostBridgeHandle Handle of the Host Bridge. 88 @param Configuration Pointer to PCI I/O and PCI memory resource descriptors. 89 The Configuration contains the resources for all the 90 root bridges. The resource for each root bridge is 91 terminated with END descriptor and an additional END 92 is appended indicating the end of the entire resources. 93 The resource descriptor field values follow the description 94 in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.SubmitResources(). 95 **/ 96 VOID 97 EFIAPI 98 PciHostBridgeResourceConflict ( 99 EFI_HANDLE HostBridgeHandle, 100 VOID *Configuration 101 ); 102 103 #endif 104