diff options
Diffstat (limited to 'include/acpi/acobject.h')
-rw-r--r-- | include/acpi/acobject.h | 181 |
1 files changed, 92 insertions, 89 deletions
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h index d130cfed8d55..28241aa15de9 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,21 @@ | |||
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 |
66 | */ | 68 | */ |
67 | #define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\ | 69 | #define ACPI_OBJECT_COMMON_HEADER \ |
68 | u8 descriptor; /* To differentiate various internal objs */\ | 70 | union acpi_operand_object *next_object; /* Objects linked to parent NS node */\ |
69 | u8 type; /* acpi_object_type */\ | 71 | u8 descriptor_type; /* To differentiate various internal objs */\ |
70 | u16 reference_count; /* For object deletion management */\ | 72 | u8 type; /* acpi_object_type */\ |
71 | union acpi_operand_object *next_object; /* Objects linked to parent NS node */\ | 73 | u16 reference_count; /* For object deletion management */\ |
72 | u8 flags; | 74 | u8 flags; |
73 | 75 | /* | |
74 | /* Values for flag byte above */ | 76 | * Note: There are 3 bytes available here before the |
77 | * next natural alignment boundary (for both 32/64 cases) | ||
78 | */ | ||
79 | |||
80 | /* Values for Flag byte above */ | ||
75 | 81 | ||
76 | #define AOPOBJ_AML_CONSTANT 0x01 | 82 | #define AOPOBJ_AML_CONSTANT 0x01 |
77 | #define AOPOBJ_STATIC_POINTER 0x02 | 83 | #define AOPOBJ_STATIC_POINTER 0x02 |
@@ -80,36 +86,6 @@ | |||
80 | #define AOPOBJ_SETUP_COMPLETE 0x10 | 86 | #define AOPOBJ_SETUP_COMPLETE 0x10 |
81 | #define AOPOBJ_SINGLE_DATUM 0x20 | 87 | #define AOPOBJ_SINGLE_DATUM 0x20 |
82 | 88 | ||
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 | |||
113 | /****************************************************************************** | 89 | /****************************************************************************** |
114 | * | 90 | * |
115 | * Basic data types | 91 | * Basic data types |
@@ -125,25 +101,31 @@ struct acpi_object_integer { | |||
125 | 101 | ||
126 | /* | 102 | /* |
127 | * Note: The String and Buffer object must be identical through the Pointer | 103 | * Note: The String and Buffer object must be identical through the Pointer |
128 | * element. There is code that depends on this. | 104 | * and length elements. There is code that depends on this. |
105 | * | ||
106 | * Fields common to both Strings and Buffers | ||
129 | */ | 107 | */ |
108 | #define ACPI_COMMON_BUFFER_INFO(_type) \ | ||
109 | _type *pointer; \ | ||
110 | u32 length; | ||
111 | |||
130 | struct acpi_object_string { /* Null terminated, ASCII characters only */ | 112 | 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 */ | 113 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(char) /* String in AML stream or allocated string */ |
132 | }; | 114 | }; |
133 | 115 | ||
134 | struct acpi_object_buffer { | 116 | struct acpi_object_buffer { |
135 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO u8 * pointer; /* Buffer in AML stream or allocated buffer */ | 117 | 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; | 118 | u32 aml_length; |
119 | u8 *aml_start; | ||
120 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
139 | }; | 121 | }; |
140 | 122 | ||
141 | struct acpi_object_package { | 123 | struct acpi_object_package { |
142 | ACPI_OBJECT_COMMON_HEADER u32 count; /* # of elements in package */ | 124 | 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 */ | 125 | union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ |
126 | u8 *aml_start; | ||
127 | u32 aml_length; | ||
128 | u32 count; /* # of elements in package */ | ||
147 | }; | 129 | }; |
148 | 130 | ||
149 | /****************************************************************************** | 131 | /****************************************************************************** |
@@ -156,23 +138,6 @@ struct acpi_object_event { | |||
156 | ACPI_OBJECT_COMMON_HEADER void *semaphore; | 138 | ACPI_OBJECT_COMMON_HEADER void *semaphore; |
157 | }; | 139 | }; |
158 | 140 | ||
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 { | 141 | struct acpi_object_mutex { |
177 | ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ | 142 | ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ |
178 | u16 acquisition_depth; /* Allow multiple Acquires, same thread */ | 143 | u16 acquisition_depth; /* Allow multiple Acquires, same thread */ |
@@ -186,11 +151,23 @@ struct acpi_object_mutex { | |||
186 | 151 | ||
187 | struct acpi_object_region { | 152 | struct acpi_object_region { |
188 | ACPI_OBJECT_COMMON_HEADER u8 space_id; | 153 | 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 */ | 154 | struct acpi_namespace_node *node; /* Containing namespace node */ |
155 | union acpi_operand_object *handler; /* Handler for region access */ | ||
191 | union acpi_operand_object *next; | 156 | union acpi_operand_object *next; |
192 | u32 length; | ||
193 | acpi_physical_address address; | 157 | acpi_physical_address address; |
158 | u32 length; | ||
159 | }; | ||
160 | |||
161 | struct acpi_object_method { | ||
162 | ACPI_OBJECT_COMMON_HEADER u8 method_flags; | ||
163 | u8 param_count; | ||
164 | u8 concurrency; | ||
165 | void *semaphore; | ||
166 | u8 *aml_start; | ||
167 | ACPI_INTERNAL_METHOD implementation; | ||
168 | u32 aml_length; | ||
169 | u8 thread_count; | ||
170 | acpi_owner_id owner_id; | ||
194 | }; | 171 | }; |
195 | 172 | ||
196 | /****************************************************************************** | 173 | /****************************************************************************** |
@@ -199,6 +176,14 @@ struct acpi_object_region { | |||
199 | * | 176 | * |
200 | *****************************************************************************/ | 177 | *****************************************************************************/ |
201 | 178 | ||
179 | /* | ||
180 | * Common fields for objects that support ASL notifications | ||
181 | */ | ||
182 | #define ACPI_COMMON_NOTIFY_INFO \ | ||
183 | union acpi_operand_object *system_notify; /* Handler for system notifies */\ | ||
184 | union acpi_operand_object *device_notify; /* Handler for driver notifies */\ | ||
185 | union acpi_operand_object *handler; /* Handler for Address space */ | ||
186 | |||
202 | struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ | 187 | struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ |
203 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; | 188 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; |
204 | 189 | ||
@@ -213,9 +198,9 @@ struct acpi_object_power_resource { | |||
213 | }; | 198 | }; |
214 | 199 | ||
215 | struct acpi_object_processor { | 200 | struct acpi_object_processor { |
216 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 proc_id; | 201 | ACPI_OBJECT_COMMON_HEADER u8 proc_id; |
217 | u32 length; | 202 | u8 length; |
218 | acpi_io_address address; | 203 | ACPI_COMMON_NOTIFY_INFO acpi_io_address address; |
219 | }; | 204 | }; |
220 | 205 | ||
221 | struct acpi_object_thermal_zone { | 206 | struct acpi_object_thermal_zone { |
@@ -227,9 +212,24 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; | |||
227 | * | 212 | * |
228 | *****************************************************************************/ | 213 | *****************************************************************************/ |
229 | 214 | ||
215 | /* | ||
216 | * Common bitfield for the field objects | ||
217 | * "Field Datum" -- a datum from the actual field object | ||
218 | * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field | ||
219 | */ | ||
220 | #define ACPI_COMMON_FIELD_INFO \ | ||
221 | u8 field_flags; /* Access, update, and lock bits */\ | ||
222 | u8 attribute; /* From access_as keyword */\ | ||
223 | u8 access_byte_width; /* Read/Write size in bytes */\ | ||
224 | struct acpi_namespace_node *node; /* Link back to parent node */\ | ||
225 | u32 bit_length; /* Length of field in bits */\ | ||
226 | u32 base_byte_offset; /* Byte offset within containing object */\ | ||
227 | u32 value; /* Value to store into the Bank or Index register */\ | ||
228 | u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ | ||
229 | u8 access_bit_width; /* Read/Write size in bits (8-64) */ | ||
230 | |||
230 | struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ | 231 | 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 */ | 232 | 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 | }; | 233 | }; |
234 | 234 | ||
235 | struct acpi_object_region_field { | 235 | struct acpi_object_region_field { |
@@ -269,13 +269,9 @@ struct acpi_object_notify_handler { | |||
269 | void *context; | 269 | void *context; |
270 | }; | 270 | }; |
271 | 271 | ||
272 | /* Flags for address handler */ | ||
273 | |||
274 | #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1 | ||
275 | |||
276 | struct acpi_object_addr_handler { | 272 | struct acpi_object_addr_handler { |
277 | ACPI_OBJECT_COMMON_HEADER u8 space_id; | 273 | ACPI_OBJECT_COMMON_HEADER u8 space_id; |
278 | u16 hflags; | 274 | u8 handler_flags; |
279 | acpi_adr_space_handler handler; | 275 | acpi_adr_space_handler handler; |
280 | struct acpi_namespace_node *node; /* Parent device */ | 276 | struct acpi_namespace_node *node; /* Parent device */ |
281 | void *context; | 277 | void *context; |
@@ -284,6 +280,10 @@ struct acpi_object_addr_handler { | |||
284 | union acpi_operand_object *next; | 280 | union acpi_operand_object *next; |
285 | }; | 281 | }; |
286 | 282 | ||
283 | /* Flags for address handler (handler_flags) */ | ||
284 | |||
285 | #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01 | ||
286 | |||
287 | /****************************************************************************** | 287 | /****************************************************************************** |
288 | * | 288 | * |
289 | * Special internal objects | 289 | * Special internal objects |
@@ -297,10 +297,10 @@ struct acpi_object_addr_handler { | |||
297 | struct acpi_object_reference { | 297 | struct acpi_object_reference { |
298 | ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ | 298 | ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ |
299 | u16 opcode; | 299 | u16 opcode; |
300 | u32 offset; /* Used for arg_op, local_op, and index_op */ | 300 | 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; | 301 | struct acpi_namespace_node *node; |
303 | union acpi_operand_object **where; | 302 | union acpi_operand_object **where; |
303 | u32 offset; /* Used for arg_op, local_op, and index_op */ | ||
304 | }; | 304 | }; |
305 | 305 | ||
306 | /* | 306 | /* |
@@ -311,12 +311,10 @@ struct acpi_object_reference { | |||
311 | * Currently: Region and field_unit types | 311 | * Currently: Region and field_unit types |
312 | */ | 312 | */ |
313 | struct acpi_object_extra { | 313 | struct acpi_object_extra { |
314 | ACPI_OBJECT_COMMON_HEADER u8 byte_fill1; | 314 | 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 */ | 315 | void *region_context; /* Region-specific data */ |
316 | u8 *aml_start; | ||
317 | u32 aml_length; | ||
320 | }; | 318 | }; |
321 | 319 | ||
322 | /* Additional data that can be attached to namespace nodes */ | 320 | /* Additional data that can be attached to namespace nodes */ |
@@ -391,8 +389,13 @@ union acpi_operand_object { | |||
391 | #define ACPI_DESC_TYPE_NAMED 0x0F | 389 | #define ACPI_DESC_TYPE_NAMED 0x0F |
392 | #define ACPI_DESC_TYPE_MAX 0x0F | 390 | #define ACPI_DESC_TYPE_MAX 0x0F |
393 | 391 | ||
392 | struct acpi_common_descriptor { | ||
393 | void *common_pointer; | ||
394 | u8 descriptor_type; /* To differentiate various internal objs */ | ||
395 | }; | ||
396 | |||
394 | union acpi_descriptor { | 397 | union acpi_descriptor { |
395 | u8 descriptor_id; /* To differentiate various internal objs */ | 398 | struct acpi_common_descriptor common; |
396 | union acpi_operand_object object; | 399 | union acpi_operand_object object; |
397 | struct acpi_namespace_node node; | 400 | struct acpi_namespace_node node; |
398 | union acpi_parse_object op; | 401 | union acpi_parse_object op; |