]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.h
43e3e48f2b81a1b485b86ade59a043f1df533a93
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / PciBusDxe / PciLib.h
1 /** @file
2 Internal library declaration for PCI Bus module.
3
4 Copyright (c) 2006 - 2009, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _EFI_PCI_LIB_H_
16 #define _EFI_PCI_LIB_H_
17
18
19 typedef struct {
20 EFI_HANDLE Handle;
21 } EFI_DEVICE_HANDLE_EXTENDED_DATA_PAYLOAD;
22
23 typedef struct {
24 UINT32 Bar;
25 UINT16 DevicePathSize;
26 UINT16 ReqResSize;
27 UINT16 AllocResSize;
28 UINT8 *DevicePath;
29 UINT8 *ReqRes;
30 UINT8 *AllocRes;
31 } EFI_RESOURCE_ALLOC_FAILURE_ERROR_DATA_PAYLOAD;
32
33
34 /**
35 Retrieve the PCI Card device BAR information via PciIo interface.
36
37 @param PciIoDevice PCI Card device instance.
38
39 **/
40 VOID
41 GetBackPcCardBar (
42 IN PCI_IO_DEVICE *PciIoDevice
43 );
44
45 /**
46 Remove rejected pci device from specific root bridge
47 handle.
48
49 @param RootBridgeHandle Specific parent root bridge handle.
50 @param Bridge Bridge device instance.
51
52 **/
53 VOID
54 RemoveRejectedPciDevices (
55 IN EFI_HANDLE RootBridgeHandle,
56 IN PCI_IO_DEVICE *Bridge
57 );
58
59 /**
60 Submits the I/O and memory resource requirements for the specified PCI Host Bridge.
61
62 @param PciResAlloc Point to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
63
64 @retval EFI_SUCCESS Successfully finished resource allocation.
65 @retval EFI_NOT_FOUND Cannot get root bridge instance.
66 @retval EFI_OUT_OF_RESOURCES Platform failed to program the resources if no hot plug supported.
67 @retval other Some error occurred when allocating resources for the PCI Host Bridge.
68
69 @note Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
70
71 **/
72 EFI_STATUS
73 PciHostBridgeResourceAllocator (
74 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
75 );
76
77 /**
78 Scan pci bus and assign bus number to the given PCI bus system.
79
80 @param Bridge Bridge device instance.
81 @param StartBusNumber start point.
82 @param SubBusNumber Point to sub bus number.
83 @param PaddedBusRange Customized bus number.
84
85 @retval EFI_SUCCESS Successfully scanned and assigned bus number.
86 @retval other Some error occurred when scanning pci bus.
87
88 @note Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
89
90 **/
91 EFI_STATUS
92 PciScanBus (
93 IN PCI_IO_DEVICE *Bridge,
94 IN UINT8 StartBusNumber,
95 OUT UINT8 *SubBusNumber,
96 OUT UINT8 *PaddedBusRange
97 );
98
99 /**
100 Process Option Rom on the specified root bridge.
101
102 @param Bridge Pci root bridge device instance.
103
104 @retval EFI_SUCCESS Success process.
105 @retval other Some error occurred when processing Option Rom on the root bridge.
106
107 **/
108 EFI_STATUS
109 PciRootBridgeP2CProcess (
110 IN PCI_IO_DEVICE *Bridge
111 );
112
113 /**
114 Process Option Rom on the specified host bridge.
115
116 @param PciResAlloc Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
117
118 @retval EFI_SUCCESS Success process.
119 @retval EFI_NOT_FOUND Can not find the root bridge instance.
120 @retval other Some error occurred when processing Option Rom on the host bridge.
121
122 **/
123 EFI_STATUS
124 PciHostBridgeP2CProcess (
125 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
126 );
127
128 /**
129 This function is used to enumerate the entire host bridge
130 in a given platform.
131
132 @param PciResAlloc A pointer to the PCI Host Resource Allocation protocol.
133
134 @retval EFI_SUCCESS Successfully enumerated the host bridge.
135 @retval EFI_OUT_OF_RESOURCES No enough memory available.
136 @retval other Some error occurred when enumerating the host bridge.
137
138 **/
139 EFI_STATUS
140 PciHostBridgeEnumerator (
141 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
142 );
143
144 #endif