Home | History | Annotate | Download | only in ddk
      1 #pragma once
      2 
      3 #ifdef __cplusplus
      4 extern "C" {
      5 #endif
      6 
      7 #define ACPI_EVAL_INPUT_BUFFER_SIGNATURE                    'BieA'
      8 #define ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE     'IieA'
      9 #define ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE      'SieA'
     10 #define ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE            'CieA'
     11 #define ACPI_EVAL_OUTPUT_BUFFER_SIGNATURE                   'BoeA'
     12 #if (NTDDI_VERSION >= NTDDI_VISTA)
     13 #define ACPI_EVAL_INPUT_BUFFER_SIGNATURE_EX                 'AieA'
     14 #define ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE_EX  'DieA'
     15 #define ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE_EX   'EieA'
     16 #define ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE_EX         'FieA'
     17 #define ACPI_ENUM_CHILDREN_OUTPUT_BUFFER_SIGNATURE          'GieA'
     18 #define ACPI_ENUM_CHILDREN_INPUT_BUFFER_SIGNATURE           'HieA'
     19 #endif
     20 
     21 #define ACPI_METHOD_ARGUMENT_INTEGER                      0x0
     22 #define ACPI_METHOD_ARGUMENT_STRING                       0x1
     23 #define ACPI_METHOD_ARGUMENT_BUFFER                       0x2
     24 #define ACPI_METHOD_ARGUMENT_PACKAGE                      0x3
     25 #define ACPI_METHOD_ARGUMENT_PACKAGE_EX                   0x4
     26 
     27 #define ACPI_ACQUIRE_GLOBAL_LOCK_SIGNATURE              'LgaA'
     28 #define ACPI_RELEASE_GLOBAL_LOCK_SIGNATURE              'LgrA'
     29 
     30 #define ACPI_OBJECT_HAS_CHILDREN            0x1
     31 
     32 #define ENUM_CHILDREN_IMMEDIATE_ONLY        0x1
     33 #define ENUM_CHILDREN_MULTILEVEL            0x2
     34 #define ENUM_CHILDREN_NAME_IS_FILTER        0x4
     35 
     36 typedef struct _ACPI_EVAL_INPUT_BUFFER {
     37   ULONG Signature;
     38   _ANONYMOUS_UNION union {
     39     UCHAR MethodName[4];
     40     ULONG MethodNameAsUlong;
     41   } DUMMYUNIONNAME;
     42 } ACPI_EVAL_INPUT_BUFFER, *PACPI_EVAL_INPUT_BUFFER;
     43 
     44 typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER {
     45   ULONG Signature;
     46   _ANONYMOUS_UNION union {
     47     UCHAR MethodName[4];
     48     ULONG MethodNameAsUlong;
     49   } DUMMYUNIONNAME;
     50   ULONG IntegerArgument;
     51 } ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER;
     52 
     53 typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING {
     54   ULONG Signature;
     55   _ANONYMOUS_UNION union {
     56     UCHAR MethodName[4];
     57     ULONG MethodNameAsUlong;
     58   } DUMMYUNIONNAME;
     59   ULONG StringLength;
     60   UCHAR String[ANYSIZE_ARRAY];
     61 } ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING;
     62 
     63 typedef struct _ACPI_METHOD_ARGUMENT {
     64   USHORT Type;
     65   USHORT DataLength;
     66   _ANONYMOUS_UNION union {
     67     ULONG Argument;
     68     UCHAR Data[ANYSIZE_ARRAY];
     69   } DUMMYUNIONNAME;
     70 } ACPI_METHOD_ARGUMENT;
     71 typedef ACPI_METHOD_ARGUMENT UNALIGNED *PACPI_METHOD_ARGUMENT;
     72 
     73 typedef struct _ACPI_EVAL_INPUT_BUFFER_COMPLEX {
     74   ULONG Signature;
     75   _ANONYMOUS_UNION union {
     76     UCHAR MethodName[4];
     77     ULONG MethodNameAsUlong;
     78   } DUMMYUNIONNAME;
     79   ULONG Size;
     80   ULONG ArgumentCount;
     81   ACPI_METHOD_ARGUMENT Argument[ANYSIZE_ARRAY];
     82 } ACPI_EVAL_INPUT_BUFFER_COMPLEX, *PACPI_EVAL_INPUT_BUFFER_COMPLEX;
     83 
     84 typedef struct _ACPI_EVAL_OUTPUT_BUFFER {
     85   ULONG Signature;
     86   ULONG Length;
     87   ULONG Count;
     88   ACPI_METHOD_ARGUMENT Argument[ANYSIZE_ARRAY];
     89 } ACPI_EVAL_OUTPUT_BUFFER;
     90 typedef ACPI_EVAL_OUTPUT_BUFFER UNALIGNED *PACPI_EVAL_OUTPUT_BUFFER;
     91 
     92 typedef struct _ACPI_MANIPULATE_GLOBAL_LOCK_BUFFER {
     93   ULONG Signature;
     94   PVOID LockObject;
     95 } ACPI_MANIPULATE_GLOBAL_LOCK_BUFFER, *PACPI_MANIPULATE_GLOBAL_LOCK_BUFFER;
     96 
     97 typedef struct _ACPI_EVAL_INPUT_BUFFER_EX {
     98   ULONG Signature;
     99   CHAR MethodName[256];
    100 } ACPI_EVAL_INPUT_BUFFER_EX, *PACPI_EVAL_INPUT_BUFFER_EX;
    101 
    102 typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_EX {
    103   ULONG Signature;
    104   CHAR MethodName[256];
    105   ULONG64 IntegerArgument;
    106 } ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_EX, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_EX;
    107 
    108 typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_EX {
    109   ULONG Signature;
    110   CHAR MethodName[256];
    111   ULONG StringLength;
    112   UCHAR String[ANYSIZE_ARRAY];
    113 } ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_EX, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_EX;
    114 
    115 typedef struct _ACPI_EVAL_INPUT_BUFFER_COMPLEX_EX {
    116   ULONG Signature;
    117   CHAR MethodName[256];
    118   ULONG Size;
    119   ULONG ArgumentCount;
    120   ACPI_METHOD_ARGUMENT Argument[ANYSIZE_ARRAY];
    121 } ACPI_EVAL_INPUT_BUFFER_COMPLEX_EX, *PACPI_EVAL_INPUT_BUFFER_COMPLEX_EX;
    122 
    123 typedef struct _ACPI_ENUM_CHILDREN_INPUT_BUFFER {
    124   ULONG Signature;
    125   ULONG Flags;
    126   ULONG NameLength;
    127   CHAR Name[ANYSIZE_ARRAY];
    128 } ACPI_ENUM_CHILDREN_INPUT_BUFFER, *PACPI_ENUM_CHILDREN_INPUT_BUFFER;
    129 
    130 typedef struct _ACPI_ENUM_CHILD {
    131   ULONG Flags;
    132   ULONG NameLength;
    133   CHAR Name[ANYSIZE_ARRAY];
    134 } ACPI_ENUM_CHILD;
    135 typedef ACPI_ENUM_CHILD UNALIGNED *PACPI_ENUM_CHILD;
    136 
    137 typedef struct _ACPI_ENUM_CHILDREN_OUTPUT_BUFFER {
    138   ULONG Signature;
    139   ULONG NumberOfChildren;
    140   ACPI_ENUM_CHILD Children[ANYSIZE_ARRAY];
    141 } ACPI_ENUM_CHILDREN_OUTPUT_BUFFER;
    142 typedef ACPI_ENUM_CHILDREN_OUTPUT_BUFFER UNALIGNED *PACPI_ENUM_CHILDREN_OUTPUT_BUFFER;
    143 
    144 #define ACPI_METHOD_ARGUMENT_LENGTH( DataLength )                           \
    145     (FIELD_OFFSET(ACPI_METHOD_ARGUMENT, Data) + max(sizeof(ULONG), DataLength))
    146 
    147 #define ACPI_METHOD_ARGUMENT_LENGTH_FROM_ARGUMENT( Argument )               \
    148     (ACPI_METHOD_ARGUMENT_LENGTH(((PACPI_METHOD_ARGUMENT)Argument)->DataLength))
    149 
    150 #define ACPI_METHOD_NEXT_ARGUMENT( Argument )                               \
    151     (PACPI_METHOD_ARGUMENT) ( (PUCHAR) Argument +                           \
    152     ACPI_METHOD_ARGUMENT_LENGTH_FROM_ARGUMENT( Argument ) )
    153 
    154 
    155 #define ACPI_METHOD_SET_ARGUMENT_INTEGER( MethodArgument, IntData )         \
    156     { MethodArgument->Type = ACPI_METHOD_ARGUMENT_INTEGER;                  \
    157       MethodArgument->DataLength = sizeof(ULONG);                           \
    158       MethodArgument->Argument = IntData; }
    159 
    160 #define ACPI_METHOD_SET_ARGUMENT_STRING( Argument, StrData )                \
    161     { Argument->Type = ACPI_METHOD_ARGUMENT_STRING;                         \
    162       Argument->DataLength = strlen((PCHAR)StrData) + sizeof(UCHAR);       \
    163       RtlCopyMemory(&Argument->Data[0],(PUCHAR)StrData,Argument->DataLength); }
    164 
    165 #define ACPI_METHOD_SET_ARGUMENT_BUFFER( Argument, BuffData, BuffLength )   \
    166     { Argument->Type = ACPI_METHOD_ARGUMENT_BUFFER;                         \
    167       Argument->DataLength = BuffLength;                                    \
    168       RtlCopyMemory(&Argument->Data[0],(PUCHAR)BuffData,Argument->DataLength); }
    169 
    170 #define ACPI_ENUM_CHILD_LENGTH_FROM_CHILD( Child )              \
    171     ( (2* sizeof (ULONG)) + Child->NameLength )
    172 
    173 #define ACPI_ENUM_CHILD_NEXT( Child )                           \
    174     (PACPI_ENUM_CHILD) ( (PUCHAR) Child +                       \
    175     ACPI_ENUM_CHILD_LENGTH_FROM_CHILD( Child ) )
    176 
    177 #define IOCTL_ACPI_ASYNC_EVAL_METHOD             CTL_CODE(FILE_DEVICE_ACPI, 0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
    178 #define IOCTL_ACPI_EVAL_METHOD                   CTL_CODE(FILE_DEVICE_ACPI, 1, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
    179 #define IOCTL_ACPI_ACQUIRE_GLOBAL_LOCK           CTL_CODE(FILE_DEVICE_ACPI, 4, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
    180 #define IOCTL_ACPI_RELEASE_GLOBAL_LOCK           CTL_CODE(FILE_DEVICE_ACPI, 5, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
    181 
    182 #if (NTDDI_VERSION >= NTDDI_VISTA)
    183 #define IOCTL_ACPI_EVAL_METHOD_EX                CTL_CODE(FILE_DEVICE_ACPI, 6, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
    184 #define IOCTL_ACPI_ASYNC_EVAL_METHOD_EX          CTL_CODE(FILE_DEVICE_ACPI, 7, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
    185 #define IOCTL_ACPI_ENUM_CHILDREN                 CTL_CODE(FILE_DEVICE_ACPI, 8, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
    186 #endif
    187 
    188 #ifdef __cplusplus
    189 }
    190 #endif
    191