]>
Commit | Line | Data |
---|---|---|
eeefcb9d | 1 | /** @file\r |
8e8227d1 | 2 | PCI Hot Plug support functions declaration for PCI Bus module.\r |
ead42efc | 3 | \r |
8e8227d1 | 4 | Copyright (c) 2006 - 2009, Intel Corporation\r |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
ead42efc | 9 | \r |
8e8227d1 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
ead42efc | 12 | \r |
8e8227d1 | 13 | **/\r |
ead42efc | 14 | \r |
eeefcb9d | 15 | #ifndef _EFI_PCI_HOT_PLUG_SUPPORT_H_\r |
16 | #define _EFI_PCI_HOT_PLUG_SUPPORT_H_\r | |
ead42efc | 17 | \r |
ead42efc | 18 | //\r |
8e8227d1 | 19 | // stall 1 second, its unit is 100ns\r |
ead42efc | 20 | //\r |
8e8227d1 | 21 | #define STALL_1_SECOND 1000000\r |
ead42efc | 22 | \r |
8e8227d1 | 23 | //\r |
24 | // PCI Hot Plug controller private data\r | |
25 | //\r | |
ead42efc | 26 | typedef struct {\r |
27 | EFI_EVENT Event;\r | |
28 | BOOLEAN Initialized;\r | |
29 | VOID *Padding;\r | |
30 | } ROOT_HPC_DATA;\r | |
31 | \r | |
8e8227d1 | 32 | //\r |
33 | // Reference of some global variabes\r | |
34 | //\r | |
ead42efc | 35 | extern EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit;\r |
36 | extern EFI_HPC_LOCATION *gPciRootHpcPool;\r | |
ead42efc | 37 | extern ROOT_HPC_DATA *gPciRootHpcData;\r |
38 | \r | |
57076f45 | 39 | /**\r |
8e8227d1 | 40 | Event notification function to set Hot Plug controller status.\r |
41 | \r | |
42 | @param Event The event that invoke this function.\r | |
43 | @param Context The calling context, pointer to ROOT_HPC_DATA.\r | |
44 | \r | |
57076f45 | 45 | **/\r |
ead42efc | 46 | VOID\r |
47 | EFIAPI\r | |
48 | PciHPCInitialized (\r | |
49 | IN EFI_EVENT Event,\r | |
50 | IN VOID *Context\r | |
ed66e1bc | 51 | );\r |
ead42efc | 52 | \r |
57076f45 | 53 | /**\r |
8e8227d1 | 54 | Compare two device pathes to check if they are exactly same.\r |
55 | \r | |
56 | @param DevicePath1 A pointer to the first device path data structure.\r | |
57 | @param DevicePath2 A pointer to the second device path data structure.\r | |
58 | \r | |
59 | @retval TRUE They are same.\r | |
60 | @retval FALSE They are not same.\r | |
61 | \r | |
57076f45 | 62 | **/\r |
ead42efc | 63 | BOOLEAN\r |
64 | EfiCompareDevicePath (\r | |
65 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,\r | |
66 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2\r | |
ed66e1bc | 67 | );\r |
ead42efc | 68 | \r |
57076f45 | 69 | /**\r |
8e8227d1 | 70 | Check hot plug support and initialize root hot plug private data.\r |
71 | \r | |
72 | If Hot Plug is supported by the platform, call PCI Hot Plug Init protocol\r | |
73 | to get PCI Hot Plug controller's information and constructor the root hot plug\r | |
74 | private data structure.\r | |
75 | \r | |
76 | @retval EFI_SUCCESS They are same.\r | |
77 | @retval EFI_UNSUPPORTED No PCI Hot Plug controler on the platform.\r | |
78 | @retval EFI_OUT_OF_RESOURCES No memory to constructor root hot plug private\r | |
79 | data structure.\r | |
80 | \r | |
57076f45 | 81 | **/\r |
ead42efc | 82 | EFI_STATUS\r |
83 | InitializeHotPlugSupport (\r | |
84 | VOID\r | |
ed66e1bc | 85 | );\r |
ead42efc | 86 | \r |
57076f45 | 87 | /**\r |
88 | Test whether PCI device is hot plug bus.\r | |
8e8227d1 | 89 | \r |
97404058 | 90 | @param PciIoDevice PCI device instance.\r |
8e8227d1 | 91 | \r |
92 | @retval TRUE PCI device is a hot plug bus.\r | |
93 | @retval FALSE PCI device is not a hot plug bus.\r | |
94 | \r | |
57076f45 | 95 | **/\r |
8e8227d1 | 96 | BOOLEAN\r |
ead42efc | 97 | IsPciHotPlugBus (\r |
98 | PCI_IO_DEVICE *PciIoDevice\r | |
ed66e1bc | 99 | );\r |
ead42efc | 100 | \r |
57076f45 | 101 | /**\r |
8e8227d1 | 102 | Test whether device path is for root pci hot plug bus.\r |
103 | \r | |
104 | @param HpbDevicePath A pointer to device path data structure to be tested.\r | |
105 | @param HpIndex If HpIndex is not NULL, return the index of root hot\r | |
106 | plug in global array when TRUE is retuned.\r | |
107 | \r | |
108 | @retval TRUE The device path is for root pci hot plug bus.\r | |
109 | @retval FALSE The device path is not for root pci hot plug bus.\r | |
110 | \r | |
57076f45 | 111 | **/\r |
ead42efc | 112 | BOOLEAN\r |
113 | IsRootPciHotPlugBus (\r | |
8e8227d1 | 114 | IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,\r |
115 | OUT UINTN *HpIndex OPTIONAL\r | |
ed66e1bc | 116 | );\r |
ead42efc | 117 | \r |
57076f45 | 118 | /**\r |
8e8227d1 | 119 | Test whether device path is for root pci hot plug controller.\r |
120 | \r | |
ae358cb2 | 121 | @param HpcDevicePath A pointer to device path data structure to be tested.\r |
8e8227d1 | 122 | @param HpIndex If HpIndex is not NULL, return the index of root hot\r |
123 | plug in global array when TRUE is retuned.\r | |
124 | \r | |
125 | @retval TRUE The device path is for root pci hot plug controller.\r | |
126 | @retval FALSE The device path is not for root pci hot plug controller.\r | |
127 | \r | |
57076f45 | 128 | **/\r |
ead42efc | 129 | BOOLEAN\r |
130 | IsRootPciHotPlugController (\r | |
131 | IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,\r | |
132 | OUT UINTN *HpIndex\r | |
ed66e1bc | 133 | );\r |
ead42efc | 134 | \r |
57076f45 | 135 | /**\r |
8e8227d1 | 136 | Creating event object for PCI Hot Plug controller.\r |
137 | \r | |
138 | @param HpIndex Index of hot plug device in global array.\r | |
139 | @param Event The retuned event that invoke this function.\r | |
140 | \r | |
141 | @return Status of create event invoken.\r | |
142 | \r | |
57076f45 | 143 | **/\r |
ead42efc | 144 | EFI_STATUS\r |
145 | CreateEventForHpc (\r | |
8e8227d1 | 146 | IN UINTN HpIndex,\r |
ead42efc | 147 | OUT EFI_EVENT *Event\r |
ed66e1bc | 148 | );\r |
ead42efc | 149 | \r |
57076f45 | 150 | /**\r |
8e8227d1 | 151 | Wait for all root PCI Hot Plug controller finished initializing.\r |
152 | \r | |
153 | @param TimeoutInMicroSeconds Microseconds to wait for all root HPCs' initialization.\r | |
154 | \r | |
155 | @retval EFI_SUCCESS All HPCs initialization finished.\r | |
156 | @retval EFI_TIMEOUT Not ALL HPCs initialization finished in Microseconds.\r | |
157 | \r | |
57076f45 | 158 | **/\r |
ead42efc | 159 | EFI_STATUS\r |
160 | AllRootHPCInitialized (\r | |
161 | IN UINTN TimeoutInMicroSeconds\r | |
ed66e1bc | 162 | );\r |
ead42efc | 163 | \r |
57076f45 | 164 | /**\r |
8e8227d1 | 165 | Check whether PCI-PCI bridge has PCI Hot Plug capability register block.\r |
166 | \r | |
167 | @param PciIoDevice A Pointer to the PCI-PCI bridge.\r | |
168 | \r | |
169 | @retval TRUE PCI device is HPC.\r | |
170 | @retval FALSE PCI device is not HPC.\r | |
171 | \r | |
57076f45 | 172 | **/\r |
8e8227d1 | 173 | BOOLEAN\r |
ead42efc | 174 | IsSHPC (\r |
8e8227d1 | 175 | IN PCI_IO_DEVICE *PciIoDevice\r |
ed66e1bc | 176 | );\r |
ead42efc | 177 | \r |
57076f45 | 178 | /**\r |
8e8227d1 | 179 | Get resource padding if the specified PCI bridge is a hot plug bus.\r |
180 | \r | |
181 | @param PciIoDevice PCI bridge instance.\r | |
182 | \r | |
57076f45 | 183 | **/\r |
8e8227d1 | 184 | VOID\r |
ead42efc | 185 | GetResourcePaddingForHpb (\r |
8e8227d1 | 186 | IN PCI_IO_DEVICE *PciIoDevice\r |
ed66e1bc | 187 | );\r |
ead42efc | 188 | \r |
189 | #endif\r |