Clean up ECC.
[edk2.git] / IntelFrameworkModulePkg / Bus / Pci / PciBusDxe / PciHotPlugSupport.h
bloba84e256b90fc476fa141a86e9a02b8bf4743177f
1 /** @file
2 PCI Hot Plug support functions declaration for PCI Bus module.
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
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.
13 **/
15 #ifndef _EFI_PCI_HOT_PLUG_SUPPORT_H_
16 #define _EFI_PCI_HOT_PLUG_SUPPORT_H_
19 // stall 1 second, its unit is 100ns
21 #define STALL_1_SECOND 1000000
24 // PCI Hot Plug controller private data
26 typedef struct {
27 EFI_EVENT Event;
28 BOOLEAN Initialized;
29 VOID *Padding;
30 } ROOT_HPC_DATA;
33 // Reference of some global variabes
35 extern EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit;
36 extern EFI_HPC_LOCATION *gPciRootHpcPool;
37 extern ROOT_HPC_DATA *gPciRootHpcData;
39 /**
40 Event notification function to set Hot Plug controller status.
42 @param Event The event that invoke this function.
43 @param Context The calling context, pointer to ROOT_HPC_DATA.
45 **/
46 VOID
47 EFIAPI
48 PciHPCInitialized (
49 IN EFI_EVENT Event,
50 IN VOID *Context
53 /**
54 Compare two device pathes to check if they are exactly same.
56 @param DevicePath1 A pointer to the first device path data structure.
57 @param DevicePath2 A pointer to the second device path data structure.
59 @retval TRUE They are same.
60 @retval FALSE They are not same.
62 **/
63 BOOLEAN
64 EfiCompareDevicePath (
65 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
66 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
69 /**
70 Check hot plug support and initialize root hot plug private data.
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.
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.
81 **/
82 EFI_STATUS
83 InitializeHotPlugSupport (
84 VOID
87 /**
88 Test whether PCI device is hot plug bus.
90 @param PciIoDevice PCI device instance.
92 @retval TRUE PCI device is a hot plug bus.
93 @retval FALSE PCI device is not a hot plug bus.
95 **/
96 BOOLEAN
97 IsPciHotPlugBus (
98 PCI_IO_DEVICE *PciIoDevice
102 Test whether device path is for root pci hot plug bus.
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.
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.
112 BOOLEAN
113 IsRootPciHotPlugBus (
114 IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
115 OUT UINTN *HpIndex OPTIONAL
119 Test whether device path is for root pci hot plug controller.
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.
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.
129 BOOLEAN
130 IsRootPciHotPlugController (
131 IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
132 OUT UINTN *HpIndex
136 Creating event object for PCI Hot Plug controller.
138 @param HpIndex Index of hot plug device in global array.
139 @param Event The retuned event that invoke this function.
141 @return Status of create event invoken.
144 EFI_STATUS
145 CreateEventForHpc (
146 IN UINTN HpIndex,
147 OUT EFI_EVENT *Event
151 Wait for all root PCI Hot Plug controller finished initializing.
153 @param TimeoutInMicroSeconds Microseconds to wait for all root HPCs' initialization.
155 @retval EFI_SUCCESS All HPCs initialization finished.
156 @retval EFI_TIMEOUT Not ALL HPCs initialization finished in Microseconds.
159 EFI_STATUS
160 AllRootHPCInitialized (
161 IN UINTN TimeoutInMicroSeconds
165 Check whether PCI-PCI bridge has PCI Hot Plug capability register block.
167 @param PciIoDevice A Pointer to the PCI-PCI bridge.
169 @retval TRUE PCI device is HPC.
170 @retval FALSE PCI device is not HPC.
173 BOOLEAN
174 IsSHPC (
175 IN PCI_IO_DEVICE *PciIoDevice
179 Get resource padding if the specified PCI bridge is a hot plug bus.
181 @param PciIoDevice PCI bridge instance.
184 VOID
185 GetResourcePaddingForHpb (
186 IN PCI_IO_DEVICE *PciIoDevice
189 #endif