Print this page
update to acpica-unix2-20140114
update to acpica-unix2-20131218
update to acpica-unix2-20130927
acpica-unix2-20130823
PANKOVs restructure
   1 /******************************************************************************
   2  *
   3  * Name: actypes.h - Common data types for the entire ACPI subsystem
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2011, 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.


 278  *
 279  ******************************************************************************/
 280 
 281 /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
 282 
 283 #ifndef ACPI_UINTPTR_T
 284 #define ACPI_UINTPTR_T                  void *
 285 #endif
 286 
 287 /*
 288  * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because
 289  * some compilers can catch printf format string problems
 290  */
 291 #ifndef ACPI_PRINTF_LIKE
 292 #define ACPI_PRINTF_LIKE(c)
 293 #endif
 294 
 295 /*
 296  * Some compilers complain about unused variables. Sometimes we don't want to
 297  * use all the variables (for example, _AcpiModuleName). This allows us
 298  * to to tell the compiler in a per-variable manner that a variable
 299  * is unused
 300  */
 301 #ifndef ACPI_UNUSED_VAR
 302 #define ACPI_UNUSED_VAR
 303 #endif
 304 
 305 /*
 306  * All ACPICA functions that are available to the rest of the kernel are
 307  * tagged with this macro which can be defined as appropriate for the host.





 308  */




 309 #ifndef ACPI_EXPORT_SYMBOL
 310 #define ACPI_EXPORT_SYMBOL(Symbol)
 311 #endif
 312 







 313 





























 314 /******************************************************************************
 315  *
 316  * ACPI Specification constants (Do not change unless the specification changes)
 317  *
 318  *****************************************************************************/
 319 
 320 /* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */
 321 
 322 #define ACPI_MAX_GPE_BLOCKS             2
 323 
 324 /* Default ACPI register widths */
 325 
 326 #define ACPI_GPE_REGISTER_WIDTH         8
 327 #define ACPI_PM1_REGISTER_WIDTH         16
 328 #define ACPI_PM2_REGISTER_WIDTH         8
 329 #define ACPI_PM_TIMER_WIDTH             32

 330 
 331 /* Names within the namespace are 4 bytes long */
 332 
 333 #define ACPI_NAME_SIZE                  4
 334 #define ACPI_PATH_SEGMENT_LENGTH        5           /* 4 chars for name + 1 char for separator */
 335 #define ACPI_PATH_SEPARATOR             '.'
 336 
 337 /* Sizes for ACPI table headers */
 338 
 339 #define ACPI_OEM_ID_SIZE                6
 340 #define ACPI_OEM_TABLE_ID_SIZE          8
 341 
 342 /* ACPI/PNP hardware IDs */
 343 
 344 #define PCI_ROOT_HID_STRING             "PNP0A03"
 345 #define PCI_EXPRESS_ROOT_HID_STRING     "PNP0A08"
 346 
 347 /* PM Timer ticks per second (HZ) */
 348 
 349 #define PM_TIMER_FREQUENCY              3579545
 350 
 351 
 352 /*******************************************************************************
 353  *
 354  * Independent types
 355  *
 356  ******************************************************************************/
 357 
 358 /* Logical defines and NULL */
 359 
 360 #ifdef FALSE
 361 #undef FALSE
 362 #endif
 363 #define FALSE                           (1 == 0)
 364 
 365 #ifdef TRUE
 366 #undef TRUE
 367 #endif
 368 #define TRUE                            (1 == 1)
 369 
 370 #ifndef NULL
 371 #define NULL                            (void *) 0
 372 #endif
 373 
 374 
 375 /*
 376  * Miscellaneous types
 377  */
 378 typedef UINT32                          ACPI_STATUS;    /* All ACPI Exceptions */
 379 typedef UINT32                          ACPI_NAME;      /* 4-byte ACPI name */
 380 typedef char *                          ACPI_STRING;    /* Null terminated ASCII string */
 381 typedef void *                          ACPI_HANDLE;    /* Actually a ptr to a NS Node */
 382 
 383 
















 384 /* Owner IDs are used to track namespace nodes for selective deletion */
 385 
 386 typedef UINT8                           ACPI_OWNER_ID;
 387 #define ACPI_OWNER_ID_MAX               0xFF
 388 
 389 
 390 #define ACPI_INTEGER_BIT_SIZE           64
 391 #define ACPI_MAX_DECIMAL_DIGITS         20  /* 2^64 = 18,446,744,073,709,551,616 */
 392 #define ACPI_MAX64_DECIMAL_DIGITS       20
 393 #define ACPI_MAX32_DECIMAL_DIGITS       10
 394 #define ACPI_MAX16_DECIMAL_DIGITS        5
 395 #define ACPI_MAX8_DECIMAL_DIGITS         3
 396 
 397 /*
 398  * Constants with special meanings
 399  */
 400 #define ACPI_ROOT_OBJECT                ACPI_ADD_PTR (ACPI_HANDLE, NULL, ACPI_MAX_PTR)
 401 #define ACPI_WAIT_FOREVER               0xFFFF  /* UINT16, as per ACPI spec */
 402 #define ACPI_DO_NOT_WAIT                0
 403 


 437 
 438 /* Size calculation */
 439 
 440 #define ACPI_ARRAY_LENGTH(x)            (sizeof(x) / sizeof((x)[0]))
 441 
 442 /* Pointer manipulation */
 443 
 444 #define ACPI_CAST_PTR(t, p)             ((t *) (ACPI_UINTPTR_T) (p))
 445 #define ACPI_CAST_INDIRECT_PTR(t, p)    ((t **) (ACPI_UINTPTR_T) (p))
 446 #define ACPI_ADD_PTR(t, a, b)           ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b)))
 447 #define ACPI_PTR_DIFF(a, b)             (ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b)))
 448 
 449 /* Pointer/Integer type conversions */
 450 
 451 #define ACPI_TO_POINTER(i)              ACPI_ADD_PTR (void, (void *) NULL,(ACPI_SIZE) i)
 452 #define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p, (void *) NULL)
 453 #define ACPI_OFFSET(d, f)               (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL)
 454 #define ACPI_PHYSADDR_TO_PTR(i)         ACPI_TO_POINTER(i)
 455 #define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
 456 


 457 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
 458 #define ACPI_COMPARE_NAME(a,b)          (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b)))

 459 #else
 460 #define ACPI_COMPARE_NAME(a,b)          (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))

 461 #endif
 462 

 463 




 464 /*******************************************************************************
 465  *
 466  * Miscellaneous constants
 467  *
 468  ******************************************************************************/
 469 
 470 /*
 471  * Initialization sequence
 472  */
 473 #define ACPI_FULL_INITIALIZATION        0x00
 474 #define ACPI_NO_ADDRESS_SPACE_INIT      0x01
 475 #define ACPI_NO_HARDWARE_INIT           0x02
 476 #define ACPI_NO_EVENT_INIT              0x04
 477 #define ACPI_NO_HANDLER_INIT            0x08
 478 #define ACPI_NO_ACPI_ENABLE             0x10
 479 #define ACPI_NO_DEVICE_INIT             0x20
 480 #define ACPI_NO_OBJECT_INIT             0x40
 481 
 482 /*
 483  * Initialization state


 517  * Sleep type invalid value
 518  */
 519 #define ACPI_SLEEP_TYPE_MAX             0x7
 520 #define ACPI_SLEEP_TYPE_INVALID         0xFF
 521 
 522 /*
 523  * Standard notify values
 524  */
 525 #define ACPI_NOTIFY_BUS_CHECK           (UINT8) 0x00
 526 #define ACPI_NOTIFY_DEVICE_CHECK        (UINT8) 0x01
 527 #define ACPI_NOTIFY_DEVICE_WAKE         (UINT8) 0x02
 528 #define ACPI_NOTIFY_EJECT_REQUEST       (UINT8) 0x03
 529 #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT  (UINT8) 0x04
 530 #define ACPI_NOTIFY_FREQUENCY_MISMATCH  (UINT8) 0x05
 531 #define ACPI_NOTIFY_BUS_MODE_MISMATCH   (UINT8) 0x06
 532 #define ACPI_NOTIFY_POWER_FAULT         (UINT8) 0x07
 533 #define ACPI_NOTIFY_CAPABILITIES_CHECK  (UINT8) 0x08
 534 #define ACPI_NOTIFY_DEVICE_PLD_CHECK    (UINT8) 0x09
 535 #define ACPI_NOTIFY_RESERVED            (UINT8) 0x0A
 536 #define ACPI_NOTIFY_LOCALITY_UPDATE     (UINT8) 0x0B

 537 
 538 #define ACPI_NOTIFY_MAX                 0x0B
 539 
 540 /*
 541  * Types associated with ACPI names and objects. The first group of
 542  * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
 543  * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore,
 544  * only add to the first group if the spec changes.
 545  *
 546  * NOTE: Types must be kept in sync with the global AcpiNsProperties
 547  * and AcpiNsTypeNames arrays.
 548  */
 549 typedef UINT32                          ACPI_OBJECT_TYPE;
 550 
 551 #define ACPI_TYPE_ANY                   0x00
 552 #define ACPI_TYPE_INTEGER               0x01  /* Byte/Word/Dword/Zero/One/Ones */
 553 #define ACPI_TYPE_STRING                0x02
 554 #define ACPI_TYPE_BUFFER                0x03
 555 #define ACPI_TYPE_PACKAGE               0x04  /* ByteConst, multiple DataTerm/Constant/SuperName */
 556 #define ACPI_TYPE_FIELD_UNIT            0x05
 557 #define ACPI_TYPE_DEVICE                0x06  /* Name, multiple Node */
 558 #define ACPI_TYPE_EVENT                 0x07


 574  * If new predefined ACPI_TYPEs are added (via the ACPI specification), these
 575  * internal types must move upwards. (There is code that depends on these
 576  * values being contiguous with the external types above.)
 577  */
 578 #define ACPI_TYPE_LOCAL_REGION_FIELD    0x11
 579 #define ACPI_TYPE_LOCAL_BANK_FIELD      0x12
 580 #define ACPI_TYPE_LOCAL_INDEX_FIELD     0x13
 581 #define ACPI_TYPE_LOCAL_REFERENCE       0x14  /* Arg#, Local#, Name, Debug, RefOf, Index */
 582 #define ACPI_TYPE_LOCAL_ALIAS           0x15
 583 #define ACPI_TYPE_LOCAL_METHOD_ALIAS    0x16
 584 #define ACPI_TYPE_LOCAL_NOTIFY          0x17
 585 #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18
 586 #define ACPI_TYPE_LOCAL_RESOURCE        0x19
 587 #define ACPI_TYPE_LOCAL_RESOURCE_FIELD  0x1A
 588 #define ACPI_TYPE_LOCAL_SCOPE           0x1B  /* 1 Name, multiple ObjectList Nodes */
 589 
 590 #define ACPI_TYPE_NS_NODE_MAX           0x1B  /* Last typecode used within a NS Node */
 591 
 592 /*
 593  * These are special object types that never appear in
 594  * a Namespace node, only in an ACPI_OPERAND_OBJECT
 595  */
 596 #define ACPI_TYPE_LOCAL_EXTRA           0x1C
 597 #define ACPI_TYPE_LOCAL_DATA            0x1D
 598 
 599 #define ACPI_TYPE_LOCAL_MAX             0x1D
 600 
 601 /* All types above here are invalid */
 602 
 603 #define ACPI_TYPE_INVALID               0x1E
 604 #define ACPI_TYPE_NOT_FOUND             0xFF
 605 
 606 #define ACPI_NUM_NS_TYPES               (ACPI_TYPE_INVALID + 1)
 607 
 608 
 609 /*
 610  * All I/O
 611  */
 612 #define ACPI_READ                       0
 613 #define ACPI_WRITE                      1
 614 #define ACPI_IO_MASK                    1


 634  * -------------
 635  * The encoding of ACPI_EVENT_STATUS is illustrated below.
 636  * Note that a set bit (1) indicates the property is TRUE
 637  * (e.g. if bit 0 is set then the event is enabled).
 638  * +-------------+-+-+-+
 639  * |   Bits 31:3 |2|1|0|
 640  * +-------------+-+-+-+
 641  *          |     | | |
 642  *          |     | | +- Enabled?
 643  *          |     | +--- Enabled for wake?
 644  *          |     +----- Set?
 645  *          +----------- <Reserved>
 646  */
 647 typedef UINT32                          ACPI_EVENT_STATUS;
 648 
 649 #define ACPI_EVENT_FLAG_DISABLED        (ACPI_EVENT_STATUS) 0x00
 650 #define ACPI_EVENT_FLAG_ENABLED         (ACPI_EVENT_STATUS) 0x01
 651 #define ACPI_EVENT_FLAG_WAKE_ENABLED    (ACPI_EVENT_STATUS) 0x02
 652 #define ACPI_EVENT_FLAG_SET             (ACPI_EVENT_STATUS) 0x04
 653 
 654 /*
 655  * General Purpose Events (GPE)
 656  */
 657 #define ACPI_GPE_INVALID                0xFF
 658 #define ACPI_GPE_MAX                    0xFF
 659 #define ACPI_NUM_GPE                    256
 660 
 661 /* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */
 662 
 663 #define ACPI_GPE_ENABLE                 0
 664 #define ACPI_GPE_DISABLE                1
 665 #define ACPI_GPE_CONDITIONAL_ENABLE     2
 666 
 667 /*
 668  * GPE info flags - Per GPE
 669  * +-------+-+-+---+
 670  * |  7:4  |3|2|1:0|
 671  * +-------+-+-+---+
 672  *     |    | |  |
 673  *     |    | |  +-- Type of dispatch:to method, handler, notify, or none
 674  *     |    | +----- Interrupt type: edge or level triggered
 675  *     |    +------- Is a Wake GPE
 676  *     +------------ <Reserved>
 677  */
 678 #define ACPI_GPE_DISPATCH_NONE          (UINT8) 0x00
 679 #define ACPI_GPE_DISPATCH_METHOD        (UINT8) 0x01
 680 #define ACPI_GPE_DISPATCH_HANDLER       (UINT8) 0x02


 683 
 684 #define ACPI_GPE_LEVEL_TRIGGERED        (UINT8) 0x04
 685 #define ACPI_GPE_EDGE_TRIGGERED         (UINT8) 0x00
 686 #define ACPI_GPE_XRUPT_TYPE_MASK        (UINT8) 0x04
 687 
 688 #define ACPI_GPE_CAN_WAKE               (UINT8) 0x08
 689 
 690 /*
 691  * Flags for GPE and Lock interfaces
 692  */
 693 #define ACPI_NOT_ISR                    0x1
 694 #define ACPI_ISR                        0x0
 695 
 696 
 697 /* Notify types */
 698 
 699 #define ACPI_SYSTEM_NOTIFY              0x1
 700 #define ACPI_DEVICE_NOTIFY              0x2
 701 #define ACPI_ALL_NOTIFY                 (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY)
 702 #define ACPI_MAX_NOTIFY_HANDLER_TYPE    0x3

 703 
 704 #define ACPI_MAX_SYS_NOTIFY             0x7f

 705 


 706 

 707 /* Address Space (Operation Region) Types */
 708 
 709 typedef UINT8                           ACPI_ADR_SPACE_TYPE;
 710 
 711 #define ACPI_ADR_SPACE_SYSTEM_MEMORY    (ACPI_ADR_SPACE_TYPE) 0
 712 #define ACPI_ADR_SPACE_SYSTEM_IO        (ACPI_ADR_SPACE_TYPE) 1
 713 #define ACPI_ADR_SPACE_PCI_CONFIG       (ACPI_ADR_SPACE_TYPE) 2
 714 #define ACPI_ADR_SPACE_EC               (ACPI_ADR_SPACE_TYPE) 3
 715 #define ACPI_ADR_SPACE_SMBUS            (ACPI_ADR_SPACE_TYPE) 4
 716 #define ACPI_ADR_SPACE_CMOS             (ACPI_ADR_SPACE_TYPE) 5
 717 #define ACPI_ADR_SPACE_PCI_BAR_TARGET   (ACPI_ADR_SPACE_TYPE) 6
 718 #define ACPI_ADR_SPACE_IPMI             (ACPI_ADR_SPACE_TYPE) 7



 719 
 720 #define ACPI_NUM_PREDEFINED_REGIONS     8
 721 
 722 /*
 723  * Special Address Spaces
 724  *
 725  * Note: A Data Table region is a special type of operation region
 726  * that has its own AML opcode. However, internally, the AML
 727  * interpreter simply creates an operation region with an an address
 728  * space type of ACPI_ADR_SPACE_DATA_TABLE.
 729  */
 730 #define ACPI_ADR_SPACE_DATA_TABLE       (ACPI_ADR_SPACE_TYPE) 0x7E /* Internal to ACPICA only */
 731 #define ACPI_ADR_SPACE_FIXED_HARDWARE   (ACPI_ADR_SPACE_TYPE) 0x7F
 732 
 733 /* Values for _REG connection code */
 734 
 735 #define ACPI_REG_DISCONNECT             0
 736 #define ACPI_REG_CONNECT                1
 737 
 738 /*
 739  * BitRegister IDs
 740  *


 773 #define ACPI_BITREG_SLEEP_ENABLE                0x12
 774 
 775 /* PM2 Control register */
 776 
 777 #define ACPI_BITREG_ARB_DISABLE                 0x13
 778 
 779 #define ACPI_BITREG_MAX                         0x13
 780 #define ACPI_NUM_BITREG                         ACPI_BITREG_MAX + 1
 781 
 782 
 783 /* Status register values. A 1 clears a status bit. 0 = no effect */
 784 
 785 #define ACPI_CLEAR_STATUS                       1
 786 
 787 /* Enable and Control register values */
 788 
 789 #define ACPI_ENABLE_EVENT                       1
 790 #define ACPI_DISABLE_EVENT                      0
 791 
 792 













 793 /*
 794  * External ACPI object definition
 795  */
 796 
 797 /*
 798  * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package element
 799  * or an unresolved named reference.
 800  */
 801 typedef union acpi_object
 802 {
 803     ACPI_OBJECT_TYPE                Type;   /* See definition of AcpiNsType for values */
 804     struct
 805     {
 806         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_INTEGER */
 807         UINT64                          Value;      /* The actual number */
 808     } Integer;
 809 
 810     struct
 811     {
 812         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_STRING */


 851     } PowerResource;
 852 
 853 } ACPI_OBJECT;
 854 
 855 
 856 /*
 857  * List of objects, used as a parameter list for control method evaluation
 858  */
 859 typedef struct acpi_object_list
 860 {
 861     UINT32                          Count;
 862     ACPI_OBJECT                     *Pointer;
 863 
 864 } ACPI_OBJECT_LIST;
 865 
 866 
 867 /*
 868  * Miscellaneous common Data Structures used by the interfaces
 869  */
 870 #define ACPI_NO_BUFFER              0
 871 #define ACPI_ALLOCATE_BUFFER        (ACPI_SIZE) (-1)
 872 #define ACPI_ALLOCATE_LOCAL_BUFFER  (ACPI_SIZE) (-2)
 873 
 874 typedef struct acpi_buffer
 875 {
 876     ACPI_SIZE                       Length;         /* Length in bytes of the buffer */
 877     void                            *Pointer;       /* pointer to buffer */
 878 
 879 } ACPI_BUFFER;
 880 
 881 
 882 /*
 883  * NameType for AcpiGetName
 884  */
 885 #define ACPI_FULL_PATHNAME              0
 886 #define ACPI_SINGLE_NAME                1
 887 #define ACPI_NAME_TYPE_MAX              1
 888 
 889 
 890 /*
 891  * Predefined Namespace items
 892  */


 942 #define ACPI_TABLE_EVENT_LOAD           0x0
 943 #define ACPI_TABLE_EVENT_UNLOAD         0x1
 944 #define ACPI_NUM_TABLE_EVENTS           2
 945 
 946 
 947 /*
 948  * Types specific to the OS service interfaces
 949  */
 950 typedef UINT32
 951 (ACPI_SYSTEM_XFACE *ACPI_OSD_HANDLER) (
 952     void                            *Context);
 953 
 954 typedef void
 955 (ACPI_SYSTEM_XFACE *ACPI_OSD_EXEC_CALLBACK) (
 956     void                            *Context);
 957 
 958 /*
 959  * Various handlers and callback procedures
 960  */
 961 typedef




 962 void (*ACPI_GBL_EVENT_HANDLER) (
 963     UINT32                          EventType,
 964     ACPI_HANDLE                     Device,
 965     UINT32                          EventNumber,
 966     void                            *Context);
 967 
 968 #define ACPI_EVENT_TYPE_GPE         0
 969 #define ACPI_EVENT_TYPE_FIXED       1
 970 
 971 typedef
 972 UINT32 (*ACPI_EVENT_HANDLER) (
 973     void                            *Context);
 974 
 975 typedef
 976 UINT32 (*ACPI_GPE_HANDLER) (
 977     ACPI_HANDLE                     GpeDevice,
 978     UINT32                          GpeNumber,
 979     void                            *Context);
 980 
 981 typedef


1013     void                            *Context);
1014 
1015 #define ACPI_TABLE_LOAD             0x0
1016 #define ACPI_TABLE_UNLOAD           0x1
1017 #define ACPI_NUM_TABLE_EVENTS       2
1018 
1019 
1020 /* Address Spaces (For Operation Regions) */
1021 
1022 typedef
1023 ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
1024     UINT32                          Function,
1025     ACPI_PHYSICAL_ADDRESS           Address,
1026     UINT32                          BitWidth,
1027     UINT64                          *Value,
1028     void                            *HandlerContext,
1029     void                            *RegionContext);
1030 
1031 #define ACPI_DEFAULT_HANDLER            NULL
1032 











1033 typedef
1034 ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
1035     ACPI_HANDLE                     RegionHandle,
1036     UINT32                          Function,
1037     void                            *HandlerContext,
1038     void                            **RegionContext);
1039 
1040 #define ACPI_REGION_ACTIVATE    0
1041 #define ACPI_REGION_DEACTIVATE  1
1042 
1043 typedef
1044 ACPI_STATUS (*ACPI_WALK_CALLBACK) (
1045     ACPI_HANDLE                     Object,
1046     UINT32                          NestingLevel,
1047     void                            *Context,
1048     void                            **ReturnValue);
1049 
1050 typedef
1051 UINT32 (*ACPI_INTERFACE_HANDLER) (
1052     ACPI_STRING                     InterfaceName,


1055 
1056 /* Interrupt handler return values */
1057 
1058 #define ACPI_INTERRUPT_NOT_HANDLED      0x00
1059 #define ACPI_INTERRUPT_HANDLED          0x01
1060 
1061 /* GPE handler return values */
1062 
1063 #define ACPI_REENABLE_GPE               0x80
1064 
1065 
1066 /* Length of 32-bit EISAID values when converted back to a string */
1067 
1068 #define ACPI_EISAID_STRING_SIZE         8   /* Includes null terminator */
1069 
1070 /* Length of UUID (string) values */
1071 
1072 #define ACPI_UUID_LENGTH                16
1073 
1074 
1075 /* Structures used for device/processor HID, UID, CID */
1076 
1077 typedef struct acpi_device_id
1078 {
1079     UINT32                          Length;             /* Length of string + null */
1080     char                            *String;
1081 
1082 } ACPI_DEVICE_ID;
1083 
1084 typedef struct acpi_device_id_list
1085 {
1086     UINT32                          Count;              /* Number of IDs in Ids array */
1087     UINT32                          ListSize;           /* Size of list, including ID strings */
1088     ACPI_DEVICE_ID                  Ids[1];             /* ID array */
1089 
1090 } ACPI_DEVICE_ID_LIST;
1091 
1092 /*
1093  * Structure returned from AcpiGetObjectInfo.
1094  * Optimized for both 32- and 64-bit builds
1095  */
1096 typedef struct acpi_device_info
1097 {
1098     UINT32                          InfoSize;           /* Size of info, including ID strings */
1099     UINT32                          Name;               /* ACPI object Name */
1100     ACPI_OBJECT_TYPE                Type;               /* ACPI object Type */
1101     UINT8                           ParamCount;         /* If a method, required parameter count */
1102     UINT8                           Valid;              /* Indicates which optional fields are valid */
1103     UINT8                           Flags;              /* Miscellaneous info */
1104     UINT8                           HighestDstates[4];  /* _SxD values: 0xFF indicates not valid */
1105     UINT8                           LowestDstates[5];   /* _SxW values: 0xFF indicates not valid */
1106     UINT32                          CurrentStatus;      /* _STA value */
1107     UINT64                          Address;            /* _ADR value */
1108     ACPI_DEVICE_ID                  HardwareId;         /* _HID value */
1109     ACPI_DEVICE_ID                  UniqueId;           /* _UID value */
1110     ACPI_DEVICE_ID_LIST             CompatibleIdList;   /* _CID list <must be last> */

1111 
1112 } ACPI_DEVICE_INFO;
1113 
1114 /* Values for Flags field above (AcpiGetObjectInfo) */
1115 
1116 #define ACPI_PCI_ROOT_BRIDGE            0x01
1117 
1118 /* Flags for Valid field above (AcpiGetObjectInfo) */
1119 
1120 #define ACPI_VALID_STA                  0x01
1121 #define ACPI_VALID_ADR                  0x02
1122 #define ACPI_VALID_HID                  0x04
1123 #define ACPI_VALID_UID                  0x08
1124 #define ACPI_VALID_CID                  0x10
1125 #define ACPI_VALID_SXDS                 0x20
1126 #define ACPI_VALID_SXWS                 0x40

1127 
1128 /* Flags for _STA method */
1129 
1130 #define ACPI_STA_DEVICE_PRESENT         0x01
1131 #define ACPI_STA_DEVICE_ENABLED         0x02
1132 #define ACPI_STA_DEVICE_UI              0x04
1133 #define ACPI_STA_DEVICE_FUNCTIONING     0x08
1134 #define ACPI_STA_DEVICE_OK              0x08 /* Synonym */
1135 #define ACPI_STA_BATTERY_PRESENT        0x10
1136 
1137 
1138 /* Context structs for address space handlers */
1139 
1140 typedef struct acpi_pci_id
1141 {
1142     UINT16                          Segment;
1143     UINT16                          Bus;
1144     UINT16                          Device;
1145     UINT16                          Function;
1146 
1147 } ACPI_PCI_ID;
1148 


1150 {
1151     UINT32                          Length;
1152     ACPI_PHYSICAL_ADDRESS           Address;
1153     ACPI_PHYSICAL_ADDRESS           MappedPhysicalAddress;
1154     UINT8                           *MappedLogicalAddress;
1155     ACPI_SIZE                       MappedLength;
1156 
1157 } ACPI_MEM_SPACE_CONTEXT;
1158 
1159 
1160 /*
1161  * ACPI_MEMORY_LIST is used only if the ACPICA local cache is enabled
1162  */
1163 typedef struct acpi_memory_list
1164 {
1165     char                            *ListName;
1166     void                            *ListHead;
1167     UINT16                          ObjectSize;
1168     UINT16                          MaxDepth;
1169     UINT16                          CurrentDepth;
1170     UINT16                          LinkOffset;
1171 
1172 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
1173 
1174     /* Statistics for debug memory tracking only */
1175 
1176     UINT32                          TotalAllocated;
1177     UINT32                          TotalFreed;
1178     UINT32                          MaxOccupied;
1179     UINT32                          TotalSize;
1180     UINT32                          CurrentTotalSize;
1181     UINT32                          Requests;
1182     UINT32                          Hits;
1183 #endif
1184 
1185 } ACPI_MEMORY_LIST;
1186 
1187 




























1188 #endif /* __ACTYPES_H__ */
   1 /******************************************************************************
   2  *
   3  * Name: actypes.h - Common data types for the entire ACPI subsystem
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2014, 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.


 278  *
 279  ******************************************************************************/
 280 
 281 /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
 282 
 283 #ifndef ACPI_UINTPTR_T
 284 #define ACPI_UINTPTR_T                  void *
 285 #endif
 286 
 287 /*
 288  * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because
 289  * some compilers can catch printf format string problems
 290  */
 291 #ifndef ACPI_PRINTF_LIKE
 292 #define ACPI_PRINTF_LIKE(c)
 293 #endif
 294 
 295 /*
 296  * Some compilers complain about unused variables. Sometimes we don't want to
 297  * use all the variables (for example, _AcpiModuleName). This allows us
 298  * to tell the compiler in a per-variable manner that a variable
 299  * is unused
 300  */
 301 #ifndef ACPI_UNUSED_VAR
 302 #define ACPI_UNUSED_VAR
 303 #endif
 304 
 305 /*
 306  * All ACPICA external functions that are available to the rest of the kernel
 307  * are tagged with thes macros which can be defined as appropriate for the host.
 308  *
 309  * Notes:
 310  * ACPI_EXPORT_SYMBOL_INIT is used for initialization and termination
 311  * interfaces that may need special processing.
 312  * ACPI_EXPORT_SYMBOL is used for all other public external functions.
 313  */
 314 #ifndef ACPI_EXPORT_SYMBOL_INIT
 315 #define ACPI_EXPORT_SYMBOL_INIT(Symbol)
 316 #endif
 317 
 318 #ifndef ACPI_EXPORT_SYMBOL
 319 #define ACPI_EXPORT_SYMBOL(Symbol)
 320 #endif
 321 
 322 /*
 323  * Compiler/Clibrary-dependent debug initialization. Used for ACPICA
 324  * utilities only.
 325  */
 326 #ifndef ACPI_DEBUG_INITIALIZE
 327 #define ACPI_DEBUG_INITIALIZE()
 328 #endif
 329 
 330 
 331 /*******************************************************************************
 332  *
 333  * Configuration
 334  *
 335  ******************************************************************************/
 336 
 337 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
 338 /*
 339  * Memory allocation tracking (used by AcpiExec to detect memory leaks)
 340  */
 341 #define ACPI_MEM_PARAMETERS             _COMPONENT, _AcpiModuleName, __LINE__
 342 #define ACPI_ALLOCATE(a)                AcpiUtAllocateAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS)
 343 #define ACPI_ALLOCATE_ZEROED(a)         AcpiUtAllocateZeroedAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS)
 344 #define ACPI_FREE(a)                    AcpiUtFreeAndTrack (a, ACPI_MEM_PARAMETERS)
 345 #define ACPI_MEM_TRACKING(a)            a
 346 
 347 #else
 348 /*
 349  * Normal memory allocation directly via the OS services layer
 350  */
 351 #define ACPI_ALLOCATE(a)                AcpiOsAllocate ((ACPI_SIZE) (a))
 352 #define ACPI_ALLOCATE_ZEROED(a)         AcpiOsAllocateZeroed ((ACPI_SIZE) (a))
 353 #define ACPI_FREE(a)                    AcpiOsFree (a)
 354 #define ACPI_MEM_TRACKING(a)
 355 
 356 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
 357 
 358 
 359 /******************************************************************************
 360  *
 361  * ACPI Specification constants (Do not change unless the specification changes)
 362  *
 363  *****************************************************************************/
 364 
 365 /* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */
 366 
 367 #define ACPI_MAX_GPE_BLOCKS             2
 368 
 369 /* Default ACPI register widths */
 370 
 371 #define ACPI_GPE_REGISTER_WIDTH         8
 372 #define ACPI_PM1_REGISTER_WIDTH         16
 373 #define ACPI_PM2_REGISTER_WIDTH         8
 374 #define ACPI_PM_TIMER_WIDTH             32
 375 #define ACPI_RESET_REGISTER_WIDTH       8
 376 
 377 /* Names within the namespace are 4 bytes long */
 378 
 379 #define ACPI_NAME_SIZE                  4
 380 #define ACPI_PATH_SEGMENT_LENGTH        5           /* 4 chars for name + 1 char for separator */
 381 #define ACPI_PATH_SEPARATOR             '.'
 382 
 383 /* Sizes for ACPI table headers */
 384 
 385 #define ACPI_OEM_ID_SIZE                6
 386 #define ACPI_OEM_TABLE_ID_SIZE          8
 387 
 388 /* ACPI/PNP hardware IDs */
 389 
 390 #define PCI_ROOT_HID_STRING             "PNP0A03"
 391 #define PCI_EXPRESS_ROOT_HID_STRING     "PNP0A08"
 392 
 393 /* PM Timer ticks per second (HZ) */
 394 
 395 #define ACPI_PM_TIMER_FREQUENCY         3579545
 396 
 397 
 398 /*******************************************************************************
 399  *
 400  * Independent types
 401  *
 402  ******************************************************************************/
 403 
 404 /* Logical defines and NULL */
 405 
 406 #ifdef FALSE
 407 #undef FALSE
 408 #endif
 409 #define FALSE                           (1 == 0)
 410 
 411 #ifdef TRUE
 412 #undef TRUE
 413 #endif
 414 #define TRUE                            (1 == 1)
 415 
 416 #ifndef NULL
 417 #define NULL                            (void *) 0
 418 #endif
 419 
 420 
 421 /*
 422  * Miscellaneous types
 423  */
 424 typedef UINT32                          ACPI_STATUS;    /* All ACPI Exceptions */
 425 typedef UINT32                          ACPI_NAME;      /* 4-byte ACPI name */
 426 typedef char *                          ACPI_STRING;    /* Null terminated ASCII string */
 427 typedef void *                          ACPI_HANDLE;    /* Actually a ptr to a NS Node */
 428 
 429 
 430 /* Time constants for timer calculations */
 431 
 432 #define ACPI_MSEC_PER_SEC               1000L
 433 
 434 #define ACPI_USEC_PER_MSEC              1000L
 435 #define ACPI_USEC_PER_SEC               1000000L
 436 
 437 #define ACPI_100NSEC_PER_USEC           10L
 438 #define ACPI_100NSEC_PER_MSEC           10000L
 439 #define ACPI_100NSEC_PER_SEC            10000000L
 440 
 441 #define ACPI_NSEC_PER_USEC              1000L
 442 #define ACPI_NSEC_PER_MSEC              1000000L
 443 #define ACPI_NSEC_PER_SEC               1000000000L
 444 
 445 
 446 /* Owner IDs are used to track namespace nodes for selective deletion */
 447 
 448 typedef UINT8                           ACPI_OWNER_ID;
 449 #define ACPI_OWNER_ID_MAX               0xFF
 450 
 451 
 452 #define ACPI_INTEGER_BIT_SIZE           64
 453 #define ACPI_MAX_DECIMAL_DIGITS         20  /* 2^64 = 18,446,744,073,709,551,616 */
 454 #define ACPI_MAX64_DECIMAL_DIGITS       20
 455 #define ACPI_MAX32_DECIMAL_DIGITS       10
 456 #define ACPI_MAX16_DECIMAL_DIGITS        5
 457 #define ACPI_MAX8_DECIMAL_DIGITS         3
 458 
 459 /*
 460  * Constants with special meanings
 461  */
 462 #define ACPI_ROOT_OBJECT                ACPI_ADD_PTR (ACPI_HANDLE, NULL, ACPI_MAX_PTR)
 463 #define ACPI_WAIT_FOREVER               0xFFFF  /* UINT16, as per ACPI spec */
 464 #define ACPI_DO_NOT_WAIT                0
 465 


 499 
 500 /* Size calculation */
 501 
 502 #define ACPI_ARRAY_LENGTH(x)            (sizeof(x) / sizeof((x)[0]))
 503 
 504 /* Pointer manipulation */
 505 
 506 #define ACPI_CAST_PTR(t, p)             ((t *) (ACPI_UINTPTR_T) (p))
 507 #define ACPI_CAST_INDIRECT_PTR(t, p)    ((t **) (ACPI_UINTPTR_T) (p))
 508 #define ACPI_ADD_PTR(t, a, b)           ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b)))
 509 #define ACPI_PTR_DIFF(a, b)             (ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b)))
 510 
 511 /* Pointer/Integer type conversions */
 512 
 513 #define ACPI_TO_POINTER(i)              ACPI_ADD_PTR (void, (void *) NULL,(ACPI_SIZE) i)
 514 #define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p, (void *) NULL)
 515 #define ACPI_OFFSET(d, f)               (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL)
 516 #define ACPI_PHYSADDR_TO_PTR(i)         ACPI_TO_POINTER(i)
 517 #define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
 518 
 519 /* Optimizations for 4-character (32-bit) ACPI_NAME manipulation */
 520 
 521 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
 522 #define ACPI_COMPARE_NAME(a,b)          (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b)))
 523 #define ACPI_MOVE_NAME(dest,src)        (*ACPI_CAST_PTR (UINT32, (dest)) = *ACPI_CAST_PTR (UINT32, (src)))
 524 #else
 525 #define ACPI_COMPARE_NAME(a,b)          (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
 526 #define ACPI_MOVE_NAME(dest,src)        (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
 527 #endif
 528 
 529 /* Support for the special RSDP signature (8 characters) */
 530 
 531 #define ACPI_VALIDATE_RSDP_SIG(a)       (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
 532 #define ACPI_MAKE_RSDP_SIG(dest)        (ACPI_MEMCPY (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
 533 
 534 
 535 /*******************************************************************************
 536  *
 537  * Miscellaneous constants
 538  *
 539  ******************************************************************************/
 540 
 541 /*
 542  * Initialization sequence
 543  */
 544 #define ACPI_FULL_INITIALIZATION        0x00
 545 #define ACPI_NO_ADDRESS_SPACE_INIT      0x01
 546 #define ACPI_NO_HARDWARE_INIT           0x02
 547 #define ACPI_NO_EVENT_INIT              0x04
 548 #define ACPI_NO_HANDLER_INIT            0x08
 549 #define ACPI_NO_ACPI_ENABLE             0x10
 550 #define ACPI_NO_DEVICE_INIT             0x20
 551 #define ACPI_NO_OBJECT_INIT             0x40
 552 
 553 /*
 554  * Initialization state


 588  * Sleep type invalid value
 589  */
 590 #define ACPI_SLEEP_TYPE_MAX             0x7
 591 #define ACPI_SLEEP_TYPE_INVALID         0xFF
 592 
 593 /*
 594  * Standard notify values
 595  */
 596 #define ACPI_NOTIFY_BUS_CHECK           (UINT8) 0x00
 597 #define ACPI_NOTIFY_DEVICE_CHECK        (UINT8) 0x01
 598 #define ACPI_NOTIFY_DEVICE_WAKE         (UINT8) 0x02
 599 #define ACPI_NOTIFY_EJECT_REQUEST       (UINT8) 0x03
 600 #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT  (UINT8) 0x04
 601 #define ACPI_NOTIFY_FREQUENCY_MISMATCH  (UINT8) 0x05
 602 #define ACPI_NOTIFY_BUS_MODE_MISMATCH   (UINT8) 0x06
 603 #define ACPI_NOTIFY_POWER_FAULT         (UINT8) 0x07
 604 #define ACPI_NOTIFY_CAPABILITIES_CHECK  (UINT8) 0x08
 605 #define ACPI_NOTIFY_DEVICE_PLD_CHECK    (UINT8) 0x09
 606 #define ACPI_NOTIFY_RESERVED            (UINT8) 0x0A
 607 #define ACPI_NOTIFY_LOCALITY_UPDATE     (UINT8) 0x0B
 608 #define ACPI_NOTIFY_SHUTDOWN_REQUEST    (UINT8) 0x0C
 609 
 610 #define ACPI_NOTIFY_MAX                 0x0C
 611 
 612 /*
 613  * Types associated with ACPI names and objects. The first group of
 614  * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
 615  * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore,
 616  * only add to the first group if the spec changes.
 617  *
 618  * NOTE: Types must be kept in sync with the global AcpiNsProperties
 619  * and AcpiNsTypeNames arrays.
 620  */
 621 typedef UINT32                          ACPI_OBJECT_TYPE;
 622 
 623 #define ACPI_TYPE_ANY                   0x00
 624 #define ACPI_TYPE_INTEGER               0x01  /* Byte/Word/Dword/Zero/One/Ones */
 625 #define ACPI_TYPE_STRING                0x02
 626 #define ACPI_TYPE_BUFFER                0x03
 627 #define ACPI_TYPE_PACKAGE               0x04  /* ByteConst, multiple DataTerm/Constant/SuperName */
 628 #define ACPI_TYPE_FIELD_UNIT            0x05
 629 #define ACPI_TYPE_DEVICE                0x06  /* Name, multiple Node */
 630 #define ACPI_TYPE_EVENT                 0x07


 646  * If new predefined ACPI_TYPEs are added (via the ACPI specification), these
 647  * internal types must move upwards. (There is code that depends on these
 648  * values being contiguous with the external types above.)
 649  */
 650 #define ACPI_TYPE_LOCAL_REGION_FIELD    0x11
 651 #define ACPI_TYPE_LOCAL_BANK_FIELD      0x12
 652 #define ACPI_TYPE_LOCAL_INDEX_FIELD     0x13
 653 #define ACPI_TYPE_LOCAL_REFERENCE       0x14  /* Arg#, Local#, Name, Debug, RefOf, Index */
 654 #define ACPI_TYPE_LOCAL_ALIAS           0x15
 655 #define ACPI_TYPE_LOCAL_METHOD_ALIAS    0x16
 656 #define ACPI_TYPE_LOCAL_NOTIFY          0x17
 657 #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18
 658 #define ACPI_TYPE_LOCAL_RESOURCE        0x19
 659 #define ACPI_TYPE_LOCAL_RESOURCE_FIELD  0x1A
 660 #define ACPI_TYPE_LOCAL_SCOPE           0x1B  /* 1 Name, multiple ObjectList Nodes */
 661 
 662 #define ACPI_TYPE_NS_NODE_MAX           0x1B  /* Last typecode used within a NS Node */
 663 
 664 /*
 665  * These are special object types that never appear in
 666  * a Namespace node, only in an object of ACPI_OPERAND_OBJECT
 667  */
 668 #define ACPI_TYPE_LOCAL_EXTRA           0x1C
 669 #define ACPI_TYPE_LOCAL_DATA            0x1D
 670 
 671 #define ACPI_TYPE_LOCAL_MAX             0x1D
 672 
 673 /* All types above here are invalid */
 674 
 675 #define ACPI_TYPE_INVALID               0x1E
 676 #define ACPI_TYPE_NOT_FOUND             0xFF
 677 
 678 #define ACPI_NUM_NS_TYPES               (ACPI_TYPE_INVALID + 1)
 679 
 680 
 681 /*
 682  * All I/O
 683  */
 684 #define ACPI_READ                       0
 685 #define ACPI_WRITE                      1
 686 #define ACPI_IO_MASK                    1


 706  * -------------
 707  * The encoding of ACPI_EVENT_STATUS is illustrated below.
 708  * Note that a set bit (1) indicates the property is TRUE
 709  * (e.g. if bit 0 is set then the event is enabled).
 710  * +-------------+-+-+-+
 711  * |   Bits 31:3 |2|1|0|
 712  * +-------------+-+-+-+
 713  *          |     | | |
 714  *          |     | | +- Enabled?
 715  *          |     | +--- Enabled for wake?
 716  *          |     +----- Set?
 717  *          +----------- <Reserved>
 718  */
 719 typedef UINT32                          ACPI_EVENT_STATUS;
 720 
 721 #define ACPI_EVENT_FLAG_DISABLED        (ACPI_EVENT_STATUS) 0x00
 722 #define ACPI_EVENT_FLAG_ENABLED         (ACPI_EVENT_STATUS) 0x01
 723 #define ACPI_EVENT_FLAG_WAKE_ENABLED    (ACPI_EVENT_STATUS) 0x02
 724 #define ACPI_EVENT_FLAG_SET             (ACPI_EVENT_STATUS) 0x04
 725 







 726 /* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */
 727 
 728 #define ACPI_GPE_ENABLE                 0
 729 #define ACPI_GPE_DISABLE                1
 730 #define ACPI_GPE_CONDITIONAL_ENABLE     2
 731 
 732 /*
 733  * GPE info flags - Per GPE
 734  * +-------+-+-+---+
 735  * |  7:4  |3|2|1:0|
 736  * +-------+-+-+---+
 737  *     |    | |  |
 738  *     |    | |  +-- Type of dispatch:to method, handler, notify, or none
 739  *     |    | +----- Interrupt type: edge or level triggered
 740  *     |    +------- Is a Wake GPE
 741  *     +------------ <Reserved>
 742  */
 743 #define ACPI_GPE_DISPATCH_NONE          (UINT8) 0x00
 744 #define ACPI_GPE_DISPATCH_METHOD        (UINT8) 0x01
 745 #define ACPI_GPE_DISPATCH_HANDLER       (UINT8) 0x02


 748 
 749 #define ACPI_GPE_LEVEL_TRIGGERED        (UINT8) 0x04
 750 #define ACPI_GPE_EDGE_TRIGGERED         (UINT8) 0x00
 751 #define ACPI_GPE_XRUPT_TYPE_MASK        (UINT8) 0x04
 752 
 753 #define ACPI_GPE_CAN_WAKE               (UINT8) 0x08
 754 
 755 /*
 756  * Flags for GPE and Lock interfaces
 757  */
 758 #define ACPI_NOT_ISR                    0x1
 759 #define ACPI_ISR                        0x0
 760 
 761 
 762 /* Notify types */
 763 
 764 #define ACPI_SYSTEM_NOTIFY              0x1
 765 #define ACPI_DEVICE_NOTIFY              0x2
 766 #define ACPI_ALL_NOTIFY                 (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY)
 767 #define ACPI_MAX_NOTIFY_HANDLER_TYPE    0x3
 768 #define ACPI_NUM_NOTIFY_TYPES           2
 769 
 770 #define ACPI_MAX_SYS_NOTIFY             0x7F
 771 #define ACPI_MAX_DEVICE_SPECIFIC_NOTIFY 0xBF
 772 
 773 #define ACPI_SYSTEM_HANDLER_LIST        0 /* Used as index, must be SYSTEM_NOTIFY -1 */
 774 #define ACPI_DEVICE_HANDLER_LIST        1 /* Used as index, must be DEVICE_NOTIFY -1 */
 775 
 776 
 777 /* Address Space (Operation Region) Types */
 778 
 779 typedef UINT8                           ACPI_ADR_SPACE_TYPE;
 780 
 781 #define ACPI_ADR_SPACE_SYSTEM_MEMORY    (ACPI_ADR_SPACE_TYPE) 0
 782 #define ACPI_ADR_SPACE_SYSTEM_IO        (ACPI_ADR_SPACE_TYPE) 1
 783 #define ACPI_ADR_SPACE_PCI_CONFIG       (ACPI_ADR_SPACE_TYPE) 2
 784 #define ACPI_ADR_SPACE_EC               (ACPI_ADR_SPACE_TYPE) 3
 785 #define ACPI_ADR_SPACE_SMBUS            (ACPI_ADR_SPACE_TYPE) 4
 786 #define ACPI_ADR_SPACE_CMOS             (ACPI_ADR_SPACE_TYPE) 5
 787 #define ACPI_ADR_SPACE_PCI_BAR_TARGET   (ACPI_ADR_SPACE_TYPE) 6
 788 #define ACPI_ADR_SPACE_IPMI             (ACPI_ADR_SPACE_TYPE) 7
 789 #define ACPI_ADR_SPACE_GPIO             (ACPI_ADR_SPACE_TYPE) 8
 790 #define ACPI_ADR_SPACE_GSBUS            (ACPI_ADR_SPACE_TYPE) 9
 791 #define ACPI_ADR_SPACE_PLATFORM_COMM    (ACPI_ADR_SPACE_TYPE) 10
 792 
 793 #define ACPI_NUM_PREDEFINED_REGIONS     11
 794 
 795 /*
 796  * Special Address Spaces
 797  *
 798  * Note: A Data Table region is a special type of operation region
 799  * that has its own AML opcode. However, internally, the AML
 800  * interpreter simply creates an operation region with an an address
 801  * space type of ACPI_ADR_SPACE_DATA_TABLE.
 802  */
 803 #define ACPI_ADR_SPACE_DATA_TABLE       (ACPI_ADR_SPACE_TYPE) 0x7E /* Internal to ACPICA only */
 804 #define ACPI_ADR_SPACE_FIXED_HARDWARE   (ACPI_ADR_SPACE_TYPE) 0x7F
 805 
 806 /* Values for _REG connection code */
 807 
 808 #define ACPI_REG_DISCONNECT             0
 809 #define ACPI_REG_CONNECT                1
 810 
 811 /*
 812  * BitRegister IDs
 813  *


 846 #define ACPI_BITREG_SLEEP_ENABLE                0x12
 847 
 848 /* PM2 Control register */
 849 
 850 #define ACPI_BITREG_ARB_DISABLE                 0x13
 851 
 852 #define ACPI_BITREG_MAX                         0x13
 853 #define ACPI_NUM_BITREG                         ACPI_BITREG_MAX + 1
 854 
 855 
 856 /* Status register values. A 1 clears a status bit. 0 = no effect */
 857 
 858 #define ACPI_CLEAR_STATUS                       1
 859 
 860 /* Enable and Control register values */
 861 
 862 #define ACPI_ENABLE_EVENT                       1
 863 #define ACPI_DISABLE_EVENT                      0
 864 
 865 
 866 /* Sleep function dispatch */
 867 
 868 typedef ACPI_STATUS (*ACPI_SLEEP_FUNCTION) (
 869     UINT8                   SleepState);
 870 
 871 typedef struct acpi_sleep_functions
 872 {
 873     ACPI_SLEEP_FUNCTION     LegacyFunction;
 874     ACPI_SLEEP_FUNCTION     ExtendedFunction;
 875 
 876 } ACPI_SLEEP_FUNCTIONS;
 877 
 878 
 879 /*
 880  * External ACPI object definition
 881  */
 882 
 883 /*
 884  * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package element
 885  * or an unresolved named reference.
 886  */
 887 typedef union acpi_object
 888 {
 889     ACPI_OBJECT_TYPE                Type;   /* See definition of AcpiNsType for values */
 890     struct
 891     {
 892         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_INTEGER */
 893         UINT64                          Value;      /* The actual number */
 894     } Integer;
 895 
 896     struct
 897     {
 898         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_STRING */


 937     } PowerResource;
 938 
 939 } ACPI_OBJECT;
 940 
 941 
 942 /*
 943  * List of objects, used as a parameter list for control method evaluation
 944  */
 945 typedef struct acpi_object_list
 946 {
 947     UINT32                          Count;
 948     ACPI_OBJECT                     *Pointer;
 949 
 950 } ACPI_OBJECT_LIST;
 951 
 952 
 953 /*
 954  * Miscellaneous common Data Structures used by the interfaces
 955  */
 956 #define ACPI_NO_BUFFER              0
 957 #define ACPI_ALLOCATE_BUFFER        (ACPI_SIZE) (-1)    /* Let ACPICA allocate buffer */
 958 #define ACPI_ALLOCATE_LOCAL_BUFFER  (ACPI_SIZE) (-2)    /* For internal use only (enables tracking) */
 959 
 960 typedef struct acpi_buffer
 961 {
 962     ACPI_SIZE                       Length;         /* Length in bytes of the buffer */
 963     void                            *Pointer;       /* pointer to buffer */
 964 
 965 } ACPI_BUFFER;
 966 
 967 
 968 /*
 969  * NameType for AcpiGetName
 970  */
 971 #define ACPI_FULL_PATHNAME              0
 972 #define ACPI_SINGLE_NAME                1
 973 #define ACPI_NAME_TYPE_MAX              1
 974 
 975 
 976 /*
 977  * Predefined Namespace items
 978  */


1028 #define ACPI_TABLE_EVENT_LOAD           0x0
1029 #define ACPI_TABLE_EVENT_UNLOAD         0x1
1030 #define ACPI_NUM_TABLE_EVENTS           2
1031 
1032 
1033 /*
1034  * Types specific to the OS service interfaces
1035  */
1036 typedef UINT32
1037 (ACPI_SYSTEM_XFACE *ACPI_OSD_HANDLER) (
1038     void                            *Context);
1039 
1040 typedef void
1041 (ACPI_SYSTEM_XFACE *ACPI_OSD_EXEC_CALLBACK) (
1042     void                            *Context);
1043 
1044 /*
1045  * Various handlers and callback procedures
1046  */
1047 typedef
1048 UINT32 (*ACPI_SCI_HANDLER) (
1049     void                            *Context);
1050 
1051 typedef
1052 void (*ACPI_GBL_EVENT_HANDLER) (
1053     UINT32                          EventType,
1054     ACPI_HANDLE                     Device,
1055     UINT32                          EventNumber,
1056     void                            *Context);
1057 
1058 #define ACPI_EVENT_TYPE_GPE         0
1059 #define ACPI_EVENT_TYPE_FIXED       1
1060 
1061 typedef
1062 UINT32 (*ACPI_EVENT_HANDLER) (
1063     void                            *Context);
1064 
1065 typedef
1066 UINT32 (*ACPI_GPE_HANDLER) (
1067     ACPI_HANDLE                     GpeDevice,
1068     UINT32                          GpeNumber,
1069     void                            *Context);
1070 
1071 typedef


1103     void                            *Context);
1104 
1105 #define ACPI_TABLE_LOAD             0x0
1106 #define ACPI_TABLE_UNLOAD           0x1
1107 #define ACPI_NUM_TABLE_EVENTS       2
1108 
1109 
1110 /* Address Spaces (For Operation Regions) */
1111 
1112 typedef
1113 ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
1114     UINT32                          Function,
1115     ACPI_PHYSICAL_ADDRESS           Address,
1116     UINT32                          BitWidth,
1117     UINT64                          *Value,
1118     void                            *HandlerContext,
1119     void                            *RegionContext);
1120 
1121 #define ACPI_DEFAULT_HANDLER            NULL
1122 
1123 /* Special Context data for GenericSerialBus/GeneralPurposeIo (ACPI 5.0) */
1124 
1125 typedef struct acpi_connection_info
1126 {
1127     UINT8                           *Connection;
1128     UINT16                          Length;
1129     UINT8                           AccessLength;
1130 
1131 } ACPI_CONNECTION_INFO;
1132 
1133 
1134 typedef
1135 ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
1136     ACPI_HANDLE                     RegionHandle,
1137     UINT32                          Function,
1138     void                            *HandlerContext,
1139     void                            **RegionContext);
1140 
1141 #define ACPI_REGION_ACTIVATE    0
1142 #define ACPI_REGION_DEACTIVATE  1
1143 
1144 typedef
1145 ACPI_STATUS (*ACPI_WALK_CALLBACK) (
1146     ACPI_HANDLE                     Object,
1147     UINT32                          NestingLevel,
1148     void                            *Context,
1149     void                            **ReturnValue);
1150 
1151 typedef
1152 UINT32 (*ACPI_INTERFACE_HANDLER) (
1153     ACPI_STRING                     InterfaceName,


1156 
1157 /* Interrupt handler return values */
1158 
1159 #define ACPI_INTERRUPT_NOT_HANDLED      0x00
1160 #define ACPI_INTERRUPT_HANDLED          0x01
1161 
1162 /* GPE handler return values */
1163 
1164 #define ACPI_REENABLE_GPE               0x80
1165 
1166 
1167 /* Length of 32-bit EISAID values when converted back to a string */
1168 
1169 #define ACPI_EISAID_STRING_SIZE         8   /* Includes null terminator */
1170 
1171 /* Length of UUID (string) values */
1172 
1173 #define ACPI_UUID_LENGTH                16
1174 
1175 
1176 /* Structures used for device/processor HID, UID, CID, and SUB */
1177 
1178 typedef struct acpi_pnp_device_id
1179 {
1180     UINT32                          Length;             /* Length of string + null */
1181     char                            *String;
1182 
1183 } ACPI_PNP_DEVICE_ID;
1184 
1185 typedef struct acpi_pnp_device_id_list
1186 {
1187     UINT32                          Count;              /* Number of IDs in Ids array */
1188     UINT32                          ListSize;           /* Size of list, including ID strings */
1189     ACPI_PNP_DEVICE_ID              Ids[1];             /* ID array */
1190 
1191 } ACPI_PNP_DEVICE_ID_LIST;
1192 
1193 /*
1194  * Structure returned from AcpiGetObjectInfo.
1195  * Optimized for both 32- and 64-bit builds
1196  */
1197 typedef struct acpi_device_info
1198 {
1199     UINT32                          InfoSize;           /* Size of info, including ID strings */
1200     UINT32                          Name;               /* ACPI object Name */
1201     ACPI_OBJECT_TYPE                Type;               /* ACPI object Type */
1202     UINT8                           ParamCount;         /* If a method, required parameter count */
1203     UINT8                           Valid;              /* Indicates which optional fields are valid */
1204     UINT8                           Flags;              /* Miscellaneous info */
1205     UINT8                           HighestDstates[4];  /* _SxD values: 0xFF indicates not valid */
1206     UINT8                           LowestDstates[5];   /* _SxW values: 0xFF indicates not valid */
1207     UINT32                          CurrentStatus;      /* _STA value */
1208     UINT64                          Address;            /* _ADR value */
1209     ACPI_PNP_DEVICE_ID              HardwareId;         /* _HID value */
1210     ACPI_PNP_DEVICE_ID              UniqueId;           /* _UID value */
1211     ACPI_PNP_DEVICE_ID              SubsystemId;        /* _SUB value */
1212     ACPI_PNP_DEVICE_ID_LIST         CompatibleIdList;   /* _CID list <must be last> */
1213 
1214 } ACPI_DEVICE_INFO;
1215 
1216 /* Values for Flags field above (AcpiGetObjectInfo) */
1217 
1218 #define ACPI_PCI_ROOT_BRIDGE            0x01
1219 
1220 /* Flags for Valid field above (AcpiGetObjectInfo) */
1221 
1222 #define ACPI_VALID_STA                  0x01
1223 #define ACPI_VALID_ADR                  0x02
1224 #define ACPI_VALID_HID                  0x04
1225 #define ACPI_VALID_UID                  0x08
1226 #define ACPI_VALID_SUB                  0x10
1227 #define ACPI_VALID_CID                  0x20
1228 #define ACPI_VALID_SXDS                 0x40
1229 #define ACPI_VALID_SXWS                 0x80
1230 
1231 /* Flags for _STA return value (CurrentStatus above) */
1232 
1233 #define ACPI_STA_DEVICE_PRESENT         0x01
1234 #define ACPI_STA_DEVICE_ENABLED         0x02
1235 #define ACPI_STA_DEVICE_UI              0x04
1236 #define ACPI_STA_DEVICE_FUNCTIONING     0x08
1237 #define ACPI_STA_DEVICE_OK              0x08 /* Synonym */
1238 #define ACPI_STA_BATTERY_PRESENT        0x10
1239 
1240 
1241 /* Context structs for address space handlers */
1242 
1243 typedef struct acpi_pci_id
1244 {
1245     UINT16                          Segment;
1246     UINT16                          Bus;
1247     UINT16                          Device;
1248     UINT16                          Function;
1249 
1250 } ACPI_PCI_ID;
1251 


1253 {
1254     UINT32                          Length;
1255     ACPI_PHYSICAL_ADDRESS           Address;
1256     ACPI_PHYSICAL_ADDRESS           MappedPhysicalAddress;
1257     UINT8                           *MappedLogicalAddress;
1258     ACPI_SIZE                       MappedLength;
1259 
1260 } ACPI_MEM_SPACE_CONTEXT;
1261 
1262 
1263 /*
1264  * ACPI_MEMORY_LIST is used only if the ACPICA local cache is enabled
1265  */
1266 typedef struct acpi_memory_list
1267 {
1268     char                            *ListName;
1269     void                            *ListHead;
1270     UINT16                          ObjectSize;
1271     UINT16                          MaxDepth;
1272     UINT16                          CurrentDepth;

1273 
1274 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
1275 
1276     /* Statistics for debug memory tracking only */
1277 
1278     UINT32                          TotalAllocated;
1279     UINT32                          TotalFreed;
1280     UINT32                          MaxOccupied;
1281     UINT32                          TotalSize;
1282     UINT32                          CurrentTotalSize;
1283     UINT32                          Requests;
1284     UINT32                          Hits;
1285 #endif
1286 
1287 } ACPI_MEMORY_LIST;
1288 
1289 
1290 /* Definitions of _OSI support */
1291 
1292 #define ACPI_VENDOR_STRINGS                 0x01
1293 #define ACPI_FEATURE_STRINGS                0x02
1294 #define ACPI_ENABLE_INTERFACES              0x00
1295 #define ACPI_DISABLE_INTERFACES             0x04
1296 
1297 #define ACPI_DISABLE_ALL_VENDOR_STRINGS     (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS)
1298 #define ACPI_DISABLE_ALL_FEATURE_STRINGS    (ACPI_DISABLE_INTERFACES | ACPI_FEATURE_STRINGS)
1299 #define ACPI_DISABLE_ALL_STRINGS            (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS)
1300 #define ACPI_ENABLE_ALL_VENDOR_STRINGS      (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS)
1301 #define ACPI_ENABLE_ALL_FEATURE_STRINGS     (ACPI_ENABLE_INTERFACES | ACPI_FEATURE_STRINGS)
1302 #define ACPI_ENABLE_ALL_STRINGS             (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS)
1303 
1304 #define ACPI_OSI_WIN_2000               0x01
1305 #define ACPI_OSI_WIN_XP                 0x02
1306 #define ACPI_OSI_WIN_XP_SP1             0x03
1307 #define ACPI_OSI_WINSRV_2003            0x04
1308 #define ACPI_OSI_WIN_XP_SP2             0x05
1309 #define ACPI_OSI_WINSRV_2003_SP1        0x06
1310 #define ACPI_OSI_WIN_VISTA              0x07
1311 #define ACPI_OSI_WINSRV_2008            0x08
1312 #define ACPI_OSI_WIN_VISTA_SP1          0x09
1313 #define ACPI_OSI_WIN_VISTA_SP2          0x0A
1314 #define ACPI_OSI_WIN_7                  0x0B
1315 #define ACPI_OSI_WIN_8                  0x0C
1316 
1317 
1318 #endif /* __ACTYPES_H__ */