9060e3ec |
1 | /** @file\r |
2 | Internal library declaration for PCI Bus module.\r |
3 | \r |
306bbe82 |
4 | Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r |
9d510e61 |
5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
9060e3ec |
6 | \r |
7 | **/\r |
8 | \r |
9 | #ifndef _EFI_PCI_LIB_H_\r |
10 | #define _EFI_PCI_LIB_H_\r |
11 | \r |
12 | \r |
13 | typedef struct {\r |
14 | EFI_HANDLE Handle;\r |
15 | } EFI_DEVICE_HANDLE_EXTENDED_DATA_PAYLOAD;\r |
16 | \r |
17 | typedef struct {\r |
18 | UINT32 Bar;\r |
19 | UINT16 DevicePathSize;\r |
20 | UINT16 ReqResSize;\r |
21 | UINT16 AllocResSize;\r |
22 | UINT8 *DevicePath;\r |
23 | UINT8 *ReqRes;\r |
24 | UINT8 *AllocRes;\r |
25 | } EFI_RESOURCE_ALLOC_FAILURE_ERROR_DATA_PAYLOAD;\r |
26 | \r |
27 | \r |
28 | /**\r |
29 | Retrieve the PCI Card device BAR information via PciIo interface.\r |
30 | \r |
31 | @param PciIoDevice PCI Card device instance.\r |
32 | \r |
33 | **/\r |
34 | VOID\r |
35 | GetBackPcCardBar (\r |
36 | IN PCI_IO_DEVICE *PciIoDevice\r |
37 | );\r |
38 | \r |
39 | /**\r |
40 | Remove rejected pci device from specific root bridge\r |
41 | handle.\r |
42 | \r |
43 | @param RootBridgeHandle Specific parent root bridge handle.\r |
44 | @param Bridge Bridge device instance.\r |
45 | \r |
46 | **/\r |
47 | VOID\r |
48 | RemoveRejectedPciDevices (\r |
49 | IN EFI_HANDLE RootBridgeHandle,\r |
50 | IN PCI_IO_DEVICE *Bridge\r |
51 | );\r |
52 | \r |
53 | /**\r |
54 | Submits the I/O and memory resource requirements for the specified PCI Host Bridge.\r |
55 | \r |
56 | @param PciResAlloc Point to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.\r |
57 | \r |
58 | @retval EFI_SUCCESS Successfully finished resource allocation.\r |
59 | @retval EFI_NOT_FOUND Cannot get root bridge instance.\r |
60 | @retval EFI_OUT_OF_RESOURCES Platform failed to program the resources if no hot plug supported.\r |
61 | @retval other Some error occurred when allocating resources for the PCI Host Bridge.\r |
62 | \r |
63 | @note Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.\r |
64 | \r |
65 | **/\r |
66 | EFI_STATUS\r |
67 | PciHostBridgeResourceAllocator (\r |
68 | IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc\r |
69 | );\r |
70 | \r |
306bbe82 |
71 | /**\r |
72 | Allocate NumberOfBuses buses and return the next available PCI bus number.\r |
73 | \r |
74 | @param Bridge Bridge device instance.\r |
75 | @param StartBusNumber Current available PCI bus number.\r |
76 | @param NumberOfBuses Number of buses enumerated below the StartBusNumber.\r |
77 | @param NextBusNumber Next available PCI bus number.\r |
78 | \r |
79 | @retval EFI_SUCCESS Available bus number resource is enough. Next available PCI bus number\r |
80 | is returned in NextBusNumber.\r |
81 | @retval EFI_OUT_OF_RESOURCES Available bus number resource is not enough for allocation.\r |
82 | \r |
83 | **/\r |
84 | EFI_STATUS\r |
85 | PciAllocateBusNumber (\r |
86 | IN PCI_IO_DEVICE *Bridge,\r |
87 | IN UINT8 StartBusNumber,\r |
88 | IN UINT8 NumberOfBuses,\r |
89 | OUT UINT8 *NextBusNumber\r |
90 | );\r |
91 | \r |
9060e3ec |
92 | /**\r |
93 | Scan pci bus and assign bus number to the given PCI bus system.\r |
94 | \r |
95 | @param Bridge Bridge device instance.\r |
96 | @param StartBusNumber start point.\r |
97 | @param SubBusNumber Point to sub bus number.\r |
98 | @param PaddedBusRange Customized bus number.\r |
99 | \r |
100 | @retval EFI_SUCCESS Successfully scanned and assigned bus number.\r |
101 | @retval other Some error occurred when scanning pci bus.\r |
102 | \r |
103 | @note Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.\r |
104 | \r |
105 | **/\r |
106 | EFI_STATUS\r |
107 | PciScanBus (\r |
108 | IN PCI_IO_DEVICE *Bridge,\r |
109 | IN UINT8 StartBusNumber,\r |
110 | OUT UINT8 *SubBusNumber,\r |
111 | OUT UINT8 *PaddedBusRange\r |
112 | );\r |
113 | \r |
114 | /**\r |
115 | Process Option Rom on the specified root bridge.\r |
116 | \r |
117 | @param Bridge Pci root bridge device instance.\r |
118 | \r |
119 | @retval EFI_SUCCESS Success process.\r |
120 | @retval other Some error occurred when processing Option Rom on the root bridge.\r |
121 | \r |
122 | **/\r |
123 | EFI_STATUS\r |
124 | PciRootBridgeP2CProcess (\r |
125 | IN PCI_IO_DEVICE *Bridge\r |
126 | );\r |
127 | \r |
128 | /**\r |
129 | Process Option Rom on the specified host bridge.\r |
130 | \r |
131 | @param PciResAlloc Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.\r |
132 | \r |
133 | @retval EFI_SUCCESS Success process.\r |
134 | @retval EFI_NOT_FOUND Can not find the root bridge instance.\r |
135 | @retval other Some error occurred when processing Option Rom on the host bridge.\r |
136 | \r |
137 | **/\r |
138 | EFI_STATUS\r |
139 | PciHostBridgeP2CProcess (\r |
140 | IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc\r |
141 | );\r |
142 | \r |
143 | /**\r |
144 | This function is used to enumerate the entire host bridge\r |
145 | in a given platform.\r |
146 | \r |
147 | @param PciResAlloc A pointer to the PCI Host Resource Allocation protocol.\r |
148 | \r |
149 | @retval EFI_SUCCESS Successfully enumerated the host bridge.\r |
150 | @retval EFI_OUT_OF_RESOURCES No enough memory available.\r |
151 | @retval other Some error occurred when enumerating the host bridge.\r |
152 | \r |
153 | **/\r |
154 | EFI_STATUS\r |
155 | PciHostBridgeEnumerator (\r |
156 | IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc\r |
157 | );\r |
158 | \r |
159 | #endif\r |