diff options
Diffstat (limited to 'include/acpi/acobject.h')
-rw-r--r-- | include/acpi/acobject.h | 188 |
1 files changed, 98 insertions, 90 deletions
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h index d130cfed8d55..1747d94084d8 100644 --- a/include/acpi/acobject.h +++ b/include/acpi/acobject.h | |||
@@ -1,7 +1,7 @@ | |||
1 | 1 | ||
2 | /****************************************************************************** | 2 | /****************************************************************************** |
3 | * | 3 | * |
4 | * Name: acobject.h - Definition of union acpi_operand_object (Internal object only) | 4 | * Name: acobject.h - Definition of union acpi_operand_object (Internal object only) |
5 | * | 5 | * |
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
@@ -45,10 +45,12 @@ | |||
45 | #ifndef _ACOBJECT_H | 45 | #ifndef _ACOBJECT_H |
46 | #define _ACOBJECT_H | 46 | #define _ACOBJECT_H |
47 | 47 | ||
48 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
49 | |||
48 | /* | 50 | /* |
49 | * The union acpi_operand_object is used to pass AML operands from the dispatcher | 51 | * The union acpi_operand_object is used to pass AML operands from the dispatcher |
50 | * to the interpreter, and to keep track of the various handlers such as | 52 | * to the interpreter, and to keep track of the various handlers such as |
51 | * address space handlers and notify handlers. The object is a constant | 53 | * address space handlers and notify handlers. The object is a constant |
52 | * size in order to allow it to be cached and reused. | 54 | * size in order to allow it to be cached and reused. |
53 | */ | 55 | */ |
54 | 56 | ||
@@ -61,17 +63,25 @@ | |||
61 | /* | 63 | /* |
62 | * Common area for all objects. | 64 | * Common area for all objects. |
63 | * | 65 | * |
64 | * data_type is used to differentiate between internal descriptors, and MUST | 66 | * descriptor_type is used to differentiate between internal descriptors, and |
65 | * be the first byte in this structure. | 67 | * must be in the same place across all descriptors |
68 | * | ||
69 | * Note: The descriptor_type and Type fields must appear in the identical | ||
70 | * position in both the struct acpi_namespace_node and union acpi_operand_object | ||
71 | * structures. | ||
66 | */ | 72 | */ |
67 | #define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\ | 73 | #define ACPI_OBJECT_COMMON_HEADER \ |
68 | u8 descriptor; /* To differentiate various internal objs */\ | 74 | union acpi_operand_object *next_object; /* Objects linked to parent NS node */\ |
69 | u8 type; /* acpi_object_type */\ | 75 | u8 descriptor_type; /* To differentiate various internal objs */\ |
70 | u16 reference_count; /* For object deletion management */\ | 76 | u8 type; /* acpi_object_type */\ |
71 | union acpi_operand_object *next_object; /* Objects linked to parent NS node */\ | 77 | u16 reference_count; /* For object deletion management */\ |
72 | u8 flags; | 78 | u8 flags; |
73 | 79 | /* | |
74 | /* Values for flag byte above */ | 80 | * Note: There are 3 bytes available here before the |
81 | * next natural alignment boundary (for both 32/64 cases) | ||
82 | */ | ||
83 | |||
84 | /* Values for Flag byte above */ | ||
75 | 85 | ||
76 | #define AOPOBJ_AML_CONSTANT 0x01 | 86 | #define AOPOBJ_AML_CONSTANT 0x01 |
77 | #define AOPOBJ_STATIC_POINTER 0x02 | 87 | #define AOPOBJ_STATIC_POINTER 0x02 |
@@ -79,36 +89,7 @@ | |||
79 | #define AOPOBJ_OBJECT_INITIALIZED 0x08 | 89 | #define AOPOBJ_OBJECT_INITIALIZED 0x08 |
80 | #define AOPOBJ_SETUP_COMPLETE 0x10 | 90 | #define AOPOBJ_SETUP_COMPLETE 0x10 |
81 | #define AOPOBJ_SINGLE_DATUM 0x20 | 91 | #define AOPOBJ_SINGLE_DATUM 0x20 |
82 | 92 | #define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */ | |
83 | /* | ||
84 | * Common bitfield for the field objects | ||
85 | * "Field Datum" -- a datum from the actual field object | ||
86 | * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field | ||
87 | */ | ||
88 | #define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\ | ||
89 | u8 field_flags; /* Access, update, and lock bits */\ | ||
90 | u8 attribute; /* From access_as keyword */\ | ||
91 | u8 access_byte_width; /* Read/Write size in bytes */\ | ||
92 | u32 bit_length; /* Length of field in bits */\ | ||
93 | u32 base_byte_offset; /* Byte offset within containing object */\ | ||
94 | u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ | ||
95 | u8 access_bit_width; /* Read/Write size in bits (8-64) */\ | ||
96 | u32 value; /* Value to store into the Bank or Index register */\ | ||
97 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
98 | |||
99 | /* | ||
100 | * Fields common to both Strings and Buffers | ||
101 | */ | ||
102 | #define ACPI_COMMON_BUFFER_INFO \ | ||
103 | u32 length; | ||
104 | |||
105 | /* | ||
106 | * Common fields for objects that support ASL notifications | ||
107 | */ | ||
108 | #define ACPI_COMMON_NOTIFY_INFO \ | ||
109 | union acpi_operand_object *system_notify; /* Handler for system notifies */\ | ||
110 | union acpi_operand_object *device_notify; /* Handler for driver notifies */\ | ||
111 | union acpi_operand_object *handler; /* Handler for Address space */ | ||
112 | 93 | ||
113 | /****************************************************************************** | 94 | /****************************************************************************** |
114 | * | 95 | * |
@@ -125,25 +106,31 @@ struct acpi_object_integer { | |||
125 | 106 | ||
126 | /* | 107 | /* |
127 | * Note: The String and Buffer object must be identical through the Pointer | 108 | * Note: The String and Buffer object must be identical through the Pointer |
128 | * element. There is code that depends on this. | 109 | * and length elements. There is code that depends on this. |
110 | * | ||
111 | * Fields common to both Strings and Buffers | ||
129 | */ | 112 | */ |
113 | #define ACPI_COMMON_BUFFER_INFO(_type) \ | ||
114 | _type *pointer; \ | ||
115 | u32 length; | ||
116 | |||
130 | struct acpi_object_string { /* Null terminated, ASCII characters only */ | 117 | struct acpi_object_string { /* Null terminated, ASCII characters only */ |
131 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO char *pointer; /* String in AML stream or allocated string */ | 118 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(char) /* String in AML stream or allocated string */ |
132 | }; | 119 | }; |
133 | 120 | ||
134 | struct acpi_object_buffer { | 121 | struct acpi_object_buffer { |
135 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO u8 * pointer; /* Buffer in AML stream or allocated buffer */ | 122 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(u8) /* Buffer in AML stream or allocated buffer */ |
136 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
137 | u8 *aml_start; | ||
138 | u32 aml_length; | 123 | u32 aml_length; |
124 | u8 *aml_start; | ||
125 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
139 | }; | 126 | }; |
140 | 127 | ||
141 | struct acpi_object_package { | 128 | struct acpi_object_package { |
142 | ACPI_OBJECT_COMMON_HEADER u32 count; /* # of elements in package */ | 129 | ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Link back to parent node */ |
143 | u32 aml_length; | ||
144 | u8 *aml_start; | ||
145 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
146 | union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ | 130 | union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ |
131 | u8 *aml_start; | ||
132 | u32 aml_length; | ||
133 | u32 count; /* # of elements in package */ | ||
147 | }; | 134 | }; |
148 | 135 | ||
149 | /****************************************************************************** | 136 | /****************************************************************************** |
@@ -156,23 +143,6 @@ struct acpi_object_event { | |||
156 | ACPI_OBJECT_COMMON_HEADER void *semaphore; | 143 | ACPI_OBJECT_COMMON_HEADER void *semaphore; |
157 | }; | 144 | }; |
158 | 145 | ||
159 | #define ACPI_INFINITE_CONCURRENCY 0xFF | ||
160 | |||
161 | typedef | ||
162 | acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state); | ||
163 | |||
164 | struct acpi_object_method { | ||
165 | ACPI_OBJECT_COMMON_HEADER u8 method_flags; | ||
166 | u8 param_count; | ||
167 | u32 aml_length; | ||
168 | void *semaphore; | ||
169 | u8 *aml_start; | ||
170 | ACPI_INTERNAL_METHOD implementation; | ||
171 | u8 concurrency; | ||
172 | u8 thread_count; | ||
173 | acpi_owner_id owner_id; | ||
174 | }; | ||
175 | |||
176 | struct acpi_object_mutex { | 146 | struct acpi_object_mutex { |
177 | ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ | 147 | ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ |
178 | u16 acquisition_depth; /* Allow multiple Acquires, same thread */ | 148 | u16 acquisition_depth; /* Allow multiple Acquires, same thread */ |
@@ -186,11 +156,23 @@ struct acpi_object_mutex { | |||
186 | 156 | ||
187 | struct acpi_object_region { | 157 | struct acpi_object_region { |
188 | ACPI_OBJECT_COMMON_HEADER u8 space_id; | 158 | ACPI_OBJECT_COMMON_HEADER u8 space_id; |
189 | union acpi_operand_object *handler; /* Handler for region access */ | ||
190 | struct acpi_namespace_node *node; /* Containing namespace node */ | 159 | struct acpi_namespace_node *node; /* Containing namespace node */ |
160 | union acpi_operand_object *handler; /* Handler for region access */ | ||
191 | union acpi_operand_object *next; | 161 | union acpi_operand_object *next; |
192 | u32 length; | ||
193 | acpi_physical_address address; | 162 | acpi_physical_address address; |
163 | u32 length; | ||
164 | }; | ||
165 | |||
166 | struct acpi_object_method { | ||
167 | ACPI_OBJECT_COMMON_HEADER u8 method_flags; | ||
168 | u8 param_count; | ||
169 | u8 concurrency; | ||
170 | void *semaphore; | ||
171 | u8 *aml_start; | ||
172 | ACPI_INTERNAL_METHOD implementation; | ||
173 | u32 aml_length; | ||
174 | u8 thread_count; | ||
175 | acpi_owner_id owner_id; | ||
194 | }; | 176 | }; |
195 | 177 | ||
196 | /****************************************************************************** | 178 | /****************************************************************************** |
@@ -199,6 +181,14 @@ struct acpi_object_region { | |||
199 | * | 181 | * |
200 | *****************************************************************************/ | 182 | *****************************************************************************/ |
201 | 183 | ||
184 | /* | ||
185 | * Common fields for objects that support ASL notifications | ||
186 | */ | ||
187 | #define ACPI_COMMON_NOTIFY_INFO \ | ||
188 | union acpi_operand_object *system_notify; /* Handler for system notifies */\ | ||
189 | union acpi_operand_object *device_notify; /* Handler for driver notifies */\ | ||
190 | union acpi_operand_object *handler; /* Handler for Address space */ | ||
191 | |||
202 | struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ | 192 | struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ |
203 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; | 193 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; |
204 | 194 | ||
@@ -213,9 +203,9 @@ struct acpi_object_power_resource { | |||
213 | }; | 203 | }; |
214 | 204 | ||
215 | struct acpi_object_processor { | 205 | struct acpi_object_processor { |
216 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 proc_id; | 206 | ACPI_OBJECT_COMMON_HEADER u8 proc_id; |
217 | u32 length; | 207 | u8 length; |
218 | acpi_io_address address; | 208 | ACPI_COMMON_NOTIFY_INFO acpi_io_address address; |
219 | }; | 209 | }; |
220 | 210 | ||
221 | struct acpi_object_thermal_zone { | 211 | struct acpi_object_thermal_zone { |
@@ -227,9 +217,24 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; | |||
227 | * | 217 | * |
228 | *****************************************************************************/ | 218 | *****************************************************************************/ |
229 | 219 | ||
220 | /* | ||
221 | * Common bitfield for the field objects | ||
222 | * "Field Datum" -- a datum from the actual field object | ||
223 | * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field | ||
224 | */ | ||
225 | #define ACPI_COMMON_FIELD_INFO \ | ||
226 | u8 field_flags; /* Access, update, and lock bits */\ | ||
227 | u8 attribute; /* From access_as keyword */\ | ||
228 | u8 access_byte_width; /* Read/Write size in bytes */\ | ||
229 | struct acpi_namespace_node *node; /* Link back to parent node */\ | ||
230 | u32 bit_length; /* Length of field in bits */\ | ||
231 | u32 base_byte_offset; /* Byte offset within containing object */\ | ||
232 | u32 value; /* Value to store into the Bank or Index register */\ | ||
233 | u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ | ||
234 | u8 access_bit_width; /* Read/Write size in bits (8-64) */ | ||
235 | |||
230 | struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ | 236 | struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ |
231 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing Operation Region object */ | 237 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */ |
232 | /* (REGION/BANK fields only) */ | ||
233 | }; | 238 | }; |
234 | 239 | ||
235 | struct acpi_object_region_field { | 240 | struct acpi_object_region_field { |
@@ -244,7 +249,7 @@ struct acpi_object_bank_field { | |||
244 | struct acpi_object_index_field { | 249 | struct acpi_object_index_field { |
245 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO | 250 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO |
246 | /* | 251 | /* |
247 | * No "region_obj" pointer needed since the Index and Data registers | 252 | * No "RegionObj" pointer needed since the Index and Data registers |
248 | * are each field definitions unto themselves. | 253 | * are each field definitions unto themselves. |
249 | */ | 254 | */ |
250 | union acpi_operand_object *index_obj; /* Index register */ | 255 | union acpi_operand_object *index_obj; /* Index register */ |
@@ -269,13 +274,9 @@ struct acpi_object_notify_handler { | |||
269 | void *context; | 274 | void *context; |
270 | }; | 275 | }; |
271 | 276 | ||
272 | /* Flags for address handler */ | ||
273 | |||
274 | #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1 | ||
275 | |||
276 | struct acpi_object_addr_handler { | 277 | struct acpi_object_addr_handler { |
277 | ACPI_OBJECT_COMMON_HEADER u8 space_id; | 278 | ACPI_OBJECT_COMMON_HEADER u8 space_id; |
278 | u16 hflags; | 279 | u8 handler_flags; |
279 | acpi_adr_space_handler handler; | 280 | acpi_adr_space_handler handler; |
280 | struct acpi_namespace_node *node; /* Parent device */ | 281 | struct acpi_namespace_node *node; /* Parent device */ |
281 | void *context; | 282 | void *context; |
@@ -284,6 +285,10 @@ struct acpi_object_addr_handler { | |||
284 | union acpi_operand_object *next; | 285 | union acpi_operand_object *next; |
285 | }; | 286 | }; |
286 | 287 | ||
288 | /* Flags for address handler (handler_flags) */ | ||
289 | |||
290 | #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01 | ||
291 | |||
287 | /****************************************************************************** | 292 | /****************************************************************************** |
288 | * | 293 | * |
289 | * Special internal objects | 294 | * Special internal objects |
@@ -297,10 +302,10 @@ struct acpi_object_addr_handler { | |||
297 | struct acpi_object_reference { | 302 | struct acpi_object_reference { |
298 | ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ | 303 | ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ |
299 | u16 opcode; | 304 | u16 opcode; |
300 | u32 offset; /* Used for arg_op, local_op, and index_op */ | 305 | void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ |
301 | void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ | ||
302 | struct acpi_namespace_node *node; | 306 | struct acpi_namespace_node *node; |
303 | union acpi_operand_object **where; | 307 | union acpi_operand_object **where; |
308 | u32 offset; /* Used for arg_op, local_op, and index_op */ | ||
304 | }; | 309 | }; |
305 | 310 | ||
306 | /* | 311 | /* |
@@ -311,12 +316,10 @@ struct acpi_object_reference { | |||
311 | * Currently: Region and field_unit types | 316 | * Currently: Region and field_unit types |
312 | */ | 317 | */ |
313 | struct acpi_object_extra { | 318 | struct acpi_object_extra { |
314 | ACPI_OBJECT_COMMON_HEADER u8 byte_fill1; | 319 | ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */ |
315 | u16 word_fill1; | ||
316 | u32 aml_length; | ||
317 | u8 *aml_start; | ||
318 | struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */ | ||
319 | void *region_context; /* Region-specific data */ | 320 | void *region_context; /* Region-specific data */ |
321 | u8 *aml_start; | ||
322 | u32 aml_length; | ||
320 | }; | 323 | }; |
321 | 324 | ||
322 | /* Additional data that can be attached to namespace nodes */ | 325 | /* Additional data that can be attached to namespace nodes */ |
@@ -391,8 +394,13 @@ union acpi_operand_object { | |||
391 | #define ACPI_DESC_TYPE_NAMED 0x0F | 394 | #define ACPI_DESC_TYPE_NAMED 0x0F |
392 | #define ACPI_DESC_TYPE_MAX 0x0F | 395 | #define ACPI_DESC_TYPE_MAX 0x0F |
393 | 396 | ||
397 | struct acpi_common_descriptor { | ||
398 | void *common_pointer; | ||
399 | u8 descriptor_type; /* To differentiate various internal objs */ | ||
400 | }; | ||
401 | |||
394 | union acpi_descriptor { | 402 | union acpi_descriptor { |
395 | u8 descriptor_id; /* To differentiate various internal objs */ | 403 | struct acpi_common_descriptor common; |
396 | union acpi_operand_object object; | 404 | union acpi_operand_object object; |
397 | struct acpi_namespace_node node; | 405 | struct acpi_namespace_node node; |
398 | union acpi_parse_object op; | 406 | union acpi_parse_object op; |