1 /** @file
2   Header file of PciHostBridgeLib.
3 
4   Copyright (C) 2016, Red Hat, Inc.
5   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
6 
7   This program and the accompanying materials are licensed and made available
8   under the terms and conditions of the BSD License which accompanies this
9   distribution.  The full 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, WITHOUT
13   WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 
15 **/
16 
17 #ifndef _PCI_HOST_BRIDGE_H
18 #define _PCI_HOST_BRIDGE_H
19 
20 typedef struct {
21   ACPI_HID_DEVICE_PATH     AcpiDevicePath;
22   EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
23 } CB_PCI_ROOT_BRIDGE_DEVICE_PATH;
24 
25 PCI_ROOT_BRIDGE *
26 ScanForRootBridges (
27   UINTN      *NumberOfRootBridges
28 );
29 
30 /**
31   Initialize a PCI_ROOT_BRIDGE structure.
32 
33   @param[in]  Supports         Supported attributes.
34 
35   @param[in]  Attributes       Initial attributes.
36 
37   @param[in]  AllocAttributes  Allocation attributes.
38 
39   @param[in]  RootBusNumber    The bus number to store in RootBus.
40 
41   @param[in]  MaxSubBusNumber  The inclusive maximum bus number that can be
42                                assigned to any subordinate bus found behind any
43                                PCI bridge hanging off this root bus.
44 
45                                The caller is repsonsible for ensuring that
46                                RootBusNumber <= MaxSubBusNumber. If
47                                RootBusNumber equals MaxSubBusNumber, then the
48                                root bus has no room for subordinate buses.
49 
50   @param[in]  Io               IO aperture.
51 
52   @param[in]  Mem              MMIO aperture.
53 
54   @param[in]  MemAbove4G       MMIO aperture above 4G.
55 
56   @param[in]  PMem             Prefetchable MMIO aperture.
57 
58   @param[in]  PMemAbove4G      Prefetchable MMIO aperture above 4G.
59 
60   @param[out] RootBus          The PCI_ROOT_BRIDGE structure (allocated by the
61                                caller) that should be filled in by this
62                                function.
63 
64   @retval EFI_SUCCESS           Initialization successful. A device path
65                                 consisting of an ACPI device path node, with
66                                 UID = RootBusNumber, has been allocated and
67                                 linked into RootBus.
68 
69   @retval EFI_OUT_OF_RESOURCES  Memory allocation failed.
70 **/
71 EFI_STATUS
72 InitRootBridge (
73   IN  UINT64                   Supports,
74   IN  UINT64                   Attributes,
75   IN  UINT64                   AllocAttributes,
76   IN  UINT8                    RootBusNumber,
77   IN  UINT8                    MaxSubBusNumber,
78   IN  PCI_ROOT_BRIDGE_APERTURE *Io,
79   IN  PCI_ROOT_BRIDGE_APERTURE *Mem,
80   IN  PCI_ROOT_BRIDGE_APERTURE *MemAbove4G,
81   IN  PCI_ROOT_BRIDGE_APERTURE *PMem,
82   IN  PCI_ROOT_BRIDGE_APERTURE *PMemAbove4G,
83   OUT PCI_ROOT_BRIDGE          *RootBus
84 );
85 
86 #endif
87