1 /****************************************************************************** 2 * 3 * Name: acevents.h - Event subcomponent prototypes and defines 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2022, Intel Corp. 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 * substantially similar to the "NO WARRANTY" disclaimer below 19 * ("Disclaimer") and any redistribution must be conditioned upon 20 * including a substantially similar Disclaimer requirement for further 21 * binary redistribution. 22 * 3. Neither the names of the above-listed copyright holders nor the names 23 * of any contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * Alternatively, this software may be distributed under the terms of the 27 * GNU General Public License ("GPL") version 2 as published by the Free 28 * Software Foundation. 29 * 30 * NO WARRANTY 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44 #ifndef __ACEVENTS_H__ 45 #define __ACEVENTS_H__ 46 47 48 /* 49 * Conditions to trigger post enabling GPE polling: 50 * It is not sufficient to trigger edge-triggered GPE with specific GPE 51 * chips, software need to poll once after enabling. 52 */ 53 #ifdef ACPI_USE_GPE_POLLING 54 #define ACPI_GPE_IS_POLLING_NEEDED(__gpe__) \ 55 ((__gpe__)->RuntimeCount == 1 && \ 56 (__gpe__)->Flags & ACPI_GPE_INITIALIZED && \ 57 ((__gpe__)->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_EDGE_TRIGGERED) 58 #else 59 #define ACPI_GPE_IS_POLLING_NEEDED(__gpe__) FALSE 60 #endif 61 62 63 /* 64 * evevent 65 */ 66 ACPI_STATUS 67 AcpiEvInitializeEvents ( 68 void); 69 70 ACPI_STATUS 71 AcpiEvInstallXruptHandlers ( 72 void); 73 74 UINT32 75 AcpiEvFixedEventDetect ( 76 void); 77 78 79 /* 80 * evmisc 81 */ 82 BOOLEAN 83 AcpiEvIsNotifyObject ( 84 ACPI_NAMESPACE_NODE *Node); 85 86 UINT32 87 AcpiEvGetGpeNumberIndex ( 88 UINT32 GpeNumber); 89 90 ACPI_STATUS 91 AcpiEvQueueNotifyRequest ( 92 ACPI_NAMESPACE_NODE *Node, 93 UINT32 NotifyValue); 94 95 96 /* 97 * evglock - Global Lock support 98 */ 99 ACPI_STATUS 100 AcpiEvInitGlobalLockHandler ( 101 void); 102 103 ACPI_HW_DEPENDENT_RETURN_OK ( 104 ACPI_STATUS 105 AcpiEvAcquireGlobalLock( 106 UINT16 Timeout)) 107 108 ACPI_HW_DEPENDENT_RETURN_OK ( 109 ACPI_STATUS 110 AcpiEvReleaseGlobalLock( 111 void)) 112 113 ACPI_STATUS 114 AcpiEvRemoveGlobalLockHandler ( 115 void); 116 117 118 /* 119 * evgpe - Low-level GPE support 120 */ 121 UINT32 122 AcpiEvGpeDetect ( 123 ACPI_GPE_XRUPT_INFO *GpeXruptList); 124 125 ACPI_STATUS 126 AcpiEvUpdateGpeEnableMask ( 127 ACPI_GPE_EVENT_INFO *GpeEventInfo); 128 129 ACPI_STATUS 130 AcpiEvEnableGpe ( 131 ACPI_GPE_EVENT_INFO *GpeEventInfo); 132 133 ACPI_STATUS 134 AcpiEvMaskGpe ( 135 ACPI_GPE_EVENT_INFO *GpeEventInfo, 136 BOOLEAN IsMasked); 137 138 ACPI_STATUS 139 AcpiEvAddGpeReference ( 140 ACPI_GPE_EVENT_INFO *GpeEventInfo, 141 BOOLEAN ClearOnEnable); 142 143 ACPI_STATUS 144 AcpiEvRemoveGpeReference ( 145 ACPI_GPE_EVENT_INFO *GpeEventInfo); 146 147 ACPI_GPE_EVENT_INFO * 148 AcpiEvGetGpeEventInfo ( 149 ACPI_HANDLE GpeDevice, 150 UINT32 GpeNumber); 151 152 ACPI_GPE_EVENT_INFO * 153 AcpiEvLowGetGpeInfo ( 154 UINT32 GpeNumber, 155 ACPI_GPE_BLOCK_INFO *GpeBlock); 156 157 ACPI_STATUS 158 AcpiEvFinishGpe ( 159 ACPI_GPE_EVENT_INFO *GpeEventInfo); 160 161 UINT32 162 AcpiEvDetectGpe ( 163 ACPI_NAMESPACE_NODE *GpeDevice, 164 ACPI_GPE_EVENT_INFO *GpeEventInfo, 165 UINT32 GpeNumber); 166 167 168 /* 169 * evgpeblk - Upper-level GPE block support 170 */ 171 ACPI_STATUS 172 AcpiEvCreateGpeBlock ( 173 ACPI_NAMESPACE_NODE *GpeDevice, 174 UINT64 Address, 175 UINT8 SpaceId, 176 UINT32 RegisterCount, 177 UINT16 GpeBlockBaseNumber, 178 UINT32 InterruptNumber, 179 ACPI_GPE_BLOCK_INFO **ReturnGpeBlock); 180 181 ACPI_STATUS 182 AcpiEvInitializeGpeBlock ( 183 ACPI_GPE_XRUPT_INFO *GpeXruptInfo, 184 ACPI_GPE_BLOCK_INFO *GpeBlock, 185 void *Context); 186 187 ACPI_HW_DEPENDENT_RETURN_OK ( 188 ACPI_STATUS 189 AcpiEvDeleteGpeBlock ( 190 ACPI_GPE_BLOCK_INFO *GpeBlock)) 191 192 UINT32 193 AcpiEvGpeDispatch ( 194 ACPI_NAMESPACE_NODE *GpeDevice, 195 ACPI_GPE_EVENT_INFO *GpeEventInfo, 196 UINT32 GpeNumber); 197 198 199 /* 200 * evgpeinit - GPE initialization and update 201 */ 202 ACPI_STATUS 203 AcpiEvGpeInitialize ( 204 void); 205 206 ACPI_HW_DEPENDENT_RETURN_VOID ( 207 void 208 AcpiEvUpdateGpes ( 209 ACPI_OWNER_ID TableOwnerId)) 210 211 ACPI_STATUS 212 AcpiEvMatchGpeMethod ( 213 ACPI_HANDLE ObjHandle, 214 UINT32 Level, 215 void *Context, 216 void **ReturnValue); 217 218 219 /* 220 * evgpeutil - GPE utilities 221 */ 222 ACPI_STATUS 223 AcpiEvWalkGpeList ( 224 ACPI_GPE_CALLBACK GpeWalkCallback, 225 void *Context); 226 227 ACPI_STATUS 228 AcpiEvGetGpeDevice ( 229 ACPI_GPE_XRUPT_INFO *GpeXruptInfo, 230 ACPI_GPE_BLOCK_INFO *GpeBlock, 231 void *Context); 232 233 ACPI_STATUS 234 AcpiEvGetGpeXruptBlock ( 235 UINT32 InterruptNumber, 236 ACPI_GPE_XRUPT_INFO **GpeXruptBlock); 237 238 ACPI_STATUS 239 AcpiEvDeleteGpeXrupt ( 240 ACPI_GPE_XRUPT_INFO *GpeXrupt); 241 242 ACPI_STATUS 243 AcpiEvDeleteGpeHandlers ( 244 ACPI_GPE_XRUPT_INFO *GpeXruptInfo, 245 ACPI_GPE_BLOCK_INFO *GpeBlock, 246 void *Context); 247 248 249 /* 250 * evhandler - Address space handling 251 */ 252 ACPI_OPERAND_OBJECT * 253 AcpiEvFindRegionHandler ( 254 ACPI_ADR_SPACE_TYPE SpaceId, 255 ACPI_OPERAND_OBJECT *HandlerObj); 256 257 BOOLEAN 258 AcpiEvHasDefaultHandler ( 259 ACPI_NAMESPACE_NODE *Node, 260 ACPI_ADR_SPACE_TYPE SpaceId); 261 262 ACPI_STATUS 263 AcpiEvInstallRegionHandlers ( 264 void); 265 266 ACPI_STATUS 267 AcpiEvInstallSpaceHandler ( 268 ACPI_NAMESPACE_NODE *Node, 269 ACPI_ADR_SPACE_TYPE SpaceId, 270 ACPI_ADR_SPACE_HANDLER Handler, 271 ACPI_ADR_SPACE_SETUP Setup, 272 void *Context); 273 274 275 /* 276 * evregion - Operation region support 277 */ 278 ACPI_STATUS 279 AcpiEvInitializeOpRegions ( 280 void); 281 282 ACPI_STATUS 283 AcpiEvAddressSpaceDispatch ( 284 ACPI_OPERAND_OBJECT *RegionObj, 285 ACPI_OPERAND_OBJECT *FieldObj, 286 UINT32 Function, 287 UINT32 RegionOffset, 288 UINT32 BitWidth, 289 UINT64 *Value); 290 291 ACPI_STATUS 292 AcpiEvAttachRegion ( 293 ACPI_OPERAND_OBJECT *HandlerObj, 294 ACPI_OPERAND_OBJECT *RegionObj, 295 BOOLEAN AcpiNsIsLocked); 296 297 void 298 AcpiEvDetachRegion ( 299 ACPI_OPERAND_OBJECT *RegionObj, 300 BOOLEAN AcpiNsIsLocked); 301 302 void 303 AcpiEvExecuteRegMethods ( 304 ACPI_NAMESPACE_NODE *Node, 305 ACPI_ADR_SPACE_TYPE SpaceId, 306 UINT32 Function); 307 308 ACPI_STATUS 309 AcpiEvExecuteRegMethod ( 310 ACPI_OPERAND_OBJECT *RegionObj, 311 UINT32 Function); 312 313 314 /* 315 * evregini - Region initialization and setup 316 */ 317 ACPI_STATUS 318 AcpiEvSystemMemoryRegionSetup ( 319 ACPI_HANDLE Handle, 320 UINT32 Function, 321 void *HandlerContext, 322 void **RegionContext); 323 324 ACPI_STATUS 325 AcpiEvIoSpaceRegionSetup ( 326 ACPI_HANDLE Handle, 327 UINT32 Function, 328 void *HandlerContext, 329 void **RegionContext); 330 331 ACPI_STATUS 332 AcpiEvPciConfigRegionSetup ( 333 ACPI_HANDLE Handle, 334 UINT32 Function, 335 void *HandlerContext, 336 void **RegionContext); 337 338 ACPI_STATUS 339 AcpiEvCmosRegionSetup ( 340 ACPI_HANDLE Handle, 341 UINT32 Function, 342 void *HandlerContext, 343 void **RegionContext); 344 345 ACPI_STATUS 346 AcpiEvPciBarRegionSetup ( 347 ACPI_HANDLE Handle, 348 UINT32 Function, 349 void *HandlerContext, 350 void **RegionContext); 351 352 ACPI_STATUS 353 AcpiEvDataTableRegionSetup ( 354 ACPI_HANDLE Handle, 355 UINT32 Function, 356 void *HandlerContext, 357 void **RegionContext); 358 359 ACPI_STATUS 360 AcpiEvDefaultRegionSetup ( 361 ACPI_HANDLE Handle, 362 UINT32 Function, 363 void *HandlerContext, 364 void **RegionContext); 365 366 ACPI_STATUS 367 AcpiEvInitializeRegion ( 368 ACPI_OPERAND_OBJECT *RegionObj); 369 370 BOOLEAN 371 AcpiEvIsPciRootBridge ( 372 ACPI_NAMESPACE_NODE *Node); 373 374 375 /* 376 * evsci - SCI (System Control Interrupt) handling/dispatch 377 */ 378 UINT32 ACPI_SYSTEM_XFACE 379 AcpiEvGpeXruptHandler ( 380 void *Context); 381 382 UINT32 383 AcpiEvSciDispatch ( 384 void); 385 386 UINT32 387 AcpiEvInstallSciHandler ( 388 void); 389 390 ACPI_STATUS 391 AcpiEvRemoveAllSciHandlers ( 392 void); 393 394 ACPI_HW_DEPENDENT_RETURN_VOID ( 395 void 396 AcpiEvTerminate ( 397 void)) 398 399 #endif /* __ACEVENTS_H__ */ 400