| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
#include "aecommon.h" |
| 45 |
|
| 46 |
#define _COMPONENT ACPI_TOOLS |
| 47 |
ACPI_MODULE_NAME ("aehandlers") |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
static void |
| 53 |
AeNotifyHandler1 ( |
| 54 |
ACPI_HANDLE Device, |
| 55 |
UINT32 Value, |
| 56 |
void *Context); |
| 57 |
|
| 58 |
static void |
| 59 |
AeNotifyHandler2 ( |
| 60 |
ACPI_HANDLE Device, |
| 61 |
UINT32 Value, |
| 62 |
void *Context); |
| 63 |
|
| 64 |
static void |
| 65 |
AeCommonNotifyHandler ( |
| 66 |
ACPI_HANDLE Device, |
| 67 |
UINT32 Value, |
| 68 |
UINT32 HandlerId); |
| 69 |
|
| 70 |
static void |
| 71 |
AeDeviceNotifyHandler ( |
| 72 |
ACPI_HANDLE Device, |
| 73 |
UINT32 Value, |
| 74 |
void *Context); |
| 75 |
|
| 76 |
static ACPI_STATUS |
| 77 |
AeTableHandler ( |
| 78 |
UINT32 Event, |
| 79 |
void *Table, |
| 80 |
void *Context); |
| 81 |
|
| 82 |
static void |
| 83 |
AeAttachedDataHandler ( |
| 84 |
ACPI_HANDLE Object, |
| 85 |
void *Data); |
| 86 |
|
| 87 |
static void |
| 88 |
AeAttachedDataHandler2 ( |
| 89 |
ACPI_HANDLE Object, |
| 90 |
void *Data); |
| 91 |
|
| 92 |
static UINT32 |
| 93 |
AeInterfaceHandler ( |
| 94 |
ACPI_STRING InterfaceName, |
| 95 |
UINT32 Supported); |
| 96 |
|
| 97 |
#if (!ACPI_REDUCED_HARDWARE) |
| 98 |
static UINT32 |
| 99 |
AeEventHandler ( |
| 100 |
void *Context); |
| 101 |
|
| 102 |
static UINT32 |
| 103 |
AeSciHandler ( |
| 104 |
void *Context); |
| 105 |
|
| 106 |
static char *TableEvents[] = |
| 107 |
{ |
| 108 |
"LOAD", |
| 109 |
"UNLOAD", |
| 110 |
"INSTALL", |
| 111 |
"UNINSTALL", |
| 112 |
"UNKNOWN" |
| 113 |
}; |
| 114 |
#endif |
| 115 |
|
| 116 |
|
| 117 |
static AE_DEBUG_REGIONS AeRegions; |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
static void |
| 136 |
AeNotifyHandler1 ( |
| 137 |
ACPI_HANDLE Device, |
| 138 |
UINT32 Value, |
| 139 |
void *Context) |
| 140 |
{ |
| 141 |
AeCommonNotifyHandler (Device, Value, 1); |
| 142 |
} |
| 143 |
|
| 144 |
static void |
| 145 |
AeNotifyHandler2 ( |
| 146 |
ACPI_HANDLE Device, |
| 147 |
UINT32 Value, |
| 148 |
void *Context) |
| 149 |
{ |
| 150 |
AeCommonNotifyHandler (Device, Value, 2); |
| 151 |
} |
| 152 |
|
| 153 |
static void |
| 154 |
AeCommonNotifyHandler ( |
| 155 |
ACPI_HANDLE Device, |
| 156 |
UINT32 Value, |
| 157 |
UINT32 HandlerId) |
| 158 |
{ |
| 159 |
char *Type; |
| 160 |
|
| 161 |
|
| 162 |
Type = "Device"; |
| 163 |
if (Value <= ACPI_MAX_SYS_NOTIFY) |
| 164 |
{ |
| 165 |
Type = "System"; |
| 166 |
} |
| 167 |
|
| 168 |
switch (Value) |
| 169 |
{ |
| 170 |
#if 0 |
| 171 |
case 0: |
| 172 |
|
| 173 |
printf (AE_PREFIX |
| 174 |
"Method Error 0x%X: Results not equal\n", Value); |
| 175 |
if (AcpiGbl_DebugFile) |
| 176 |
{ |
| 177 |
AcpiOsPrintf (AE_PREFIX |
| 178 |
"Method Error: Results not equal\n"); |
| 179 |
} |
| 180 |
break; |
| 181 |
|
| 182 |
case 1: |
| 183 |
|
| 184 |
printf (AE_PREFIX |
| 185 |
"Method Error: Incorrect numeric result\n"); |
| 186 |
if (AcpiGbl_DebugFile) |
| 187 |
{ |
| 188 |
AcpiOsPrintf (AE_PREFIX |
| 189 |
"Method Error: Incorrect numeric result\n"); |
| 190 |
} |
| 191 |
break; |
| 192 |
|
| 193 |
case 2: |
| 194 |
|
| 195 |
printf (AE_PREFIX |
| 196 |
"Method Error: An operand was overwritten\n"); |
| 197 |
if (AcpiGbl_DebugFile) |
| 198 |
{ |
| 199 |
AcpiOsPrintf (AE_PREFIX |
| 200 |
"Method Error: An operand was overwritten\n"); |
| 201 |
} |
| 202 |
break; |
| 203 |
|
| 204 |
#endif |
| 205 |
|
| 206 |
default: |
| 207 |
|
| 208 |
printf (AE_PREFIX |
| 209 |
"Handler %u: Received a %s Notify on [%4.4s] %p Value 0x%2.2X (%s)\n", |
| 210 |
HandlerId, Type, AcpiUtGetNodeName (Device), Device, Value, |
| 211 |
AcpiUtGetNotifyName (Value, ACPI_TYPE_ANY)); |
| 212 |
if (AcpiGbl_DebugFile) |
| 213 |
{ |
| 214 |
AcpiOsPrintf (AE_PREFIX |
| 215 |
"Handler %u: Received a %s notify, Value 0x%2.2X\n", |
| 216 |
HandlerId, Type, Value); |
| 217 |
} |
| 218 |
|
| 219 |
(void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL); |
| 220 |
break; |
| 221 |
} |
| 222 |
} |
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
static void |
| 240 |
AeSystemNotifyHandler ( |
| 241 |
ACPI_HANDLE Device, |
| 242 |
UINT32 Value, |
| 243 |
void *Context) |
| 244 |
{ |
| 245 |
|
| 246 |
printf (AE_PREFIX |
| 247 |
"Global: Received a System Notify on [%4.4s] %p Value 0x%2.2X (%s)\n", |
| 248 |
AcpiUtGetNodeName (Device), Device, Value, |
| 249 |
AcpiUtGetNotifyName (Value, ACPI_TYPE_ANY)); |
| 250 |
if (AcpiGbl_DebugFile) |
| 251 |
{ |
| 252 |
AcpiOsPrintf (AE_PREFIX |
| 253 |
"Global: Received a System Notify, Value 0x%2.2X\n", Value); |
| 254 |
} |
| 255 |
|
| 256 |
(void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL); |
| 257 |
} |
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
static void |
| 275 |
AeDeviceNotifyHandler ( |
| 276 |
ACPI_HANDLE Device, |
| 277 |
UINT32 Value, |
| 278 |
void *Context) |
| 279 |
{ |
| 280 |
|
| 281 |
printf (AE_PREFIX |
| 282 |
"Global: Received a Device Notify on [%4.4s] %p Value 0x%2.2X (%s)\n", |
| 283 |
AcpiUtGetNodeName (Device), Device, Value, |
| 284 |
AcpiUtGetNotifyName (Value, ACPI_TYPE_ANY)); |
| 285 |
if (AcpiGbl_DebugFile) |
| 286 |
{ |
| 287 |
AcpiOsPrintf (AE_PREFIX |
| 288 |
"Global: Received a Device Notify, Value 0x%2.2X\n", Value); |
| 289 |
} |
| 290 |
|
| 291 |
(void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL); |
| 292 |
} |
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
static ACPI_STATUS |
| 308 |
AeTableHandler ( |
| 309 |
UINT32 Event, |
| 310 |
void *Table, |
| 311 |
void *Context) |
| 312 |
{ |
| 313 |
#if (!ACPI_REDUCED_HARDWARE) |
| 314 |
ACPI_STATUS Status; |
| 315 |
#endif |
| 316 |
|
| 317 |
|
| 318 |
if (Event > ACPI_NUM_TABLE_EVENTS) |
| 319 |
{ |
| 320 |
Event = ACPI_NUM_TABLE_EVENTS; |
| 321 |
} |
| 322 |
|
| 323 |
#if (!ACPI_REDUCED_HARDWARE) |
| 324 |
|
| 325 |
|
| 326 |
Status = AcpiUpdateAllGpes (); |
| 327 |
ACPI_CHECK_OK (AcpiUpdateAllGpes, Status); |
| 328 |
|
| 329 |
printf (AE_PREFIX "Table Event %s, [%4.4s] %p\n", |
| 330 |
TableEvents[Event], |
| 331 |
((ACPI_TABLE_HEADER *) Table)->Signature, Table); |
| 332 |
#endif |
| 333 |
|
| 334 |
return (AE_OK); |
| 335 |
} |
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
UINT32 |
| 347 |
AeGpeHandler ( |
| 348 |
ACPI_HANDLE GpeDevice, |
| 349 |
UINT32 GpeNumber, |
| 350 |
void *Context) |
| 351 |
{ |
| 352 |
ACPI_NAMESPACE_NODE *DeviceNode = (ACPI_NAMESPACE_NODE *) GpeDevice; |
| 353 |
|
| 354 |
|
| 355 |
AcpiOsPrintf (AE_PREFIX |
| 356 |
"GPE Handler received GPE %02X (GPE block %4.4s)\n", |
| 357 |
GpeNumber, GpeDevice ? DeviceNode->Name.Ascii : "FADT"); |
| 358 |
|
| 359 |
return (ACPI_REENABLE_GPE); |
| 360 |
} |
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
void |
| 372 |
AeGlobalEventHandler ( |
| 373 |
UINT32 Type, |
| 374 |
ACPI_HANDLE Device, |
| 375 |
UINT32 EventNumber, |
| 376 |
void *Context) |
| 377 |
{ |
| 378 |
char *TypeName; |
| 379 |
|
| 380 |
|
| 381 |
switch (Type) |
| 382 |
{ |
| 383 |
case ACPI_EVENT_TYPE_GPE: |
| 384 |
|
| 385 |
TypeName = "GPE"; |
| 386 |
break; |
| 387 |
|
| 388 |
case ACPI_EVENT_TYPE_FIXED: |
| 389 |
|
| 390 |
TypeName = "FixedEvent"; |
| 391 |
break; |
| 392 |
|
| 393 |
default: |
| 394 |
|
| 395 |
TypeName = "UNKNOWN"; |
| 396 |
break; |
| 397 |
} |
| 398 |
|
| 399 |
AcpiOsPrintf (AE_PREFIX |
| 400 |
"Global Event Handler received: Type %s Number %.2X Dev %p\n", |
| 401 |
TypeName, EventNumber, Device); |
| 402 |
} |
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
static void |
| 415 |
AeAttachedDataHandler ( |
| 416 |
ACPI_HANDLE Object, |
| 417 |
void *Data) |
| 418 |
{ |
| 419 |
ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Data); |
| 420 |
|
| 421 |
ACPI_FUNCTION_NAME (AeAttachedDataHandler1); |
| 422 |
|
| 423 |
|
| 424 |
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
| 425 |
"Received an attached data deletion at handler 1 on %4.4s\n", |
| 426 |
Node->Name.Ascii)); |
| 427 |
} |
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
static void |
| 440 |
AeAttachedDataHandler2 ( |
| 441 |
ACPI_HANDLE Object, |
| 442 |
void *Data) |
| 443 |
{ |
| 444 |
ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Data); |
| 445 |
|
| 446 |
ACPI_FUNCTION_NAME (AeAttachedDataHandler2); |
| 447 |
|
| 448 |
|
| 449 |
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
| 450 |
"Received an attached data deletion at handler 2 on %4.4s\n", |
| 451 |
Node->Name.Ascii)); |
| 452 |
} |
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
static UINT32 |
| 464 |
AeInterfaceHandler ( |
| 465 |
ACPI_STRING InterfaceName, |
| 466 |
UINT32 Supported) |
| 467 |
{ |
| 468 |
ACPI_FUNCTION_NAME (AeInterfaceHandler); |
| 469 |
|
| 470 |
|
| 471 |
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
| 472 |
"Received _OSI (\"%s\"), is %ssupported\n", |
| 473 |
InterfaceName, Supported == 0 ? "not " : "")); |
| 474 |
|
| 475 |
return (Supported); |
| 476 |
} |
| 477 |
|
| 478 |
|
| 479 |
#if (!ACPI_REDUCED_HARDWARE) |
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
static UINT32 |
| 489 |
AeEventHandler ( |
| 490 |
void *Context) |
| 491 |
{ |
| 492 |
return (0); |
| 493 |
} |
| 494 |
|
| 495 |
static UINT32 |
| 496 |
AeSciHandler ( |
| 497 |
void *Context) |
| 498 |
{ |
| 499 |
|
| 500 |
AcpiOsPrintf (AE_PREFIX |
| 501 |
"Received an SCI at handler\n"); |
| 502 |
return (0); |
| 503 |
} |
| 504 |
|
| 505 |
#endif |
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
|
| 521 |
static ACPI_STATUS |
| 522 |
AeInstallSciHandler ( |
| 523 |
void) |
| 524 |
{ |
| 525 |
ACPI_STATUS Status; |
| 526 |
|
| 527 |
|
| 528 |
Status = AcpiInstallSciHandler (AeSciHandler, &AeMyContext); |
| 529 |
if (ACPI_FAILURE (Status)) |
| 530 |
{ |
| 531 |
ACPI_EXCEPTION ((AE_INFO, Status, |
| 532 |
"Could not install an SCI handler (1)")); |
| 533 |
} |
| 534 |
|
| 535 |
Status = AcpiRemoveSciHandler (AeSciHandler); |
| 536 |
if (ACPI_FAILURE (Status)) |
| 537 |
{ |
| 538 |
ACPI_EXCEPTION ((AE_INFO, Status, |
| 539 |
"Could not remove an SCI handler")); |
| 540 |
} |
| 541 |
|
| 542 |
Status = AcpiInstallSciHandler (AeSciHandler, &AeMyContext); |
| 543 |
if (ACPI_FAILURE (Status)) |
| 544 |
{ |
| 545 |
ACPI_EXCEPTION ((AE_INFO, Status, |
| 546 |
"Could not install an SCI handler (2)")); |
| 547 |
} |
| 548 |
|
| 549 |
return (Status); |
| 550 |
} |
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
ACPI_STATUS |
| 566 |
AeInstallLateHandlers ( |
| 567 |
void) |
| 568 |
{ |
| 569 |
ACPI_STATUS Status; |
| 570 |
ACPI_HANDLE Handle; |
| 571 |
|
| 572 |
|
| 573 |
Status = AcpiGetHandle (NULL, "\\_TZ.TZ1", &Handle); |
| 574 |
if (ACPI_SUCCESS (Status)) |
| 575 |
{ |
| 576 |
Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, |
| 577 |
AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567)); |
| 578 |
ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); |
| 579 |
|
| 580 |
Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, |
| 581 |
AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF)); |
| 582 |
ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); |
| 583 |
|
| 584 |
Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY, |
| 585 |
AeNotifyHandler1); |
| 586 |
ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); |
| 587 |
|
| 588 |
Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY, |
| 589 |
AeNotifyHandler2); |
| 590 |
ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); |
| 591 |
|
| 592 |
Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, |
| 593 |
AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF)); |
| 594 |
ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); |
| 595 |
|
| 596 |
Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, |
| 597 |
AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567)); |
| 598 |
ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); |
| 599 |
} |
| 600 |
|
| 601 |
Status = AcpiGetHandle (NULL, "\\_PR.CPU0", &Handle); |
| 602 |
if (ACPI_SUCCESS (Status)) |
| 603 |
{ |
| 604 |
Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, |
| 605 |
AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567)); |
| 606 |
ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); |
| 607 |
|
| 608 |
Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, |
| 609 |
AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF)); |
| 610 |
ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); |
| 611 |
} |
| 612 |
|
| 613 |
#if (!ACPI_REDUCED_HARDWARE) |
| 614 |
if (!AcpiGbl_ReducedHardware) |
| 615 |
{ |
| 616 |
|
| 617 |
|
| 618 |
Status = AeInstallSciHandler (); |
| 619 |
ACPI_CHECK_OK (AeInstallSciHandler, Status); |
| 620 |
|
| 621 |
|
| 622 |
|
| 623 |
Status = AcpiInstallFixedEventHandler ( |
| 624 |
ACPI_EVENT_GLOBAL, AeEventHandler, NULL); |
| 625 |
ACPI_CHECK_OK (AcpiInstallFixedEventHandler, Status); |
| 626 |
|
| 627 |
Status = AcpiInstallFixedEventHandler ( |
| 628 |
ACPI_EVENT_RTC, AeEventHandler, NULL); |
| 629 |
ACPI_CHECK_OK (AcpiInstallFixedEventHandler, Status); |
| 630 |
} |
| 631 |
#endif |
| 632 |
|
| 633 |
AeMyContext.Connection = NULL; |
| 634 |
AeMyContext.AccessLength = 0xA5; |
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
|
| 642 |
AeInstallDeviceHandlers (); |
| 643 |
|
| 644 |
|
| 645 |
|
| 646 |
|
| 647 |
|
| 648 |
AeInstallRegionHandlers (); |
| 649 |
return (AE_OK); |
| 650 |
} |
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
|
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
ACPI_STATUS |
| 669 |
AeInstallEarlyHandlers ( |
| 670 |
void) |
| 671 |
{ |
| 672 |
ACPI_STATUS Status; |
| 673 |
ACPI_HANDLE Handle; |
| 674 |
|
| 675 |
|
| 676 |
ACPI_FUNCTION_ENTRY (); |
| 677 |
|
| 678 |
|
| 679 |
Status = AcpiInstallInterfaceHandler (AeInterfaceHandler); |
| 680 |
if (ACPI_FAILURE (Status)) |
| 681 |
{ |
| 682 |
printf ("Could not install interface handler, %s\n", |
| 683 |
AcpiFormatException (Status)); |
| 684 |
} |
| 685 |
|
| 686 |
Status = AcpiInstallTableHandler (AeTableHandler, NULL); |
| 687 |
if (ACPI_FAILURE (Status)) |
| 688 |
{ |
| 689 |
printf ("Could not install table handler, %s\n", |
| 690 |
AcpiFormatException (Status)); |
| 691 |
} |
| 692 |
|
| 693 |
Status = AcpiInstallExceptionHandler (AeExceptionHandler); |
| 694 |
if (ACPI_FAILURE (Status)) |
| 695 |
{ |
| 696 |
printf ("Could not install exception handler, %s\n", |
| 697 |
AcpiFormatException (Status)); |
| 698 |
} |
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, |
| 703 |
ACPI_SYSTEM_NOTIFY, AeSystemNotifyHandler, NULL); |
| 704 |
if (ACPI_FAILURE (Status)) |
| 705 |
{ |
| 706 |
printf ("Could not install a global system notify handler, %s\n", |
| 707 |
AcpiFormatException (Status)); |
| 708 |
} |
| 709 |
|
| 710 |
Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, |
| 711 |
ACPI_DEVICE_NOTIFY, AeDeviceNotifyHandler, NULL); |
| 712 |
if (ACPI_FAILURE (Status)) |
| 713 |
{ |
| 714 |
printf ("Could not install a global notify handler, %s\n", |
| 715 |
AcpiFormatException (Status)); |
| 716 |
} |
| 717 |
|
| 718 |
Status = AcpiGetHandle (NULL, "\\_SB", &Handle); |
| 719 |
if (ACPI_SUCCESS (Status)) |
| 720 |
{ |
| 721 |
Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, |
| 722 |
AeNotifyHandler1, NULL); |
| 723 |
if (ACPI_FAILURE (Status)) |
| 724 |
{ |
| 725 |
printf ("Could not install a notify handler, %s\n", |
| 726 |
AcpiFormatException (Status)); |
| 727 |
} |
| 728 |
|
| 729 |
Status = AcpiRemoveNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, |
| 730 |
AeNotifyHandler1); |
| 731 |
if (ACPI_FAILURE (Status)) |
| 732 |
{ |
| 733 |
printf ("Could not remove a notify handler, %s\n", |
| 734 |
AcpiFormatException (Status)); |
| 735 |
} |
| 736 |
|
| 737 |
Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, |
| 738 |
AeNotifyHandler1, NULL); |
| 739 |
ACPI_CHECK_OK (AcpiInstallNotifyHandler, Status); |
| 740 |
|
| 741 |
Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY, |
| 742 |
AeNotifyHandler1); |
| 743 |
ACPI_CHECK_OK (AcpiRemoveNotifyHandler, Status); |
| 744 |
|
| 745 |
#if 0 |
| 746 |
Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, |
| 747 |
AeNotifyHandler1, NULL); |
| 748 |
if (ACPI_FAILURE (Status)) |
| 749 |
{ |
| 750 |
printf ("Could not install a notify handler, %s\n", |
| 751 |
AcpiFormatException (Status)); |
| 752 |
} |
| 753 |
#endif |
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, |
| 758 |
AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567)); |
| 759 |
ACPI_CHECK_OK(AcpiInstallNotifyHandler, Status); |
| 760 |
|
| 761 |
Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, |
| 762 |
AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF)); |
| 763 |
ACPI_CHECK_OK(AcpiInstallNotifyHandler, Status); |
| 764 |
|
| 765 |
|
| 766 |
|
| 767 |
(void) AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, |
| 768 |
AeNotifyHandler1, ACPI_CAST_PTR (void, 0x77777777)); |
| 769 |
|
| 770 |
Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle); |
| 771 |
ACPI_CHECK_OK (AcpiAttachData, Status); |
| 772 |
|
| 773 |
Status = AcpiDetachData (Handle, AeAttachedDataHandler); |
| 774 |
ACPI_CHECK_OK (AcpiDetachData, Status); |
| 775 |
|
| 776 |
|
| 777 |
|
| 778 |
Status = AcpiAttachData (ACPI_ROOT_OBJECT, AeAttachedDataHandler, |
| 779 |
AcpiGbl_RootNode); |
| 780 |
ACPI_CHECK_OK (AcpiAttachData, Status); |
| 781 |
|
| 782 |
Status = AcpiAttachData (ACPI_ROOT_OBJECT, AeAttachedDataHandler2, |
| 783 |
AcpiGbl_RootNode); |
| 784 |
ACPI_CHECK_OK (AcpiAttachData, Status); |
| 785 |
|
| 786 |
|
| 787 |
|
| 788 |
Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle); |
| 789 |
ACPI_CHECK_OK (AcpiAttachData, Status); |
| 790 |
|
| 791 |
Status = AcpiAttachData (Handle, AeAttachedDataHandler2, Handle); |
| 792 |
ACPI_CHECK_OK (AcpiAttachData, Status); |
| 793 |
} |
| 794 |
else |
| 795 |
{ |
| 796 |
printf ("No _SB_ found, %s\n", AcpiFormatException (Status)); |
| 797 |
} |
| 798 |
|
| 799 |
|
| 800 |
|
| 801 |
|
| 802 |
|
| 803 |
AeOverrideRegionHandlers (); |
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
AeRegions.NumberOfRegions = 0; |
| 810 |
AeRegions.RegionList = NULL; |
| 811 |
return (AE_OK); |
| 812 |
} |