diff options
40 files changed, 558 insertions, 1153 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 606f8733a776..9c4ac0191f64 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -596,6 +596,8 @@ void __init acpi_early_init(void) | |||
596 | if (acpi_disabled) | 596 | if (acpi_disabled) |
597 | return_VOID; | 597 | return_VOID; |
598 | 598 | ||
599 | printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); | ||
600 | |||
599 | /* enable workarounds, unless strict ACPI spec. compliance */ | 601 | /* enable workarounds, unless strict ACPI spec. compliance */ |
600 | if (!acpi_strict) | 602 | if (!acpi_strict) |
601 | acpi_gbl_enable_interpreter_slack = TRUE; | 603 | acpi_gbl_enable_interpreter_slack = TRUE; |
@@ -743,8 +745,6 @@ static int __init acpi_init(void) | |||
743 | 745 | ||
744 | ACPI_FUNCTION_TRACE("acpi_init"); | 746 | ACPI_FUNCTION_TRACE("acpi_init"); |
745 | 747 | ||
746 | printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION); | ||
747 | |||
748 | if (acpi_disabled) { | 748 | if (acpi_disabled) { |
749 | printk(KERN_INFO PREFIX "Interpreter disabled.\n"); | 749 | printk(KERN_INFO PREFIX "Interpreter disabled.\n"); |
750 | return_VALUE(-ENODEV); | 750 | return_VALUE(-ENODEV); |
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index 2ed48439835d..ce4de18f1229 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c | |||
@@ -100,10 +100,10 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) | |||
100 | ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name, | 100 | ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name, |
101 | NAMEOF_ARG_NTE); | 101 | NAMEOF_ARG_NTE); |
102 | walk_state->arguments[i].name.integer |= (i << 24); | 102 | walk_state->arguments[i].name.integer |= (i << 24); |
103 | walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; | 103 | walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED; |
104 | walk_state->arguments[i].type = ACPI_TYPE_ANY; | 104 | walk_state->arguments[i].type = ACPI_TYPE_ANY; |
105 | walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | | 105 | walk_state->arguments[i].flags = |
106 | ANOBJ_METHOD_ARG; | 106 | ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG; |
107 | } | 107 | } |
108 | 108 | ||
109 | /* Init the method locals */ | 109 | /* Init the method locals */ |
@@ -113,11 +113,11 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) | |||
113 | NAMEOF_LOCAL_NTE); | 113 | NAMEOF_LOCAL_NTE); |
114 | 114 | ||
115 | walk_state->local_variables[i].name.integer |= (i << 24); | 115 | walk_state->local_variables[i].name.integer |= (i << 24); |
116 | walk_state->local_variables[i].descriptor = | 116 | walk_state->local_variables[i].descriptor_type = |
117 | ACPI_DESC_TYPE_NAMED; | 117 | ACPI_DESC_TYPE_NAMED; |
118 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; | 118 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; |
119 | walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | | 119 | walk_state->local_variables[i].flags = |
120 | ANOBJ_METHOD_LOCAL; | 120 | ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL; |
121 | } | 121 | } |
122 | 122 | ||
123 | return_VOID; | 123 | return_VOID; |
diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c index e2954fff8c5e..3cd6895ed2c3 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/dispatcher/dswscope.c | |||
@@ -128,7 +128,7 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node, | |||
128 | 128 | ||
129 | /* Init new scope object */ | 129 | /* Init new scope object */ |
130 | 130 | ||
131 | scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE; | 131 | scope_info->common.descriptor_type = ACPI_DESC_TYPE_STATE_WSCOPE; |
132 | scope_info->scope.node = node; | 132 | scope_info->scope.node = node; |
133 | scope_info->common.value = (u16) type; | 133 | scope_info->common.value = (u16) type; |
134 | 134 | ||
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index d2846ffc9773..4840eae47d34 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c | |||
@@ -337,7 +337,7 @@ acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state) | |||
337 | return (AE_NO_MEMORY); | 337 | return (AE_NO_MEMORY); |
338 | } | 338 | } |
339 | 339 | ||
340 | state->common.data_type = ACPI_DESC_TYPE_STATE_RESULT; | 340 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_RESULT; |
341 | acpi_ut_push_generic_state(&walk_state->results, state); | 341 | acpi_ut_push_generic_state(&walk_state->results, state); |
342 | 342 | ||
343 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", | 343 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", |
@@ -620,7 +620,7 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread) | |||
620 | * | 620 | * |
621 | * PARAMETERS: owner_id - ID for object creation | 621 | * PARAMETERS: owner_id - ID for object creation |
622 | * Origin - Starting point for this walk | 622 | * Origin - Starting point for this walk |
623 | * mth_desc - Method object | 623 | * method_desc - Method object |
624 | * Thread - Current thread state | 624 | * Thread - Current thread state |
625 | * | 625 | * |
626 | * RETURN: Pointer to the new walk state. | 626 | * RETURN: Pointer to the new walk state. |
@@ -634,7 +634,7 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, | |||
634 | union acpi_parse_object | 634 | union acpi_parse_object |
635 | *origin, | 635 | *origin, |
636 | union acpi_operand_object | 636 | union acpi_operand_object |
637 | *mth_desc, | 637 | *method_desc, |
638 | struct acpi_thread_state | 638 | struct acpi_thread_state |
639 | *thread) | 639 | *thread) |
640 | { | 640 | { |
@@ -648,10 +648,10 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, | |||
648 | return_PTR(NULL); | 648 | return_PTR(NULL); |
649 | } | 649 | } |
650 | 650 | ||
651 | walk_state->data_type = ACPI_DESC_TYPE_WALK; | 651 | walk_state->descriptor_type = ACPI_DESC_TYPE_WALK; |
652 | walk_state->method_desc = method_desc; | ||
652 | walk_state->owner_id = owner_id; | 653 | walk_state->owner_id = owner_id; |
653 | walk_state->origin = origin; | 654 | walk_state->origin = origin; |
654 | walk_state->method_desc = mth_desc; | ||
655 | walk_state->thread = thread; | 655 | walk_state->thread = thread; |
656 | 656 | ||
657 | walk_state->parser_state.start_op = origin; | 657 | walk_state->parser_state.start_op = origin; |
@@ -819,7 +819,7 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) | |||
819 | return; | 819 | return; |
820 | } | 820 | } |
821 | 821 | ||
822 | if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { | 822 | if (walk_state->descriptor_type != ACPI_DESC_TYPE_WALK) { |
823 | ACPI_ERROR((AE_INFO, "%p is not a valid walk state", | 823 | ACPI_ERROR((AE_INFO, "%p is not a valid walk state", |
824 | walk_state)); | 824 | walk_state)); |
825 | return; | 825 | return; |
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index e8e72986f0d6..4e90c1f837c3 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c | |||
@@ -131,7 +131,7 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info) | |||
131 | * | 131 | * |
132 | ******************************************************************************/ | 132 | ******************************************************************************/ |
133 | 133 | ||
134 | acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) | 134 | acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback) |
135 | { | 135 | { |
136 | struct acpi_gpe_block_info *gpe_block; | 136 | struct acpi_gpe_block_info *gpe_block; |
137 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | 137 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; |
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 334407239f2f..b216b3229e27 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -185,7 +185,8 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
185 | return (AE_NO_MEMORY); | 185 | return (AE_NO_MEMORY); |
186 | } | 186 | } |
187 | 187 | ||
188 | notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY; | 188 | notify_info->common.descriptor_type = |
189 | ACPI_DESC_TYPE_STATE_NOTIFY; | ||
189 | notify_info->notify.node = node; | 190 | notify_info->notify.node = node; |
190 | notify_info->notify.value = (u16) notify_value; | 191 | notify_info->notify.value = (u16) notify_value; |
191 | notify_info->notify.handler_obj = handler_obj; | 192 | notify_info->notify.handler_obj = handler_obj; |
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 2b900ef05fa9..0337ad222b26 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c | |||
@@ -250,7 +250,6 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
250 | 250 | ||
251 | cleanup: | 251 | cleanup: |
252 | acpi_ut_remove_reference(params[0]); | 252 | acpi_ut_remove_reference(params[0]); |
253 | |||
254 | return_ACPI_STATUS(status); | 253 | return_ACPI_STATUS(status); |
255 | } | 254 | } |
256 | 255 | ||
@@ -389,9 +388,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
389 | acpi_ut_get_region_name(region_obj->region. | 388 | acpi_ut_get_region_name(region_obj->region. |
390 | space_id))); | 389 | space_id))); |
391 | 390 | ||
392 | if (! | 391 | if (!(handler_desc->address_space.handler_flags & |
393 | (handler_desc->address_space. | 392 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { |
394 | hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { | ||
395 | /* | 393 | /* |
396 | * For handlers other than the default (supplied) handlers, we must | 394 | * For handlers other than the default (supplied) handlers, we must |
397 | * exit the interpreter because the handler *might* block -- we don't | 395 | * exit the interpreter because the handler *might* block -- we don't |
@@ -412,9 +410,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
412 | space_id))); | 410 | space_id))); |
413 | } | 411 | } |
414 | 412 | ||
415 | if (! | 413 | if (!(handler_desc->address_space.handler_flags & |
416 | (handler_desc->address_space. | 414 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { |
417 | hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { | ||
418 | /* | 415 | /* |
419 | * We just returned from a non-default handler, we must re-enter the | 416 | * We just returned from a non-default handler, we must re-enter the |
420 | * interpreter | 417 | * interpreter |
@@ -772,7 +769,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
772 | union acpi_operand_object *handler_obj; | 769 | union acpi_operand_object *handler_obj; |
773 | acpi_status status; | 770 | acpi_status status; |
774 | acpi_object_type type; | 771 | acpi_object_type type; |
775 | u16 flags = 0; | 772 | u8 flags = 0; |
776 | 773 | ||
777 | ACPI_FUNCTION_TRACE("ev_install_space_handler"); | 774 | ACPI_FUNCTION_TRACE("ev_install_space_handler"); |
778 | 775 | ||
@@ -930,7 +927,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
930 | /* Init handler obj */ | 927 | /* Init handler obj */ |
931 | 928 | ||
932 | handler_obj->address_space.space_id = (u8) space_id; | 929 | handler_obj->address_space.space_id = (u8) space_id; |
933 | handler_obj->address_space.hflags = flags; | 930 | handler_obj->address_space.handler_flags = flags; |
934 | handler_obj->address_space.region_list = NULL; | 931 | handler_obj->address_space.region_list = NULL; |
935 | handler_obj->address_space.node = node; | 932 | handler_obj->address_space.node = node; |
936 | handler_obj->address_space.handler = handler; | 933 | handler_obj->address_space.handler = handler; |
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 680575402835..763e132da4c6 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c | |||
@@ -243,8 +243,9 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state) | |||
243 | obj_desc->mutex.node = | 243 | obj_desc->mutex.node = |
244 | (struct acpi_namespace_node *)walk_state->operands[0]; | 244 | (struct acpi_namespace_node *)walk_state->operands[0]; |
245 | 245 | ||
246 | status = acpi_ns_attach_object(obj_desc->mutex.node, | 246 | status = |
247 | obj_desc, ACPI_TYPE_MUTEX); | 247 | acpi_ns_attach_object(obj_desc->mutex.node, obj_desc, |
248 | ACPI_TYPE_MUTEX); | ||
248 | 249 | ||
249 | cleanup: | 250 | cleanup: |
250 | /* | 251 | /* |
@@ -464,9 +465,9 @@ acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state) | |||
464 | /* Initialize the processor object from the operands */ | 465 | /* Initialize the processor object from the operands */ |
465 | 466 | ||
466 | obj_desc->processor.proc_id = (u8) operand[1]->integer.value; | 467 | obj_desc->processor.proc_id = (u8) operand[1]->integer.value; |
468 | obj_desc->processor.length = (u8) operand[3]->integer.value; | ||
467 | obj_desc->processor.address = | 469 | obj_desc->processor.address = |
468 | (acpi_io_address) operand[2]->integer.value; | 470 | (acpi_io_address) operand[2]->integer.value; |
469 | obj_desc->processor.length = (u8) operand[3]->integer.value; | ||
470 | 471 | ||
471 | /* Install the processor object in the parent Node */ | 472 | /* Install the processor object in the parent Node */ |
472 | 473 | ||
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 502293c35afa..56db58b8e23a 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -267,8 +267,6 @@ static struct acpi_exdump_info acpi_ex_dump_node[6] = { | |||
267 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, | 267 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, |
268 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, | 268 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, |
269 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, | 269 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, |
270 | {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET(reference_count), | ||
271 | "Reference Count"}, | ||
272 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"}, | 270 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"}, |
273 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"} | 271 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"} |
274 | }; | 272 | }; |
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index acd4b6732ac4..8b921c96d6a5 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c | |||
@@ -47,9 +47,6 @@ | |||
47 | #define _COMPONENT ACPI_NAMESPACE | 47 | #define _COMPONENT ACPI_NAMESPACE |
48 | ACPI_MODULE_NAME("nsalloc") | 48 | ACPI_MODULE_NAME("nsalloc") |
49 | 49 | ||
50 | /* Local prototypes */ | ||
51 | static void acpi_ns_remove_reference(struct acpi_namespace_node *node); | ||
52 | |||
53 | /******************************************************************************* | 50 | /******************************************************************************* |
54 | * | 51 | * |
55 | * FUNCTION: acpi_ns_create_node | 52 | * FUNCTION: acpi_ns_create_node |
@@ -61,14 +58,13 @@ static void acpi_ns_remove_reference(struct acpi_namespace_node *node); | |||
61 | * DESCRIPTION: Create a namespace node | 58 | * DESCRIPTION: Create a namespace node |
62 | * | 59 | * |
63 | ******************************************************************************/ | 60 | ******************************************************************************/ |
64 | |||
65 | struct acpi_namespace_node *acpi_ns_create_node(u32 name) | 61 | struct acpi_namespace_node *acpi_ns_create_node(u32 name) |
66 | { | 62 | { |
67 | struct acpi_namespace_node *node; | 63 | struct acpi_namespace_node *node; |
68 | 64 | ||
69 | ACPI_FUNCTION_TRACE("ns_create_node"); | 65 | ACPI_FUNCTION_TRACE("ns_create_node"); |
70 | 66 | ||
71 | node = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_namespace_node)); | 67 | node = acpi_os_acquire_object(acpi_gbl_namespace_cache); |
72 | if (!node) { | 68 | if (!node) { |
73 | return_PTR(NULL); | 69 | return_PTR(NULL); |
74 | } | 70 | } |
@@ -76,9 +72,7 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name) | |||
76 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++); | 72 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++); |
77 | 73 | ||
78 | node->name.integer = name; | 74 | node->name.integer = name; |
79 | node->reference_count = 1; | ||
80 | ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED); | 75 | ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED); |
81 | |||
82 | return_PTR(node); | 76 | return_PTR(node); |
83 | } | 77 | } |
84 | 78 | ||
@@ -139,10 +133,10 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
139 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); | 133 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); |
140 | 134 | ||
141 | /* | 135 | /* |
142 | * Detach an object if there is one then delete the node | 136 | * Detach an object if there is one, then delete the node |
143 | */ | 137 | */ |
144 | acpi_ns_detach_object(node); | 138 | acpi_ns_detach_object(node); |
145 | ACPI_FREE(node); | 139 | (void)acpi_os_release_object(acpi_gbl_namespace_cache, node); |
146 | return_VOID; | 140 | return_VOID; |
147 | } | 141 | } |
148 | 142 | ||
@@ -217,16 +211,6 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp | |||
217 | acpi_ut_get_node_name(parent_node), | 211 | acpi_ut_get_node_name(parent_node), |
218 | acpi_ut_get_type_name(parent_node->type), | 212 | acpi_ut_get_type_name(parent_node->type), |
219 | parent_node)); | 213 | parent_node)); |
220 | |||
221 | /* | ||
222 | * Increment the reference count(s) of all parents up to | ||
223 | * the root! | ||
224 | */ | ||
225 | while ((node = acpi_ns_get_parent_node(node)) != NULL) { | ||
226 | node->reference_count++; | ||
227 | } | ||
228 | |||
229 | return_VOID; | ||
230 | } | 214 | } |
231 | 215 | ||
232 | /******************************************************************************* | 216 | /******************************************************************************* |
@@ -246,7 +230,6 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | |||
246 | { | 230 | { |
247 | struct acpi_namespace_node *child_node; | 231 | struct acpi_namespace_node *child_node; |
248 | struct acpi_namespace_node *next_node; | 232 | struct acpi_namespace_node *next_node; |
249 | struct acpi_namespace_node *node; | ||
250 | u8 flags; | 233 | u8 flags; |
251 | 234 | ||
252 | ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node); | 235 | ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node); |
@@ -292,26 +275,10 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | |||
292 | */ | 275 | */ |
293 | acpi_ns_detach_object(child_node); | 276 | acpi_ns_detach_object(child_node); |
294 | 277 | ||
295 | /* | ||
296 | * Decrement the reference count(s) of all parents up to | ||
297 | * the root! (counts were incremented when the node was created) | ||
298 | */ | ||
299 | node = child_node; | ||
300 | while ((node = acpi_ns_get_parent_node(node)) != NULL) { | ||
301 | node->reference_count--; | ||
302 | } | ||
303 | |||
304 | /* There should be only one reference remaining on this node */ | ||
305 | |||
306 | if (child_node->reference_count != 1) { | ||
307 | ACPI_WARNING((AE_INFO, | ||
308 | "Existing references (%d) on node being deleted (%p)", | ||
309 | child_node->reference_count, child_node)); | ||
310 | } | ||
311 | |||
312 | /* Now we can delete the node */ | 278 | /* Now we can delete the node */ |
313 | 279 | ||
314 | ACPI_FREE(child_node); | 280 | (void)acpi_os_release_object(acpi_gbl_namespace_cache, |
281 | child_node); | ||
315 | 282 | ||
316 | /* And move on to the next child in the list */ | 283 | /* And move on to the next child in the list */ |
317 | 284 | ||
@@ -358,8 +325,9 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
358 | 325 | ||
359 | /* Get the next node in this scope (NULL if none) */ | 326 | /* Get the next node in this scope (NULL if none) */ |
360 | 327 | ||
361 | child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, | 328 | child_node = |
362 | child_node); | 329 | acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, |
330 | child_node); | ||
363 | if (child_node) { | 331 | if (child_node) { |
364 | 332 | ||
365 | /* Found a child node - detach any attached object */ | 333 | /* Found a child node - detach any attached object */ |
@@ -406,57 +374,6 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
406 | 374 | ||
407 | /******************************************************************************* | 375 | /******************************************************************************* |
408 | * | 376 | * |
409 | * FUNCTION: acpi_ns_remove_reference | ||
410 | * | ||
411 | * PARAMETERS: Node - Named node whose reference count is to be | ||
412 | * decremented | ||
413 | * | ||
414 | * RETURN: None. | ||
415 | * | ||
416 | * DESCRIPTION: Remove a Node reference. Decrements the reference count | ||
417 | * of all parent Nodes up to the root. Any node along | ||
418 | * the way that reaches zero references is freed. | ||
419 | * | ||
420 | ******************************************************************************/ | ||
421 | |||
422 | static void acpi_ns_remove_reference(struct acpi_namespace_node *node) | ||
423 | { | ||
424 | struct acpi_namespace_node *parent_node; | ||
425 | struct acpi_namespace_node *this_node; | ||
426 | |||
427 | ACPI_FUNCTION_ENTRY(); | ||
428 | |||
429 | /* | ||
430 | * Decrement the reference count(s) of this node and all | ||
431 | * nodes up to the root, Delete anything with zero remaining references. | ||
432 | */ | ||
433 | this_node = node; | ||
434 | while (this_node) { | ||
435 | |||
436 | /* Prepare to move up to parent */ | ||
437 | |||
438 | parent_node = acpi_ns_get_parent_node(this_node); | ||
439 | |||
440 | /* Decrement the reference count on this node */ | ||
441 | |||
442 | this_node->reference_count--; | ||
443 | |||
444 | /* Delete the node if no more references */ | ||
445 | |||
446 | if (!this_node->reference_count) { | ||
447 | |||
448 | /* Delete all children and delete the node */ | ||
449 | |||
450 | acpi_ns_delete_children(this_node); | ||
451 | acpi_ns_delete_node(this_node); | ||
452 | } | ||
453 | |||
454 | this_node = parent_node; | ||
455 | } | ||
456 | } | ||
457 | |||
458 | /******************************************************************************* | ||
459 | * | ||
460 | * FUNCTION: acpi_ns_delete_namespace_by_owner | 377 | * FUNCTION: acpi_ns_delete_namespace_by_owner |
461 | * | 378 | * |
462 | * PARAMETERS: owner_id - All nodes with this owner will be deleted | 379 | * PARAMETERS: owner_id - All nodes with this owner will be deleted |
@@ -482,9 +399,9 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | |||
482 | return_VOID; | 399 | return_VOID; |
483 | } | 400 | } |
484 | 401 | ||
402 | deletion_node = NULL; | ||
485 | parent_node = acpi_gbl_root_node; | 403 | parent_node = acpi_gbl_root_node; |
486 | child_node = NULL; | 404 | child_node = NULL; |
487 | deletion_node = NULL; | ||
488 | level = 1; | 405 | level = 1; |
489 | 406 | ||
490 | /* | 407 | /* |
@@ -501,7 +418,8 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | |||
501 | child_node); | 418 | child_node); |
502 | 419 | ||
503 | if (deletion_node) { | 420 | if (deletion_node) { |
504 | acpi_ns_remove_reference(deletion_node); | 421 | acpi_ns_delete_children(deletion_node); |
422 | acpi_ns_delete_node(deletion_node); | ||
505 | deletion_node = NULL; | 423 | deletion_node = NULL; |
506 | } | 424 | } |
507 | 425 | ||
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index 586014ecf24b..9fa38ffc2e6e 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c | |||
@@ -81,7 +81,7 @@ acpi_ns_report_error(char *module_name, | |||
81 | u32 bad_name; | 81 | u32 bad_name; |
82 | char *name = NULL; | 82 | char *name = NULL; |
83 | 83 | ||
84 | acpi_ut_report_error(module_name, line_number); | 84 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); |
85 | 85 | ||
86 | if (lookup_status == AE_BAD_CHARACTER) { | 86 | if (lookup_status == AE_BAD_CHARACTER) { |
87 | 87 | ||
@@ -139,7 +139,7 @@ acpi_ns_report_method_error(char *module_name, | |||
139 | acpi_status status; | 139 | acpi_status status; |
140 | struct acpi_namespace_node *node = prefix_node; | 140 | struct acpi_namespace_node *node = prefix_node; |
141 | 141 | ||
142 | acpi_ut_report_error(module_name, line_number); | 142 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); |
143 | 143 | ||
144 | if (path) { | 144 | if (path) { |
145 | status = acpi_ns_get_node_by_path(path, prefix_node, | 145 | status = acpi_ns_get_node_by_path(path, prefix_node, |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 56d97f1d108f..006b31a56559 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -1126,14 +1126,13 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object) | |||
1126 | * | 1126 | * |
1127 | * RETURN: Status | 1127 | * RETURN: Status |
1128 | * | 1128 | * |
1129 | * DESCRIPTION: Get an object from the specified cache. If cache is empty, | 1129 | * DESCRIPTION: Return a zero-filled object. |
1130 | * the object is allocated. | ||
1131 | * | 1130 | * |
1132 | ******************************************************************************/ | 1131 | ******************************************************************************/ |
1133 | 1132 | ||
1134 | void *acpi_os_acquire_object(acpi_cache_t * cache) | 1133 | void *acpi_os_acquire_object(acpi_cache_t * cache) |
1135 | { | 1134 | { |
1136 | void *object = kmem_cache_alloc(cache, GFP_KERNEL); | 1135 | void *object = kmem_cache_zalloc(cache, GFP_KERNEL); |
1137 | WARN_ON(!object); | 1136 | WARN_ON(!object); |
1138 | return object; | 1137 | return object; |
1139 | } | 1138 | } |
diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c index edb7c9ba6ec2..9233a4044d6b 100644 --- a/drivers/acpi/parser/psscope.c +++ b/drivers/acpi/parser/psscope.c | |||
@@ -113,7 +113,7 @@ acpi_ps_init_scope(struct acpi_parse_state * parser_state, | |||
113 | return_ACPI_STATUS(AE_NO_MEMORY); | 113 | return_ACPI_STATUS(AE_NO_MEMORY); |
114 | } | 114 | } |
115 | 115 | ||
116 | scope->common.data_type = ACPI_DESC_TYPE_STATE_RPSCOPE; | 116 | scope->common.descriptor_type = ACPI_DESC_TYPE_STATE_RPSCOPE; |
117 | scope->parse_scope.op = root_op; | 117 | scope->parse_scope.op = root_op; |
118 | scope->parse_scope.arg_count = ACPI_VAR_ARGS; | 118 | scope->parse_scope.arg_count = ACPI_VAR_ARGS; |
119 | scope->parse_scope.arg_end = parser_state->aml_end; | 119 | scope->parse_scope.arg_end = parser_state->aml_end; |
@@ -143,7 +143,7 @@ acpi_ps_init_scope(struct acpi_parse_state * parser_state, | |||
143 | acpi_status | 143 | acpi_status |
144 | acpi_ps_push_scope(struct acpi_parse_state *parser_state, | 144 | acpi_ps_push_scope(struct acpi_parse_state *parser_state, |
145 | union acpi_parse_object *op, | 145 | union acpi_parse_object *op, |
146 | u32 remaining_args, u32 arg_count) | 146 | u32 remaining_args, u8 arg_count) |
147 | { | 147 | { |
148 | union acpi_generic_state *scope; | 148 | union acpi_generic_state *scope; |
149 | 149 | ||
@@ -154,7 +154,7 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state, | |||
154 | return_ACPI_STATUS(AE_NO_MEMORY); | 154 | return_ACPI_STATUS(AE_NO_MEMORY); |
155 | } | 155 | } |
156 | 156 | ||
157 | scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE; | 157 | scope->common.descriptor_type = ACPI_DESC_TYPE_STATE_PSCOPE; |
158 | scope->parse_scope.op = op; | 158 | scope->parse_scope.op = op; |
159 | scope->parse_scope.arg_list = remaining_args; | 159 | scope->parse_scope.arg_list = remaining_args; |
160 | scope->parse_scope.arg_count = arg_count; | 160 | scope->parse_scope.arg_count = arg_count; |
@@ -196,7 +196,7 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state, | |||
196 | 196 | ||
197 | void | 197 | void |
198 | acpi_ps_pop_scope(struct acpi_parse_state *parser_state, | 198 | acpi_ps_pop_scope(struct acpi_parse_state *parser_state, |
199 | union acpi_parse_object **op, u32 * arg_list, u32 * arg_count) | 199 | union acpi_parse_object **op, u32 * arg_list, u8 * arg_count) |
200 | { | 200 | { |
201 | union acpi_generic_state *scope = parser_state->scope; | 201 | union acpi_generic_state *scope = parser_state->scope; |
202 | 202 | ||
@@ -207,7 +207,7 @@ acpi_ps_pop_scope(struct acpi_parse_state *parser_state, | |||
207 | if (scope->common.next) { | 207 | if (scope->common.next) { |
208 | scope = acpi_ut_pop_generic_state(&parser_state->scope); | 208 | scope = acpi_ut_pop_generic_state(&parser_state->scope); |
209 | 209 | ||
210 | /* return to parsing previous op */ | 210 | /* Return to parsing previous op */ |
211 | 211 | ||
212 | *op = scope->parse_scope.op; | 212 | *op = scope->parse_scope.op; |
213 | *arg_list = scope->parse_scope.arg_list; | 213 | *arg_list = scope->parse_scope.arg_list; |
@@ -218,7 +218,7 @@ acpi_ps_pop_scope(struct acpi_parse_state *parser_state, | |||
218 | 218 | ||
219 | acpi_ut_delete_generic_state(scope); | 219 | acpi_ut_delete_generic_state(scope); |
220 | } else { | 220 | } else { |
221 | /* empty parse stack, prepare to fetch next opcode */ | 221 | /* Empty parse stack, prepare to fetch next opcode */ |
222 | 222 | ||
223 | *op = NULL; | 223 | *op = NULL; |
224 | *arg_list = 0; | 224 | *arg_list = 0; |
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index a4c33a4bfe35..43e3190583e3 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c | |||
@@ -89,7 +89,7 @@ void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode) | |||
89 | { | 89 | { |
90 | ACPI_FUNCTION_ENTRY(); | 90 | ACPI_FUNCTION_ENTRY(); |
91 | 91 | ||
92 | op->common.data_type = ACPI_DESC_TYPE_PARSER; | 92 | op->common.descriptor_type = ACPI_DESC_TYPE_PARSER; |
93 | op->common.aml_opcode = opcode; | 93 | op->common.aml_opcode = opcode; |
94 | 94 | ||
95 | ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name, | 95 | ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name, |
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 8e406d992f3b..dd5caa2c8fdd 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c | |||
@@ -456,7 +456,7 @@ acpi_rs_get_list_length(u8 * aml_buffer, | |||
456 | *size_needed += buffer_size; | 456 | *size_needed += buffer_size; |
457 | 457 | ||
458 | ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, | 458 | ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, |
459 | "Type %.2X, Aml %.2X internal %.2X\n", | 459 | "Type %.2X, aml_length %.2X internal_length %.2X\n", |
460 | acpi_ut_get_resource_type(aml_buffer), | 460 | acpi_ut_get_resource_type(aml_buffer), |
461 | acpi_ut_get_descriptor_length(aml_buffer), | 461 | acpi_ut_get_descriptor_length(aml_buffer), |
462 | buffer_size)); | 462 | buffer_size)); |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 67c052af7bbe..01488cfc9bae 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c | |||
@@ -75,6 +75,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, | |||
75 | u8 *aml_start; | 75 | u8 *aml_start; |
76 | acpi_size list_size_needed = 0; | 76 | acpi_size list_size_needed = 0; |
77 | u32 aml_buffer_length; | 77 | u32 aml_buffer_length; |
78 | void *resource; | ||
78 | 79 | ||
79 | ACPI_FUNCTION_TRACE("rs_create_resource_list"); | 80 | ACPI_FUNCTION_TRACE("rs_create_resource_list"); |
80 | 81 | ||
@@ -107,8 +108,10 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, | |||
107 | 108 | ||
108 | /* Do the conversion */ | 109 | /* Do the conversion */ |
109 | 110 | ||
110 | status = acpi_rs_convert_aml_to_resources(aml_start, aml_buffer_length, | 111 | resource = output_buffer->pointer; |
111 | output_buffer->pointer); | 112 | status = acpi_ut_walk_aml_resources(aml_start, aml_buffer_length, |
113 | acpi_rs_convert_aml_to_resources, | ||
114 | &resource); | ||
112 | if (ACPI_FAILURE(status)) { | 115 | if (ACPI_FAILURE(status)) { |
113 | return_ACPI_STATUS(status); | 116 | return_ACPI_STATUS(status); |
114 | } | 117 | } |
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index 6f2d8de39523..50bbb19bf4ae 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c | |||
@@ -51,92 +51,60 @@ ACPI_MODULE_NAME("rslist") | |||
51 | * | 51 | * |
52 | * FUNCTION: acpi_rs_convert_aml_to_resources | 52 | * FUNCTION: acpi_rs_convert_aml_to_resources |
53 | * | 53 | * |
54 | * PARAMETERS: Aml - Pointer to the resource byte stream | 54 | * PARAMETERS: acpi_walk_aml_callback |
55 | * aml_length - Length of Aml | 55 | * resource_ptr - Pointer to the buffer that will |
56 | * output_buffer - Pointer to the buffer that will | 56 | * contain the output structures |
57 | * contain the output structures | ||
58 | * | 57 | * |
59 | * RETURN: Status | 58 | * RETURN: Status |
60 | * | 59 | * |
61 | * DESCRIPTION: Takes the resource byte stream and parses it, creating a | 60 | * DESCRIPTION: Convert an AML resource to an internal representation of the |
62 | * linked list of resources in the caller's output buffer | 61 | * resource that is aligned and easier to access. |
63 | * | 62 | * |
64 | ******************************************************************************/ | 63 | ******************************************************************************/ |
65 | acpi_status | 64 | acpi_status |
66 | acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer) | 65 | acpi_rs_convert_aml_to_resources(u8 * aml, |
66 | u32 length, | ||
67 | u32 offset, | ||
68 | u8 resource_index, void **resource_ptr) | ||
67 | { | 69 | { |
68 | struct acpi_resource *resource = (void *)output_buffer; | 70 | struct acpi_resource *resource = *resource_ptr; |
69 | acpi_status status; | 71 | acpi_status status; |
70 | u8 resource_index; | ||
71 | u8 *end_aml; | ||
72 | 72 | ||
73 | ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); | 73 | ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); |
74 | 74 | ||
75 | end_aml = aml + aml_length; | 75 | /* |
76 | 76 | * Check that the input buffer and all subsequent pointers into it | |
77 | /* Loop until end-of-buffer or an end_tag is found */ | 77 | * are aligned on a native word boundary. Most important on IA64 |
78 | 78 | */ | |
79 | while (aml < end_aml) { | 79 | if (ACPI_IS_MISALIGNED(resource)) { |
80 | /* | 80 | ACPI_WARNING((AE_INFO, |
81 | * Check that the input buffer and all subsequent pointers into it | 81 | "Misaligned resource pointer %p", resource)); |
82 | * are aligned on a native word boundary. Most important on IA64 | 82 | } |
83 | */ | ||
84 | if (ACPI_IS_MISALIGNED(resource)) { | ||
85 | ACPI_WARNING((AE_INFO, | ||
86 | "Misaligned resource pointer %p", | ||
87 | resource)); | ||
88 | } | ||
89 | |||
90 | /* Validate the Resource Type and Resource Length */ | ||
91 | |||
92 | status = acpi_ut_validate_resource(aml, &resource_index); | ||
93 | if (ACPI_FAILURE(status)) { | ||
94 | return_ACPI_STATUS(status); | ||
95 | } | ||
96 | |||
97 | /* Convert the AML byte stream resource to a local resource struct */ | ||
98 | |||
99 | status = | ||
100 | acpi_rs_convert_aml_to_resource(resource, | ||
101 | ACPI_CAST_PTR(union | ||
102 | aml_resource, | ||
103 | aml), | ||
104 | acpi_gbl_get_resource_dispatch | ||
105 | [resource_index]); | ||
106 | if (ACPI_FAILURE(status)) { | ||
107 | ACPI_EXCEPTION((AE_INFO, status, | ||
108 | "Could not convert AML resource (Type %X)", | ||
109 | *aml)); | ||
110 | return_ACPI_STATUS(status); | ||
111 | } | ||
112 | |||
113 | ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, | ||
114 | "Type %.2X, Aml %.2X internal %.2X\n", | ||
115 | acpi_ut_get_resource_type(aml), | ||
116 | acpi_ut_get_descriptor_length(aml), | ||
117 | resource->length)); | ||
118 | |||
119 | /* Normal exit on completion of an end_tag resource descriptor */ | ||
120 | |||
121 | if (acpi_ut_get_resource_type(aml) == | ||
122 | ACPI_RESOURCE_NAME_END_TAG) { | ||
123 | return_ACPI_STATUS(AE_OK); | ||
124 | } | ||
125 | |||
126 | /* Point to the next input AML resource */ | ||
127 | |||
128 | aml += acpi_ut_get_descriptor_length(aml); | ||
129 | |||
130 | /* Point to the next structure in the output buffer */ | ||
131 | 83 | ||
132 | resource = | 84 | /* Convert the AML byte stream resource to a local resource struct */ |
133 | ACPI_ADD_PTR(struct acpi_resource, resource, | 85 | |
134 | resource->length); | 86 | status = |
87 | acpi_rs_convert_aml_to_resource(resource, | ||
88 | ACPI_CAST_PTR(union aml_resource, | ||
89 | aml), | ||
90 | acpi_gbl_get_resource_dispatch | ||
91 | [resource_index]); | ||
92 | if (ACPI_FAILURE(status)) { | ||
93 | ACPI_EXCEPTION((AE_INFO, status, | ||
94 | "Could not convert AML resource (Type %X)", | ||
95 | *aml)); | ||
96 | return_ACPI_STATUS(status); | ||
135 | } | 97 | } |
136 | 98 | ||
137 | /* Did not find an end_tag resource descriptor */ | 99 | ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, |
100 | "Type %.2X, aml_length %.2X internal_length %.2X\n", | ||
101 | acpi_ut_get_resource_type(aml), length, | ||
102 | resource->length)); | ||
138 | 103 | ||
139 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | 104 | /* Point to the next structure in the output buffer */ |
105 | |||
106 | *resource_ptr = ACPI_ADD_PTR(void, resource, resource->length); | ||
107 | return_ACPI_STATUS(AE_OK); | ||
140 | } | 108 | } |
141 | 109 | ||
142 | /******************************************************************************* | 110 | /******************************************************************************* |
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index b3feebbd8ca2..1d00d285a5a3 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c | |||
@@ -242,7 +242,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_possible_resources) | |||
242 | acpi_status | 242 | acpi_status |
243 | acpi_walk_resources(acpi_handle device_handle, | 243 | acpi_walk_resources(acpi_handle device_handle, |
244 | char *name, | 244 | char *name, |
245 | ACPI_WALK_RESOURCE_CALLBACK user_function, void *context) | 245 | acpi_walk_resource_callback user_function, void *context) |
246 | { | 246 | { |
247 | acpi_status status; | 247 | acpi_status status; |
248 | struct acpi_buffer buffer; | 248 | struct acpi_buffer buffer; |
@@ -469,7 +469,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_vendor_resource) | |||
469 | * | 469 | * |
470 | * FUNCTION: acpi_rs_match_vendor_resource | 470 | * FUNCTION: acpi_rs_match_vendor_resource |
471 | * | 471 | * |
472 | * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK | 472 | * PARAMETERS: acpi_walk_resource_callback |
473 | * | 473 | * |
474 | * RETURN: Status | 474 | * RETURN: Status |
475 | * | 475 | * |
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 7b35eb84d058..3b29aecaaca5 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
@@ -46,24 +46,6 @@ | |||
46 | #define _COMPONENT ACPI_UTILITIES | 46 | #define _COMPONENT ACPI_UTILITIES |
47 | ACPI_MODULE_NAME("utalloc") | 47 | ACPI_MODULE_NAME("utalloc") |
48 | 48 | ||
49 | /* Local prototypes */ | ||
50 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
51 | static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); | ||
52 | |||
53 | static acpi_status | ||
54 | acpi_ut_track_allocation(struct acpi_debug_mem_block *address, | ||
55 | acpi_size size, | ||
56 | u8 alloc_type, u32 component, char *module, u32 line); | ||
57 | |||
58 | static acpi_status | ||
59 | acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, | ||
60 | u32 component, char *module, u32 line); | ||
61 | |||
62 | static acpi_status | ||
63 | acpi_ut_create_list(char *list_name, | ||
64 | u16 object_size, struct acpi_memory_list **return_cache); | ||
65 | #endif | ||
66 | |||
67 | /******************************************************************************* | 49 | /******************************************************************************* |
68 | * | 50 | * |
69 | * FUNCTION: acpi_ut_create_caches | 51 | * FUNCTION: acpi_ut_create_caches |
@@ -75,7 +57,6 @@ acpi_ut_create_list(char *list_name, | |||
75 | * DESCRIPTION: Create all local caches | 57 | * DESCRIPTION: Create all local caches |
76 | * | 58 | * |
77 | ******************************************************************************/ | 59 | ******************************************************************************/ |
78 | |||
79 | acpi_status acpi_ut_create_caches(void) | 60 | acpi_status acpi_ut_create_caches(void) |
80 | { | 61 | { |
81 | acpi_status status; | 62 | acpi_status status; |
@@ -101,7 +82,16 @@ acpi_status acpi_ut_create_caches(void) | |||
101 | /* Object Caches, for frequently used objects */ | 82 | /* Object Caches, for frequently used objects */ |
102 | 83 | ||
103 | status = | 84 | status = |
104 | acpi_os_create_cache("acpi_state", sizeof(union acpi_generic_state), | 85 | acpi_os_create_cache("Acpi-Namespace", |
86 | sizeof(struct acpi_namespace_node), | ||
87 | ACPI_MAX_NAMESPACE_CACHE_DEPTH, | ||
88 | &acpi_gbl_namespace_cache); | ||
89 | if (ACPI_FAILURE(status)) { | ||
90 | return (status); | ||
91 | } | ||
92 | |||
93 | status = | ||
94 | acpi_os_create_cache("Acpi-State", sizeof(union acpi_generic_state), | ||
105 | ACPI_MAX_STATE_CACHE_DEPTH, | 95 | ACPI_MAX_STATE_CACHE_DEPTH, |
106 | &acpi_gbl_state_cache); | 96 | &acpi_gbl_state_cache); |
107 | if (ACPI_FAILURE(status)) { | 97 | if (ACPI_FAILURE(status)) { |
@@ -109,7 +99,7 @@ acpi_status acpi_ut_create_caches(void) | |||
109 | } | 99 | } |
110 | 100 | ||
111 | status = | 101 | status = |
112 | acpi_os_create_cache("acpi_parse", | 102 | acpi_os_create_cache("Acpi-Parse", |
113 | sizeof(struct acpi_parse_obj_common), | 103 | sizeof(struct acpi_parse_obj_common), |
114 | ACPI_MAX_PARSE_CACHE_DEPTH, | 104 | ACPI_MAX_PARSE_CACHE_DEPTH, |
115 | &acpi_gbl_ps_node_cache); | 105 | &acpi_gbl_ps_node_cache); |
@@ -118,7 +108,7 @@ acpi_status acpi_ut_create_caches(void) | |||
118 | } | 108 | } |
119 | 109 | ||
120 | status = | 110 | status = |
121 | acpi_os_create_cache("acpi_parse_ext", | 111 | acpi_os_create_cache("Acpi-parse_ext", |
122 | sizeof(struct acpi_parse_obj_named), | 112 | sizeof(struct acpi_parse_obj_named), |
123 | ACPI_MAX_EXTPARSE_CACHE_DEPTH, | 113 | ACPI_MAX_EXTPARSE_CACHE_DEPTH, |
124 | &acpi_gbl_ps_node_ext_cache); | 114 | &acpi_gbl_ps_node_ext_cache); |
@@ -127,7 +117,7 @@ acpi_status acpi_ut_create_caches(void) | |||
127 | } | 117 | } |
128 | 118 | ||
129 | status = | 119 | status = |
130 | acpi_os_create_cache("acpi_operand", | 120 | acpi_os_create_cache("Acpi-Operand", |
131 | sizeof(union acpi_operand_object), | 121 | sizeof(union acpi_operand_object), |
132 | ACPI_MAX_OBJECT_CACHE_DEPTH, | 122 | ACPI_MAX_OBJECT_CACHE_DEPTH, |
133 | &acpi_gbl_operand_cache); | 123 | &acpi_gbl_operand_cache); |
@@ -153,6 +143,9 @@ acpi_status acpi_ut_create_caches(void) | |||
153 | acpi_status acpi_ut_delete_caches(void) | 143 | acpi_status acpi_ut_delete_caches(void) |
154 | { | 144 | { |
155 | 145 | ||
146 | (void)acpi_os_delete_cache(acpi_gbl_namespace_cache); | ||
147 | acpi_gbl_namespace_cache = NULL; | ||
148 | |||
156 | (void)acpi_os_delete_cache(acpi_gbl_state_cache); | 149 | (void)acpi_os_delete_cache(acpi_gbl_state_cache); |
157 | acpi_gbl_state_cache = NULL; | 150 | acpi_gbl_state_cache = NULL; |
158 | 151 | ||
@@ -288,7 +281,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, | |||
288 | * | 281 | * |
289 | * RETURN: Address of the allocated memory on success, NULL on failure. | 282 | * RETURN: Address of the allocated memory on success, NULL on failure. |
290 | * | 283 | * |
291 | * DESCRIPTION: The subsystem's equivalent of malloc. | 284 | * DESCRIPTION: Subsystem equivalent of malloc. |
292 | * | 285 | * |
293 | ******************************************************************************/ | 286 | ******************************************************************************/ |
294 | 287 | ||
@@ -301,8 +294,8 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | |||
301 | /* Check for an inadvertent size of zero bytes */ | 294 | /* Check for an inadvertent size of zero bytes */ |
302 | 295 | ||
303 | if (!size) { | 296 | if (!size) { |
304 | ACPI_ERROR((module, line, | 297 | ACPI_WARNING((module, line, |
305 | "ut_allocate: Attempt to allocate zero bytes, allocating 1 byte")); | 298 | "Attempt to allocate zero bytes, allocating 1 byte")); |
306 | size = 1; | 299 | size = 1; |
307 | } | 300 | } |
308 | 301 | ||
@@ -311,9 +304,8 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | |||
311 | 304 | ||
312 | /* Report allocation error */ | 305 | /* Report allocation error */ |
313 | 306 | ||
314 | ACPI_ERROR((module, line, | 307 | ACPI_WARNING((module, line, |
315 | "ut_allocate: Could not allocate size %X", | 308 | "Could not allocate size %X", (u32) size)); |
316 | (u32) size)); | ||
317 | 309 | ||
318 | return_PTR(NULL); | 310 | return_PTR(NULL); |
319 | } | 311 | } |
@@ -323,7 +315,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | |||
323 | 315 | ||
324 | /******************************************************************************* | 316 | /******************************************************************************* |
325 | * | 317 | * |
326 | * FUNCTION: acpi_ut_callocate | 318 | * FUNCTION: acpi_ut_allocate_zeroed |
327 | * | 319 | * |
328 | * PARAMETERS: Size - Size of the allocation | 320 | * PARAMETERS: Size - Size of the allocation |
329 | * Component - Component type of caller | 321 | * Component - Component type of caller |
@@ -332,546 +324,24 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | |||
332 | * | 324 | * |
333 | * RETURN: Address of the allocated memory on success, NULL on failure. | 325 | * RETURN: Address of the allocated memory on success, NULL on failure. |
334 | * | 326 | * |
335 | * DESCRIPTION: Subsystem equivalent of calloc. | 327 | * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory. |
336 | * | 328 | * |
337 | ******************************************************************************/ | 329 | ******************************************************************************/ |
338 | 330 | ||
339 | void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) | 331 | void *acpi_ut_allocate_zeroed(acpi_size size, |
332 | u32 component, char *module, u32 line) | ||
340 | { | 333 | { |
341 | void *allocation; | 334 | void *allocation; |
342 | 335 | ||
343 | ACPI_FUNCTION_TRACE_U32("ut_callocate", size); | ||
344 | |||
345 | /* Check for an inadvertent size of zero bytes */ | ||
346 | |||
347 | if (!size) { | ||
348 | ACPI_ERROR((module, line, | ||
349 | "Attempt to allocate zero bytes, allocating 1 byte")); | ||
350 | size = 1; | ||
351 | } | ||
352 | |||
353 | allocation = acpi_os_allocate(size); | ||
354 | if (!allocation) { | ||
355 | |||
356 | /* Report allocation error */ | ||
357 | |||
358 | ACPI_ERROR((module, line, | ||
359 | "Could not allocate size %X", (u32) size)); | ||
360 | return_PTR(NULL); | ||
361 | } | ||
362 | |||
363 | /* Clear the memory block */ | ||
364 | |||
365 | ACPI_MEMSET(allocation, 0, size); | ||
366 | return_PTR(allocation); | ||
367 | } | ||
368 | |||
369 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
370 | /* | ||
371 | * These procedures are used for tracking memory leaks in the subsystem, and | ||
372 | * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set. | ||
373 | * | ||
374 | * Each memory allocation is tracked via a doubly linked list. Each | ||
375 | * element contains the caller's component, module name, function name, and | ||
376 | * line number. acpi_ut_allocate and acpi_ut_callocate call | ||
377 | * acpi_ut_track_allocation to add an element to the list; deletion | ||
378 | * occurs in the body of acpi_ut_free. | ||
379 | */ | ||
380 | |||
381 | /******************************************************************************* | ||
382 | * | ||
383 | * FUNCTION: acpi_ut_create_list | ||
384 | * | ||
385 | * PARAMETERS: cache_name - Ascii name for the cache | ||
386 | * object_size - Size of each cached object | ||
387 | * return_cache - Where the new cache object is returned | ||
388 | * | ||
389 | * RETURN: Status | ||
390 | * | ||
391 | * DESCRIPTION: Create a local memory list for tracking purposed | ||
392 | * | ||
393 | ******************************************************************************/ | ||
394 | |||
395 | static acpi_status | ||
396 | acpi_ut_create_list(char *list_name, | ||
397 | u16 object_size, struct acpi_memory_list **return_cache) | ||
398 | { | ||
399 | struct acpi_memory_list *cache; | ||
400 | |||
401 | cache = acpi_os_allocate(sizeof(struct acpi_memory_list)); | ||
402 | if (!cache) { | ||
403 | return (AE_NO_MEMORY); | ||
404 | } | ||
405 | |||
406 | ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); | ||
407 | |||
408 | cache->list_name = list_name; | ||
409 | cache->object_size = object_size; | ||
410 | |||
411 | *return_cache = cache; | ||
412 | return (AE_OK); | ||
413 | } | ||
414 | |||
415 | /******************************************************************************* | ||
416 | * | ||
417 | * FUNCTION: acpi_ut_allocate_and_track | ||
418 | * | ||
419 | * PARAMETERS: Size - Size of the allocation | ||
420 | * Component - Component type of caller | ||
421 | * Module - Source file name of caller | ||
422 | * Line - Line number of caller | ||
423 | * | ||
424 | * RETURN: Address of the allocated memory on success, NULL on failure. | ||
425 | * | ||
426 | * DESCRIPTION: The subsystem's equivalent of malloc. | ||
427 | * | ||
428 | ******************************************************************************/ | ||
429 | |||
430 | void *acpi_ut_allocate_and_track(acpi_size size, | ||
431 | u32 component, char *module, u32 line) | ||
432 | { | ||
433 | struct acpi_debug_mem_block *allocation; | ||
434 | acpi_status status; | ||
435 | |||
436 | allocation = | ||
437 | acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header), | ||
438 | component, module, line); | ||
439 | if (!allocation) { | ||
440 | return (NULL); | ||
441 | } | ||
442 | |||
443 | status = acpi_ut_track_allocation(allocation, size, | ||
444 | ACPI_MEM_MALLOC, component, module, | ||
445 | line); | ||
446 | if (ACPI_FAILURE(status)) { | ||
447 | acpi_os_free(allocation); | ||
448 | return (NULL); | ||
449 | } | ||
450 | |||
451 | acpi_gbl_global_list->total_allocated++; | ||
452 | acpi_gbl_global_list->current_total_size += (u32) size; | ||
453 | |||
454 | return ((void *)&allocation->user_space); | ||
455 | } | ||
456 | |||
457 | /******************************************************************************* | ||
458 | * | ||
459 | * FUNCTION: acpi_ut_callocate_and_track | ||
460 | * | ||
461 | * PARAMETERS: Size - Size of the allocation | ||
462 | * Component - Component type of caller | ||
463 | * Module - Source file name of caller | ||
464 | * Line - Line number of caller | ||
465 | * | ||
466 | * RETURN: Address of the allocated memory on success, NULL on failure. | ||
467 | * | ||
468 | * DESCRIPTION: Subsystem equivalent of calloc. | ||
469 | * | ||
470 | ******************************************************************************/ | ||
471 | |||
472 | void *acpi_ut_callocate_and_track(acpi_size size, | ||
473 | u32 component, char *module, u32 line) | ||
474 | { | ||
475 | struct acpi_debug_mem_block *allocation; | ||
476 | acpi_status status; | ||
477 | |||
478 | allocation = | ||
479 | acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header), | ||
480 | component, module, line); | ||
481 | if (!allocation) { | ||
482 | |||
483 | /* Report allocation error */ | ||
484 | |||
485 | ACPI_ERROR((module, line, | ||
486 | "Could not allocate size %X", (u32) size)); | ||
487 | return (NULL); | ||
488 | } | ||
489 | |||
490 | status = acpi_ut_track_allocation(allocation, size, | ||
491 | ACPI_MEM_CALLOC, component, module, | ||
492 | line); | ||
493 | if (ACPI_FAILURE(status)) { | ||
494 | acpi_os_free(allocation); | ||
495 | return (NULL); | ||
496 | } | ||
497 | |||
498 | acpi_gbl_global_list->total_allocated++; | ||
499 | acpi_gbl_global_list->current_total_size += (u32) size; | ||
500 | |||
501 | return ((void *)&allocation->user_space); | ||
502 | } | ||
503 | |||
504 | /******************************************************************************* | ||
505 | * | ||
506 | * FUNCTION: acpi_ut_free_and_track | ||
507 | * | ||
508 | * PARAMETERS: Allocation - Address of the memory to deallocate | ||
509 | * Component - Component type of caller | ||
510 | * Module - Source file name of caller | ||
511 | * Line - Line number of caller | ||
512 | * | ||
513 | * RETURN: None | ||
514 | * | ||
515 | * DESCRIPTION: Frees the memory at Allocation | ||
516 | * | ||
517 | ******************************************************************************/ | ||
518 | |||
519 | void | ||
520 | acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line) | ||
521 | { | ||
522 | struct acpi_debug_mem_block *debug_block; | ||
523 | acpi_status status; | ||
524 | |||
525 | ACPI_FUNCTION_TRACE_PTR("ut_free", allocation); | ||
526 | |||
527 | if (NULL == allocation) { | ||
528 | ACPI_ERROR((module, line, "Attempt to delete a NULL address")); | ||
529 | |||
530 | return_VOID; | ||
531 | } | ||
532 | |||
533 | debug_block = ACPI_CAST_PTR(struct acpi_debug_mem_block, | ||
534 | (((char *)allocation) - | ||
535 | sizeof(struct acpi_debug_mem_header))); | ||
536 | |||
537 | acpi_gbl_global_list->total_freed++; | ||
538 | acpi_gbl_global_list->current_total_size -= debug_block->size; | ||
539 | |||
540 | status = acpi_ut_remove_allocation(debug_block, | ||
541 | component, module, line); | ||
542 | if (ACPI_FAILURE(status)) { | ||
543 | ACPI_EXCEPTION((AE_INFO, status, "Could not free memory")); | ||
544 | } | ||
545 | |||
546 | acpi_os_free(debug_block); | ||
547 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation)); | ||
548 | return_VOID; | ||
549 | } | ||
550 | |||
551 | /******************************************************************************* | ||
552 | * | ||
553 | * FUNCTION: acpi_ut_find_allocation | ||
554 | * | ||
555 | * PARAMETERS: Allocation - Address of allocated memory | ||
556 | * | ||
557 | * RETURN: A list element if found; NULL otherwise. | ||
558 | * | ||
559 | * DESCRIPTION: Searches for an element in the global allocation tracking list. | ||
560 | * | ||
561 | ******************************************************************************/ | ||
562 | |||
563 | static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation) | ||
564 | { | ||
565 | struct acpi_debug_mem_block *element; | ||
566 | |||
567 | ACPI_FUNCTION_ENTRY(); | 336 | ACPI_FUNCTION_ENTRY(); |
568 | 337 | ||
569 | element = acpi_gbl_global_list->list_head; | 338 | allocation = acpi_ut_allocate(size, component, module, line); |
570 | 339 | if (allocation) { | |
571 | /* Search for the address. */ | ||
572 | |||
573 | while (element) { | ||
574 | if (element == allocation) { | ||
575 | return (element); | ||
576 | } | ||
577 | |||
578 | element = element->next; | ||
579 | } | ||
580 | |||
581 | return (NULL); | ||
582 | } | ||
583 | |||
584 | /******************************************************************************* | ||
585 | * | ||
586 | * FUNCTION: acpi_ut_track_allocation | ||
587 | * | ||
588 | * PARAMETERS: Allocation - Address of allocated memory | ||
589 | * Size - Size of the allocation | ||
590 | * alloc_type - MEM_MALLOC or MEM_CALLOC | ||
591 | * Component - Component type of caller | ||
592 | * Module - Source file name of caller | ||
593 | * Line - Line number of caller | ||
594 | * | ||
595 | * RETURN: None. | ||
596 | * | ||
597 | * DESCRIPTION: Inserts an element into the global allocation tracking list. | ||
598 | * | ||
599 | ******************************************************************************/ | ||
600 | |||
601 | static acpi_status | ||
602 | acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation, | ||
603 | acpi_size size, | ||
604 | u8 alloc_type, u32 component, char *module, u32 line) | ||
605 | { | ||
606 | struct acpi_memory_list *mem_list; | ||
607 | struct acpi_debug_mem_block *element; | ||
608 | acpi_status status = AE_OK; | ||
609 | |||
610 | ACPI_FUNCTION_TRACE_PTR("ut_track_allocation", allocation); | ||
611 | |||
612 | mem_list = acpi_gbl_global_list; | ||
613 | status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); | ||
614 | if (ACPI_FAILURE(status)) { | ||
615 | return_ACPI_STATUS(status); | ||
616 | } | ||
617 | |||
618 | /* | ||
619 | * Search list for this address to make sure it is not already on the list. | ||
620 | * This will catch several kinds of problems. | ||
621 | */ | ||
622 | element = acpi_ut_find_allocation(allocation); | ||
623 | if (element) { | ||
624 | ACPI_ERROR((AE_INFO, | ||
625 | "ut_track_allocation: Allocation already present in list! (%p)", | ||
626 | allocation)); | ||
627 | 340 | ||
628 | ACPI_ERROR((AE_INFO, "Element %p Address %p", | 341 | /* Clear the memory block */ |
629 | element, allocation)); | ||
630 | 342 | ||
631 | goto unlock_and_exit; | 343 | ACPI_MEMSET(allocation, 0, size); |
632 | } | 344 | } |
633 | 345 | ||
634 | /* Fill in the instance data. */ | 346 | return (allocation); |
635 | |||
636 | allocation->size = (u32) size; | ||
637 | allocation->alloc_type = alloc_type; | ||
638 | allocation->component = component; | ||
639 | allocation->line = line; | ||
640 | |||
641 | ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME); | ||
642 | allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0; | ||
643 | |||
644 | /* Insert at list head */ | ||
645 | |||
646 | if (mem_list->list_head) { | ||
647 | ((struct acpi_debug_mem_block *)(mem_list->list_head))-> | ||
648 | previous = allocation; | ||
649 | } | ||
650 | |||
651 | allocation->next = mem_list->list_head; | ||
652 | allocation->previous = NULL; | ||
653 | |||
654 | mem_list->list_head = allocation; | ||
655 | |||
656 | unlock_and_exit: | ||
657 | status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); | ||
658 | return_ACPI_STATUS(status); | ||
659 | } | 347 | } |
660 | |||
661 | /******************************************************************************* | ||
662 | * | ||
663 | * FUNCTION: acpi_ut_remove_allocation | ||
664 | * | ||
665 | * PARAMETERS: Allocation - Address of allocated memory | ||
666 | * Component - Component type of caller | ||
667 | * Module - Source file name of caller | ||
668 | * Line - Line number of caller | ||
669 | * | ||
670 | * RETURN: | ||
671 | * | ||
672 | * DESCRIPTION: Deletes an element from the global allocation tracking list. | ||
673 | * | ||
674 | ******************************************************************************/ | ||
675 | |||
676 | static acpi_status | ||
677 | acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, | ||
678 | u32 component, char *module, u32 line) | ||
679 | { | ||
680 | struct acpi_memory_list *mem_list; | ||
681 | acpi_status status; | ||
682 | |||
683 | ACPI_FUNCTION_TRACE("ut_remove_allocation"); | ||
684 | |||
685 | mem_list = acpi_gbl_global_list; | ||
686 | if (NULL == mem_list->list_head) { | ||
687 | |||
688 | /* No allocations! */ | ||
689 | |||
690 | ACPI_ERROR((module, line, | ||
691 | "Empty allocation list, nothing to free!")); | ||
692 | |||
693 | return_ACPI_STATUS(AE_OK); | ||
694 | } | ||
695 | |||
696 | status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); | ||
697 | if (ACPI_FAILURE(status)) { | ||
698 | return_ACPI_STATUS(status); | ||
699 | } | ||
700 | |||
701 | /* Unlink */ | ||
702 | |||
703 | if (allocation->previous) { | ||
704 | (allocation->previous)->next = allocation->next; | ||
705 | } else { | ||
706 | mem_list->list_head = allocation->next; | ||
707 | } | ||
708 | |||
709 | if (allocation->next) { | ||
710 | (allocation->next)->previous = allocation->previous; | ||
711 | } | ||
712 | |||
713 | /* Mark the segment as deleted */ | ||
714 | |||
715 | ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size); | ||
716 | |||
717 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", | ||
718 | allocation->size)); | ||
719 | |||
720 | status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); | ||
721 | return_ACPI_STATUS(status); | ||
722 | } | ||
723 | |||
724 | /******************************************************************************* | ||
725 | * | ||
726 | * FUNCTION: acpi_ut_dump_allocation_info | ||
727 | * | ||
728 | * PARAMETERS: | ||
729 | * | ||
730 | * RETURN: None | ||
731 | * | ||
732 | * DESCRIPTION: Print some info about the outstanding allocations. | ||
733 | * | ||
734 | ******************************************************************************/ | ||
735 | |||
736 | #ifdef ACPI_FUTURE_USAGE | ||
737 | void acpi_ut_dump_allocation_info(void) | ||
738 | { | ||
739 | /* | ||
740 | struct acpi_memory_list *mem_list; | ||
741 | */ | ||
742 | |||
743 | ACPI_FUNCTION_TRACE("ut_dump_allocation_info"); | ||
744 | |||
745 | /* | ||
746 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
747 | ("%30s: %4d (%3d Kb)\n", "Current allocations", | ||
748 | mem_list->current_count, | ||
749 | ROUND_UP_TO_1K (mem_list->current_size))); | ||
750 | |||
751 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
752 | ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", | ||
753 | mem_list->max_concurrent_count, | ||
754 | ROUND_UP_TO_1K (mem_list->max_concurrent_size))); | ||
755 | |||
756 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
757 | ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", | ||
758 | running_object_count, | ||
759 | ROUND_UP_TO_1K (running_object_size))); | ||
760 | |||
761 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
762 | ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", | ||
763 | running_alloc_count, | ||
764 | ROUND_UP_TO_1K (running_alloc_size))); | ||
765 | |||
766 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
767 | ("%30s: %4d (%3d Kb)\n", "Current Nodes", | ||
768 | acpi_gbl_current_node_count, | ||
769 | ROUND_UP_TO_1K (acpi_gbl_current_node_size))); | ||
770 | |||
771 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
772 | ("%30s: %4d (%3d Kb)\n", "Max Nodes", | ||
773 | acpi_gbl_max_concurrent_node_count, | ||
774 | ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * | ||
775 | sizeof (struct acpi_namespace_node))))); | ||
776 | */ | ||
777 | return_VOID; | ||
778 | } | ||
779 | #endif /* ACPI_FUTURE_USAGE */ | ||
780 | |||
781 | /******************************************************************************* | ||
782 | * | ||
783 | * FUNCTION: acpi_ut_dump_allocations | ||
784 | * | ||
785 | * PARAMETERS: Component - Component(s) to dump info for. | ||
786 | * Module - Module to dump info for. NULL means all. | ||
787 | * | ||
788 | * RETURN: None | ||
789 | * | ||
790 | * DESCRIPTION: Print a list of all outstanding allocations. | ||
791 | * | ||
792 | ******************************************************************************/ | ||
793 | |||
794 | void acpi_ut_dump_allocations(u32 component, char *module) | ||
795 | { | ||
796 | struct acpi_debug_mem_block *element; | ||
797 | union acpi_descriptor *descriptor; | ||
798 | u32 num_outstanding = 0; | ||
799 | |||
800 | ACPI_FUNCTION_TRACE("ut_dump_allocations"); | ||
801 | |||
802 | /* | ||
803 | * Walk the allocation list. | ||
804 | */ | ||
805 | if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_MEMORY))) { | ||
806 | return; | ||
807 | } | ||
808 | |||
809 | element = acpi_gbl_global_list->list_head; | ||
810 | while (element) { | ||
811 | if ((element->component & component) && | ||
812 | ((module == NULL) | ||
813 | || (0 == ACPI_STRCMP(module, element->module)))) { | ||
814 | |||
815 | /* Ignore allocated objects that are in a cache */ | ||
816 | |||
817 | descriptor = | ||
818 | ACPI_CAST_PTR(union acpi_descriptor, | ||
819 | &element->user_space); | ||
820 | if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) { | ||
821 | acpi_os_printf("%p Len %04X %9.9s-%d [%s] ", | ||
822 | descriptor, element->size, | ||
823 | element->module, element->line, | ||
824 | acpi_ut_get_descriptor_name | ||
825 | (descriptor)); | ||
826 | |||
827 | /* Most of the elements will be Operand objects. */ | ||
828 | |||
829 | switch (ACPI_GET_DESCRIPTOR_TYPE(descriptor)) { | ||
830 | case ACPI_DESC_TYPE_OPERAND: | ||
831 | acpi_os_printf("%12.12s R%hd", | ||
832 | acpi_ut_get_type_name | ||
833 | (descriptor->object. | ||
834 | common.type), | ||
835 | descriptor->object. | ||
836 | common.reference_count); | ||
837 | break; | ||
838 | |||
839 | case ACPI_DESC_TYPE_PARSER: | ||
840 | acpi_os_printf("aml_opcode %04hX", | ||
841 | descriptor->op.asl. | ||
842 | aml_opcode); | ||
843 | break; | ||
844 | |||
845 | case ACPI_DESC_TYPE_NAMED: | ||
846 | acpi_os_printf("%4.4s", | ||
847 | acpi_ut_get_node_name | ||
848 | (&descriptor->node)); | ||
849 | break; | ||
850 | |||
851 | default: | ||
852 | break; | ||
853 | } | ||
854 | |||
855 | acpi_os_printf("\n"); | ||
856 | num_outstanding++; | ||
857 | } | ||
858 | } | ||
859 | element = element->next; | ||
860 | } | ||
861 | |||
862 | (void)acpi_ut_release_mutex(ACPI_MTX_MEMORY); | ||
863 | |||
864 | /* Print summary */ | ||
865 | |||
866 | if (!num_outstanding) { | ||
867 | ACPI_INFO((AE_INFO, "No outstanding allocations")); | ||
868 | } else { | ||
869 | ACPI_ERROR((AE_INFO, | ||
870 | "%d(%X) Outstanding allocations", | ||
871 | num_outstanding, num_outstanding)); | ||
872 | } | ||
873 | |||
874 | return_VOID; | ||
875 | } | ||
876 | |||
877 | #endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ | ||
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c index 5d2f4b2802a5..593b08ccd6bf 100644 --- a/drivers/acpi/utilities/utcache.c +++ b/drivers/acpi/utilities/utcache.c | |||
@@ -272,9 +272,9 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
272 | cache->current_depth--; | 272 | cache->current_depth--; |
273 | 273 | ||
274 | ACPI_MEM_TRACKING(cache->hits++); | 274 | ACPI_MEM_TRACKING(cache->hits++); |
275 | ACPI_MEM_TRACKING(ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 275 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
276 | "Object %p from %s cache\n", | 276 | "Object %p from %s cache\n", object, |
277 | object, cache->list_name))); | 277 | cache->list_name)); |
278 | 278 | ||
279 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); | 279 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); |
280 | if (ACPI_FAILURE(status)) { | 280 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 9c6867fcf009..51356e8eb999 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c | |||
@@ -200,8 +200,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
200 | */ | 200 | */ |
201 | handler_desc = object->region.handler; | 201 | handler_desc = object->region.handler; |
202 | if (handler_desc) { | 202 | if (handler_desc) { |
203 | if (handler_desc->address_space. | 203 | if (handler_desc->address_space.handler_flags & |
204 | hflags & | ||
205 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { | 204 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { |
206 | obj_pointer = | 205 | obj_pointer = |
207 | second_desc->extra.region_context; | 206 | second_desc->extra.region_context; |
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 5bc8da7acc6c..8a05bb5ef4fe 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c | |||
@@ -191,12 +191,14 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = { | |||
191 | "Linux", | 191 | "Linux", |
192 | "Windows 2000", | 192 | "Windows 2000", |
193 | "Windows 2001", | 193 | "Windows 2001", |
194 | "Windows 2001.1", | ||
195 | "Windows 2001 SP0", | 194 | "Windows 2001 SP0", |
196 | "Windows 2001 SP1", | 195 | "Windows 2001 SP1", |
197 | "Windows 2001 SP2", | 196 | "Windows 2001 SP2", |
198 | "Windows 2001 SP3", | 197 | "Windows 2001 SP3", |
199 | "Windows 2001 SP4", | 198 | "Windows 2001 SP4", |
199 | "Windows 2001.1", | ||
200 | "Windows 2001.1 SP1", /* Added 03/2006 */ | ||
201 | "Windows 2006", /* Added 03/2006 */ | ||
200 | 202 | ||
201 | /* Feature Group Strings */ | 203 | /* Feature Group Strings */ |
202 | 204 | ||
@@ -633,7 +635,7 @@ char *acpi_ut_get_node_name(void *object) | |||
633 | 635 | ||
634 | /* Descriptor must be a namespace node */ | 636 | /* Descriptor must be a namespace node */ |
635 | 637 | ||
636 | if (node->descriptor != ACPI_DESC_TYPE_NAMED) { | 638 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { |
637 | return ("####"); | 639 | return ("####"); |
638 | } | 640 | } |
639 | 641 | ||
@@ -855,7 +857,7 @@ void acpi_ut_init_globals(void) | |||
855 | 857 | ||
856 | acpi_gbl_root_node = NULL; | 858 | acpi_gbl_root_node = NULL; |
857 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; | 859 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; |
858 | acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED; | 860 | acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; |
859 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; | 861 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; |
860 | acpi_gbl_root_node_struct.child = NULL; | 862 | acpi_gbl_root_node_struct.child = NULL; |
861 | acpi_gbl_root_node_struct.peer = NULL; | 863 | acpi_gbl_root_node_struct.peer = NULL; |
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 77268ba86291..017a87ebc40b 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -881,36 +881,3 @@ acpi_ut_info(char *module_name, u32 line_number, char *format, ...) | |||
881 | acpi_os_vprintf(format, args); | 881 | acpi_os_vprintf(format, args); |
882 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); | 882 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); |
883 | } | 883 | } |
884 | |||
885 | /******************************************************************************* | ||
886 | * | ||
887 | * FUNCTION: acpi_ut_report_error, Warning, Info | ||
888 | * | ||
889 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
890 | * line_number - Caller's line number (for error output) | ||
891 | * | ||
892 | * RETURN: None | ||
893 | * | ||
894 | * DESCRIPTION: Print error message | ||
895 | * | ||
896 | * Note: Legacy only, should be removed when no longer used by drivers. | ||
897 | * | ||
898 | ******************************************************************************/ | ||
899 | |||
900 | void acpi_ut_report_error(char *module_name, u32 line_number) | ||
901 | { | ||
902 | |||
903 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); | ||
904 | } | ||
905 | |||
906 | void acpi_ut_report_warning(char *module_name, u32 line_number) | ||
907 | { | ||
908 | |||
909 | acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number); | ||
910 | } | ||
911 | |||
912 | void acpi_ut_report_info(char *module_name, u32 line_number) | ||
913 | { | ||
914 | |||
915 | acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number); | ||
916 | } | ||
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index 27158dd0f877..4c24e6d5400a 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c | |||
@@ -240,6 +240,104 @@ static const u8 acpi_gbl_resource_types[] = { | |||
240 | 240 | ||
241 | /******************************************************************************* | 241 | /******************************************************************************* |
242 | * | 242 | * |
243 | * FUNCTION: acpi_ut_walk_aml_resources | ||
244 | * | ||
245 | * PARAMETERS: Aml - Pointer to the raw AML resource template | ||
246 | * aml_length - Length of the entire template | ||
247 | * user_function - Called once for each descriptor found. If | ||
248 | * NULL, a pointer to the end_tag is returned | ||
249 | * Context - Passed to user_function | ||
250 | * | ||
251 | * RETURN: Status | ||
252 | * | ||
253 | * DESCRIPTION: Walk a raw AML resource list(buffer). User function called | ||
254 | * once for each resource found. | ||
255 | * | ||
256 | ******************************************************************************/ | ||
257 | |||
258 | acpi_status | ||
259 | acpi_ut_walk_aml_resources(u8 * aml, | ||
260 | acpi_size aml_length, | ||
261 | acpi_walk_aml_callback user_function, void *context) | ||
262 | { | ||
263 | acpi_status status; | ||
264 | u8 *end_aml; | ||
265 | u8 resource_index; | ||
266 | u32 length; | ||
267 | u32 offset = 0; | ||
268 | |||
269 | ACPI_FUNCTION_TRACE("ut_walk_aml_resources"); | ||
270 | |||
271 | /* The absolute minimum resource template is one end_tag descriptor */ | ||
272 | |||
273 | if (aml_length < sizeof(struct aml_resource_end_tag)) { | ||
274 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | ||
275 | } | ||
276 | |||
277 | /* Point to the end of the resource template buffer */ | ||
278 | |||
279 | end_aml = aml + aml_length; | ||
280 | |||
281 | /* Walk the byte list, abort on any invalid descriptor type or length */ | ||
282 | |||
283 | while (aml < end_aml) { | ||
284 | |||
285 | /* Validate the Resource Type and Resource Length */ | ||
286 | |||
287 | status = acpi_ut_validate_resource(aml, &resource_index); | ||
288 | if (ACPI_FAILURE(status)) { | ||
289 | return_ACPI_STATUS(status); | ||
290 | } | ||
291 | |||
292 | /* Get the length of this descriptor */ | ||
293 | |||
294 | length = acpi_ut_get_descriptor_length(aml); | ||
295 | |||
296 | /* Invoke the user function */ | ||
297 | |||
298 | if (user_function) { | ||
299 | status = | ||
300 | user_function(aml, length, offset, resource_index, | ||
301 | context); | ||
302 | if (ACPI_FAILURE(status)) { | ||
303 | return (status); | ||
304 | } | ||
305 | } | ||
306 | |||
307 | /* An end_tag descriptor terminates this resource template */ | ||
308 | |||
309 | if (acpi_ut_get_resource_type(aml) == | ||
310 | ACPI_RESOURCE_NAME_END_TAG) { | ||
311 | /* | ||
312 | * There must be at least one more byte in the buffer for | ||
313 | * the 2nd byte of the end_tag | ||
314 | */ | ||
315 | if ((aml + 1) >= end_aml) { | ||
316 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | ||
317 | } | ||
318 | |||
319 | /* Return the pointer to the end_tag if requested */ | ||
320 | |||
321 | if (!user_function) { | ||
322 | *(void **)context = aml; | ||
323 | } | ||
324 | |||
325 | /* Normal exit */ | ||
326 | |||
327 | return_ACPI_STATUS(AE_OK); | ||
328 | } | ||
329 | |||
330 | aml += length; | ||
331 | offset += length; | ||
332 | } | ||
333 | |||
334 | /* Did not find an end_tag descriptor */ | ||
335 | |||
336 | return (AE_AML_NO_RESOURCE_END_TAG); | ||
337 | } | ||
338 | |||
339 | /******************************************************************************* | ||
340 | * | ||
243 | * FUNCTION: acpi_ut_validate_resource | 341 | * FUNCTION: acpi_ut_validate_resource |
244 | * | 342 | * |
245 | * PARAMETERS: Aml - Pointer to the raw AML resource descriptor | 343 | * PARAMETERS: Aml - Pointer to the raw AML resource descriptor |
@@ -498,61 +596,21 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, | |||
498 | u8 ** end_tag) | 596 | u8 ** end_tag) |
499 | { | 597 | { |
500 | acpi_status status; | 598 | acpi_status status; |
501 | u8 *aml; | ||
502 | u8 *end_aml; | ||
503 | 599 | ||
504 | ACPI_FUNCTION_TRACE("ut_get_resource_end_tag"); | 600 | ACPI_FUNCTION_TRACE("ut_get_resource_end_tag"); |
505 | 601 | ||
506 | /* Get start and end pointers */ | ||
507 | |||
508 | aml = obj_desc->buffer.pointer; | ||
509 | end_aml = aml + obj_desc->buffer.length; | ||
510 | |||
511 | /* Allow a buffer length of zero */ | 602 | /* Allow a buffer length of zero */ |
512 | 603 | ||
513 | if (!obj_desc->buffer.length) { | 604 | if (!obj_desc->buffer.length) { |
514 | *end_tag = aml; | 605 | *end_tag = obj_desc->buffer.pointer; |
515 | return_ACPI_STATUS(AE_OK); | 606 | return_ACPI_STATUS(AE_OK); |
516 | } | 607 | } |
517 | 608 | ||
518 | /* Walk the resource template, one descriptor per iteration */ | 609 | /* Validate the template and get a pointer to the end_tag */ |
519 | |||
520 | while (aml < end_aml) { | ||
521 | |||
522 | /* Validate the Resource Type and Resource Length */ | ||
523 | |||
524 | status = acpi_ut_validate_resource(aml, NULL); | ||
525 | if (ACPI_FAILURE(status)) { | ||
526 | return_ACPI_STATUS(status); | ||
527 | } | ||
528 | |||
529 | /* end_tag resource indicates the end of the resource template */ | ||
530 | |||
531 | if (acpi_ut_get_resource_type(aml) == | ||
532 | ACPI_RESOURCE_NAME_END_TAG) { | ||
533 | /* | ||
534 | * There must be at least one more byte in the buffer for | ||
535 | * the 2nd byte of the end_tag | ||
536 | */ | ||
537 | if ((aml + 1) >= end_aml) { | ||
538 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | ||
539 | } | ||
540 | |||
541 | /* Return the pointer to the end_tag */ | ||
542 | |||
543 | *end_tag = aml; | ||
544 | return_ACPI_STATUS(AE_OK); | ||
545 | } | ||
546 | |||
547 | /* | ||
548 | * Point to the next resource descriptor in the AML buffer. The | ||
549 | * descriptor length is guaranteed to be non-zero by resource | ||
550 | * validation above. | ||
551 | */ | ||
552 | aml += acpi_ut_get_descriptor_length(aml); | ||
553 | } | ||
554 | 610 | ||
555 | /* Did not find an end_tag resource descriptor */ | 611 | status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer, |
612 | obj_desc->buffer.length, NULL, | ||
613 | end_tag); | ||
556 | 614 | ||
557 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | 615 | return_ACPI_STATUS(status); |
558 | } | 616 | } |
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index 69f2bfdc26ab..637c5f964879 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c | |||
@@ -162,7 +162,7 @@ union acpi_generic_state *acpi_ut_create_generic_state(void) | |||
162 | 162 | ||
163 | /* Initialize */ | 163 | /* Initialize */ |
164 | memset(state, 0, sizeof(union acpi_generic_state)); | 164 | memset(state, 0, sizeof(union acpi_generic_state)); |
165 | state->common.data_type = ACPI_DESC_TYPE_STATE; | 165 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE; |
166 | } | 166 | } |
167 | 167 | ||
168 | return (state); | 168 | return (state); |
@@ -196,7 +196,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void) | |||
196 | 196 | ||
197 | /* Init fields specific to the update struct */ | 197 | /* Init fields specific to the update struct */ |
198 | 198 | ||
199 | state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD; | 199 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD; |
200 | state->thread.thread_id = acpi_os_get_thread_id(); | 200 | state->thread.thread_id = acpi_os_get_thread_id(); |
201 | 201 | ||
202 | return_PTR((struct acpi_thread_state *)state); | 202 | return_PTR((struct acpi_thread_state *)state); |
@@ -233,7 +233,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object | |||
233 | 233 | ||
234 | /* Init fields specific to the update struct */ | 234 | /* Init fields specific to the update struct */ |
235 | 235 | ||
236 | state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE; | 236 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE; |
237 | state->update.object = object; | 237 | state->update.object = object; |
238 | state->update.value = action; | 238 | state->update.value = action; |
239 | 239 | ||
@@ -270,7 +270,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, | |||
270 | 270 | ||
271 | /* Init fields specific to the update struct */ | 271 | /* Init fields specific to the update struct */ |
272 | 272 | ||
273 | state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE; | 273 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_PACKAGE; |
274 | state->pkg.source_object = (union acpi_operand_object *)internal_object; | 274 | state->pkg.source_object = (union acpi_operand_object *)internal_object; |
275 | state->pkg.dest_object = external_object; | 275 | state->pkg.dest_object = external_object; |
276 | state->pkg.index = index; | 276 | state->pkg.index = index; |
@@ -307,7 +307,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void) | |||
307 | 307 | ||
308 | /* Init fields specific to the control struct */ | 308 | /* Init fields specific to the control struct */ |
309 | 309 | ||
310 | state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL; | 310 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL; |
311 | state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; | 311 | state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; |
312 | 312 | ||
313 | return_PTR(state); | 313 | return_PTR(state); |
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index ebe793fc137f..f3acfd9249fc 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h | |||
@@ -63,7 +63,7 @@ | |||
63 | 63 | ||
64 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 64 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
65 | 65 | ||
66 | #define ACPI_CA_VERSION 0x20060310 | 66 | #define ACPI_CA_VERSION 0x20060317 |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * OS name, used for the _OS object. The _OS object is essentially obsolete, | 69 | * OS name, used for the _OS object. The _OS object is essentially obsolete, |
@@ -81,6 +81,7 @@ | |||
81 | #define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ | 81 | #define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ |
82 | #define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ | 82 | #define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ |
83 | #define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ | 83 | #define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ |
84 | #define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */ | ||
84 | 85 | ||
85 | /* | 86 | /* |
86 | * Should the subsystem abort the loading of an ACPI table if the | 87 | * Should the subsystem abort the loading of an ACPI table if the |
@@ -189,7 +190,7 @@ | |||
189 | 190 | ||
190 | /* Number of strings associated with the _OSI reserved method */ | 191 | /* Number of strings associated with the _OSI reserved method */ |
191 | 192 | ||
192 | #define ACPI_NUM_OSI_STRINGS 10 | 193 | #define ACPI_NUM_OSI_STRINGS 12 |
193 | 194 | ||
194 | /****************************************************************************** | 195 | /****************************************************************************** |
195 | * | 196 | * |
diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h index f2717be4fe0d..272bd0480ec7 100644 --- a/include/acpi/acevents.h +++ b/include/acpi/acevents.h | |||
@@ -93,7 +93,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, | |||
93 | */ | 93 | */ |
94 | u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info); | 94 | u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info); |
95 | 95 | ||
96 | acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback); | 96 | acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback); |
97 | 97 | ||
98 | acpi_status | 98 | acpi_status |
99 | acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 99 | acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index 734cc77bf2c7..f9eb5925511f 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h | |||
@@ -203,6 +203,7 @@ ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list; | |||
203 | 203 | ||
204 | /* Object caches */ | 204 | /* Object caches */ |
205 | 205 | ||
206 | ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache; | ||
206 | ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; | 207 | ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; |
207 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; | 208 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; |
208 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; | 209 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; |
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 94fbf96ed3df..5956431784d5 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h | |||
@@ -44,7 +44,10 @@ | |||
44 | #ifndef __ACLOCAL_H__ | 44 | #ifndef __ACLOCAL_H__ |
45 | #define __ACLOCAL_H__ | 45 | #define __ACLOCAL_H__ |
46 | 46 | ||
47 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
48 | |||
47 | #define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ | 49 | #define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ |
50 | #define ACPI_INFINITE_CONCURRENCY 0xFF | ||
48 | 51 | ||
49 | typedef void *acpi_mutex; | 52 | typedef void *acpi_mutex; |
50 | typedef u32 acpi_mutex_handle; | 53 | typedef u32 acpi_mutex_handle; |
@@ -144,6 +147,8 @@ struct acpi_mutex_info { | |||
144 | #define ACPI_FIELD_DWORD_GRANULARITY 4 | 147 | #define ACPI_FIELD_DWORD_GRANULARITY 4 |
145 | #define ACPI_FIELD_QWORD_GRANULARITY 8 | 148 | #define ACPI_FIELD_QWORD_GRANULARITY 8 |
146 | 149 | ||
150 | #define ACPI_ENTRY_NOT_FOUND NULL | ||
151 | |||
147 | /***************************************************************************** | 152 | /***************************************************************************** |
148 | * | 153 | * |
149 | * Namespace typedefs and structs | 154 | * Namespace typedefs and structs |
@@ -158,49 +163,45 @@ typedef enum { | |||
158 | ACPI_IMODE_EXECUTE = 0x0E | 163 | ACPI_IMODE_EXECUTE = 0x0E |
159 | } acpi_interpreter_mode; | 164 | } acpi_interpreter_mode; |
160 | 165 | ||
161 | /* | ||
162 | * The Node describes a named object that appears in the AML | ||
163 | * An acpi_node is used to store Nodes. | ||
164 | * | ||
165 | * data_type is used to differentiate between internal descriptors, and MUST | ||
166 | * be the first byte in this structure. | ||
167 | */ | ||
168 | union acpi_name_union { | 166 | union acpi_name_union { |
169 | u32 integer; | 167 | u32 integer; |
170 | char ascii[4]; | 168 | char ascii[4]; |
171 | }; | 169 | }; |
172 | 170 | ||
171 | /* | ||
172 | * The Namespace Node describes a named object that appears in the AML. | ||
173 | * descriptor_type is used to differentiate between internal descriptors. | ||
174 | * | ||
175 | * The node is optimized for both 32-bit and 64-bit platforms: | ||
176 | * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case. | ||
177 | */ | ||
173 | struct acpi_namespace_node { | 178 | struct acpi_namespace_node { |
174 | u8 descriptor; /* Used to differentiate object descriptor types */ | 179 | union acpi_operand_object *object; /* Interpreter object */ |
175 | u8 type; /* Type associated with this name */ | 180 | u8 descriptor_type; /* Differentiate object descriptor types */ |
176 | u16 reference_count; /* Current count of references and children */ | 181 | u8 flags; /* Miscellaneous flags */ |
182 | acpi_owner_id owner_id; /* Node creator */ | ||
183 | u8 type; /* ACPI Type associated with this name */ | ||
177 | union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ | 184 | union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ |
178 | union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */ | ||
179 | struct acpi_namespace_node *child; /* First child */ | 185 | struct acpi_namespace_node *child; /* First child */ |
180 | struct acpi_namespace_node *peer; /* Next peer */ | 186 | struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */ |
181 | u8 owner_id; /* Who created this node */ | ||
182 | u8 flags; | ||
183 | 187 | ||
184 | /* Fields used by the ASL compiler and disassembler only */ | 188 | /* Fields used by the ASL compiler and disassembler only: */ |
185 | 189 | ||
186 | #ifdef ACPI_LARGE_NAMESPACE_NODE | 190 | #ifdef ACPI_LARGE_NAMESPACE_NODE |
187 | u32 value; | ||
188 | union acpi_parse_object *op; | 191 | union acpi_parse_object *op; |
192 | u32 value; | ||
189 | #endif | 193 | #endif |
190 | }; | 194 | }; |
191 | 195 | ||
192 | #define ACPI_ENTRY_NOT_FOUND NULL | 196 | /* Namespace Node flags */ |
193 | |||
194 | /* Node flags */ | ||
195 | 197 | ||
196 | #define ANOBJ_RESERVED 0x01 | 198 | #define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */ |
197 | #define ANOBJ_END_OF_PEER_LIST 0x02 | 199 | #define ANOBJ_DATA_WIDTH_32 0x02 /* Parent table uses 32-bit math */ |
198 | #define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ | 200 | #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ |
199 | #define ANOBJ_METHOD_ARG 0x08 | 201 | #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ |
200 | #define ANOBJ_METHOD_LOCAL 0x10 | 202 | #define ANOBJ_METHOD_NO_RETVal 0x10 /* i_aSL only: Method has no return value */ |
201 | #define ANOBJ_METHOD_NO_RETVAL 0x20 | 203 | #define ANOBJ_METHOD_SOME_NO_RETVal 0x20 /* i_aSL only: Method has at least one return value */ |
202 | #define ANOBJ_METHOD_SOME_NO_RETVAL 0x40 | 204 | #define ANOBJ_IS_BIT_OFFSet 0x40 /* i_aSL only: Reference is a bit offset */ |
203 | #define ANOBJ_IS_BIT_OFFSET 0x80 | ||
204 | 205 | ||
205 | /* | 206 | /* |
206 | * ACPI Table Descriptor. One per ACPI table | 207 | * ACPI Table Descriptor. One per ACPI table |
@@ -212,8 +213,8 @@ struct acpi_table_desc { | |||
212 | struct acpi_table_header *pointer; | 213 | struct acpi_table_header *pointer; |
213 | u8 *aml_start; | 214 | u8 *aml_start; |
214 | u64 physical_address; | 215 | u64 physical_address; |
215 | u32 aml_length; | ||
216 | acpi_size length; | 216 | acpi_size length; |
217 | u32 aml_length; | ||
217 | acpi_owner_id owner_id; | 218 | acpi_owner_id owner_id; |
218 | u8 type; | 219 | u8 type; |
219 | u8 allocation; | 220 | u8 allocation; |
@@ -276,6 +277,9 @@ struct acpi_create_field_info { | |||
276 | u8 field_type; | 277 | u8 field_type; |
277 | }; | 278 | }; |
278 | 279 | ||
280 | typedef | ||
281 | acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state); | ||
282 | |||
279 | /* | 283 | /* |
280 | * Bitmapped ACPI types. Used internally only | 284 | * Bitmapped ACPI types. Used internally only |
281 | */ | 285 | */ |
@@ -377,7 +381,7 @@ struct acpi_gpe_walk_info { | |||
377 | struct acpi_gpe_block_info *gpe_block; | 381 | struct acpi_gpe_block_info *gpe_block; |
378 | }; | 382 | }; |
379 | 383 | ||
380 | typedef acpi_status(*ACPI_GPE_CALLBACK) (struct acpi_gpe_xrupt_info * | 384 | typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info * |
381 | gpe_xrupt_info, | 385 | gpe_xrupt_info, |
382 | struct acpi_gpe_block_info * | 386 | struct acpi_gpe_block_info * |
383 | gpe_block); | 387 | gpe_block); |
@@ -416,13 +420,14 @@ struct acpi_field_info { | |||
416 | #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 | 420 | #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 |
417 | #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 | 421 | #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 |
418 | 422 | ||
419 | #define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ | 423 | #define ACPI_STATE_COMMON \ |
420 | u8 data_type; /* To differentiate various internal objs */\ | 424 | void *next; \ |
421 | u8 flags; \ | 425 | u8 descriptor_type; /* To differentiate various internal objs */\ |
422 | u16 value; \ | 426 | u8 flags; \ |
423 | u16 state; \ | 427 | u16 value; \ |
424 | u16 reserved; \ | 428 | u16 state; |
425 | void *next; | 429 | |
430 | /* There are 2 bytes available here until the next natural alignment boundary */ | ||
426 | 431 | ||
427 | struct acpi_common_state { | 432 | struct acpi_common_state { |
428 | ACPI_STATE_COMMON}; | 433 | ACPI_STATE_COMMON}; |
@@ -438,12 +443,12 @@ struct acpi_update_state { | |||
438 | * Pkg state - used to traverse nested package structures | 443 | * Pkg state - used to traverse nested package structures |
439 | */ | 444 | */ |
440 | struct acpi_pkg_state { | 445 | struct acpi_pkg_state { |
441 | ACPI_STATE_COMMON union acpi_operand_object *source_object; | 446 | ACPI_STATE_COMMON u16 index; |
447 | union acpi_operand_object *source_object; | ||
442 | union acpi_operand_object *dest_object; | 448 | union acpi_operand_object *dest_object; |
443 | struct acpi_walk_state *walk_state; | 449 | struct acpi_walk_state *walk_state; |
444 | void *this_target_obj; | 450 | void *this_target_obj; |
445 | u32 num_packages; | 451 | u32 num_packages; |
446 | u16 index; | ||
447 | }; | 452 | }; |
448 | 453 | ||
449 | /* | 454 | /* |
@@ -451,10 +456,10 @@ struct acpi_pkg_state { | |||
451 | * Allows nesting of these constructs | 456 | * Allows nesting of these constructs |
452 | */ | 457 | */ |
453 | struct acpi_control_state { | 458 | struct acpi_control_state { |
454 | ACPI_STATE_COMMON union acpi_parse_object *predicate_op; | 459 | ACPI_STATE_COMMON u16 opcode; |
460 | union acpi_parse_object *predicate_op; | ||
455 | u8 *aml_predicate_start; /* Start of if/while predicate */ | 461 | u8 *aml_predicate_start; /* Start of if/while predicate */ |
456 | u8 *package_end; /* End of if/while block */ | 462 | u8 *package_end; /* End of if/while block */ |
457 | u16 opcode; | ||
458 | }; | 463 | }; |
459 | 464 | ||
460 | /* | 465 | /* |
@@ -465,11 +470,11 @@ struct acpi_scope_state { | |||
465 | }; | 470 | }; |
466 | 471 | ||
467 | struct acpi_pscope_state { | 472 | struct acpi_pscope_state { |
468 | ACPI_STATE_COMMON union acpi_parse_object *op; /* Current op being parsed */ | 473 | ACPI_STATE_COMMON u8 arg_count; /* Number of fixed arguments */ |
474 | union acpi_parse_object *op; /* Current op being parsed */ | ||
469 | u8 *arg_end; /* Current argument end */ | 475 | u8 *arg_end; /* Current argument end */ |
470 | u8 *pkg_end; /* Current package end */ | 476 | u8 *pkg_end; /* Current package end */ |
471 | u32 arg_list; /* Next argument to parse */ | 477 | u32 arg_list; /* Next argument to parse */ |
472 | u32 arg_count; /* Number of fixed arguments */ | ||
473 | }; | 478 | }; |
474 | 479 | ||
475 | /* | 480 | /* |
@@ -477,10 +482,10 @@ struct acpi_pscope_state { | |||
477 | * states are created when there are nested control methods executing. | 482 | * states are created when there are nested control methods executing. |
478 | */ | 483 | */ |
479 | struct acpi_thread_state { | 484 | struct acpi_thread_state { |
480 | ACPI_STATE_COMMON struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ | 485 | ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */ |
486 | struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ | ||
481 | union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ | 487 | union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ |
482 | acpi_thread_id thread_id; /* Running thread ID */ | 488 | acpi_thread_id thread_id; /* Running thread ID */ |
483 | u8 current_sync_level; /* Mutex Sync (nested acquire) level */ | ||
484 | }; | 489 | }; |
485 | 490 | ||
486 | /* | 491 | /* |
@@ -488,10 +493,9 @@ struct acpi_thread_state { | |||
488 | * AML arguments | 493 | * AML arguments |
489 | */ | 494 | */ |
490 | struct acpi_result_values { | 495 | struct acpi_result_values { |
491 | ACPI_STATE_COMMON | 496 | ACPI_STATE_COMMON u8 num_results; |
492 | union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS]; | ||
493 | u8 num_results; | ||
494 | u8 last_insert; | 497 | u8 last_insert; |
498 | union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS]; | ||
495 | }; | 499 | }; |
496 | 500 | ||
497 | typedef | 501 | typedef |
@@ -546,7 +550,7 @@ struct acpi_opcode_info { | |||
546 | #endif | 550 | #endif |
547 | u32 parse_args; /* Grammar/Parse time arguments */ | 551 | u32 parse_args; /* Grammar/Parse time arguments */ |
548 | u32 runtime_args; /* Interpret time arguments */ | 552 | u32 runtime_args; /* Interpret time arguments */ |
549 | u32 flags; /* Misc flags */ | 553 | u16 flags; /* Misc flags */ |
550 | u8 object_type; /* Corresponding internal object type */ | 554 | u8 object_type; /* Corresponding internal object type */ |
551 | u8 class; /* Opcode class */ | 555 | u8 class; /* Opcode class */ |
552 | u8 type; /* Opcode type */ | 556 | u8 type; /* Opcode type */ |
@@ -563,29 +567,28 @@ union acpi_parse_value { | |||
563 | }; | 567 | }; |
564 | 568 | ||
565 | #define ACPI_PARSE_COMMON \ | 569 | #define ACPI_PARSE_COMMON \ |
566 | u8 data_type; /* To differentiate various internal objs */\ | 570 | union acpi_parse_object *parent; /* Parent op */\ |
567 | u8 flags; /* Type of Op */\ | 571 | u8 descriptor_type; /* To differentiate various internal objs */\ |
568 | u16 aml_opcode; /* AML opcode */\ | 572 | u8 flags; /* Type of Op */\ |
569 | u32 aml_offset; /* Offset of declaration in AML */\ | 573 | u16 aml_opcode; /* AML opcode */\ |
570 | union acpi_parse_object *parent; /* Parent op */\ | 574 | u32 aml_offset; /* Offset of declaration in AML */\ |
571 | union acpi_parse_object *next; /* Next op */\ | 575 | union acpi_parse_object *next; /* Next op */\ |
576 | struct acpi_namespace_node *node; /* For use by interpreter */\ | ||
577 | union acpi_parse_value value; /* Value or args associated with the opcode */\ | ||
572 | ACPI_DISASM_ONLY_MEMBERS (\ | 578 | ACPI_DISASM_ONLY_MEMBERS (\ |
573 | u8 disasm_flags; /* Used during AML disassembly */\ | 579 | u8 disasm_flags; /* Used during AML disassembly */\ |
574 | u8 disasm_opcode; /* Subtype used for disassembly */\ | 580 | u8 disasm_opcode; /* Subtype used for disassembly */\ |
575 | char aml_op_name[16]) /* Op name (debug only) */\ | 581 | char aml_op_name[16]) /* Op name (debug only) */ |
576 | /* NON-DEBUG members below: */\ | 582 | |
577 | struct acpi_namespace_node *node; /* For use by interpreter */\ | 583 | #define ACPI_DASM_BUFFER 0x00 |
578 | union acpi_parse_value value; /* Value or args associated with the opcode */ | 584 | #define ACPI_DASM_RESOURCE 0x01 |
579 | 585 | #define ACPI_DASM_STRING 0x02 | |
580 | #define ACPI_DASM_BUFFER 0x00 | 586 | #define ACPI_DASM_UNICODE 0x03 |
581 | #define ACPI_DASM_RESOURCE 0x01 | 587 | #define ACPI_DASM_EISAID 0x04 |
582 | #define ACPI_DASM_STRING 0x02 | 588 | #define ACPI_DASM_MATCHOP 0x05 |
583 | #define ACPI_DASM_UNICODE 0x03 | ||
584 | #define ACPI_DASM_EISAID 0x04 | ||
585 | #define ACPI_DASM_MATCHOP 0x05 | ||
586 | 589 | ||
587 | /* | 590 | /* |
588 | * generic operation (for example: If, While, Store) | 591 | * Generic operation (for example: If, While, Store) |
589 | */ | 592 | */ |
590 | struct acpi_parse_obj_common { | 593 | struct acpi_parse_obj_common { |
591 | ACPI_PARSE_COMMON}; | 594 | ACPI_PARSE_COMMON}; |
@@ -601,7 +604,7 @@ struct acpi_parse_obj_named { | |||
601 | u32 name; /* 4-byte name or zero if no name */ | 604 | u32 name; /* 4-byte name or zero if no name */ |
602 | }; | 605 | }; |
603 | 606 | ||
604 | /* The parse node is the fundamental element of the parse tree */ | 607 | /* this version is used by the i_aSL compiler only */ |
605 | 608 | ||
606 | #define ACPI_MAX_PARSEOP_NAME 20 | 609 | #define ACPI_MAX_PARSEOP_NAME 20 |
607 | 610 | ||
@@ -643,7 +646,6 @@ union acpi_parse_object { | |||
643 | * method. | 646 | * method. |
644 | */ | 647 | */ |
645 | struct acpi_parse_state { | 648 | struct acpi_parse_state { |
646 | u32 aml_size; | ||
647 | u8 *aml_start; /* First AML byte */ | 649 | u8 *aml_start; /* First AML byte */ |
648 | u8 *aml; /* Next AML byte */ | 650 | u8 *aml; /* Next AML byte */ |
649 | u8 *aml_end; /* (last + 1) AML byte */ | 651 | u8 *aml_end; /* (last + 1) AML byte */ |
@@ -653,22 +655,23 @@ struct acpi_parse_state { | |||
653 | struct acpi_namespace_node *start_node; | 655 | struct acpi_namespace_node *start_node; |
654 | union acpi_generic_state *scope; /* Current scope */ | 656 | union acpi_generic_state *scope; /* Current scope */ |
655 | union acpi_parse_object *start_scope; | 657 | union acpi_parse_object *start_scope; |
658 | u32 aml_size; | ||
656 | }; | 659 | }; |
657 | 660 | ||
658 | /* Parse object flags */ | 661 | /* Parse object flags */ |
659 | 662 | ||
660 | #define ACPI_PARSEOP_GENERIC 0x01 | 663 | #define ACPI_PARSEOP_GENERIC 0x01 |
661 | #define ACPI_PARSEOP_NAMED 0x02 | 664 | #define ACPI_PARSEOP_NAMED 0x02 |
662 | #define ACPI_PARSEOP_DEFERRED 0x04 | 665 | #define ACPI_PARSEOP_DEFERRED 0x04 |
663 | #define ACPI_PARSEOP_BYTELIST 0x08 | 666 | #define ACPI_PARSEOP_BYTELIST 0x08 |
664 | #define ACPI_PARSEOP_IN_CACHE 0x80 | 667 | #define ACPI_PARSEOP_IN_CACHE 0x80 |
665 | 668 | ||
666 | /* Parse object disasm_flags */ | 669 | /* Parse object disasm_flags */ |
667 | 670 | ||
668 | #define ACPI_PARSEOP_IGNORE 0x01 | 671 | #define ACPI_PARSEOP_IGNORE 0x01 |
669 | #define ACPI_PARSEOP_PARAMLIST 0x02 | 672 | #define ACPI_PARSEOP_PARAMLIST 0x02 |
670 | #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 | 673 | #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 |
671 | #define ACPI_PARSEOP_SPECIAL 0x10 | 674 | #define ACPI_PARSEOP_SPECIAL 0x10 |
672 | 675 | ||
673 | /***************************************************************************** | 676 | /***************************************************************************** |
674 | * | 677 | * |
@@ -676,8 +679,8 @@ struct acpi_parse_state { | |||
676 | * | 679 | * |
677 | ****************************************************************************/ | 680 | ****************************************************************************/ |
678 | 681 | ||
679 | #define PCI_ROOT_HID_STRING "PNP0A03" | 682 | #define PCI_ROOT_HID_STRING "PNP0A03" |
680 | #define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" | 683 | #define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" |
681 | 684 | ||
682 | struct acpi_bit_register_info { | 685 | struct acpi_bit_register_info { |
683 | u8 parent_register; | 686 | u8 parent_register; |
@@ -710,13 +713,14 @@ struct acpi_bit_register_info { | |||
710 | #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ | 713 | #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ |
711 | #define ACPI_BITMASK_WAKE_STATUS 0x8000 | 714 | #define ACPI_BITMASK_WAKE_STATUS 0x8000 |
712 | 715 | ||
713 | #define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \ | 716 | #define ACPI_BITMASK_ALL_FIXED_STATUS (\ |
714 | ACPI_BITMASK_BUS_MASTER_STATUS | \ | 717 | ACPI_BITMASK_TIMER_STATUS | \ |
715 | ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ | 718 | ACPI_BITMASK_BUS_MASTER_STATUS | \ |
716 | ACPI_BITMASK_POWER_BUTTON_STATUS | \ | 719 | ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ |
717 | ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ | 720 | ACPI_BITMASK_POWER_BUTTON_STATUS | \ |
718 | ACPI_BITMASK_RT_CLOCK_STATUS | \ | 721 | ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ |
719 | ACPI_BITMASK_WAKE_STATUS) | 722 | ACPI_BITMASK_RT_CLOCK_STATUS | \ |
723 | ACPI_BITMASK_WAKE_STATUS) | ||
720 | 724 | ||
721 | #define ACPI_BITMASK_TIMER_ENABLE 0x0001 | 725 | #define ACPI_BITMASK_TIMER_ENABLE 0x0001 |
722 | #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 | 726 | #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 |
@@ -820,7 +824,7 @@ struct acpi_bit_register_info { | |||
820 | * | 824 | * |
821 | ****************************************************************************/ | 825 | ****************************************************************************/ |
822 | 826 | ||
823 | #define ACPI_ASCII_ZERO 0x30 | 827 | #define ACPI_ASCII_ZERO 0x30 |
824 | 828 | ||
825 | /***************************************************************************** | 829 | /***************************************************************************** |
826 | * | 830 | * |
@@ -842,9 +846,9 @@ struct acpi_integrity_info { | |||
842 | u32 objects; | 846 | u32 objects; |
843 | }; | 847 | }; |
844 | 848 | ||
845 | #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 | 849 | #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 |
846 | #define ACPI_DB_CONSOLE_OUTPUT 0x02 | 850 | #define ACPI_DB_CONSOLE_OUTPUT 0x02 |
847 | #define ACPI_DB_DUPLICATE_OUTPUT 0x03 | 851 | #define ACPI_DB_DUPLICATE_OUTPUT 0x03 |
848 | 852 | ||
849 | /***************************************************************************** | 853 | /***************************************************************************** |
850 | * | 854 | * |
@@ -854,18 +858,18 @@ struct acpi_integrity_info { | |||
854 | 858 | ||
855 | /* Entry for a memory allocation (debug only) */ | 859 | /* Entry for a memory allocation (debug only) */ |
856 | 860 | ||
857 | #define ACPI_MEM_MALLOC 0 | 861 | #define ACPI_MEM_MALLOC 0 |
858 | #define ACPI_MEM_CALLOC 1 | 862 | #define ACPI_MEM_CALLOC 1 |
859 | #define ACPI_MAX_MODULE_NAME 16 | 863 | #define ACPI_MAX_MODULE_NAME 16 |
860 | 864 | ||
861 | #define ACPI_COMMON_DEBUG_MEM_HEADER \ | 865 | #define ACPI_COMMON_DEBUG_MEM_HEADER \ |
862 | struct acpi_debug_mem_block *previous; \ | 866 | struct acpi_debug_mem_block *previous; \ |
863 | struct acpi_debug_mem_block *next; \ | 867 | struct acpi_debug_mem_block *next; \ |
864 | u32 size; \ | 868 | u32 size; \ |
865 | u32 component; \ | 869 | u32 component; \ |
866 | u32 line; \ | 870 | u32 line; \ |
867 | char module[ACPI_MAX_MODULE_NAME]; \ | 871 | char module[ACPI_MAX_MODULE_NAME]; \ |
868 | u8 alloc_type; | 872 | u8 alloc_type; |
869 | 873 | ||
870 | struct acpi_debug_mem_header { | 874 | struct acpi_debug_mem_header { |
871 | ACPI_COMMON_DEBUG_MEM_HEADER}; | 875 | ACPI_COMMON_DEBUG_MEM_HEADER}; |
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index c8aa73fc6dd3..c495670aa11a 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h | |||
@@ -400,8 +400,8 @@ | |||
400 | * | 400 | * |
401 | * The "Descriptor" field is the first field in both structures. | 401 | * The "Descriptor" field is the first field in both structures. |
402 | */ | 402 | */ |
403 | #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->descriptor_id) | 403 | #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type) |
404 | #define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->descriptor_id = t) | 404 | #define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t) |
405 | 405 | ||
406 | /* Macro to test the object type */ | 406 | /* Macro to test the object type */ |
407 | 407 | ||
@@ -490,7 +490,6 @@ | |||
490 | #define ACPI_ERROR(plist) | 490 | #define ACPI_ERROR(plist) |
491 | #define ACPI_ERROR_NAMESPACE(s,e) | 491 | #define ACPI_ERROR_NAMESPACE(s,e) |
492 | #define ACPI_ERROR_METHOD(s,n,p,e) | 492 | #define ACPI_ERROR_METHOD(s,n,p,e) |
493 | |||
494 | #endif | 493 | #endif |
495 | 494 | ||
496 | /* | 495 | /* |
@@ -532,13 +531,13 @@ | |||
532 | #endif | 531 | #endif |
533 | 532 | ||
534 | #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ | 533 | #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ |
535 | acpi_ut_trace(ACPI_DEBUG_PARAMETERS) | 534 | acpi_ut_trace(ACPI_DEBUG_PARAMETERS) |
536 | #define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ | 535 | #define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ |
537 | acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) | 536 | acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) |
538 | #define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ | 537 | #define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ |
539 | acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b) | 538 | acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b) |
540 | #define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ | 539 | #define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ |
541 | acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b) | 540 | acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b) |
542 | 541 | ||
543 | #define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() | 542 | #define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() |
544 | 543 | ||
@@ -658,6 +657,7 @@ | |||
658 | #define ACPI_DUMP_STACK_ENTRY(a) | 657 | #define ACPI_DUMP_STACK_ENTRY(a) |
659 | #define ACPI_DUMP_OPERANDS(a,b,c,d,e) | 658 | #define ACPI_DUMP_OPERANDS(a,b,c,d,e) |
660 | #define ACPI_DUMP_ENTRY(a,b) | 659 | #define ACPI_DUMP_ENTRY(a,b) |
660 | #define ACPI_DUMP_TABLES(a,b) | ||
661 | #define ACPI_DUMP_PATHNAME(a,b,c,d) | 661 | #define ACPI_DUMP_PATHNAME(a,b,c,d) |
662 | #define ACPI_DUMP_RESOURCE_LIST(a) | 662 | #define ACPI_DUMP_RESOURCE_LIST(a) |
663 | #define ACPI_DUMP_BUFFER(a,b) | 663 | #define ACPI_DUMP_BUFFER(a,b) |
@@ -714,7 +714,7 @@ | |||
714 | /* Memory allocation */ | 714 | /* Memory allocation */ |
715 | 715 | ||
716 | #define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) | 716 | #define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) |
717 | #define ACPI_ALLOCATE_ZEROED(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) | 717 | #define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) |
718 | #define ACPI_FREE(a) acpi_os_free(a) | 718 | #define ACPI_FREE(a) acpi_os_free(a) |
719 | #define ACPI_MEM_TRACKING(a) | 719 | #define ACPI_MEM_TRACKING(a) |
720 | 720 | ||
@@ -723,9 +723,9 @@ | |||
723 | /* Memory allocation */ | 723 | /* Memory allocation */ |
724 | 724 | ||
725 | #define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) | 725 | #define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) |
726 | #define ACPI_ALLOCATE_ZEROED(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) | 726 | #define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) |
727 | #define ACPI_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) | 727 | #define ACPI_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) |
728 | #define ACPI_MEM_TRACKING(a) a | 728 | #define ACPI_MEM_TRACKING(a) a |
729 | 729 | ||
730 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ | 730 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ |
731 | 731 | ||
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; |
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 7785d481dc3e..621fe23bb4fb 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h | |||
@@ -144,7 +144,7 @@ | |||
144 | 144 | ||
145 | /* | 145 | /* |
146 | * These two levels are essentially obsolete, all instances in the | 146 | * These two levels are essentially obsolete, all instances in the |
147 | * ACPICA core code have been replaced by REPORT_ERROR and REPORT_WARNING | 147 | * ACPICA core code have been replaced by ACPI_ERROR and ACPI_WARNING |
148 | * (Kept here because some drivers may still use them) | 148 | * (Kept here because some drivers may still use them) |
149 | */ | 149 | */ |
150 | #define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) | 150 | #define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) |
diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h index 5a1ff484af33..53ac4ce8753a 100644 --- a/include/acpi/acparser.h +++ b/include/acpi/acparser.h | |||
@@ -48,7 +48,7 @@ | |||
48 | 48 | ||
49 | /* variable # arguments */ | 49 | /* variable # arguments */ |
50 | 50 | ||
51 | #define ACPI_VAR_ARGS ACPI_UINT32_MAX | 51 | #define ACPI_VAR_ARGS ACPI_UINT8_MAX |
52 | 52 | ||
53 | #define ACPI_PARSE_DELETE_TREE 0x0001 | 53 | #define ACPI_PARSE_DELETE_TREE 0x0001 |
54 | #define ACPI_PARSE_NO_TREE_DELETE 0x0000 | 54 | #define ACPI_PARSE_NO_TREE_DELETE 0x0000 |
@@ -146,13 +146,12 @@ u8 acpi_ps_has_completed_scope(struct acpi_parse_state *parser_state); | |||
146 | 146 | ||
147 | void | 147 | void |
148 | acpi_ps_pop_scope(struct acpi_parse_state *parser_state, | 148 | acpi_ps_pop_scope(struct acpi_parse_state *parser_state, |
149 | union acpi_parse_object **op, | 149 | union acpi_parse_object **op, u32 * arg_list, u8 * arg_count); |
150 | u32 * arg_list, u32 * arg_count); | ||
151 | 150 | ||
152 | acpi_status | 151 | acpi_status |
153 | acpi_ps_push_scope(struct acpi_parse_state *parser_state, | 152 | acpi_ps_push_scope(struct acpi_parse_state *parser_state, |
154 | union acpi_parse_object *op, | 153 | union acpi_parse_object *op, |
155 | u32 remaining_args, u32 arg_count); | 154 | u32 remaining_args, u8 arg_count); |
156 | 155 | ||
157 | void acpi_ps_cleanup_scope(struct acpi_parse_state *state); | 156 | void acpi_ps_cleanup_scope(struct acpi_parse_state *state); |
158 | 157 | ||
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 66cf2ecef57a..049e9aa1b867 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -268,7 +268,7 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device); | |||
268 | * Resource interfaces | 268 | * Resource interfaces |
269 | */ | 269 | */ |
270 | typedef | 270 | typedef |
271 | acpi_status(*ACPI_WALK_RESOURCE_CALLBACK) (struct acpi_resource * resource, | 271 | acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource, |
272 | void *context); | 272 | void *context); |
273 | 273 | ||
274 | acpi_status | 274 | acpi_status |
@@ -290,7 +290,7 @@ acpi_get_possible_resources(acpi_handle device_handle, | |||
290 | acpi_status | 290 | acpi_status |
291 | acpi_walk_resources(acpi_handle device_handle, | 291 | acpi_walk_resources(acpi_handle device_handle, |
292 | char *name, | 292 | char *name, |
293 | ACPI_WALK_RESOURCE_CALLBACK user_function, void *context); | 293 | acpi_walk_resource_callback user_function, void *context); |
294 | 294 | ||
295 | acpi_status | 295 | acpi_status |
296 | acpi_set_current_resources(acpi_handle device_handle, | 296 | acpi_set_current_resources(acpi_handle device_handle, |
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index fa02e8083381..bdd6584bbcf1 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h | |||
@@ -198,8 +198,9 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
198 | acpi_size * buffer_size_needed); | 198 | acpi_size * buffer_size_needed); |
199 | 199 | ||
200 | acpi_status | 200 | acpi_status |
201 | acpi_rs_convert_aml_to_resources(u8 * aml_buffer, | 201 | acpi_rs_convert_aml_to_resources(u8 * aml, |
202 | u32 aml_buffer_length, u8 * output_buffer); | 202 | u32 length, |
203 | u32 offset, u8 resource_index, void **context); | ||
203 | 204 | ||
204 | acpi_status | 205 | acpi_status |
205 | acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | 206 | acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, |
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h index d8c1c2cdac0c..04e8966a377d 100644 --- a/include/acpi/acstruct.h +++ b/include/acpi/acstruct.h | |||
@@ -44,6 +44,8 @@ | |||
44 | #ifndef __ACSTRUCT_H__ | 44 | #ifndef __ACSTRUCT_H__ |
45 | #define __ACSTRUCT_H__ | 45 | #define __ACSTRUCT_H__ |
46 | 46 | ||
47 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
48 | |||
47 | /***************************************************************************** | 49 | /***************************************************************************** |
48 | * | 50 | * |
49 | * Tree walking typedefs and structs | 51 | * Tree walking typedefs and structs |
@@ -64,54 +66,55 @@ | |||
64 | #define ACPI_WALK_CONST_OPTIONAL 4 | 66 | #define ACPI_WALK_CONST_OPTIONAL 4 |
65 | 67 | ||
66 | struct acpi_walk_state { | 68 | struct acpi_walk_state { |
67 | u8 data_type; /* To differentiate various internal objs MUST BE FIRST! */ | 69 | struct acpi_walk_state *next; /* Next walk_state in list */ |
70 | u8 descriptor_type; /* To differentiate various internal objs */ | ||
68 | u8 walk_type; | 71 | u8 walk_type; |
69 | acpi_owner_id owner_id; /* Owner of objects created during the walk */ | 72 | u16 opcode; /* Current AML opcode */ |
70 | u8 last_predicate; /* Result of last predicate */ | ||
71 | u8 current_result; /* */ | ||
72 | u8 next_op_info; /* Info about next_op */ | 73 | u8 next_op_info; /* Info about next_op */ |
73 | u8 num_operands; /* Stack pointer for Operands[] array */ | 74 | u8 num_operands; /* Stack pointer for Operands[] array */ |
75 | acpi_owner_id owner_id; /* Owner of objects created during the walk */ | ||
76 | u8 last_predicate; /* Result of last predicate */ | ||
77 | u8 current_result; | ||
74 | u8 return_used; | 78 | u8 return_used; |
75 | u16 opcode; /* Current AML opcode */ | ||
76 | u8 scope_depth; | 79 | u8 scope_depth; |
77 | u8 pass_number; /* Parse pass during table load */ | 80 | u8 pass_number; /* Parse pass during table load */ |
78 | u32 arg_count; /* push for fixed or var args */ | ||
79 | u32 aml_offset; | 81 | u32 aml_offset; |
80 | u32 arg_types; | 82 | u32 arg_types; |
81 | u32 method_breakpoint; /* For single stepping */ | 83 | u32 method_breakpoint; /* For single stepping */ |
82 | u32 user_breakpoint; /* User AML breakpoint */ | 84 | u32 user_breakpoint; /* User AML breakpoint */ |
83 | u32 parse_flags; | 85 | u32 parse_flags; |
86 | |||
87 | struct acpi_parse_state parser_state; /* Current state of parser */ | ||
84 | u32 prev_arg_types; | 88 | u32 prev_arg_types; |
89 | u8 arg_count; /* push for fixed or var args */ | ||
85 | 90 | ||
86 | u8 *aml_last_while; | ||
87 | struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ | 91 | struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ |
92 | struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ | ||
93 | union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ | ||
94 | union acpi_operand_object **params; | ||
95 | |||
96 | u8 *aml_last_while; | ||
88 | union acpi_operand_object **caller_return_desc; | 97 | union acpi_operand_object **caller_return_desc; |
89 | union acpi_generic_state *control_state; /* List of control states (nested IFs) */ | 98 | union acpi_generic_state *control_state; /* List of control states (nested IFs) */ |
90 | struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ | 99 | struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ |
91 | struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */ | 100 | struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */ |
92 | union acpi_operand_object *implicit_return_obj; | 101 | union acpi_operand_object *implicit_return_obj; |
93 | struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ | ||
94 | struct acpi_namespace_node *method_call_node; /* Called method Node */ | 102 | struct acpi_namespace_node *method_call_node; /* Called method Node */ |
95 | union acpi_parse_object *method_call_op; /* method_call Op if running a method */ | 103 | union acpi_parse_object *method_call_op; /* method_call Op if running a method */ |
96 | union acpi_operand_object *method_desc; /* Method descriptor if running a method */ | 104 | union acpi_operand_object *method_desc; /* Method descriptor if running a method */ |
97 | struct acpi_namespace_node *method_node; /* Method node if running a method. */ | 105 | struct acpi_namespace_node *method_node; /* Method node if running a method. */ |
98 | union acpi_parse_object *op; /* Current parser op */ | 106 | union acpi_parse_object *op; /* Current parser op */ |
99 | union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ | ||
100 | const struct acpi_opcode_info *op_info; /* Info on current opcode */ | 107 | const struct acpi_opcode_info *op_info; /* Info on current opcode */ |
101 | union acpi_parse_object *origin; /* Start of walk [Obsolete] */ | 108 | union acpi_parse_object *origin; /* Start of walk [Obsolete] */ |
102 | union acpi_operand_object **params; | ||
103 | struct acpi_parse_state parser_state; /* Current state of parser */ | ||
104 | union acpi_operand_object *result_obj; | 109 | union acpi_operand_object *result_obj; |
105 | union acpi_generic_state *results; /* Stack of accumulated results */ | 110 | union acpi_generic_state *results; /* Stack of accumulated results */ |
106 | union acpi_operand_object *return_desc; /* Return object, if any */ | 111 | union acpi_operand_object *return_desc; /* Return object, if any */ |
107 | union acpi_generic_state *scope_info; /* Stack of nested scopes */ | 112 | union acpi_generic_state *scope_info; /* Stack of nested scopes */ |
108 | |||
109 | union acpi_parse_object *prev_op; /* Last op that was processed */ | 113 | union acpi_parse_object *prev_op; /* Last op that was processed */ |
110 | union acpi_parse_object *next_op; /* next op to be processed */ | 114 | union acpi_parse_object *next_op; /* next op to be processed */ |
115 | struct acpi_thread_state *thread; | ||
111 | acpi_parse_downwards descending_callback; | 116 | acpi_parse_downwards descending_callback; |
112 | acpi_parse_upwards ascending_callback; | 117 | acpi_parse_upwards ascending_callback; |
113 | struct acpi_thread_state *thread; | ||
114 | struct acpi_walk_state *next; /* Next walk_state in list */ | ||
115 | }; | 118 | }; |
116 | 119 | ||
117 | /* Info used by acpi_ps_init_objects */ | 120 | /* Info used by acpi_ps_init_objects */ |
@@ -151,11 +154,11 @@ struct acpi_walk_info { | |||
151 | 154 | ||
152 | /* Display Types */ | 155 | /* Display Types */ |
153 | 156 | ||
154 | #define ACPI_DISPLAY_SUMMARY (u8) 0 | 157 | #define ACPI_DISPLAY_SUMMARY (u8) 0 |
155 | #define ACPI_DISPLAY_OBJECTS (u8) 1 | 158 | #define ACPI_DISPLAY_OBJECTS (u8) 1 |
156 | #define ACPI_DISPLAY_MASK (u8) 1 | 159 | #define ACPI_DISPLAY_MASK (u8) 1 |
157 | 160 | ||
158 | #define ACPI_DISPLAY_SHORT (u8) 2 | 161 | #define ACPI_DISPLAY_SHORT (u8) 2 |
159 | 162 | ||
160 | struct acpi_get_devices_info { | 163 | struct acpi_get_devices_info { |
161 | acpi_walk_callback user_function; | 164 | acpi_walk_callback user_function; |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 520f315dd53a..091dd2567172 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -44,6 +44,8 @@ | |||
44 | #ifndef __ACTYPES_H__ | 44 | #ifndef __ACTYPES_H__ |
45 | #define __ACTYPES_H__ | 45 | #define __ACTYPES_H__ |
46 | 46 | ||
47 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
48 | |||
47 | /* | 49 | /* |
48 | * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header | 50 | * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header |
49 | * and must be either 16, 32, or 64 | 51 | * and must be either 16, 32, or 64 |
@@ -250,7 +252,7 @@ typedef acpi_native_uint acpi_size; | |||
250 | /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ | 252 | /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ |
251 | 253 | ||
252 | #ifndef acpi_uintptr_t | 254 | #ifndef acpi_uintptr_t |
253 | #define acpi_uintptr_t void * | 255 | #define acpi_uintptr_t void * |
254 | #endif | 256 | #endif |
255 | 257 | ||
256 | /* | 258 | /* |
@@ -259,7 +261,7 @@ typedef acpi_native_uint acpi_size; | |||
259 | * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) | 261 | * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) |
260 | */ | 262 | */ |
261 | #ifndef acpi_cache_t | 263 | #ifndef acpi_cache_t |
262 | #define acpi_cache_t struct acpi_memory_list | 264 | #define acpi_cache_t struct acpi_memory_list |
263 | #endif | 265 | #endif |
264 | 266 | ||
265 | /* | 267 | /* |
@@ -267,7 +269,7 @@ typedef acpi_native_uint acpi_size; | |||
267 | * lock and unlock OSL interfaces. | 269 | * lock and unlock OSL interfaces. |
268 | */ | 270 | */ |
269 | #ifndef acpi_cpu_flags | 271 | #ifndef acpi_cpu_flags |
270 | #define acpi_cpu_flags acpi_native_uint | 272 | #define acpi_cpu_flags acpi_native_uint |
271 | #endif | 273 | #endif |
272 | 274 | ||
273 | /* | 275 | /* |
@@ -300,7 +302,7 @@ typedef acpi_native_uint acpi_size; | |||
300 | * thread_id is returned by acpi_os_get_thread_id. | 302 | * thread_id is returned by acpi_os_get_thread_id. |
301 | */ | 303 | */ |
302 | #ifndef acpi_thread_id | 304 | #ifndef acpi_thread_id |
303 | #define acpi_thread_id acpi_native_uint | 305 | #define acpi_thread_id acpi_native_uint |
304 | #endif | 306 | #endif |
305 | 307 | ||
306 | /******************************************************************************* | 308 | /******************************************************************************* |
@@ -869,7 +871,7 @@ acpi_status(*acpi_adr_space_handler) (u32 function, | |||
869 | void *handler_context, | 871 | void *handler_context, |
870 | void *region_context); | 872 | void *region_context); |
871 | 873 | ||
872 | #define ACPI_DEFAULT_HANDLER NULL | 874 | #define ACPI_DEFAULT_HANDLER NULL |
873 | 875 | ||
874 | typedef | 876 | typedef |
875 | acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, | 877 | acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, |
@@ -926,8 +928,8 @@ struct acpi_compatible_id_list { | |||
926 | #define ACPI_STA_BATTERY_PRESENT 0x10 | 928 | #define ACPI_STA_BATTERY_PRESENT 0x10 |
927 | 929 | ||
928 | #define ACPI_COMMON_OBJ_INFO \ | 930 | #define ACPI_COMMON_OBJ_INFO \ |
929 | acpi_object_type type; /* ACPI object type */ \ | 931 | acpi_object_type type; /* ACPI object type */ \ |
930 | acpi_name name /* ACPI object Name */ | 932 | acpi_name name /* ACPI object Name */ |
931 | 933 | ||
932 | struct acpi_obj_info_header { | 934 | struct acpi_obj_info_header { |
933 | ACPI_COMMON_OBJ_INFO; | 935 | ACPI_COMMON_OBJ_INFO; |
@@ -1182,12 +1184,12 @@ struct acpi_resource_source { | |||
1182 | /* Fields common to all address descriptors, 16/32/64 bit */ | 1184 | /* Fields common to all address descriptors, 16/32/64 bit */ |
1183 | 1185 | ||
1184 | #define ACPI_RESOURCE_ADDRESS_COMMON \ | 1186 | #define ACPI_RESOURCE_ADDRESS_COMMON \ |
1185 | u8 resource_type; \ | 1187 | u8 resource_type; \ |
1186 | u8 producer_consumer; \ | 1188 | u8 producer_consumer; \ |
1187 | u8 decode; \ | 1189 | u8 decode; \ |
1188 | u8 min_address_fixed; \ | 1190 | u8 min_address_fixed; \ |
1189 | u8 max_address_fixed; \ | 1191 | u8 max_address_fixed; \ |
1190 | union acpi_resource_attribute info; | 1192 | union acpi_resource_attribute info; |
1191 | 1193 | ||
1192 | struct acpi_resource_address { | 1194 | struct acpi_resource_address { |
1193 | ACPI_RESOURCE_ADDRESS_COMMON}; | 1195 | ACPI_RESOURCE_ADDRESS_COMMON}; |
@@ -1308,10 +1310,6 @@ struct acpi_resource { | |||
1308 | 1310 | ||
1309 | #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) | 1311 | #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) |
1310 | 1312 | ||
1311 | /* | ||
1312 | * END: of definitions for Resource Attributes | ||
1313 | */ | ||
1314 | |||
1315 | struct acpi_pci_routing_table { | 1313 | struct acpi_pci_routing_table { |
1316 | u32 length; | 1314 | u32 length; |
1317 | u32 pin; | 1315 | u32 pin; |
@@ -1320,8 +1318,4 @@ struct acpi_pci_routing_table { | |||
1320 | char source[4]; /* pad to 64 bits so sizeof() works in all cases */ | 1318 | char source[4]; /* pad to 64 bits so sizeof() works in all cases */ |
1321 | }; | 1319 | }; |
1322 | 1320 | ||
1323 | /* | ||
1324 | * END: of definitions for PCI Routing tables | ||
1325 | */ | ||
1326 | |||
1327 | #endif /* __ACTYPES_H__ */ | 1321 | #endif /* __ACTYPES_H__ */ |
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 71ff78c75441..5e69a80c7850 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h | |||
@@ -78,6 +78,12 @@ extern const char *acpi_gbl_TYPdecode[4]; | |||
78 | #define ACPI_SMALL_VARIABLE_LENGTH 3 | 78 | #define ACPI_SMALL_VARIABLE_LENGTH 3 |
79 | 79 | ||
80 | typedef | 80 | typedef |
81 | acpi_status(*acpi_walk_aml_callback) (u8 * aml, | ||
82 | u32 length, | ||
83 | u32 offset, | ||
84 | u8 resource_index, void *context); | ||
85 | |||
86 | typedef | ||
81 | acpi_status(*acpi_pkg_callback) (u8 object_type, | 87 | acpi_status(*acpi_pkg_callback) (u8 object_type, |
82 | union acpi_operand_object * source_object, | 88 | union acpi_operand_object * source_object, |
83 | union acpi_generic_state * state, | 89 | union acpi_generic_state * state, |
@@ -469,6 +475,25 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); | |||
469 | 475 | ||
470 | #define ACPI_ANY_BASE 0 | 476 | #define ACPI_ANY_BASE 0 |
471 | 477 | ||
478 | u32 acpi_ut_dword_byte_swap(u32 value); | ||
479 | |||
480 | void acpi_ut_set_integer_width(u8 revision); | ||
481 | |||
482 | #ifdef ACPI_DEBUG_OUTPUT | ||
483 | void | ||
484 | acpi_ut_display_init_pathname(u8 type, | ||
485 | struct acpi_namespace_node *obj_handle, | ||
486 | char *path); | ||
487 | #endif | ||
488 | |||
489 | /* | ||
490 | * utresrc | ||
491 | */ | ||
492 | acpi_status | ||
493 | acpi_ut_walk_aml_resources(u8 * aml, | ||
494 | acpi_size aml_length, | ||
495 | acpi_walk_aml_callback user_function, void *context); | ||
496 | |||
472 | acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index); | 497 | acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index); |
473 | 498 | ||
474 | u32 acpi_ut_get_descriptor_length(void *aml); | 499 | u32 acpi_ut_get_descriptor_length(void *aml); |
@@ -483,18 +508,6 @@ acpi_status | |||
483 | acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, | 508 | acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, |
484 | u8 ** end_tag); | 509 | u8 ** end_tag); |
485 | 510 | ||
486 | u32 acpi_ut_dword_byte_swap(u32 value); | ||
487 | |||
488 | void acpi_ut_set_integer_width(u8 revision); | ||
489 | |||
490 | #ifdef ACPI_DEBUG_OUTPUT | ||
491 | void | ||
492 | acpi_ut_display_init_pathname(u8 type, | ||
493 | struct acpi_namespace_node *obj_handle, | ||
494 | char *path); | ||
495 | |||
496 | #endif | ||
497 | |||
498 | /* | 511 | /* |
499 | * utmutex - mutex support | 512 | * utmutex - mutex support |
500 | */ | 513 | */ |
@@ -521,14 +534,15 @@ acpi_ut_initialize_buffer(struct acpi_buffer *buffer, | |||
521 | 534 | ||
522 | void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line); | 535 | void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line); |
523 | 536 | ||
524 | void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line); | 537 | void *acpi_ut_allocate_zeroed(acpi_size size, |
538 | u32 component, char *module, u32 line); | ||
525 | 539 | ||
526 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 540 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
527 | void *acpi_ut_allocate_and_track(acpi_size size, | 541 | void *acpi_ut_allocate_and_track(acpi_size size, |
528 | u32 component, char *module, u32 line); | 542 | u32 component, char *module, u32 line); |
529 | 543 | ||
530 | void *acpi_ut_callocate_and_track(acpi_size size, | 544 | void *acpi_ut_allocate_zeroed_and_track(acpi_size size, |
531 | u32 component, char *module, u32 line); | 545 | u32 component, char *module, u32 line); |
532 | 546 | ||
533 | void | 547 | void |
534 | acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line); | 548 | acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line); |
@@ -538,6 +552,11 @@ void acpi_ut_dump_allocation_info(void); | |||
538 | #endif /* ACPI_FUTURE_USAGE */ | 552 | #endif /* ACPI_FUTURE_USAGE */ |
539 | 553 | ||
540 | void acpi_ut_dump_allocations(u32 component, char *module); | 554 | void acpi_ut_dump_allocations(u32 component, char *module); |
555 | |||
556 | acpi_status | ||
557 | acpi_ut_create_list(char *list_name, | ||
558 | u16 object_size, struct acpi_memory_list **return_cache); | ||
559 | |||
541 | #endif | 560 | #endif |
542 | 561 | ||
543 | #endif /* _ACUTILS_H */ | 562 | #endif /* _ACUTILS_H */ |
diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h index e5b42eb38190..64736860bdd5 100644 --- a/include/acpi/amlresrc.h +++ b/include/acpi/amlresrc.h | |||
@@ -42,9 +42,17 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
46 | |||
45 | #ifndef __AMLRESRC_H | 47 | #ifndef __AMLRESRC_H |
46 | #define __AMLRESRC_H | 48 | #define __AMLRESRC_H |
47 | 49 | ||
50 | /*! [Begin] no source code translation */ | ||
51 | |||
52 | /* | ||
53 | * Resource descriptor tags, as defined in the ACPI specification. | ||
54 | * Used to symbolically reference fields within a descriptor. | ||
55 | */ | ||
48 | #define ACPI_RESTAG_ADDRESS "_ADR" | 56 | #define ACPI_RESTAG_ADDRESS "_ADR" |
49 | #define ACPI_RESTAG_ALIGNMENT "_ALN" | 57 | #define ACPI_RESTAG_ALIGNMENT "_ALN" |
50 | #define ACPI_RESTAG_ADDRESSSPACE "_ASI" | 58 | #define ACPI_RESTAG_ADDRESSSPACE "_ASI" |
@@ -57,12 +65,12 @@ | |||
57 | #define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ | 65 | #define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ |
58 | #define ACPI_RESTAG_GRANULARITY "_GRA" | 66 | #define ACPI_RESTAG_GRANULARITY "_GRA" |
59 | #define ACPI_RESTAG_INTERRUPT "_INT" | 67 | #define ACPI_RESTAG_INTERRUPT "_INT" |
60 | #define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ | 68 | #define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */ |
61 | #define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ | 69 | #define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */ |
62 | #define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ | 70 | #define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ |
63 | #define ACPI_RESTAG_LENGTH "_LEN" | 71 | #define ACPI_RESTAG_LENGTH "_LEN" |
64 | #define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ | 72 | #define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ |
65 | #define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ | 73 | #define ACPI_RESTAG_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ |
66 | #define ACPI_RESTAG_MAXADDR "_MAX" | 74 | #define ACPI_RESTAG_MAXADDR "_MAX" |
67 | #define ACPI_RESTAG_MINADDR "_MIN" | 75 | #define ACPI_RESTAG_MINADDR "_MIN" |
68 | #define ACPI_RESTAG_MAXTYPE "_MAF" | 76 | #define ACPI_RESTAG_MAXTYPE "_MAF" |
@@ -70,11 +78,12 @@ | |||
70 | #define ACPI_RESTAG_REGISTERBITOFFSET "_RBO" | 78 | #define ACPI_RESTAG_REGISTERBITOFFSET "_RBO" |
71 | #define ACPI_RESTAG_REGISTERBITWIDTH "_RBW" | 79 | #define ACPI_RESTAG_REGISTERBITWIDTH "_RBW" |
72 | #define ACPI_RESTAG_RANGETYPE "_RNG" | 80 | #define ACPI_RESTAG_RANGETYPE "_RNG" |
73 | #define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ | 81 | #define ACPI_RESTAG_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */ |
74 | #define ACPI_RESTAG_TRANSLATION "_TRA" | 82 | #define ACPI_RESTAG_TRANSLATION "_TRA" |
75 | #define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ | 83 | #define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ |
76 | #define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */ | 84 | #define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */ |
77 | #define ACPI_RESTAG_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */ | 85 | #define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */ |
86 | /*! [End] no source code translation !*/ | ||
78 | 87 | ||
79 | /* Default sizes for "small" resource descriptors */ | 88 | /* Default sizes for "small" resource descriptors */ |
80 | 89 | ||
@@ -109,7 +118,7 @@ struct asl_resource_node { | |||
109 | * SMALL descriptors | 118 | * SMALL descriptors |
110 | */ | 119 | */ |
111 | #define AML_RESOURCE_SMALL_HEADER_COMMON \ | 120 | #define AML_RESOURCE_SMALL_HEADER_COMMON \ |
112 | u8 descriptor_type; | 121 | u8 descriptor_type; |
113 | 122 | ||
114 | struct aml_resource_small_header { | 123 | struct aml_resource_small_header { |
115 | AML_RESOURCE_SMALL_HEADER_COMMON}; | 124 | AML_RESOURCE_SMALL_HEADER_COMMON}; |
@@ -162,8 +171,8 @@ struct aml_resource_end_tag { | |||
162 | * LARGE descriptors | 171 | * LARGE descriptors |
163 | */ | 172 | */ |
164 | #define AML_RESOURCE_LARGE_HEADER_COMMON \ | 173 | #define AML_RESOURCE_LARGE_HEADER_COMMON \ |
165 | u8 descriptor_type;\ | 174 | u8 descriptor_type;\ |
166 | u16 resource_length; | 175 | u16 resource_length; |
167 | 176 | ||
168 | struct aml_resource_large_header { | 177 | struct aml_resource_large_header { |
169 | AML_RESOURCE_LARGE_HEADER_COMMON}; | 178 | AML_RESOURCE_LARGE_HEADER_COMMON}; |
@@ -194,9 +203,9 @@ struct aml_resource_fixed_memory32 { | |||
194 | }; | 203 | }; |
195 | 204 | ||
196 | #define AML_RESOURCE_ADDRESS_COMMON \ | 205 | #define AML_RESOURCE_ADDRESS_COMMON \ |
197 | u8 resource_type; \ | 206 | u8 resource_type; \ |
198 | u8 flags; \ | 207 | u8 flags; \ |
199 | u8 specific_flags; | 208 | u8 specific_flags; |
200 | 209 | ||
201 | struct aml_resource_address { | 210 | struct aml_resource_address { |
202 | AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON}; | 211 | AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON}; |
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index d5a7f566c018..2270bdd5e530 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h | |||
@@ -70,6 +70,7 @@ | |||
70 | #define ACPI_DEBUGGER | 70 | #define ACPI_DEBUGGER |
71 | #define ACPI_DISASSEMBLER | 71 | #define ACPI_DISASSEMBLER |
72 | #define ACPI_MUTEX_DEBUG | 72 | #define ACPI_MUTEX_DEBUG |
73 | #define ACPI_DBG_TRACK_ALLOCATIONS | ||
73 | #endif | 74 | #endif |
74 | 75 | ||
75 | #ifdef ACPI_ASL_COMPILER | 76 | #ifdef ACPI_ASL_COMPILER |
@@ -165,17 +166,6 @@ | |||
165 | 166 | ||
166 | #endif | 167 | #endif |
167 | 168 | ||
168 | /* | ||
169 | * Memory allocation tracking. Used only if | ||
170 | * 1) This is the debug version | ||
171 | * 2) This is NOT a 16-bit version of the code (not enough real-mode memory) | ||
172 | */ | ||
173 | #ifdef ACPI_DEBUG_OUTPUT | ||
174 | #if ACPI_MACHINE_WIDTH != 16 | ||
175 | #define ACPI_DBG_TRACK_ALLOCATIONS | ||
176 | #endif | ||
177 | #endif | ||
178 | |||
179 | /*! [End] no source code translation !*/ | 169 | /*! [End] no source code translation !*/ |
180 | 170 | ||
181 | /* | 171 | /* |