]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.h
Clean up ECC.
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / PciBusDxe / PciHotPlugSupport.h
1 /** @file
2 PCI Hot Plug support functions 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_HOT_PLUG_SUPPORT_H_
16 #define _EFI_PCI_HOT_PLUG_SUPPORT_H_
17
18 //
19 // stall 1 second, its unit is 100ns
20 //
21 #define STALL_1_SECOND 1000000
22
23 //
24 // PCI Hot Plug controller private data
25 //
26 typedef struct {
27 EFI_EVENT Event;
28 BOOLEAN Initialized;
29 VOID *Padding;
30 } ROOT_HPC_DATA;
31
32 //
33 // Reference of some global variabes
34 //
35 extern EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit;
36 extern EFI_HPC_LOCATION *gPciRootHpcPool;
37 extern ROOT_HPC_DATA *gPciRootHpcData;
38
39 /**
40 Event notification function to set Hot Plug controller status.
41
42 @param Event The event that invoke this function.
43 @param Context The calling context, pointer to ROOT_HPC_DATA.
44
45 **/
46 VOID
47 EFIAPI
48 PciHPCInitialized (
49 IN EFI_EVENT Event,
50 IN VOID *Context
51 );
52
53 /**
54 Compare two device pathes to check if they are exactly same.
55
56 @param DevicePath1 A pointer to the first device path data structure.
57 @param DevicePath2 A pointer to the second device path data structure.
58
59 @retval TRUE They are same.
60 @retval FALSE They are not same.
61
62 **/
63 BOOLEAN
64 EfiCompareDevicePath (
65 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
66 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
67 );
68
69 /**
70 Check hot plug support and initialize root hot plug private data.
71
72 If Hot Plug is supported by the platform, call PCI Hot Plug Init protocol
73 to get PCI Hot Plug controller's information and constructor the root hot plug
74 private data structure.
75
76 @retval EFI_SUCCESS They are same.
77 @retval EFI_UNSUPPORTED No PCI Hot Plug controler on the platform.
78 @retval EFI_OUT_OF_RESOURCES No memory to constructor root hot plug private
79 data structure.
80
81 **/
82 EFI_STATUS
83 InitializeHotPlugSupport (
84 VOID
85 );
86
87 /**
88 Test whether PCI device is hot plug bus.
89
90 @param PciIoDevice PCI device instance.
91
92 @retval TRUE PCI device is a hot plug bus.
93 @retval FALSE PCI device is not a hot plug bus.
94
95 **/
96 BOOLEAN
97 IsPciHotPlugBus (
98 PCI_IO_DEVICE *PciIoDevice
99 );
100
101 /**
102 Test whether device path is for root pci hot plug bus.
103
104 @param HpbDevicePath A pointer to device path data structure to be tested.
105 @param HpIndex If HpIndex is not NULL, return the index of root hot
106 plug in global array when TRUE is retuned.
107
108 @retval TRUE The device path is for root pci hot plug bus.
109 @retval FALSE The device path is not for root pci hot plug bus.
110
111 **/
112 BOOLEAN
113 IsRootPciHotPlugBus (
114 IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
115 OUT UINTN *HpIndex OPTIONAL
116 );
117
118 /**
119 Test whether device path is for root pci hot plug controller.
120
121 @param HpcDevicePath A pointer to device path data structure to be tested.
122 @param HpIndex If HpIndex is not NULL, return the index of root hot
123 plug in global array when TRUE is retuned.
124
125 @retval TRUE The device path is for root pci hot plug controller.
126 @retval FALSE The device path is not for root pci hot plug controller.
127
128 **/
129 BOOLEAN
130 IsRootPciHotPlugController (
131 IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
132 OUT UINTN *HpIndex
133 );
134
135 /**
136 Creating event object for PCI Hot Plug controller.
137
138 @param HpIndex Index of hot plug device in global array.
139 @param Event The retuned event that invoke this function.
140
141 @return Status of create event invoken.
142
143 **/
144 EFI_STATUS
145 CreateEventForHpc (
146 IN UINTN HpIndex,
147 OUT EFI_EVENT *Event
148 );
149
150 /**
151 Wait for all root PCI Hot Plug controller finished initializing.
152
153 @param TimeoutInMicroSeconds Microseconds to wait for all root HPCs' initialization.
154
155 @retval EFI_SUCCESS All HPCs initialization finished.
156 @retval EFI_TIMEOUT Not ALL HPCs initialization finished in Microseconds.
157
158 **/
159 EFI_STATUS
160 AllRootHPCInitialized (
161 IN UINTN TimeoutInMicroSeconds
162 );
163
164 /**
165 Check whether PCI-PCI bridge has PCI Hot Plug capability register block.
166
167 @param PciIoDevice A Pointer to the PCI-PCI bridge.
168
169 @retval TRUE PCI device is HPC.
170 @retval FALSE PCI device is not HPC.
171
172 **/
173 BOOLEAN
174 IsSHPC (
175 IN PCI_IO_DEVICE *PciIoDevice
176 );
177
178 /**
179 Get resource padding if the specified PCI bridge is a hot plug bus.
180
181 @param PciIoDevice PCI bridge instance.
182
183 **/
184 VOID
185 GetResourcePaddingForHpb (
186 IN PCI_IO_DEVICE *PciIoDevice
187 );
188
189 #endif